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 grammar //// parsing error. #818

Merged
merged 1 commit into from Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions grammars/src/grammars/json.pest
Expand Up @@ -19,6 +19,10 @@ pair = { string ~ ":" ~ value }

array = { "[" ~ value ~ ("," ~ value)* ~ "]" | "[" ~ "]" }


//////////////////////
/// Matches value, e.g.: `"foo"`, `42`, `true`, `null`, `[]`, `{}`.
//////////////////////
value = { string | number | object | array | bool | null }

string = @{ "\"" ~ inner ~ "\"" }
Expand Down
2 changes: 1 addition & 1 deletion meta/src/grammar.pest
Expand Up @@ -171,6 +171,6 @@ space = _{ " " | "\t" }
/// A top-level comment.
grammar_doc = ${ "//!" ~ space? ~ inner_doc }
/// A rule comment.
line_doc = ${ "///" ~ space? ~ !"/" ~ inner_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.

Before this rule was following the Rust line_doc rule, wants to be let the //// as a normal comment.

But I think, maybe we don't need to do that, just let it as a line_doc is also ok. So it will not come to a complex rule.

line_doc = ${ "///" ~ space? ~ inner_doc }
/// A comment content.
inner_doc = @{ (!newline ~ ANY)* }