diff options
Diffstat (limited to 'libbuild2/lexer.cxx')
-rw-r--r-- | libbuild2/lexer.cxx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/libbuild2/lexer.cxx b/libbuild2/lexer.cxx index 6da8a80..ac62996 100644 --- a/libbuild2/lexer.cxx +++ b/libbuild2/lexer.cxx @@ -55,6 +55,12 @@ namespace build2 s2 = " "; break; } + case lexer_mode::case_patterns: + { + s1 = " $(){}[],|#\t\n"; + s2 = " "; + break; + } case lexer_mode::attribute: { s1 = " $(]#\t\n"; @@ -113,6 +119,7 @@ namespace build2 case lexer_mode::normal: case lexer_mode::value: case lexer_mode::values: + case lexer_mode::case_patterns: case lexer_mode::attribute: case lexer_mode::variable: case lexer_mode::buildspec: break; @@ -150,7 +157,9 @@ namespace build2 { // Expire value/values modes at the end of the line. // - if (m == lexer_mode::value || m == lexer_mode::values) + if (m == lexer_mode::value || + m == lexer_mode::values || + m == lexer_mode::case_patterns) state_.pop (); sep = true; // Treat newline as always separated. @@ -227,7 +236,9 @@ namespace build2 // The following characters are special in the values and buildspec mode. // - if (m == lexer_mode::values || m == lexer_mode::buildspec) + if (m == lexer_mode::buildspec || + m == lexer_mode::values || + m == lexer_mode::case_patterns) { // NOTE: remember to update mode() if adding new special characters. // @@ -237,6 +248,18 @@ namespace build2 } } + // The following characters are special in the case_patterns mode. + // + if (m == lexer_mode::case_patterns) + { + // NOTE: remember to update mode() if adding new special characters. + // + switch (c) + { + case '|': return make_token (type::bit_or); + } + } + // Otherwise it is a word. // unget (c); |