help-octave
[Top][All Lists]
Advanced

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

syntax error


From: Mike Gross
Subject: syntax error
Date: Fri, 26 Jan 2007 12:51:48 -0800
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

Hello,

Recently a coworker of mine ran across the following problem which I thought to be a little confusing. He kept getting a syntax error in one of his functions and had trouble determining where the problem actually was.

I took a quick look at his file and nothing seemed obviously wrong. After puzzling over it for a while I eventually tried running it in matlab and it immediately gave me an error: "end" expected, "End of Input" found.

With this information it was easy to locate and fix the problem, which of course was a missing end statement. In general the syntax error message is great as it prints the offending line, but when there is an error of omission the error is blank.

Does anyone else think that it would be useful to include a little more description as to what the actual syntax error is?

Here is an example of what I mean:


GNU Octave, version 2.9.9 (i486-pc-linux-gnu).
Copyright (C) 2006 John W. Eaton.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html

Report bugs to <address@hidden> (but first, please read
http://www.octave.org/bugs.html to learn how to write a helpful report).

octave2.9:1> version
ans = 2.9.9
octave2.9:2> errorTest
parse error near line 10 of file /home/mike/errorTest.m

  syntax error



octave2.9:2>





The function was defined as:


function errorTest()

a = 0;

if(a == 1)

end

if(a == 0)


reply via email to

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