We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

nested comments with equal number of open and closing tokens

Thread ID:

Created:

Updated:

Platform:

Replies:

41618 Mar 7,2006 02:29 PM UTC Mar 16,2006 04:10 AM UTC WinForms 9
loading
Tags: EditControl
Administrator [Syncfusion]
Asked On March 7, 2006 02:29 PM UTC

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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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 ;-) ?

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On March 15, 2006 02:11 PM UTC

Works perfect - thx, Klaus

Administrator [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;