bugGNU Octave - Bugs: bug #67269, % causes an unexpected error in...

 
 

bug #67269: % causes an unexpected error in function generated in gui command window

Submitter:  Liang Tang <lt1234>
Submitted:  Tue 01 Jul 2025 11:05:12 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Patch Reviewed Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Open
Release:  * 9.3.0 Release: 
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  10.3.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 12 Jul 2025 07:49:47 PM UTC, comment #6: 

I would put jwe's patch on stable.

Rik <rik5>
Group administrator
Thu 03 Jul 2025 07:03:52 PM UTC, comment #5: 

This pa5tch fixd the problem for me (on dev).

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 03 Jul 2025 06:55:27 PM UTC, comment #4: 

Does the attached patch fix the problem for you?

I'm not sure why the previous code didn't work.  I expected that "%{" at the beginning of a line would match either of the patterns


<LINE_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL}
<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}


and then use the first one (that was intended to detect the start of a block comment when already parsing a series of line comments).  Maybe this doesn't work because of the beginning of line anchor?  I'm not sure of the reason but it seems fine to just merge the two rules.

I made this change while working on the default branch but I'm leaning toward fixing it on stable for the next 10.x release.


(file #57359)

John W. Eaton <jwe>
Group administrator
Wed 02 Jul 2025 08:28:32 PM UTC, comment #3: 

The original file I had contained the combinations of single line comments and block comments. Typically I use block comments to store the test cases that I can use directly in the gui command window. 

function test2 is in the same sequence of my original file.  I did not try other combinations.  Thanks. 


Liang Tang <lt1234>
Wed 02 Jul 2025 05:53:58 PM UTC, comment #2: 

"%{" and "%}" are block comments. Anything between them should be
treated as comments.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 02 Jul 2025 05:47:01 PM UTC, comment #1: 

I assume this is related to octave parsing help text for functions. I would expect both functions to trow an error for an undefined variable a.  Not sure why test1 passes without error.

Nicholas Jankowski <nrjank>
Group Member
Tue 01 Jul 2025 11:05:12 PM UTC, original submission:  

Pls cut/paste function test1 and test2 into gui command window.

function test1(A,B)
%{
a
display('I am here ')
%}
end
function test2(A,B)
%
%
%
%{
a
display('I am here ')
%}
end

In command window, run test1 and test2.  test2 failed unexpectedly.  Thanks.

>> test1
>> test2

error: 'a' undefined near line 6, column 1
error: called from
    test2 at line 6 column 1

Liang Tang <lt1234>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #57359:  bug-67269-patch.txt added by jwe (5KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by lt1234 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    19:49 rik5 StatusPatch Submitted Patch Reviewed
    2025-07-03 jwe StatusNone Patch Submitted
        Planned ReleaseNone 10.3.0 (current stable)
    2025-07-03 jwe Attached File- Added bug-67269-patch.txt, #57359

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code