Sitelet https://github.com/gpuweb/gpuweb/issues/2772
Skip to content

Potential parsing conflict with const literals and postfix expressions. #2772

Description

@dj2

Currently the grammar contains const_literal as part of the primary_expression rule. This is called by singular_expression. This means it's valid in the grammar to parse 1.foo as the const_literal (1) from the primary expression and the .foo from the postfix_expression.

This doesn't happen in tree-sitter because the float regex is greedy and will consume the 1..

This, I believe, can be fixed by moving const_literal into singular_expression as an entry by itself. I don't see any case where a number can be followed by a postfix_expression and singular_expression is the only caller of primary_expression.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    copyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions