summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-30 12:09:26 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-30 12:09:26 +0100
commit89eb8bae49edb71d9a9279a2210bb1ccaf4dd707 (patch)
tree160b1a2ff41b5bba8a58f882df9d10c9eb036cf2 /src/syntax/mod.rs
parentac24075469f171fe83a976b9a97b9b1ea078a7e3 (diff)
New syntax 💎
- Everything everywhere! - Blocks with curly braces: {} - Templates with brackets: [] - Function templates with hashtag: `#[f]` - Headings with equals sign: `= Introduction`
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index d1fc6b77..41fba134 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -60,7 +60,7 @@ mod tests {
roundtrip("hi");
// Heading.
- roundtrip("# *Ok*");
+ roundtrip("= *Ok*");
// Raw.
roundtrip("`lang 1`");
@@ -94,9 +94,9 @@ mod tests {
roundtrip("{(a: 1, b: 2)}");
// Templates.
- roundtrip("{[]}");
- roundtrip("{[*Ok*]}");
- roundtrip("{[[f]]}");
+ roundtrip("[]");
+ roundtrip("[*Ok*]");
+ roundtrip("{[f]}");
// Groups.
roundtrip("{(1)}");
@@ -105,6 +105,7 @@ mod tests {
roundtrip("{}");
roundtrip("{1}");
roundtrip("{ #let x = 1; x += 2; x + 1 }");
+ roundtrip("[{}]");
// Operators.
roundtrip("{-x}");
@@ -116,14 +117,14 @@ mod tests {
roundtrip("{v(1)}");
roundtrip("{v(a: 1, b)}");
- // Bracket calls.
- roundtrip("[v]");
- roundtrip("[v 1]");
- roundtrip("[v 1, 2][*Ok*]");
- roundtrip("[v 1 | f 2]");
- roundtrip("{[[v]]}");
- test("[v 1, [[f 2]]]", "[v 1 | f 2]");
- test("[v 1, 2][[f 3]]", "[v 1, 2 | f 3]");
+ // Function templates.
+ roundtrip("#[v]");
+ roundtrip("#[v 1]");
+ roundtrip("#[v 1, 2][*Ok*]");
+ roundtrip("#[v 1 | f 2]");
+ roundtrip("{#[v]}");
+ test("#[v 1, #[f 2]]", "#[v 1 | f 2]");
+ test("#[v 1, 2][#[f 3]]", "#[v 1, 2 | f 3]");
// Keywords.
roundtrip("#let x = 1 + 2");