(The following question applies to SyntaxEditor WinForms, but I would assume it applies to the WPF edition as well)
I need to provide editing support with syntax highlighting and intelliprompt for a small domain specific language. I started to implement classes based on MergableSyntaxLanguage, IMergableLexicalParser and RecursiveDescentSemanticParser - somewhat following the Simple language example.
This all works fine, except for one language "feature". Unfortunately, the language seems to require a context-dependent lexical parser, since a particular syntax can either be one feature or the other. Basically, the language is a little like Pascal/Delphi and supports the [...]-subscript for list/array access as in
something[idx1,idx2] := value
Here, the tokens should be ident, square bracket, ident, ident, assignment, ident.
However, the square brackets can also be used to represent a certain type of value as in
something := [special-value]
Here, the tokens should be ident, assignment, special.
The actual parser executing the language has no issue in performing the lexical and semantic parsing. There is no actual ambiguity for any expression. However, the semantic and lexical parser collaborate in anaylzing the language, since the semantic parser provides a "hint" to the parser whether the next token would be a terminal/literal. If so, a square bracket would be used as the special-value, if not, a square bracket would be a simple token of its own.
How can this be achieved with the SyntaxEditor infrastructure?
Any help would be appreciated.