Review Request: Fixing bug 204068, adding ERROR-Token to parser

Eike Krumbacher eike.krumbacher at x-eike.de
Fri Nov 18 23:26:41 UTC 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103182/
-----------------------------------------------------------

Review request for KDE Edu.


Description
-------

Hello Folks!

If you have a set of functions like
f(x) = g x²
g(x) = 2 x

* kmplot crashes without notice, because the parser reads "g" as a function and reports "Wrong number of arguments" but crashes.
* If "g" is meant to be a predefined constant the parser crashes because g is read as a function with wrong argument counts. 

So there are several cases:
1) g(x) and f(x) exists in a file, reading the file should not crash
2) if g is a constant, whether in the file or "global", f(x) should read this constant first
3) a function set like 
g(x) = 10 * g
f(x) = g(x) + g
should be read and displayed.

With the given diff, we can archive (1) and (2) but not (3), which now does not crash anymore but  gives strange results. In the surrounding of the changes, I added some whitespaces to reflect the style guide of the given code. The main part is an introduction of the token "ERROR", adding this token to the stack in case of an error. 

Have fun

Eike


This addresses bug 204068.
    http://bugs.kde.org/show_bug.cgi?id=204068


Diffs
-----

  kmplot/parser.h c3fb92e 
  kmplot/parser.cpp 23569aa 

Diff: http://git.reviewboard.kde.org/r/103182/diff/diff


Testing
-------

(1), (2) and (3) was tested. The original file from the bug report associated with this review was tested. No crashes in these special cases. 


Thanks,

Eike Krumbacher

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20111118/88cd3547/attachment.html>


More information about the kde-edu mailing list