bugGNU Octave - Bugs: bug #45967, More consistent error message...

 
 

bug #45967: More consistent error message style for parse errors

Submitted by:  Ceral Paquet <octavebugs>
Submitted on:  Tue 15 Sep 2015 12:19:24 AM UTC  
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.0.0 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 16 Sep 2015 12:16:26 PM UTC, comment #2: 

I think the "parse error" messages come from the yyerror (or octave_error) function in the parser and that's separate from the error handling code that is used when code is evaluated in Octave.

It does make sense to me to at least unify the way error messages are displayed.

John W. Eaton <jwe>
Project Administrator
Tue 15 Sep 2015 02:10:36 AM UTC, comment #1: 

This is interesting. My first instinct is to say that they are really two different kinds of errors, but I realized that command syntax allows "sentences" like the first example to work just fine. Maybe "i" is a special case in that it is both syntax and a built-in function named "i".

But compare

>> i am a bug
parse error:

  syntax error

>>> i am a bug
       ^

>> fft am a bug
error: invalid conversion from string to real scalar

Both "i" and "fft" are built-in functions, but with "fft" it does the normal conversion from command to function call, and the error is different.

Perhaps it is a bug that "i am a bug" is flagged as a syntax error rather than an invalid function call to the function named "i", but that's about it.

If your function were

function f ()
  1 +
endfunction

the same "parse error" would be thrown, because it is illegal syntax, not just an invalid function call or reference to an unknown variable.

Mike Miller <mtmiller>
Project Administrator
Tue 15 Sep 2015 12:19:24 AM UTC, original submission:  

function myfoo()

i am a bug

endfunction

 

function mybar()

i_am_a_bug

endfuction

-----------------

>> myfoo

parse error near line 3 of file /home/ceral/octave/myfoo.m

  syntax error

>>> i am a bug

       ^

>> mybar

error: 'i_am_a_bug' undefined near line 3 column 1
error: called from
    mybar at line 3 column 1

Would it be possible to use the same style for these two types of error? Perhaps the latter is slightly tidier. How about:

>> myfoo

error: syntax error near line 3 column 1
error: called from
    myfoo.m at line 3 column 1

What would be awesome is to have the final line be clickable and take you to that file and line in the Editor.

Ceral Paquet <octavebugs>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by octavebugs (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-15 mtmiller CategoryNone => Interpreter
        Severity3 - Normal => 1 - Wish
        Item GroupNone => Feature Request
        StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5