diff options
Diffstat (limited to 'libbuild2/token.hxx')
-rw-r--r-- | libbuild2/token.hxx | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libbuild2/token.hxx b/libbuild2/token.hxx index 030ab48..f9ede65 100644 --- a/libbuild2/token.hxx +++ b/libbuild2/token.hxx @@ -30,6 +30,7 @@ namespace build2 eos, newline, word, + escape, // token::value is <...> in $\<...> pair_separator, // token::value[0] is the pair separator char. colon, // : @@ -119,10 +120,13 @@ namespace build2 // Quoting can be complete, where the token starts and ends with the quote // characters and quoting is contiguous or partial where only some part(s) - // of the token are quoted or quoting continues to the next token. + // of the token are quoted or quoting continues to the next token. We also + // keep track whether the first character of a token is quoted (we also + // treat escaped first character as quoted). // quote_type qtype; bool qcomp; + bool qfirst; // Normally only used for word, but can also be used to store "modifiers" // or some such for other tokens. @@ -139,26 +143,32 @@ namespace build2 : token (token_type::eos, false, 0, 0, token_printer) {} token (token_type t, bool s, uint64_t l, uint64_t c, printer_type* p) - : token (t, string (), s, quote_type::unquoted, false, l, c, p) {} + : token (t, string (), s, + quote_type::unquoted, false, false, + l, c, + p) {} token (token_type t, bool s, quote_type qt, uint64_t l, uint64_t c, printer_type* p) - : token (t, string (), s, qt, qt != quote_type::unquoted, l, c, p) {} + : token (t, string (), s, + qt, qt != quote_type::unquoted, qt != quote_type::unquoted, + l, c, + p) {} token (string v, bool s, - quote_type qt, bool qc, + quote_type qt, bool qc, bool qf, uint64_t l, uint64_t c) - : token (token_type::word, move (v), s, qt, qc, l, c, &token_printer){} + : token (token_type::word, move (v), s, qt, qc, qf, l, c) {} token (token_type t, string v, bool s, - quote_type qt, bool qc, + quote_type qt, bool qc, bool qf, uint64_t l, uint64_t c, - printer_type* p) + printer_type* p = &token_printer) : type (t), separated (s), - qtype (qt), qcomp (qc), + qtype (qt), qcomp (qc), qfirst (qf), value (move (v)), line (l), column (c), printer (p) {} |