We wanted to get some extra functionality out of the lexical parsing stage (specifically, supporting JavaScript's unique embedded Regex support), so we replaced our Dynamic implementation of JavaScript to a hand-build one that inherits from MergableSyntaxLanguage.
The good news is that porting the Dynamic language to Mergable was pretty easy, took about two days of work, and we also got the custom state transition logic working in our hand-built lexer.
The only odd thing I noticed was that the HighlightingStyles seemed inconsistent. For example, take the example of the following two states:
DefaultState (DefaultStyle: Black)
MultiLineCommentState (DefaultStyle: Green)
We use a delegate method in our lexer to watch for the /* token like so, and it works well:However, the /* is black, while all the remaining characters of the comment are Green. I can fix the appearance by adding extra logic in the GetHighlightingStyle in our Language, but this doesn't seem right, since really the MultiLineCommentStartToken should be in the MultiLineCommentState, not the DefaultState.
Any ideas on how to handle this scenario?
The good news is that porting the Dynamic language to Mergable was pretty easy, took about two days of work, and we also got the custom state transition logic working in our hand-built lexer.
The only odd thing I noticed was that the HighlightingStyles seemed inconsistent. For example, take the example of the following two states:
DefaultState (DefaultStyle: Black)
MultiLineCommentState (DefaultStyle: Green)
We use a delegate method in our lexer to watch for the /* token like so, and it works well:
public MatchType IsMultiLineCommentStateScopeStart(ITextBufferReader reader, ILexicalScope lexicalScope, ref ITokenLexicalParseData lexicalParseData)
{
if (reader.Peek() == '/' && reader.Peek(2) == '*')
{
reader.Read();
reader.Read();
lexicalParseData = new LexicalScopeAndIDTokenLexicalParseData(lexicalScope, EcmaScript3TokenID.MultiLineCommentStartToken);
return MatchType.ExactMatch;
}
return MatchType.NoMatch;
}
Any ideas on how to handle this scenario?