Hi all, we have a syntax-highlighting code editor control called SyntaxEditor for WPF. We wrote a
free MGrammar add-on a while back that allows an MGrammar parser to drive the syntax highlighting for the control. We've recently added features to our editor that allow a syntax/semantic parser to be automatically called when document text changes occur (like from user typing, etc.). The designated parser is called in a worker thread so that it doesn't block the UI thread.
We're about to begin work on some enhancements to our MGrammaradd-on so that the DynamicParser can harness these new features andbe called to return the parse graph asynchronously to the document being edited after text changes occur. This is going to be a great feature since it will allow devs to automatically get a parse graph they can use to show document outlines, etc. in UI, all from the text in the editor.
My question is whether it is safe to use the same DynamicParser for this parsing call? Consider that if we do it this way, the main UI thread may be using the same DynamicParser to do some quick parsing for syntax highlighting at the same time. So I'm not sure if it is "safe" to have the same DynamicParser being used from two threads at the same time or not.
If not, we can always create a second instance of the DynamicParser that should explciitly be used for the new parsing part. However it would be preferable (for memory and simplicity) to use the same instance.
Thanks for your help!
actiprosoftware.com - WPF ribbon, docking/mdi, propertygrid, navbar, explorerbar, breadcrumb, gauge, bar code, wizard controls & much more