diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-01 13:15:10 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-01 13:15:10 +0200 |
| commit | aafd3c95cacd829b647cfab1533de5d4833b9a04 (patch) | |
| tree | 3a16ea942eb71dcda46dd9a3112fa83db0729a7b /src/parse/mod.rs | |
| parent | 885bfec5d7524845b41e180fadc9cf5626157eec (diff) | |
Rename table to dict ✏
Diffstat (limited to 'src/parse/mod.rs')
| -rw-r--r-- | src/parse/mod.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs index b62bd5d3..75ca7eb4 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -14,7 +14,7 @@ use std::str::FromStr; use super::*; use crate::color::RgbaColor; -use crate::compute::table::SpannedEntry; +use crate::compute::dict::SpannedEntry; use crate::syntax::*; use crate::{Feedback, Pass}; @@ -199,13 +199,13 @@ impl Parser<'_> { self.skip_ws(); let mut args = match self.eatv() { - Some(Token::Colon) => self.parse_table_contents().0, + Some(Token::Colon) => self.parse_dict_contents().0, Some(_) => { self.expected_at("colon", name.span.end); while self.eat().is_some() {} - TableExpr::new() + DictExpr::new() } - None => TableExpr::new(), + None => DictExpr::new(), }; self.end_group(); @@ -243,17 +243,17 @@ impl Parser<'_> { fn parse_paren_call(&mut self, name: Spanned<Ident>) -> Spanned<CallExpr> { self.start_group(Group::Paren); - let args = self.parse_table_contents().0; + let args = self.parse_dict_contents().0; let args_span = self.end_group(); let span = Span::merge(name.span, args_span); CallExpr { name, args }.span_with(span) } } -// Tables. +// Dicts. impl Parser<'_> { - fn parse_table_contents(&mut self) -> (TableExpr, bool) { - let mut table = TableExpr::new(); + fn parse_dict_contents(&mut self) -> (DictExpr, bool) { + let mut dict = DictExpr::new(); let mut comma_and_keyless = true; while { @@ -292,12 +292,12 @@ impl Parser<'_> { let behind = val.span.end; if let Some(key) = key { comma_and_keyless = false; - table.insert(key.v.0, SpannedEntry::new(key.span, val)); + dict.insert(key.v.0, SpannedEntry::new(key.span, val)); self.feedback .decorations - .push(Decoration::TableKey.span_with(key.span)); + .push(Decoration::DictKey.span_with(key.span)); } else { - table.push(SpannedEntry::val(val)); + dict.push(SpannedEntry::val(val)); } if { @@ -311,8 +311,8 @@ impl Parser<'_> { comma_and_keyless = false; } - let coercable = comma_and_keyless && !table.is_empty(); - (table, coercable) + let coercable = comma_and_keyless && !dict.is_empty(); + (dict, coercable) } } @@ -421,18 +421,18 @@ impl Parser<'_> { } } - // This could be a table or a parenthesized expression. We parse as - // a table in any case and coerce the table into a value if it is - // coercable (length 1 and no trailing comma). + // This could be a dictionary or a parenthesized expression. We + // parse as a dictionary in any case and coerce into a value if + // that's coercable (length 1 and no trailing comma). Token::LeftParen => { self.start_group(Group::Paren); - let (table, coercable) = self.parse_table_contents(); + let (dict, coercable) = self.parse_dict_contents(); let span = self.end_group(); let expr = if coercable { - table.into_values().next().expect("table is coercable").val.v + dict.into_values().next().expect("dict is coercable").val.v } else { - Expr::Table(table) + Expr::Dict(dict) }; expr.span_with(span) |
