bugGNU Octave - Bugs: bug #58198, Comments not being parsed...

 
 

bug #58198: Comments not being parsed correctly in REPL

Submitter:  None
Submitted:  Fri 17 Apr 2020 05:03:17 PM UTC
   
 
Category:  Interpreter Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.0.90
Release:  Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 07 May 2020 03:53:00 PM UTC, comment #17: 

Everything looks good at my end. Thank you, John!

Anonymous
Wed 06 May 2020 05:46:14 PM UTC, comment #16: 

I pushed one more change to restore the use of the pull parser for non-interactive use:

http://hg.savannah.gnu.org/hgweb/octave/rev/ce7a5b60e102

Unless other related problems appear, I think this bug report can be closed as fixed.

John W. Eaton <jwe>
Group administrator
Tue 05 May 2020 03:37:12 PM UTC, comment #15: 

Posting my last comment again because I messed up the verbatim tag...

Yes, with the current sources


octave < test.m


displays prompts similar to executing the commands interactively but I think that might be another bug.  At least it is a change in behavior from version 5 and not something that was intentional.

John W. Eaton <jwe>
Group administrator
Tue 05 May 2020 02:45:21 PM UTC, comment #14: 

Yes, with the current sources


octave < test.m
+verbatim-

displays prompts similar to executing the commands interactively but I think that might be another bug.  At least it is a change in behavior from version 5 and not something that was intentional.

John W. Eaton <jwe>
Group administrator
Tue 05 May 2020 01:43:10 PM UTC, comment #13: 

It now works exactly as intended. Thank you, John!

For "scripting" the interactive prompt without copy-paste, I found this workaround from the shell prompt:


$ octave <test.m  # redirecting input invokes the REPL


versus

$ octave test.m  # passing a script file argument does not invoke the REPL


But I don't see a good way yet to automate this as part of "make check".

Anonymous
Tue 05 May 2020 05:12:36 AM UTC, comment #12: 

OK, here is another attempt, pushed on stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/d938c4d22200

This seems to work for me.  Are there other issues?  I'm not sure how to write a test for this bug because it requires using the push parser and lexer, and currently those are only used for interactive input.

John W. Eaton <jwe>
Group administrator
Tue 05 May 2020 02:30:48 AM UTC, comment #11: 

Oops.  So I think the decision about whether to end the statement or request more input needs to be based on feedback from the parser in some way.  I'll have another look.  This issue should definitely be fixed before the 6.1 release, so I'm tagging it as a blocker.

John W. Eaton <jwe>
Group administrator
Mon 04 May 2020 10:53:57 PM UTC, comment #10: 

John, thank you for the fix. I see that the copy-paste works as expected. I see that typing a comment (or commenting out part of a long statement) at the command prompt now causes it to seek more input (at least an enter key) before continuing. But that's the lesser of the two evils. Thank you again for the change.

Anonymous
Mon 04 May 2020 03:56:14 PM UTC, comment #9: 

I pushed the following change on stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/3e3ad0ae247f

Marking as ready for test.

John W. Eaton <jwe>
Group administrator
Fri 01 May 2020 08:55:10 PM UTC, comment #8: 

The attached change fixes the problem for me, but I haven't done much testing to see whether it causes any new problems.


(file #48983)

John W. Eaton <jwe>
Group administrator
Fri 01 May 2020 08:23:45 PM UTC, comment #7: 

I did a partial bisection. It appears this change [1] caused the comment behavior to change to its present behavior. Could somebody please check? If it's not, sorry for the noise.

[1] http://hg.savannah.gnu.org/hgweb/octave/rev/648202bebcb0

Anonymous
Sat 25 Apr 2020 04:08:15 PM UTC, comment #6: 

This bug also affects version 6, should probably factor into the upcoming release plan.

Mike Miller <mtmiller>
Group Member
Sat 18 Apr 2020 03:58:34 PM UTC, comment #5: 

OP here. Octave version is 7.0.0 dev (hg id a56ee7986ea4) on Arch Linux. Thank you.

Anonymous
Sat 18 Apr 2020 02:50:53 PM UTC, comment #4: 

Yes, this is the opposite behavior of that in bug #57208.

Pantxo Diribarne <pantxo>
Group Member
Sat 18 Apr 2020 12:29:12 PM UTC, comment #3: 

Using current dev Octave 7.0.0 and Fedora 31 I get:
for:
for i = 1:10
  # i represents the index
  disp(i)
end
I get:
octave:1> for i = 1:10

>   # i represents the index

octave:1>   disp(i)

  1. + 1i

octave:2> end
error: parse error:

  syntax error

>>> end

         ^

For:
for i = 1:10
  # i represents the index
  disp(i)
end
I get:
octave:2> for i = 1:10

>   disp(i) # i represents the index
> end

1
2
3
4
5
6
7
8
9
10
octave:3>

Michael Godfrey <godfrey>
Group Member
Sat 18 Apr 2020 12:22:30 PM UTC, comment #2: 

I confirmed that I observe the same faulty behavior as the OP on linux , I did not check on other OSs.
The problem is that pasting a loop block containing a line with a comment won't work : after the comment is read, the loop block is canceled, as if one had pressed CTRL+C. This doesn't look like the bug you mentionned.

Pantxo Diribarne <pantxo>
Group Member
Sat 18 Apr 2020 11:34:09 AM UTC, comment #1: 

@OP:
What operating system, which version of Octave?

Isn't this some sort of a duplicate, or related manifestation of bug #57634 ?

Philip Nienhuis <philipnienhuis>
Group Member
Fri 17 Apr 2020 05:03:17 PM UTC, original submission:  

During debugging a script it's common to copy-paste snippets of code to the Octave command prompt (REPL) for live evaluation. This used to work but now triggers a parse error with full-line comments.

This causes an error:

for i = 1:10
  # i represents the index
  disp(i)
end


Moving the comment to the end of the line is OK:

for i = 1:10
  disp(i) # i represents the index
end


Both of the above work as intended in scripts and function files. Only the REPL is affected.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48983:  lexer-diffs.txt added by jwe (429B - 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 (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by pantxo (Updated 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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-12 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-05-05 jwe Severity4 - Important 5 - Blocker
    2020-05-04 jwe StatusConfirmed Ready For Test
    2020-05-01 jwe Attached File- Added lexer-diffs.txt, #48983
    2020-04-25 mtmiller Severity3 - Normal 4 - Important
        Releasedev 6.0.90
    2020-04-18 pantxo StatusNeed Info Confirmed
    2020-04-18 philipnienhuis StatusConfirmed Need Info
    2020-04-17 pantxo StatusNone Confirmed

    Back to the top

    Powered by Savane 3.15-26b0.
    Corresponding source code