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

Fix parser error with named argument end in macro body #11463

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

straight-shoota
Copy link
Member

next_macro_token incorrectly recognizes a named argument called end as a macro end delimiter:

def bar(end a)
  a
end

macro foo
  bar(end: 1) # Error: unexpected token: :
end

foo

This patch fixes that. It won't recognize a macro end token if end is immediately followed by :.

This isn't an issue for non-macro tokens because the parser is aware of the context when parsing named arguments.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser labels Nov 17, 2021
@straight-shoota straight-shoota added this to the 1.3.0 milestone Nov 18, 2021
@straight-shoota straight-shoota merged commit 55ff9ae into crystal-lang:master Nov 19, 2021
@straight-shoota straight-shoota deleted the fix/macro-end branch November 19, 2021 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants