Hi,
I''m searching for a way to applay syntax highlighting for a special plc programming language.
Therefor I have to apply nested comments like the following:
..
code
..
(* comment level1
(* comment level2 *)
stil level1 *)
here back in code
Until now I found only samples where the comment ends at the first comment-end-token ''*)''.
I need a solution where the comment-open-tonkens are counted, and only after an equal number of comment-end-tokens the comment is finished.
There are a lot of samples where the first comment-end-token closes the comment. (e.g. C#) But that is NOT what I''m looking for.
Is there a possibility to realize that? And could anyone provide me with a demo config file?
Greetings, Klaus
AD
Administrator
Syncfusion Team
March 8, 2006 06:16 AM UTC
Hi Klaus,
I have attached a sample that illustrates how to apply syntax highlighting for nested comments.Let me know if this meets you requirements.
Regards,
Ebenezer.P
Sample17.zip
AD
Administrator
Syncfusion Team
March 8, 2006 08:06 AM UTC
Hi Ebenezer.P,
thank you for your fast answer!
Unfortunately the sample does not meet my requirements total.
The sample works well for nested comments with two open-comment-tokens and two closing-comment-tokens. But it does not work with higher complexity.
code (* comment (* comment (* comment *) *) still comment *) code
or
code (* comment (* comment (* comment (* comment (* comment *) *) *) *) still comment *) code
My requirements are for an unlimited number of nested comments AND naturally there must not be any other formating like keyword-hightlighting within the comments.
I know that this could be a little bit tricky because we have to count open- and closing tokens. And this is not that easy with regular expressions (at least, I do not know a solution).
Maybe you could improve your sample a little.
That would be very helpful for me, because at the moment such nested comments are the K.O.-criteria for using the edit control for my application.
Thanks, Klaus
AD
Administrator
Syncfusion Team
March 8, 2006 09:32 AM UTC
Hi Ebenezer.P,
in the meantime I played around with your sample and changed the config file to provide nested comments until 6 levels.
OK - 6 levels are not unlimited - but I think it is very unlikely that in the real world someone creates comments with more than 3 or 4 nested comments.
So, I think this solution is OK for me ;-)
But, if you have a simple solution for unlimited count of nested comments I would highly appreciate to see it ;-)
Thanks a lot, Klaus
PS: I think you guys are really spcialists for regular expressions. I''m still searching for a long time for an expression that can match such comments with an equal but unlimited number of open and closing tokens. Maybe you can give me a hint ;-) ?
AD
Administrator
Syncfusion Team
March 9, 2006 11:49 AM UTC
Hi Klaus,
We are currently working on a sample and will send it over shortly.
Thanks for your patience.
Regards,
Ebenezer.P
AD
Administrator
Syncfusion Team
March 10, 2006 02:43 PM UTC
Hi Klaus,
I have attached a sample that illustrates how to apply syntax highlighting for unlimited number of nested comments.Let me know if this meets your requirements.
Regards,
Ebenezer.P
Sample20.zip
AD
Administrator
Syncfusion Team
March 13, 2006 07:31 AM UTC
Hi Ebenezer P.,
thank you for your sample.
As I already thought - it seems to be impossible to provide the unlimited nested comments only with the config file.
Greetings, Klaus
AD
Administrator
Syncfusion Team
March 14, 2006 11:26 AM UTC
Hi Klaus,
I have attached a sample that illustrates how to apply syntax highlighting for unlimited number of nested comments using the configuration file.Please note that in the inner comments processing OnlyLocalSubLexems is not turned on,this allows to process all nested comments with the same lexem config.
Let me know if this meets your requirements.
Regards,
Ebenezer.P
Sample21.zip
AD
Administrator
Syncfusion Team
March 15, 2006 02:11 PM UTC
Works perfect - thx, Klaus
AD
Administrator
Syncfusion Team
March 16, 2006 04:10 AM UTC
Hi Klaus,
Thanks for the update. Please let us know if you need any other information.
We appreciate your continued interest in Essential Edit.
Regards,
Ebenezer.P