diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-08 16:42:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-08 16:42:24 +0200 |
commit | ccca13f8eadef31f2df873cb505ebca98501c45a (patch) | |
tree | d87b67fd42909dfc5cca2ae2a999de8f8e0cc969 /build/lexer | |
parent | b5940dd5562bfa12d6d76dceb61540b4480a4982 (diff) |
Initial take on double quote support
Currently, $(foo)-style variable expansion is not supported.
Diffstat (limited to 'build/lexer')
-rw-r--r-- | build/lexer | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/build/lexer b/build/lexer index 1e253fd..0740f14 100644 --- a/build/lexer +++ b/build/lexer @@ -28,8 +28,9 @@ namespace build // The alternnative modes must be set manually. The value and // pairs modes are automatically reset after the end of the line. // The variable mode is automatically reset after the name token. + // Quoted is an internal mode and should not be explicitly set. // - enum class lexer_mode {normal, variable, value, pairs}; + enum class lexer_mode {normal, quoted, variable, value, pairs}; class lexer: protected butl::char_scanner { @@ -71,7 +72,10 @@ namespace build name (bool separated); void - single_quote (std::string& lexeme); + single_quote (std::string&); + + bool + double_quote (std::string&); // Return true we have seen any spaces. Skipped empty lines don't // count. In other words, we are only interested in spaces that @@ -100,11 +104,12 @@ namespace build private: fail_mark fail; - // Currently, the maximum mode nesting is 3: {normal, value, variable}. + // Currently, the maximum mode nesting is 4: {normal, value, quoted, + // variable}. // struct mode_stack { - static const size_t max_size = 3; + static const size_t max_size = 4; void push (lexer_mode m) {assert (n_ != max_size); d_[n_++] = m;} void pop () {assert (n_ != 0); n_--;} |