summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-28 23:58:03 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-28 23:58:03 +0200
commitfac5b015b92ea06eaff4be6c8a2a20d90e770ebb (patch)
treeb771ea962bab41db5d9ab3f1697ea1cab081af8b /crates/rebel-parse
parent54030e686915a07452a3d4bb5a23616eec30f4fa (diff)
downloadrebel-fac5b015b92ea06eaff4be6c8a2a20d90e770ebb.tar
rebel-fac5b015b92ea06eaff4be6c8a2a20d90e770ebb.zip
rebel-parse: rename struct field name from key to name
Diffstat (limited to 'crates/rebel-parse')
-rw-r--r--crates/rebel-parse/src/ast/expr.rs8
-rw-r--r--crates/rebel-parse/src/grammar/recipe.rs4
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/rebel-parse/src/ast/expr.rs b/crates/rebel-parse/src/ast/expr.rs
index 6899903..69c4407 100644
--- a/crates/rebel-parse/src/ast/expr.rs
+++ b/crates/rebel-parse/src/ast/expr.rs
@@ -200,9 +200,9 @@ impl<'a> Literal<'a> {
Ok(())
}
Literal::Struct(entries) => {
- let mut keys = HashSet::new();
- for StructField { key, value } in entries {
- if !keys.insert(key) {
+ let mut fields = HashSet::new();
+ for StructField { name, value } in entries {
+ if !fields.insert(name) {
return Err(ValidationError::DuplicateKey);
}
value.validate()?;
@@ -238,7 +238,7 @@ impl<'a> TryFrom<&token::StrPiece<'a>> for StrPiece<'a> {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StructField<'a> {
- pub key: &'a str,
+ pub name: &'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 64c7acd..c0c0ccf 100644
--- a/crates/rebel-parse/src/grammar/recipe.rs
+++ b/crates/rebel-parse/src/grammar/recipe.rs
@@ -123,8 +123,8 @@ peg::parser! {
}
rule struct_field() -> expr::StructField<'a>
- = key:field() p('=') value:expr() {
- expr::StructField { key: key.name, value }
+ = field:field() p('=') value:expr() {
+ expr::StructField { name: field.name, value }
}
rule path() -> ast::Path<'a>