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

Cope with extra tokens after proc statements #2116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ike709
Copy link
Collaborator

@ike709 ike709 commented Nov 30, 2024

Trailing . and : tokens after if() and for() statements is valid in BYOND:
image

We already handled if(): so I just expanded our copium and fixed & extended a broken unit test in the process. Added the ExtraToken stylistic pragma for when this happens. No hits on TG/goon/para.

@boring-cyborg boring-cyborg bot added the Compiler Involves the OpenDream compiler label Nov 30, 2024
Comment on lines -1128 to +1130
Whitespace();
Check(TokenType.DM_Colon);
if (Check(TokenType.DM_Colon) || Check(TokenType.DM_Period)) {
Emit(WarningCode.ExtraToken, loc, "Extra token at end of proc statement");
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Checking for whitespace first would cause if(foo) . += "bar" to be caught, which is paraphrased from actual SS13 code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compiler Involves the OpenDream compiler size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant