Hey guys
im currently coding a text editor with syntax highlighting. Im using the Digital Rune Texteditor (DigitalRune Text Editor - A Text Editor for .NET Windows Forms.) for that.
Can someone tell me, how to make my own syntax highlighting for my own language?
Thanks
It's like this is all I say
But, LEARN THE LANGUAGE FIRST!
I'm sorry but that's the best answer I can give.
And I don't thinks anyone else is going to help you.
But if anyone can help you it's @Hassan, he made his own language.
Multiple ways of going about it, finding the most efficient is the hardest part, and making it foolproof is also difficult. If you're triggering syntax highlighting on the "textchanged" event, you're going to have to do some filtering about where to start and finish applying the syntax highlighting, as a textbox with a hundred lines of text will start lagging insanely if the whole thing is being parsed for syntax highlighting EVERY TIME someone types.
First step is to obtain a list of the words you want to highlight, you can find a lot of them on MSDN if you search for stuff like "Visual Basic Keywords List MSDN" or something like that.
Next you've got to add that list somewhere into your project (either through My.Settings, or even in a .txt file accompanying the project and to be loaded into a list at runtime.
After that, my idea would be to create a dictionary(Of String, Color) for each of the keywords, to add the color of their highlighting associated with the keyword.
Now you'll need to write some method that takes an input string, and a richtextbox control and does all the syntax highlighting for that given string.
That's really it.
It looks like you dont know DigitalRune, but thanks. I already got it working
Originally Posted by Vanoq
It looks like you dont know DigitalRune, but thanks. I already got it working
Who were you talking to, Jason or me?
Originally Posted by Vanoq
Can someone tell me, how to make my own syntax highlighting for my own language?
Thanks
I assumed you didn't want to use DigitalRune any more and make your OWN syntax highlighting as you stated in your post -.-