aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test/script
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/test/script')
-rw-r--r--libbuild2/test/script/lexer.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/libbuild2/test/script/lexer.cxx b/libbuild2/test/script/lexer.cxx
index a94109b..e895d4a 100644
--- a/libbuild2/test/script/lexer.cxx
+++ b/libbuild2/test/script/lexer.cxx
@@ -26,8 +26,6 @@ namespace build2
void lexer::
mode (base_mode m, char ps, optional<const char*> esc, uintptr_t data)
{
- bool a (false); // attributes
-
const char* s1 (nullptr);
const char* s2 (nullptr);
@@ -109,7 +107,8 @@ namespace build2
}
assert (ps == '\0');
- state_.push (state {m, data, nullopt, a, ps, s, n, q, *esc, s1, s2});
+ state_.push (
+ state {m, data, nullopt, false, false, ps, s, n, q, *esc, s1, s2});
}
token lexer::
@@ -153,16 +152,16 @@ namespace build2
return token (t, sep, ln, cn, token_printer);
};
- // Handle attributes (do it first to make sure the flag is cleared
- // regardless of what we return).
+ // Handle `[` (do it first to make sure the flag is cleared regardless
+ // of what we return).
//
- if (st.attributes)
+ if (st.lsbrace)
{
assert (m == lexer_mode::variable_line);
- state_.top ().attributes = false;
+ state_.top ().lsbrace = false; // Note: st is a copy.
- if (c == '[')
+ if (c == '[' && (!st.lsbrace_unsep || !sep))
return make_token (type::lsbrace);
}