<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://reviewboard.kde.org/r/5079/">http://reviewboard.kde.org/r/5079/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://reviewboard.kde.orgrb/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 and Alexander Rieder.</div>
<div>By Miha Cancula.</div>
<p style="color: grey;"><i>Updated 2010-08-22 20:49:52.983329</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Removed references to non-existent files.</pre>
</td>
</tr>
</table>
<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;">As discussed on email, I implemented a different approach to highlighting in Cantor. I'd like some feedback before committing it.
I introduced additional API in DefaultHighlighter and moved most of the logic in it, so the individual backend-specific highlighters only specify conditions (either QString or QRegExp) and matching text formats. The code looks much cleaner this way.
As Alexander and Oleksiy already determined, breaking the text into words and looking for these words is faster than iterating over a huge list of regexes and looking for each of them in the text. That's why functions, variables and keywords are implemented this way. OTOH, thing like comments and strings are easier done using Regexes, so this functionality is still there.
The implementation uses a QHash<QString, QTextCharFormat> and a QHash<QRegExp, QTextCharFormat>. If anyone knows of a way to make it faster, please say so.
I also updated highlighters for Octave, Maxima and Sage to use the word-based API as much as possible. Most of their code was also removed, because it's now in DefaultHighlighter. I left R alone because Oleksiy's work is not yet in trunk. </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;">I tested Maxima and Sage and they seem to be faster than before for large blocks. I used to have problems with non-smooth scrolling in Octave due to the large number of functions, but now it feels normal. I didn't notice any regressions (yet).
It all works both on trunk and 4.4. </pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/KDE/kdeedu/cantor/src/backends/maxima/maximahighlighter.h <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/maxima/maximahighlighter.cpp <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/octave/octavehighlighter.h <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/octave/octavehighlighter.cpp <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/sage/sagehighlighter.h <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/sage/sagehighlighter.cpp <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/lib/defaulthighlighter.h <span style="color: grey">(1166707)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/lib/defaulthighlighter.cpp <span style="color: grey">(1166707)</span></li>
</ul>
<p><a href="http://reviewboard.kde.org/r/5079/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>