-
Notifications
You must be signed in to change notification settings - Fork 121
Expose yyatEOF() in generated scanner API
#644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The benefit is quite clear on EofminGoldenTest.java which has states and doesn't have a single token for the EOF status. |
|
@lsf37 Am I missing something? Can a client of the scanner know whether the scanner has reached EOF in a generic way? |
|
@lsf37 I chose name |
|
The I don't fully remember any more wether relying on The whole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[deleted]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, last comment was for the wrong thread. I'm still investigating, but it looks like it's fine so far. Would only change zzAtEof() to yyAtEOF().
|
Ok, after looking through the emitter and skeleton code, |
|
We should probably add it to the manual as well. I can do that if you like (happy for you to merge first). |
Renamed to |
zzAtEof() in generated scanner APIyyatEOF() in generated scanner API
Documentation should be added with code. Done in 4405977. |
lsf37
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. Good to merge!
commit f966df4 Author: Régis Décamps <[email protected]> AuthorDate: Tue Dec 3 14:12:41 2019 +0100 Commit: GitHub <[email protected]> CommitDate: Tue Dec 3 14:12:41 2019 +0100 Expose `yyatEOF()` in generated scanner API (#644) * Add new `zzatEOF()` method to generated scanners. * Demonstrate use in tests * Update vm template in migration tool * Add documentation about yyatEOF() Updated from target/jflex-parent-1.8.0-SNAPSHOT-sources.jar
I don't think there is a convenient way to known whether a scanner has finished reading its input.
But it's sounds to me that looping until EOF is a critical use case, which is even implemented in the standalone
mainmethod as:See Emitter.java:350
This change adds a getter for the
zzAtEOFfield.