<table><tr><td style="">mwolff added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28039">View Revision</a></tr></table><br /><div><div><p>Let me try to explain the skip offset idea (it's been years since I came up with this in GeSHi :) )</p>

<p>A code highlighter will repeatedly ask all highlight contexts and items therein to find the closest token to highlight next to the current cursor position.<br />
The closest token will win and then the highlighter will repeat its question at the position after the token.<br />
For regular expressions, it's often cheaper (as indicated by this patch once again), to match the line once starting from the current position and then remember where the first match - if any - is in the current line.<br />
Then, the next time the highlighter asks for a token position, we can check the last matched position. This is essentially the skip offset - i.e. we know that we can skip querying the regexp again until the cursor position is beyond the next match.</p>

<p>Dominik, does this clear things up?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28039">https://phabricator.kde.org/D28039</a></div></div><br /><div><strong>To: </strong>cullmann, dhaumann, vkrause, nibags<br /><strong>Cc: </strong>mwolff, kwrite-devel, kde-frameworks-devel, rrosch, LeGast00n, cblack, GB_2, domson, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>