
I'm having an issue trying to get the End Pattern Group of a child state to match in my language's Dynamic Lexer. The start pattern group is defined as explicit with a pattern value of 'TYPEOF' and case sensitivity of AutoCorrect. The end pattern group is defined as Explicit with a pattern value of 'END' and a case sensitivity of AutoCorrect. Given the following snippet:
... typeof field when value then value end ...
I have no trouble matching the start pattern and the state transitions from the default state to the child state, but when it hits the value 'end' in the text it doesn't match and therefor doesn't transition back to the parent (default) state. The only requirement for matching is that it is preceeded by at least one space or a line terminator
If I change the end scope to use a Regex, I can get the match if the pattern is '\s*end', but I loose the ability to AutoCorrect, and the end token cannot be at the beginning of the line. I've also tried using every combination of LookBehind and LookAhead patterns with the Patterns collection set to just 'end', but that hasn't worked.
Can you advise on why the Explicit pattern doesn't match? Also what is the proper usage fo the LookAhead and LookBehind patterns in an End Scope?