diff options
Diffstat (limited to 'libbuild2/script/lexer.cxx')
-rw-r--r-- | libbuild2/script/lexer.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libbuild2/script/lexer.cxx b/libbuild2/script/lexer.cxx index a18c1df..e13bbdb 100644 --- a/libbuild2/script/lexer.cxx +++ b/libbuild2/script/lexer.cxx @@ -24,10 +24,7 @@ namespace build2 bool q (true); // quotes if (!esc) - { - assert (!state_.empty ()); - esc = state_.top ().escapes; - } + esc = current_state ().escapes; switch (m) { @@ -84,7 +81,7 @@ namespace build2 } assert (ps == '\0'); - state_.push ( + mode_impl ( state {m, data, nullopt, false, false, ps, s, n, q, *esc, s1, s2}); } @@ -93,7 +90,7 @@ namespace build2 { token r; - switch (state_.top ().mode) + switch (mode ()) { case lexer_mode::command_expansion: case lexer_mode::here_line_single: @@ -119,7 +116,7 @@ namespace build2 xchar c (get ()); uint64_t ln (c.line), cn (c.column); - const state& st (state_.top ()); + const state& st (current_state ()); lexer_mode m (st.mode); auto make_token = [&sep, &m, ln, cn] (type t) @@ -127,7 +124,7 @@ namespace build2 bool q (m == lexer_mode::here_line_double); return token (t, string (), sep, - (q ? quote_type::double_ : quote_type::unquoted), q, + (q ? quote_type::double_ : quote_type::unquoted), q, q, ln, cn, token_printer); }; @@ -180,7 +177,7 @@ namespace build2 auto make_token = [&sep, &c] (type t, string v = string ()) { return token (t, move (v), sep, - quote_type::unquoted, false, + quote_type::unquoted, false, false, c.line, c.column, token_printer); }; |