comparison libinterp/parse-tree/lex.ll @ 30201:501fe2c8a880

initialize filepos to (1, 1) when function appears in eval string * lex.ll (base_lexer::make_keyword_token): Set filepos to (1, 1) when a function token appears in an eval string.
author John W. Eaton <jwe@octave.org>
date Wed, 22 Sep 2021 23:09:12 -0400
parents a471bf0f78ba
children c41fec3367b0
comparison
equal deleted inserted replaced
30200:3e419a830e90 30201:501fe2c8a880
2855 { 2855 {
2856 m_reading_fcn_file = true; 2856 m_reading_fcn_file = true;
2857 m_reading_script_file = false; 2857 m_reading_script_file = false;
2858 } 2858 }
2859 2859
2860 // FIXME: should we be asking directly whether input is coming
2861 // from an eval string instead of that it is not coming from a
2862 // file?
2863
2860 if (! (m_reading_fcn_file || m_reading_script_file 2864 if (! (m_reading_fcn_file || m_reading_script_file
2861 || m_reading_classdef_file)) 2865 || m_reading_classdef_file))
2862 { 2866 {
2863 // Input must be coming from the terminal or stdin? 2867 // Input must be coming from the terminal or stdin?
2864 m_buffer_function_text = true; 2868 m_buffer_function_text = true;
2865 m_function_text += (m_current_input_line + "\n"); 2869 m_function_text += (m_current_input_line + "\n");
2866 2870
2867 // FIXME: do we need to save and restore the file position 2871 // FIXME: do we need to save and restore the file position
2868 // or just reset the line number here? The goal is to 2872 // or just reset the line number here? The goal is to
2869 // track line info for command-line functions relative 2873 // track line info for command-line functions relative
2870 // to the function keyword. 2874 // to the function keyword. Should we really be setting
2871 2875 // the line and column info to (1, 1) here?
2872 m_filepos = filepos (); 2876
2877 m_filepos = filepos (1, 1);
2873 update_token_positions (slen); 2878 update_token_positions (slen);
2874 } 2879 }
2875 break; 2880 break;
2876 2881
2877 case arguments_kw: 2882 case arguments_kw: