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

reordered EXIT rule before the NAME rule so that it matches correctly #4329

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

YutingShang
Copy link
Contributor

When compiling this program section, the exit command in fortran did not produce the correct token

    do
        print *, "Add:"
        read *, a
        if (a == 0) then
            exit
        else
            sum = sum + a
        end if
    end do

[@63,392:395='exit',<NAME>,16:12] was produced from the -tokens output
[@63,392:395='exit',<EXIT>,16:12] is the expected token

This was because the NAME lexer rule came before the EXIT rule, taking precedence. I reordered them in the lexer, which fixed the issue.

@teverett
Copy link
Member

@YutingShang thanks!

@teverett teverett merged commit 35a6f12 into antlr:master Nov 17, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants