C# Code Highlighter (BETA)
What self respecting developer site wouldn't have a code-highlighter? Well... several really, but this isn't one of them and unlike most of the others that 'borrow' other peoples efforts I have created by own.
The code behind the scenes for this Beta is not all new. The lexer engine is pretty old and was developed while I was creating bespoke content management engines that needed things like CSS, XML and other data/script parsing/interpretation. Fortunatly as I created my lexer engine in my own time, I was able to retain copyright - thus I rooted it out of my archive and update it to .NET 2.0. However the add-on engines that translated the lexical analysis tree produced by the lexer engine were not my own, so I can't bring those to you. My personal translation objects I won't release yet as I am using them for other things.
Except of course my c# translater/highlighter... once it's fully working and the Lexer has been tidied up some.
So. Please have a play and let me know of any issues (via usual channels).
C# Code Highlighter (opens new window).
To aid in this I have purposefully allowed full error messages to be displayed if anything nasty does occur. This is a privelage, please don't abuse it.
P.s. There is a glaring bug in the highlighter that I do know about, but I am opting to see if any of you spot it! Evil ain't I?
Update!: It took a while, but a '##csharp' user finally found the problem. The last token is
never parsed! Congratulations to 'IRBMe'!... no prizes though! sorry. ;)
Spotted bugs:
- Enter standard text that contains brackets produces an 'Index was Out of Range' exception in the HighLighter on line 78. - OmniMarko
- MRW: Thanks for this, I'm suprised I never picked this up. (>.<)
- ASP.NET does not highlight very nicely, even though structure is maintained. - Anon
- MRW: I am strangely not suprised considering this is a C# highlighter. Structure would be maintained as the highlighter retains white-spacing. I do not yet have plans for an ASP.NET highlighter/translater.
- (Not a bug) Can you get your highlighter to colourise sql statements in strings? - z0mb13Grrrl
- MRW: I do plan a SQL highlighter as a large percentage of of my work involves SQL-Server. However I have no plans to incorporate this into the C# highlighter as I refuse to use inline SQL. I suggest you use Stored Procedures.
- z0mb13Grrrl: I have to use Access so I can not use Stored Procedures, so what about people like myself who have no option?
- MRW: I will take this into consideration, but no promises.