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

Lines beginning with //! result in an error #838

Closed
Yarn opened this issue Apr 17, 2023 · 4 comments
Closed

Lines beginning with //! result in an error #838

Yarn opened this issue Apr 17, 2023 · 4 comments
Labels

Comments

@Yarn
Copy link

Yarn commented Apr 17, 2023

Describe the bug
lines beginning with //! result in

  |
6 | #[derive(pest_derive::Parser)]
  |          ^^^^^^^^^^^^^^^^^^^
  |
  = help: message: error parsing
            --> 16:1
             |
          16 | //!
             | ^---
             |
             = expected EOI or rule

To Reproduce
load a .pest file with a line starting with //!

Expected behavior
The line is ignored

Additional context
I'm using pest 2.5.7
The issue was not present in pest 2.1.3

this looks potentially similar to #818.

@Yarn Yarn added the bug label Apr 17, 2023
@tomtau
Copy link
Contributor

tomtau commented Apr 17, 2023

CC @huacnlee

@huacnlee
Copy link
Member

@tomtau Get it.

@huacnlee
Copy link
Member

That now is a grammar_doc issue, it by design.

Because Pest required at latest have one grammar_rule:

grammar_rules = _{ SOI ~ grammar_doc* ~ (grammar_rule)+ ~ EOI }

image

@tomtau Should I change grammar_rule+ into grammar_rule*, to let allow zero rules in a pest file.

huacnlee added a commit to huacnlee/pest that referenced this issue Apr 17, 2023
@tomtau tomtau closed this as completed in 5a05e69 Apr 17, 2023
@Yarn
Copy link
Author

Yarn commented Apr 18, 2023

I did have grammar rules, they were all before the comment in case that matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants