changeset 33103:f3eb27de36cf

fix grammar to explicitly disallow 'file' inside other statement lists * oct-parse.yy (input): Recognize 'file' here instead of in 'command'.
author John W. Eaton <jwe@octave.org>
date Wed, 28 Feb 2024 10:11:31 -0500
parents 0cee23f74ae9
children 4bf13433d79d
files libinterp/parse-tree/oct-parse.yy
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy	Tue Feb 27 23:51:59 2024 -0500
+++ b/libinterp/parse-tree/oct-parse.yy	Wed Feb 28 10:11:31 2024 -0500
@@ -434,6 +434,13 @@
                     else
                       YYACCEPT;
                   }
+                | file
+                  {
+                    lexer.m_end_of_input = true;
+
+                    $$ = $1;
+                    YYACCEPT;
+                  }
                 | parse_error
                   {
                     $$ = nullptr;
@@ -1038,8 +1045,6 @@
                   { $$ = $1; }
                 | function
                   { $$ = $1; }
-                | file
-                  { $$ = $1; }
                 ;
 
 // ======================