Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Apr 29, 2005 12:28 am   

Syntax Highlighting in zMemo
 
Well, last night I had a hard time sleeping because I realized that the simple Mark, MarkBetween, and OnHighlight methods and event for handling syntax highlighting just wasn't going to work. These routines came from the RichView resource page and just are not well implemented. They are very slow, and even worse, calling a Script from the OnHighlight event was going to be even slower! There was just no way to handle "real" syntax highlighting with these methods.

So, I got up early this morning and was motivated to implement *real* syntax highlighting routines.

I think you will be very excited about what I've come up with. You can see the full documentation at zMemo.Syntax.

Basically, you use some methods to add pattern strings to various syntax highlighting "engines". These engines are executed as needed to update the highlighting in your zMemo control.

There are some *very* powerful methods here. Not only are simply keyword and delimiter highlighting provided, but complex balanced-quote highlighting (something that is nearly impossible to achieve with regular expressions) is avaliable, along with a comment engine for end-of-line comments (that won't highlight comments within quotes, for example).

Finally, there is a general Regular Expression rule engine. You can specify a regular expression and then give the style for the overall matched pattern, as well as different styles for *each* sub-pattern that is matched. You can decide whether this regular expression rule will override any previous highlighting, or whether it respects previous highlighting.

The engines are optimized to only process the text that has been changed while you are typing.

It should be a simple matter to write some programs that read in popular syntax data files and create the zMemo rules needed. The syntax highlighting in zMemo is a lot more powerful than simple programs like EditPlus, so it should be able to do a lot more than you normally can.

Take a look at the documentation and let me know what you think. If you have suggestions on how it can be improved, let me know.

I'll try to get a new build released tomorrow so that people can really start playing with this seriously.

(Yeah I know, syntax highlighting wasn't really on my high-priority list, but I was losing sleep over it, so now I'm happier! Hope you are too!)
Reply with quote
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Fri Apr 29, 2005 1:23 am   
 
That is too cool! Cool I can't wait to play with it!
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Fri Apr 29, 2005 4:57 am   
 
Neat. That'll come in handy later for the IDE.

-Tarn
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Apr 29, 2005 6:32 am   
 
Well yeah, that's one of the main reasons I did it ;)
Reply with quote
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Fri Apr 29, 2005 1:28 pm   
 
[theNerd begins to become unstable due to the overwhelming amount of improvements Zugg has made to zApp]
Zugg,
I want zApp as its own operating system
I want 3D holographic imagery built-in
I want zApp to fit into my pocket but be able to expand to 10 feet wide when I activate it
I want...

[at this point theNerd begins losing his senses almost completely]
I want zApp to prevent tooth decay
I want zApp to act as a satellite
I want...

[at this point senses are completely lost and theNerd begins laughing hysterically]
I want zApp to end world hunger
I want zApp to cure all diseases
I want...

[Zugg, quickly sensing a complete mental melt down by theNerd, rushes over to bring him to his senses.]
"theNerd, I needed the latest addition for syntax highlighting for the IDE. **slap**
[theNerd, stunned by the slap slowly comes to his senses.]
Yes, the IDE. That would be helpful. Syntax highlighting would be good for that. Laughing
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Apr 29, 2005 6:21 pm   
 
(Actually, Zugg is secretly doing all of this to make theNerd have a nervous-breakdown, but don't tell anyone!)
Twisted Evil Razz
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net