slackhq / tree-sitter-hack

Hack grammar for tree-sitter
MIT License
33 stars 16 forks source link

[BUG] Underscores as digit separators are not supported in the grammar #72

Open mmanela opened 5 months ago

mmanela commented 5 months ago

Describe the bug

Hack documentation says you can use underscores as digit separators but the grammar errors if you use them.

Requirements

To Reproduce

Use an integer with underscore digit separators

 $a = 123_456;

Which currently parses as the following (notice the ERROR)

(expression_statement
        (binary_expression
          left: (variable)
          (ERROR
            (integer))
          right: (qualified_identifier
            (identifier))))

Expected behavior

I expect usage of the underscore digit separator to parse properly.

Saichandra2520 commented 2 months ago

I'm currently working on this issue and will submit a pull request soon. #72