Mercurial > octave
changeset 28679:9117c746de0c stable
improve tracking of token positions
* lex.ll ("("): Only update token position once, when pattern is
accepted and token is returned.
(base_lexer::make_keyword_token): Don't update token position; it
should have been done before make_keyword_token is called.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 03 Sep 2020 16:43:33 -0400 |
parents | f044b9951df5 |
children | e6928695dacb f1dcb77ca6ff |
files | libinterp/parse-tree/lex.ll |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll Wed Sep 02 10:27:58 2020 -0400 +++ b/libinterp/parse-tree/lex.ll Thu Sep 03 16:43:33 2020 -0400 @@ -1696,8 +1696,6 @@ "(" { curr_lexer->lexer_debug ("("); - curr_lexer->update_token_positions (yyleng); - bool unput_comma = false; if (curr_lexer->whitespace_is_significant () @@ -2635,6 +2633,9 @@ int base_lexer::make_keyword_token (const std::string& s) { + // Token positions should have already been updated before this + // function is called. + int slen = s.length (); const octave_kw *kw = octave_kw_hash::in_word_set (s.c_str (), slen); @@ -2647,8 +2648,6 @@ // May be reset to true for some token types. m_at_beginning_of_statement = false; - update_token_positions (slen); - token *tok_val = nullptr; switch (kw->kw_id)