Sorry - I should have given my message a little more context.
I'm trying to implement ITokenReader for my implementation of LLParseBase. I have a non-mergable lexer, and I am not able to create a new instance of it from my parser for reasons I can explain, but I don't think are pertinent to this discussion. Because I'm not able to create a new instance of my lexer, I'm having a hard time implementing the GetNextToken method of ITokenReader.
To solve this problem, I overrode Parse in my implementation of LLParseBase. This allowed my access to the snapshot that is being parsed. From the snapshot, I was able to obtain a ITextSnapshotReader, which I passed to my constructor that is implementing TokenReaderBase. The ITextSnapshotReader's underlying ITextBufferReader was passed to my base (TokenReaderBase) constructor. I then used the ISnapshotReader to implement GetNextToken, by calling ISnapshotReader.ReadToken().
As can be seen, ITextBufferReader is not much help to me if I don't want to re-implement my lexer - or at least the lexical state management portion of it. Because ITextSnapshotReader cannot access the header and footer text, it's not a great solution either.
Fortunately, the thing I'm working on now is only a small example and not required as part of our larger project. However, if it were required, I would be unsure how to best proceed at this point.
- Nick