Posted 19 years ago by tobias weltner
Avatar
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?

Comments (6)

Posted 19 years ago by tobias weltner
Avatar
I tried SyncLock with SyncRoot, but isSynchronized always returns false.
Any help?
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Are you doing this in a separate thread? If you're single-threaded you should be ok.


Actipro Software Support

Posted 19 years ago by tobias weltner
Avatar
Actually, I am not even caring about the threads, but it seems there are different threads. I am using VB.NET.
My procedure starts once someone hits ENTER and is launched by KeyTyped.
It seems to conflict with the automatic parsing that seems to take place once code is edited.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you are in the same thread then there shouldn't be a problem. If you are in a single-thread mode and you find an issue, please duplicate it in our sample application and send us the code to dupe it. Thanks!


Actipro Software Support

Posted 19 years ago by tobias weltner
Avatar
I sent you a code example by email.
It demonstrates the exception error.
Posted 19 years ago by tobias weltner
Avatar
just for the records: isUpdating needs to be set to true.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.