summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel-parse')
-rw-r--r--crates/rebel-parse/src/ast.rs8
-rw-r--r--crates/rebel-parse/src/grammar/recipe.rs8
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/rebel-parse/src/ast.rs b/crates/rebel-parse/src/ast.rs
index 88853d7..490c2f1 100644
--- a/crates/rebel-parse/src/ast.rs
+++ b/crates/rebel-parse/src/ast.rs
@@ -250,7 +250,7 @@ pub enum Literal<'a> {
},
Tuple(Vec<Expr<'a>>),
Array(Vec<Expr<'a>>),
- Map(Vec<MapEntry<'a>>),
+ Struct(Vec<StructField<'a>>),
}
impl<'a> Literal<'a> {
@@ -296,9 +296,9 @@ impl<'a> Literal<'a> {
}
Ok(())
}
- Literal::Map(entries) => {
+ Literal::Struct(entries) => {
let mut keys = HashSet::new();
- for MapEntry { key, value } in entries {
+ for StructField { key, value } in entries {
if !keys.insert(key) {
return Err(ValidationError::DuplicateKey);
}
@@ -334,7 +334,7 @@ impl<'a> TryFrom<&token::StrPiece<'a>> for StrPiece<'a> {
}
#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct MapEntry<'a> {
+pub struct StructField<'a> {
pub key: &'a str,
pub value: Expr<'a>,
}
diff --git a/crates/rebel-parse/src/grammar/recipe.rs b/crates/rebel-parse/src/grammar/recipe.rs
index aaa40d2..c23786b 100644
--- a/crates/rebel-parse/src/grammar/recipe.rs
+++ b/crates/rebel-parse/src/grammar/recipe.rs
@@ -118,13 +118,13 @@ peg::parser! {
/ p('[') elements:delimited(<expr()>, <p(',')>) p(']') {
ast::Literal::Array(elements)
}
- / p('{') entries:delimited(<map_entry()>, <p(',')>) p('}') {
- ast::Literal::Map(entries)
+ / p('{') entries:delimited(<struct_field()>, <p(',')>) p('}') {
+ ast::Literal::Struct(entries)
}
- rule map_entry() -> ast::MapEntry<'a>
+ rule struct_field() -> ast::StructField<'a>
= key:field() p('=') value:expr() {
- ast::MapEntry { key: key.name, value }
+ ast::StructField { key: key.name, value }
}
rule path() -> ast::Path<'a>