# HG changeset patch # User John W. Eaton # Date 1599165813 14400 # Node ID 9117c746de0c6958d65b6ce33554d8f6bd045972 # Parent f044b9951df5a47790b312b5ce89c6ff1293c305 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. diff -r f044b9951df5 -r 9117c746de0c libinterp/parse-tree/lex.ll --- 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)