This project has moved and is read-only. For the latest updates, please go here.

Using predefined tokens internally

Mar 20, 2014 at 4:19 PM
I'm trying to parse a block of code that can contain among other things C# string literals. Therefore I have made a custom terminal, which has a StringLiteral instance inside. I call StringLiteral.Init in my custom init method, however when trying to call StringLiteral.TryMatch inside my custom TryMatch method I'm always getting null, even though PreviewPosition is located right before the " character.

Any ideas on how I can nest a terminal in this way so as to use it as a combination with my custom terminal, or why I'm getting nothing from the StringLiteral instance?

Mar 21, 2014 at 1:17 AM
Figured it out. Main thing was just to set ISourceStream.Position equal to PreviewPosition before calling StringLiteral.TryMatch, as uses Position to revert the PreviewPosition, should it not match.