diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-12-27 20:45:20 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-12-27 20:45:20 +0100 |
| commit | ba3d43f7b2a18984be27f3d472884a19f3adce4c (patch) | |
| tree | 1c6ffa31145fb69c19319440969d2037b27b584f /src/eval | |
| parent | 750d220bb080be077cd7ede6d18d485b1c3fb0c9 (diff) | |
Refresh function call and dictionary syntax
- No colon between function name and arguments, just whitespace
- "Named" arguments (previously "keyword" arguments) use colon instead of equals sign
Diffstat (limited to 'src/eval')
| -rw-r--r-- | src/eval/args.rs | 2 | ||||
| -rw-r--r-- | src/eval/dict.rs | 16 | ||||
| -rw-r--r-- | src/eval/value.rs | 4 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/eval/args.rs b/src/eval/args.rs index 765ae09c..b379b975 100644 --- a/src/eval/args.rs +++ b/src/eval/args.rs @@ -86,7 +86,7 @@ impl Args { }) } - /// Retrieve and remove all matching keyword arguments. + /// Retrieve and remove all matching named arguments. pub fn find_all_str<T>(&mut self) -> impl Iterator<Item = (String, T)> + '_ where T: TryFromValue, diff --git a/src/eval/dict.rs b/src/eval/dict.rs index 1374c840..efa5cb37 100644 --- a/src/eval/dict.rs +++ b/src/eval/dict.rs @@ -160,11 +160,9 @@ impl<V: Debug> Debug for Dict<V> { if self.0 { f.write_str("\"")?; } - if f.alternate() { - f.write_str(" = ")?; - } else { - f.write_str("=")?; - } + + f.write_str(": ")?; + self.2.fmt(f) } } @@ -511,13 +509,13 @@ mod tests { dict.insert("sp ace", "quotes"); assert_eq!( format!("{:?}", dict), - r#"(10="hello", "sp ace"="quotes", twenty="there")"#, + r#"(10: "hello", "sp ace": "quotes", twenty: "there")"#, ); assert_eq!(format!("{:#?}", dict).lines().collect::<Vec<_>>(), [ "(", - r#" 10 = "hello","#, - r#" "sp ace" = "quotes","#, - r#" twenty = "there","#, + r#" 10: "hello","#, + r#" "sp ace": "quotes","#, + r#" twenty: "there","#, ")", ]); } diff --git a/src/eval/value.rs b/src/eval/value.rs index a27e9aa9..f15ae0c5 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -36,7 +36,7 @@ pub enum Value { Color(Color), /// A string: `"string"`. Str(String), - /// A dictionary value: `(false, 12cm, greeting="hi")`. + /// A dictionary value: `(false, 12cm, greeting: "hi")`. Dict(ValueDict), /// A content value: `{*Hi* there}`. Content(SynTree), @@ -125,7 +125,7 @@ impl Debug for Value { /// /// # Example /// ```typst -/// (false, 12cm, greeting="hi") +/// (false, 12cm, greeting: "hi") /// ``` pub type ValueDict = Dict<SpannedEntry<Value>>; |
