diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-25 13:42:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-28 10:10:44 +0200 |
commit | bb02e152dc036879ab0b2d1d8aa2cb19084b8e16 (patch) | |
tree | ca3f3e950351f5bfadeec5b0ecb31d6c5bae084f /libbuild2/token.hxx | |
parent | af5fa9e744acf6da12f2eab7f44810195c0d3ecd (diff) |
Recognize quoting of first character in token
Use this to relax the pattern inclusion/exclusion syntax to only require
unquoted +/-.
Diffstat (limited to 'libbuild2/token.hxx')
-rw-r--r-- | libbuild2/token.hxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/libbuild2/token.hxx b/libbuild2/token.hxx index 030ab48..faae466 100644 --- a/libbuild2/token.hxx +++ b/libbuild2/token.hxx @@ -119,10 +119,12 @@ 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. // 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 +141,35 @@ 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_printer) {} 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) : type (t), separated (s), - qtype (qt), qcomp (qc), + qtype (qt), qcomp (qc), qfirst (qf), value (move (v)), line (l), column (c), printer (p) {} |