summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-05-08 20:55:04 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-05-08 20:55:04 +0200
commit5478e3733810bf609a08fb172786f9d8f7c07b4e (patch)
tree21efcdbae15c931be02201c40bf86ad6b5e01928 /crates/rebel-parse/src
parent453ead2a7b52ce6ffb9b90bf03c7d4d1e6f4e7a0 (diff)
downloadrebel-5478e3733810bf609a08fb172786f9d8f7c07b4e.tar
rebel-5478e3733810bf609a08fb172786f9d8f7c07b4e.zip
rebel-parse, rebel-lang: a unit should be an empty tuple
The empty tuple becomes the representation of the unit. An empty struct is still another way to construct a unit, but never stored as a struct.
Diffstat (limited to 'crates/rebel-parse/src')
-rw-r--r--crates/rebel-parse/src/grammar/recipe.rs4
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 9b1b50b..f0605e4 100644
--- a/crates/rebel-parse/src/grammar/recipe.rs
+++ b/crates/rebel-parse/src/grammar/recipe.rs
@@ -81,7 +81,7 @@ peg::parser! {
rule typ_literal() -> typ::Literal<'a>
= p('(') p(')') { typ::Literal::Unit }
- / p('(') elements:(typ() ** p(',')) p(',')? p(')') {
+ / p('(') elements:(typ() ++ p(',')) p(',')? p(')') {
typ::Literal::Tuple(elements)
}
/ p('[') typ:typ() p(']') {
@@ -187,7 +187,7 @@ peg::parser! {
Ok(expr::Literal::Str{ pieces, kind: *kind })
}
/ p('(') p(')') { expr::Literal::Unit }
- / p('(') elements:(expr() ** p(',')) p(',')? p(')') {
+ / p('(') elements:(expr() ++ p(',')) p(',')? p(')') {
expr::Literal::Tuple(elements)
}
/ p('[') elements:delimited(<expr()>, <p(',')>) p(']') {