octave-maintainers
[Top][All Lists]
Advanced

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

Changes to lexer invalidate documentation


From: Rik
Subject: Changes to lexer invalidate documentation
Date: Sun, 12 Apr 2009 15:24:38 -0700
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

4/12/09

In section 2.5 of the documentation (How Octave Reports Errors) there is
an example using the misspelled keyword function.

--------------------
A parse error occurs if Octave cannot understand something you have
typed. For example,
if you misspell a keyword,
octave:13> functon y = f (x) y = x^2; endfunction
Octave will respond immediately with a message like this:
parse error:
syntax error
>>> functon y = f (x) y = x^2; endfunction
             ^
For most parse errors, Octave uses a caret (‘^’) to mark the point on
the line where it
was unable to make sense of your input. In this case, Octave generated
an error message
because the keyword function was misspelled. Instead of seeing ‘function
f’, Octave saw
two consecutive variable names, which is invalid in this context. It
marked the error at y
because the first name by itself was accepted as valid input.
---------------------

The parser has changed and the new output is:
---------------------
functon y = f (x) y = x^2; endfunction
parse error:

  syntax error

>>> functon y = f (x) y = x^2; endfunction
                                          ^
---------------------
    
I would argue that this is less desirable than the old behavior.  By
indicating the error at the end of line it gives no clue where the real
problem lies.   I used hg bisect to track down the changeset which
introduced the new behavior (changset 5dd06f19e9be).  If the new
behavior can't be corrected it might be better to find a new error
example which shows off the parser in a better light.

--Rik




reply via email to

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