Adding patterns at runtime

SyntaxEditor for Windows Forms Forum

Posted 20 years ago by painetraine
Avatar
I have a state called "TodoCommentState" that basically lookes for the following start tag:

-- TODO:

Is there anyway for me to add additional start matches for this state at runtime so that I could add

-- MYTODO:

At runtime and have it act as the start of the TodoCommentState in addition to

-- TODO:

I look at the PatternGroups under the LexicalState. But it looks like there is a start token that maps to --TODO: Can I have multiple start tokens or some other way to implement this - at runtime?

Thanks

Comments (2)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, you should be able to do this at run-time. Remember that you should set the language's IsUpdating flag on before making changes and then off afterwards.

If you want the "-- MYTODO:" text to start the same state as "-- TODO:", simply add a new scope to that state. The original scope would have the "-- TODO:" as your start and a line feed (I assume) as the end. The new scope you add would have "-- MYTODO:" as the start and a line feed as the end.

Hope that helps.


Actipro Software Support

Posted 20 years ago by painetraine
Avatar
That did it.

Forgot about the IsUpdating flag.

Thanks
The latest build of this product (v24.1.1) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.