From b08b0075c1a9ac18fc848e5ed1f7d15582d313de Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Nov 2016 08:32:18 +0200 Subject: Allow customizing names parsing diagnostics (testscript) --- build2/buildfile | 1 + build2/test/script/parser.cxx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build2/buildfile b/build2/buildfile index 03c0dd3..f7b2dd9 100644 --- a/build2/buildfile +++ b/build2/buildfile @@ -80,6 +80,7 @@ test/script/{hxx cxx}{ lexer } \ test/script/{hxx cxx}{ parser } \ test/script/{hxx cxx}{ runner } \ test/script/{hxx cxx}{ script } \ +test/script/{hxx cxx}{ token } \ $libs # Pass our compiler target to be used as build2 host. diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx index f067e84..827aae7 100644 --- a/build2/test/script/parser.cxx +++ b/build2/test/script/parser.cxx @@ -62,7 +62,7 @@ namespace build2 names_type ns; location nl (get_location (t)); lexer_->reset_quoted (t.quoted); - names (t, tt, ns, true); + names (t, tt, ns, true, "variable or program name"); // See if this is a variable assignment or a test command. // @@ -457,7 +457,7 @@ namespace build2 ns.clear (); lexer_->reset_quoted (t.quoted); nl = get_location (t); - names (t, tt, ns, true); + names (t, tt, ns, true, "command"); continue; } } @@ -533,7 +533,7 @@ namespace build2 { // The next chunk should be the exit status. // - names_type ns (names (t, tt, true)); + names_type ns (names (t, tt, true, "exit status")); //@@ TODO: validate to be single, simple, non-empty name that // converts to integer (is exit status always non-negative). @@ -561,7 +561,7 @@ namespace build2 // Expand the line. // - names_type ns (names (t, tt)); + names_type ns (names (t, tt, false, "here-document line")); // What shall we do if the expansion results in multiple names? For, // example if the line contains just the variable expansion and it -- cgit v1.1