-
Notifications
You must be signed in to change notification settings - Fork 131
Description
As discussed in #397 by @martingd, scanners use their atEnd predicate instead of reporting EofCh or the built-in Tokens.EOF:
Note about EofCh
First of all, it seems
scala.util.parsing.combinator.lexical.Scanners.Scannerwill never read past the end of the itsin: Reader[Char]because it stops atin.atEndso thetokenandwhitespaceparsers inscala.util.parsing.combinator.lexical.StdLexicalwill never encounter theEofChcharacter. However, we have left the mentions ofEofChin thetokenandwhitespaceparsers to avoid breaking something we might not fully understand.
The fixes implemented for strings and such work for those cases, but it seems like it's impossible for a combinator defined in a TokenParsers.Parser object to determine if its scanner has reached the end-of-file without having access to the Scanner instance; in particular, any combinator that asserts the presence of EOF will fail because the token can never emit.
It is, of course, possible that I'm using the library in a way different from how it was intended to be used. If it would be helpful, I can modify and publish my code (I'm working on a reference solution, which I don't want to post so my students can't plagiarize it). On that note, would you mind if I worked on some examples that could help with documentation? How stable is the API (#236, for example, suggested that there might be another way to represent data types)?