aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/test/script/lexer.cxx6
-rw-r--r--unit-tests/test/script/parser/pre-parse.test15
2 files changed, 18 insertions, 3 deletions
diff --git a/build2/test/script/lexer.cxx b/build2/test/script/lexer.cxx
index d2657c6..01c93a4 100644
--- a/build2/test/script/lexer.cxx
+++ b/build2/test/script/lexer.cxx
@@ -15,7 +15,7 @@ namespace build2
using type = token_type;
void lexer::
- mode (base_mode m, char)
+ mode (base_mode m, char ps)
{
const char* s1 (nullptr);
const char* s2 (nullptr);
@@ -69,9 +69,9 @@ namespace build2
}
default:
{
- // Disable pair separator.
+ // Disable pair separator except for attributes.
//
- base_lexer::mode (m, '\0');
+ base_lexer::mode (m, m != lexer_mode::attribute ? '\0' : ps);
return;
}
}
diff --git a/unit-tests/test/script/parser/pre-parse.test b/unit-tests/test/script/parser/pre-parse.test
new file mode 100644
index 0000000..4057f9a
--- /dev/null
+++ b/unit-tests/test/script/parser/pre-parse.test
@@ -0,0 +1,15 @@
+# attribute-pair
+#
+$* <<EOI 2>>EOE != 0
+x = [foo=bar]
+EOI
+testscript:1:5: error: unknown value attribute foo=bar
+EOE
+
+# attribute-pair-empty
+#
+$* <<EOI 2>>EOE != 0
+x = [foo=]
+EOI
+testscript:1:5: error: unknown value attribute foo
+EOE