31.01.2008, 20:09
This is my first ever attempt at writing a syntax highlighter. I
have not looked into anyone else's code either, so I'm proud to say
that I thought up all the algorithms used in this code by myself (though
someone else may have already used them, IDK >_>).
Doing a few benchmarks against GeSHi (what's used on most forum systems,
like phpBB and vBulletin), my code performs, on average, 2 times faster.
XML/HTML is done by a dedicated algorithm, so is usually around 5-6 times
faster than GeSHi.
Still, it's rather slow, plus, my algorithm has a little flaw, which, in a
worst case scenario, may cause it to run quite slowly.
For most codes however, it shouldn't be an issue.
I suggest installing a preparser if you plan on using
this.
One thing to note is that this algorithm is more designed for speed than
ease of extensibility, unlike GeSHi.
Features:
Tabs are displayed correctly (not converted to spaces)
Adds a Select button for easy code selection
Supported languages:
C
C++
Java
Visual Basic
PHP (custom)
XML/HTML
Javascript
Assembler
SQL
Batch
INI
Demo and support available here: http://mybbhacks.zingaburga.com/showthread.php?tid=33
Quelle: http://mods.mybboard.net/archive/view/sy...ghlighting
have not looked into anyone else's code either, so I'm proud to say
that I thought up all the algorithms used in this code by myself (though
someone else may have already used them, IDK >_>).
Doing a few benchmarks against GeSHi (what's used on most forum systems,
like phpBB and vBulletin), my code performs, on average, 2 times faster.
XML/HTML is done by a dedicated algorithm, so is usually around 5-6 times
faster than GeSHi.
Still, it's rather slow, plus, my algorithm has a little flaw, which, in a
worst case scenario, may cause it to run quite slowly.
For most codes however, it shouldn't be an issue.
I suggest installing a preparser if you plan on using
this.
One thing to note is that this algorithm is more designed for speed than
ease of extensibility, unlike GeSHi.
Features:
Tabs are displayed correctly (not converted to spaces)
Adds a Select button for easy code selection
Supported languages:
C
C++
Java
Visual Basic
PHP (custom)
XML/HTML
Javascript
Assembler
SQL
Batch
INI
Demo and support available here: http://mybbhacks.zingaburga.com/showthread.php?tid=33
Quelle: http://mods.mybboard.net/archive/view/sy...ghlighting