diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2024-05-05 15:04:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2024-05-05 15:04:07 +0200 |
commit | c9d7b4f9bb31a34539ec5d425fc66156ccc90194 (patch) | |
tree | 58fc1a72c845573992aca3b133ee15dcd4225378 /crates/rebel-parse | |
parent | 13882a131da28957fc79b75c21d13b88c257cc93 (diff) | |
download | rebel-c9d7b4f9bb31a34539ec5d425fc66156ccc90194.tar rebel-c9d7b4f9bb31a34539ec5d425fc66156ccc90194.zip |
rebel-parse: grammar: check rules in the same order for types and expressions
Diffstat (limited to 'crates/rebel-parse')
-rw-r--r-- | crates/rebel-parse/src/grammar/recipe.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/rebel-parse/src/grammar/recipe.rs b/crates/rebel-parse/src/grammar/recipe.rs index 8181ee2..ac3f90b 100644 --- a/crates/rebel-parse/src/grammar/recipe.rs +++ b/crates/rebel-parse/src/grammar/recipe.rs @@ -63,9 +63,9 @@ peg::parser! { = pat:pat() typ:tagged(<p(':')>, <typ()>)? { ast::TypedPat { pat, typ } } pub rule typ() -> Type<'a> - = lit:typ_literal() { Type::Literal(lit) } + = p('(') t:typ() p(')') { Type::Paren(Box::new(t)) } + / lit:typ_literal() { Type::Literal(lit) } / path:path() { Type::Path(path) } - / p('(') t:typ() p(')') { Type::Paren(Box::new(t)) } rule typ_literal() -> typ::Literal<'a> = p('(') p(')') { typ::Literal::Unit } |