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

Whitespace in groups #154

Closed
carl-wallace opened this issue Oct 24, 2022 · 0 comments · Fixed by #155
Closed

Whitespace in groups #154

carl-wallace opened this issue Oct 24, 2022 · 0 comments · Fixed by #155
Assignees
Labels
bug Something isn't working parser
Milestone

Comments

@carl-wallace
Copy link
Contributor

I was failing to validate a large CDDL file that looked like it ought work and distilled the issue down to this pattern:

$$A //= (b =>
   [+int])

The resulting error for the above was this:

error: parser errors
  ┌─ input:2:4
  │
2 │    [+int])
  │    ^ invalid group entry syntax

However, removing the new line clears the error.

$$A //= (b => [+int])

So does using a ":" instead of "=>". Additionally, when a colon is used, a newline does not cause an error.

$$A //= (b : [+int])

Or:

$$A //= (b : 
   [+int])

It looks to me that the issue is in whitespace handling where => is used. Adding the following at line 2606 in parser.rs fixes the issue for me. This is similar to whitespace handling for the colon case a few lines below 2606. I have not tested without the ast-comments feature enabled.

      #[cfg(feature = "ast-comments")]
          let _ = self.collect_comments()?;
      #[cfg(not(feature = "ast-comments"))]
      self.advance_newline()?;
@anweiss anweiss self-assigned this Oct 25, 2022
@anweiss anweiss added bug Something isn't working parser labels Oct 25, 2022
@anweiss anweiss added this to the v1.0.0 milestone Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants