changeset 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 3e419a830e90
children c2c11605fa7a
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Tue Sep 21 13:32:41 2021 -0400
+++ b/libinterp/parse-tree/lex.ll	Wed Sep 22 23:09:12 2021 -0400
@@ -2857,6 +2857,10 @@
             m_reading_script_file = false;
           }
 
+        // FIXME: should we be asking directly whether input is coming
+        // from an eval string instead of that it is not coming from a
+        // file?
+
         if (! (m_reading_fcn_file || m_reading_script_file
                || m_reading_classdef_file))
           {
@@ -2867,9 +2871,10 @@
             // FIXME: do we need to save and restore the file position
             // or just reset the line number here?  The goal is to
             // track line info for command-line functions relative
-            // to the function keyword.
-
-            m_filepos = filepos ();
+            // to the function keyword.  Should we really be setting
+            // the line and column info to (1, 1) here?
+
+            m_filepos = filepos (1, 1);
             update_token_positions (slen);
           }
         break;