octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64903] Command window may not accept mutliple


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #64903] Command window may not accept mutliple line comments
Date: Fri, 17 Nov 2023 10:58:13 -0500 (EST)

Update of bug #64903 (project octave):

                  Status:               Confirmed => Patch Submitted        

    _______________________________________________________

Follow-up Comment #4:

I've got it. With the attached patch, this is the behavior:

Code to paste:

for i = 1:5
i
#{
  foo
  #{
    bar
  #}
  baz
#}
-i
end


Output:


octave:1> for i = 1:5
> i
> #{
>   foo
>   #{
>     bar
>   #}
>   baz
> #}
> -i
> end
i = 1
ans = -1
i = 2
ans = -2
i = 3
ans = -3
i = 4
ans = -4
i = 5
ans = -5
octave:2>


Patch, also attached:


diff -r b5e433b52bc3 libinterp/parse-tree/lex.ll
--- a/libinterp/parse-tree/lex.ll       Mon Nov 13 16:58:52 2023 +0100
+++ b/libinterp/parse-tree/lex.ll       Fri Nov 17 10:50:29 2023 -0500
@@ -762,16 +762,17 @@ ANY_INCLUDING_NL (.|{NL})
 
     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);
   }
 
 %{


Please test this out. If it works as intended for you, I'll push it with bug
number etc.

(file #55336)

    _______________________________________________________

Additional Item Attachment:

File name: lex.patch                      Size:0 KB
    <https://file.savannah.gnu.org/file/lex.patch?file_id=55336>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64903>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]