changeset 32475:bdbc67b5f92e stable

lex.ll: Accept block comments at the command prompt (bug #64903) * lex.ll: Previously, the end of a block comment was also treated as the end of a statement, which prevented loops with block comments inside from being copy-pasted at the command prompt. This patch accepts block comments without ending the statement.
author Arun Giridhar <arungiridhar@gmail.com>
date Fri, 17 Nov 2023 11:45:51 -0500
parents 39a11fb58ae2
children 9ad5b8864d3e 53694f883c9c
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Sun Nov 05 12:58:38 2023 -0500
+++ b/libinterp/parse-tree/lex.ll	Fri Nov 17 11:45:51 2023 -0500
@@ -784,16 +784,17 @@
 
     curr_lexer->m_block_comment_nesting_level--;
 
-    int status = -1;
-
     if (curr_lexer->m_block_comment_nesting_level == 0)
       {
-        status = -2;
-
         curr_lexer->pop_start_state ();
+
+        if (curr_lexer->pending_token_count () > 0)
+          HANDLE_EOB_OR_EOF (-1);
+        else
+          HANDLE_EOB_OR_EOF (-2);
       }
-
-    HANDLE_EOB_OR_EOF (status);
+    else
+      HANDLE_EOB_OR_EOF (-1);
   }
 
 %{