#228 wrong line number in error message

closed
nobody
None
5
2006-09-14
2006-09-13
paul_fitzgerald
No

The command

return 1;

is invalid in FreeMat and MATLAB but I wrote it
because I was thinking in C. However, the error
message I got didn't point me to the right line.

If the offending line is typed on the command line,

FreeMat says:
return 1
Error: Expecting statement list or function definition

MATLAB says:
return 1
??? return 1
|
Error: Missing MATLAB operator.

But when this error is embedded in a bunch of code:

function test_error()

% there is a lot of code here
return 1;
% and here

return;

FreeMat says:
test_error
Error: Expecting (possibly empty) argument list
after '('
at line 1, column 21 of file
H:/FreeMat_mfiles/General/test_error.m

MATLAB says:
test_error
??? Error: File:
H:\FreeMat_mfiles\General\test_error.m Line: 4 Column:
10
Missing MATLAB operator.

Discussion

  • Samit Basu
    Samit Basu
    2006-09-14

    • status: open --> closed
     
  • Samit Basu
    Samit Basu
    2006-09-14

    Logged In: YES
    user_id=878533

    2.1 sports a new parser and scanner that give much better
    info than 2.0. In particular, with the "return 5"
    statement, it points the error at exactly the right spot.
    So if possible, please try these again on 2.1.

    Samit