diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-10 10:00:55 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-06-10 10:00:55 +0200 |
commit | d5faeeab1d2115c02a330ac9c95d63ba225faabc (patch) | |
tree | 410f9d2b8c70c30c74d799d4fa7695c6f367cd41 /libbuild2/lexer.cxx | |
parent | 2ee88b6041557beb517b100c3f608ebfc5eb725d (diff) |
Handle special variable names in base lexer via mode data
Diffstat (limited to 'libbuild2/lexer.cxx')
-rw-r--r-- | libbuild2/lexer.cxx | 14 |
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; |