Skip to content
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

Check eof in tree #898

Merged
merged 7 commits into from
Jun 11, 2015
Merged

Check eof in tree #898

merged 7 commits into from
Jun 11, 2015

Conversation

parrt
Copy link
Member

@parrt parrt commented Jun 11, 2015

Fixes #896 and Fixes #897.

@parrt parrt added this to the 4.5.1 milestone Jun 11, 2015
@@ -217,6 +220,9 @@ public void reset() {
public Token match(int ttype) throws RecognitionException {
Token t = getCurrentToken();
if ( t.getType()==ttype ) {
if ( t.getType()==Token.EOF ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 t.getType() could be replaced by ttype for efficiency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be using CommonToken, right?

@sharwell
Copy link
Member

❗ In addition to the items in the diff, reset() needs to be updated to set matchedEOF to false.

@parrt
Copy link
Member Author

parrt commented Jun 11, 2015

i could swear i put that in. oh only in my plugin ;)
Ter

On Jun 11, 2015, at 12:53 PM, Sam Harwell notifications@github.com wrote:

In addition to the items in the diff, reset() needs to be updated to set matchedEOF to false.


Reply to this email directly or view it on GitHub #898 (comment).

* token.
* token and has interval i..i for token index i.
*
* <p>An interval of i..j for j &lt; i indicates an empty interval.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 The getSourceInterval() method was updated in 81e2a65 to ensure that an empty interval is always represented as i..i-1. I recommend changing this paragraph to the following:

<p>An interval of i..i-1 indicates an empty interval at position i in the input stream,
where 0 &lt;= i &lt;= the size of the input token stream.</p>

@sharwell
Copy link
Member

Two suggestions from reading the updated docs, but 👍

parrt added a commit that referenced this pull request Jun 11, 2015
@parrt parrt merged commit a3ddd82 into antlr:master Jun 11, 2015
@parrt parrt deleted the check-eof-in-tree branch June 11, 2015 20:13
@sharwell sharwell self-assigned this Jun 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants