Posted 17 years ago
by Paul Fuller
Hi,
I have an 'advanced' SyntaxLanguage based mainly on the NonMergable CSharpSyntaxLanguage example that you provided some time back.
It implements PerformLexicalParse along the same lines as your example code.
I have added PerformSemanticParse myself. It produces a CompilationUnit that is used for outlining etc.
So far everything is great. However both the lexical and semantic processing occurs in the UI thread. Performance is generally very good but it can start to drag in large source files.
Now I would like to move the processing into a separate thread. Presumably using the SemanticParserService.
In various examples I have seen this being done for the semantic parsing so:Then the SyntaxLanguage needs to implement ISemanticParserServiceProcessor which is basically a Process method:
The Process request parameter does not give me a document or TokenStream to work with. Instead it has a TextBufferReader. Is it supposed to perform lexical parsing on that stream ? Is this in addition to or in place of the existing PerformLexicalParse ?
The ideal would be to have both the lexical and semantic parsing out of the main UI thread if possible.
Do you have an 'advanced' language example that uses the SemanticParserService ?
Thanks,
Paul
I have an 'advanced' SyntaxLanguage based mainly on the NonMergable CSharpSyntaxLanguage example that you provided some time back.
It implements PerformLexicalParse along the same lines as your example code.
I have added PerformSemanticParse myself. It produces a CompilationUnit that is used for outlining etc.
So far everything is great. However both the lexical and semantic processing occurs in the UI thread. Performance is generally very good but it can start to drag in large source files.
Now I would like to move the processing into a separate thread. Presumably using the SemanticParserService.
In various examples I have seen this being done for the semantic parsing so:
public override void PerformSemanticParse(Document document, TextRange parseTextRange, SemanticParseFlags flags)
{
SemanticParserService.Parse(new SemanticParserServiceRequest(
SemanticParserServiceRequest.MediumPriority
, document
, parseTextRange
, SemanticParseFlags.None
, this
, document));
}
void ISemanticParserServiceProcessor.Process(SemanticParserServiceRequest request)
{
...
}
The ideal would be to have both the lexical and semantic parsing out of the main UI thread if possible.
Do you have an 'advanced' language example that uses the SemanticParserService ?
Thanks,
Paul