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

Eike Krumbacher eike.krumbacher at x-eike.de
Tue Jan 3 00:14:15 UTC 2012



> On Dec. 31, 2011, 3:07 p.m., Albert Astals Cid wrote:
> > Do we need the ERROR token at all? I commented addToken( ERROR ); from Parser::initEquation and it seems it still works, can you confirm if that is right or explain why we need the ERROR token?
> 
> Eike Krumbacher wrote:
>     If you remove the constant definition for "g", and load a file with an equation tuple like:
>     f(x) = g(x) + g
>     g(x) = 2 g
>     kmplot crashes in the case of an commented addToken( ERROR ) in Parser::initEquation. 
>     
>     The Error Token is just a cleaner for the stack. If someone likes to invest more time into the Parser and friends, the Parser::heir{1,...,5}() and the Parserr::try{Constant, UserFunction, ...} methods might cause this trouble. But I do not invest more time into kmplot.
> 
> Albert Astals Cid wrote:
>     True.
>     
>     Do you have an account and can commit the change yourself or want me to commit it?

I changed my SSH key (today), so I stay tuned. Maybe I try again tomorrow. 
Thank you for your help


- Eike


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


On Dec. 31, 2011, 8:26 a.m., Eike Krumbacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103182/
> -----------------------------------------------------------
> 
> (Updated Dec. 31, 2011, 8:26 a.m.)
> 
> 
> 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/20120103/deaa6ea6/attachment.html>


More information about the kde-edu mailing list