aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/lexer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/lexer.cxx')
-rw-r--r--libbuild2/lexer.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/libbuild2/lexer.cxx b/libbuild2/lexer.cxx
index e50ec16..2f2ace4 100644
--- a/libbuild2/lexer.cxx
+++ b/libbuild2/lexer.cxx
@@ -741,7 +741,19 @@ namespace build2
//
else if (m == lexer_mode::variable)
{
- if (c != '_' && !(lexeme.empty () ? alpha (c) : alnum (c)))
+ bool first (lexeme.empty ());
+
+ // Handle special variable names, if any.
+ //
+ if (first &&
+ st.data != 0 &&
+ strchr (reinterpret_cast<const char*> (st.data), c) != nullptr)
+ {
+ get ();
+ lexeme += c;
+ done = true;
+ }
+ else if (c != '_' && !(first ? alpha (c) : alnum (c)))
{
if (c != '.')
done = true;