Posted 19 years ago
by tobias weltner
I am experimenting with dynamically changing the language definition at run-time.
When I remove a pattern from a pattern group, I occasionally get a null object exception, probably because the parser was using the removed pattern at that time.
Is there a way to temporarily stop parsing or to lock a pattern group? How do I work with SyncRoot in vb.net?
The underlying problem is:
I use regex patterns to identify specific tokens such as function names.
I want those function names to be colorized in the rest of the code as well.
So I thought I should enumerate the document token collection, find the regex tokens and add their token text as new patterns to the language definition.
Not only is this quite expensive. It also requires my app to do constant changes to the pattern group and remove items.
Is there maybe a better way to approach this problem?
When I remove a pattern from a pattern group, I occasionally get a null object exception, probably because the parser was using the removed pattern at that time.
Is there a way to temporarily stop parsing or to lock a pattern group? How do I work with SyncRoot in vb.net?
The underlying problem is:
I use regex patterns to identify specific tokens such as function names.
I want those function names to be colorized in the rest of the code as well.
So I thought I should enumerate the document token collection, find the regex tokens and add their token text as new patterns to the language definition.
Not only is this quite expensive. It also requires my app to do constant changes to the pattern group and remove items.
Is there maybe a better way to approach this problem?