[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-edu-devel
Subject:    Re: Review Request: Fixing bug 204068, adding ERROR-Token to parser
From:       "Eike Krumbacher" <eike.krumbacher () x-eike ! de>
Date:       2012-01-03 0:14:15
Message-ID: 20120103001415.16290.84628 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> 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
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/103182/">http://git.reviewboard.kde.org/r/103182/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On December 31st, 2011, 3:07 p.m., <b>Albert \
Astals Cid</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px \
solid #d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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?</pre>  </blockquote>




 <p>On January 2nd, 2012, 3:14 p.m., <b>Eike Krumbacher</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If you remove the \
constant definition for &quot;g&quot;, 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. </pre>  </blockquote>





 <p>On January 2nd, 2012, 9:14 p.m., <b>Albert Astals Cid</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">True.

Do you have an account and can commit the change yourself or want me to commit \
it?</pre>  </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I changed my SSH key \
(today), so I stay tuned. Maybe I try again tomorrow.  Thank you for your help</pre>
<br />








<p>- Eike</p>


<br />
<p>On December 31st, 2011, 8:26 a.m., Eike Krumbacher wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for KDE Edu.</div>
<div>By Eike Krumbacher.</div>


<p style="color: grey;"><i>Updated Dec. 31, 2011, 8:26 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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 &quot;g&quot; as a function \
                and reports &quot;Wrong number of arguments&quot; but crashes.
* If &quot;g&quot; 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 &quot;global&quot;, 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 &quot;ERROR&quot;, adding this token to the stack in case \
of an error. 

Have fun

Eike</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">(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. </pre>  \
</td>  </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=204068">204068</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kmplot/parser.h <span style="color: grey">(c3fb92e)</span></li>

 <li>kmplot/parser.cpp <span style="color: grey">(23569aa)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/103182/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kde-edu mailing list
kde-edu@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-edu


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic