Skip to content

Avoid usage of org.antlr.runtime.Token.EOF_TOKEN - #3730

Open
HannesWell wants to merge 1 commit into
eclipse-xtext:mainfrom
HannesWell:avoid-EOF-token
Open

Avoid usage of org.antlr.runtime.Token.EOF_TOKEN#3730
HannesWell wants to merge 1 commit into
eclipse-xtext:mainfrom
HannesWell:avoid-EOF-token

Conversation

@HannesWell

Copy link
Copy Markdown
Contributor

instead check if a Token has the type EOF.

This simplifies a potential future migration to the latest ANTLR 3 release since the EOF_Token was removed.
Furthermore I avoids the assumption that the EOF token is always the same instance.
@szarnekow, you mentioned that the latter assumption lead to problems in the past.
Would it be possible to simplify some code with this change being applied.

This is extracted from

instead check if a Token has the type EOF.
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Test Results

  8 064 files  ±0    8 064 suites  ±0   3h 53m 27s ⏱️ + 5m 20s
 43 169 tests ±0   42 584 ✅  - 1    584 💤 ±0  1 ❌ +1 
212 388 runs  ±0  209 466 ✅  - 1  2 921 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 9056ea3. ± Comparison against base commit 7c0ac01.

@cdietrich
cdietrich requested a review from szarnekow June 11, 2026 05:45
@cdietrich cdietrich added this to the Release_2.44 milestone Jun 11, 2026
state.text = null;
if ( input.LA(1)==CharStream.EOF ) {
return Token.EOF_TOKEN;
return new CommonToken(Token.EOF);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to create a CommonToken with correct offset information?

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.

3 participants