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 unsigned long parsing #116

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Fix unsigned long parsing #116

merged 2 commits into from
Jul 29, 2024

Conversation

marschattha
Copy link
Contributor

@marschattha marschattha commented Mar 15, 2024

Currently if you try to parse a hexadecimal unsigned long it gives an error and returns the wrong tree.

For example parsing 0xfff0000000000000UL returns

(source_file
  (ERROR
    (hex_literal)
    (simple_identifier)))

And it completely goes bonkers if there is a list of hexadecimal unsigned longs, [0xfff0000000000000UL, 0xfff0000000000000UL] returns something like:

(source_file
  (collection_literal
    (infix_expression
      (infix_expression 
        (hex_literal)
        (simple_identifier)
        (ERROR)
        (hex_literal))
      (simple_identifier))
      (simple_identifier))))

And gets worse with the length of the array.

For some reason

optional("L")

is not working correctly.

This PR moves the check for L into regex in above line to work around the issue.

@github-actions github-actions bot added the grammar Related to the grammar label Mar 15, 2024
grammar.js Outdated Show resolved Hide resolved
@marschattha marschattha requested a review from fwcd May 19, 2024 00:32
@fwcd fwcd merged commit fce89e0 into fwcd:main Jul 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grammar Related to the grammar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants