I tried solving this, in your sample code, by adding these two statements
parentLexer.LexicalStates[2].ChildLexicalStates.Insert(0, lexicalState);
parentLexer.LexicalStates[3].ChildLexicalStates.Insert(0, lexicalState);
directly after
// Insert the transition lexical state at the beginning of the parent language's
// default state's child states list so that it has top matching priority
parentLexer.DefaultLexicalState.ChildLexicalStates.Insert(0, lexicalState);
This approach works for examples like:
<element bob="<% %>">
<element bob="<% %>randomTextAfter">
However, it doesn't work when there's text in the attribute value to the left of the delimiter. For instance:
<element bob="textBeforeDelimiter<% %>">
In this case, the lexical transition is still treated as part of the attribute value. Is there something I can do so the lexical transition will be recognized in this scnario as well? Is this a bug?
Thanks again,
-Craig