What is the recommended way to do post processing on the AST?

SyntaxEditor for WPF Forum

Posted 2 years ago by Josh
Version: 18.1.2
Avatar

Hello,

We are currently overriding the Parse(IParseRequest request) method in the LLParserBase to do additional compilation type of work on the AST.  However, this seems to be done on the main thread and will slow down the typing of logic in the UI.

Is there a better place to be doing this work?  Ideally, we could do this work on the same thread as the original parse.

Any suggestions?

Thanks!

Comments (6)

Posted 2 years ago by Josh
Avatar

Think I have found the answer to my question here:

https://www.actiprosoftware.com/docs/controls/wpf/syntaxeditor/text-parsing/parsing/parse-requests-and-dispatchers

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Josh,

Yes indeed.  Please make sure you configure an ambient parse request dispatcher in your app startup as described in this documentation topic.  If you do that, then all IParser.Parse methods should be called from a worker thread, and never on the main thread.


Actipro Software Support

Posted 2 years ago by Josh
Avatar

Is there a way to initiate a synchronous manual parse on the current background parse?

Also, if I try to create a parser and call the Parse method and passing in a ParseRequest, it seems like it might be working, but I have code that relies on the Snapshot property of the IParseRequest.  How can I get that to be filled in?

Thanks!

[Modified 2 years ago]

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Josh,

Can you clarify what you are trying to do with some more detail?  You mentioned calling a synchronous parse from the current background parse operation. 

Do you mean from within IParser.Parse method itself, in which case it would be synchronous, already on the same worker thread?

Or do you mean that you want to run the parser synchronously from other external code outside of the Parse method?  For that kind of thing, you could use the extension method described in the last section of this documentation topic.


Actipro Software Support

Posted 2 years ago by Josh
Avatar

Hello!

I'm looking to initiate another IParser.Parse on a different set of logic WITHIN the existing background thread synchronously.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

This seems to be the same question as over in this thread, so we can keep the related discussion in that thread.


Actipro Software Support

The latest build of this product (v24.1.1) 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.