diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-25 13:45:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-30 15:30:08 +0200 |
commit | 70f5ab11c55ff4a43b32aafe21e839d050301215 (patch) | |
tree | 45db520a78c5b6b0b84027908a6ea4f416ea7cdf /libbuild2/lexer.cxx | |
parent | ea997c89f7ea59db0164c79ac0fda5b607754753 (diff) |
Pattern matching support (switch): multiple values implementation
Diffstat (limited to 'libbuild2/lexer.cxx')
-rw-r--r-- | libbuild2/lexer.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libbuild2/lexer.cxx b/libbuild2/lexer.cxx index fd13c31..6da8a80 100644 --- a/libbuild2/lexer.cxx +++ b/libbuild2/lexer.cxx @@ -49,6 +49,12 @@ namespace build2 s2 = " "; break; } + case lexer_mode::values: + { + s1 = " $(){}[],#\t\n"; + s2 = " "; + break; + } case lexer_mode::attribute: { s1 = " $(]#\t\n"; @@ -106,6 +112,7 @@ namespace build2 { case lexer_mode::normal: case lexer_mode::value: + case lexer_mode::values: case lexer_mode::attribute: case lexer_mode::variable: case lexer_mode::buildspec: break; @@ -141,9 +148,9 @@ namespace build2 // case '\n': { - // Expire value mode at the end of the line. + // Expire value/values modes at the end of the line. // - if (m == lexer_mode::value) + if (m == lexer_mode::value || m == lexer_mode::values) state_.pop (); sep = true; // Treat newline as always separated. @@ -218,9 +225,9 @@ namespace build2 } } - // The following characters are special in the buildspec mode. + // The following characters are special in the values and buildspec mode. // - if (m == lexer_mode::buildspec) + if (m == lexer_mode::values || m == lexer_mode::buildspec) { // NOTE: remember to update mode() if adding new special characters. // |