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 parsing while and until #1773

Closed
wants to merge 1 commit into from
Closed

Conversation

haldun
Copy link
Collaborator

@haldun haldun commented Nov 6, 2023

Closes #1771

@@ -14636,7 +14636,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power) {
parser_lex(parser);
pm_token_t keyword = parser->previous;

pm_node_t *predicate = parse_expression(parser, PM_BINDING_POWER_COMPOSITION, PM_ERR_CONDITIONAL_UNTIL_PREDICATE);
pm_node_t *predicate = parse_expression(parser, PM_BINDING_POWER_MODIFIER, PM_ERR_CONDITIONAL_UNTIL_PREDICATE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this won't be quite right because it's going to allow:

while foo if bar; end

This is a bigger problem in that we don't have a delineation between statements and expressions (it's a different issue).

I think maybe we could solve this just for now by splitting up the precedence between in and the other modifiers to make in a higher precedence.

makenowjust added a commit to makenowjust/prism-1 that referenced this pull request Nov 11, 2023
makenowjust added a commit to makenowjust/prism-1 that referenced this pull request Nov 11, 2023
makenowjust added a commit to makenowjust/prism-1 that referenced this pull request Nov 11, 2023
@haldun haldun closed this Nov 11, 2023
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.

Fails to parse while a in b; end
2 participants