aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-05-16 18:22:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-16 18:22:22 +0300
commit32cac452a834605a15a679e247f0f5faf3f2fc5d (patch)
treeca8114e9465550ffab374d58403e8b1212888e3c /build2/test/script/parser.cxx
parent320e849d17597aef40b9e3e62f79319f13f97e45 (diff)
Redo testscript diagnostics not to rely on invalid paths
Diffstat (limited to 'build2/test/script/parser.cxx')
-rw-r--r--build2/test/script/parser.cxx35
1 files changed, 10 insertions, 25 deletions
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index d3cab0a..dad397b 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -2232,34 +2232,17 @@ namespace build2
add_word (move (s), l);
else
{
- // Come up with a "path" that contains both the original
- // location as well as the expanded string. The resulting
- // diagnostics will look like this:
+ // If the chunk re-parsing results in error, our diagnostics
+ // will look like this:
//
- // testscript:10:1 ('abc): unterminated single quote
+ // <string>:1:4: error: stdout merge redirect file descriptor must be 2
+ // testscript:2:5: info: while parsing string '1>&a'
//
- path name;
- {
- string n (l.file->string ());
- n += ':';
-
- if (!ops.no_line ())
+ auto df = make_diag_frame (
+ [s, &l](const diag_record& dr)
{
- n += to_string (l.line);
- n += ':';
-
- if (!ops.no_column ())
- {
- n += to_string (l.column);
- n += ':';
- }
- }
-
- n += " (";
- n += s;
- n += ')';
- name = path (move (n));
- }
+ dr << info (l) << "while parsing string '" << s << "'";
+ });
// When re-lexing we do "effective escaping" and only for
// ['"\] (quotes plus the backslash itself). In particular,
@@ -2273,6 +2256,8 @@ namespace build2
// args = 'x=\"foo bar\"'
// cmd $args # cmd x="foo bar"
//
+
+ path name ("<string>");
istringstream is (s);
lexer lex (is, name,
lexer_mode::command_expansion,