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 #838 grammar error when only have //!, /// or //, allow writing empty pest grammar. #839

Merged
merged 1 commit into from Apr 17, 2023

Conversation

huacnlee
Copy link
Member

No description provided.

@huacnlee huacnlee requested a review from a team as a code owner April 17, 2023 02:55
@huacnlee huacnlee requested review from tomtau and removed request for a team April 17, 2023 02:55
@@ -16,102 +16,126 @@
//! future (e.g. by increasing MSRV and non_exhaustive annotations).

/// The top-level rule of a grammar.
grammar_rules = _{ SOI ~ grammar_doc* ~ (grammar_rule)+ ~ EOI }
grammar_rules = _{ SOI ~ grammar_doc* ~ grammar_rule* ~ EOI }
Copy link
Member Author

@huacnlee huacnlee Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This first just changed this line from (grammar_rule)+ to grammar_rule*.

The other changes were made by pest-fmt format.

@@ -1171,7 +1171,7 @@ mod tests {
parser: PestParser,
input: "0",
rule: Rule::grammar_rules,
positives: vec![Rule::grammar_rule, Rule::grammar_doc],
positives: vec![Rule::EOI, Rule::grammar_rule, Rule::grammar_doc],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the grammar_rules now is not requirement at least one grammar rule, so this test need to change.

@huacnlee huacnlee changed the title Fix #838 grammar error when only have //!, /// or //. Fix #838 grammar error when only have //!, /// or //, allow writing empty pest grammar. Apr 17, 2023
meta/src/grammar.pest Show resolved Hide resolved
@tomtau tomtau merged commit 5a05e69 into pest-parser:master Apr 17, 2023
9 checks passed
@huacnlee huacnlee deleted the fix-838 branch April 17, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants