oxedyne/fe2o3/fe2o3_austenite/tests/fixtures/eval/core/values.txt
23.9 KiB, 1 run
created by r1870400018:63760, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | ;; U2 value cases. Each case is `%% <Typst code>` followed by the syntax tree the U1 parser yields for it, |
| 2 | ;; as an s-expression: `(Kind child ...)` an inner node, `(Kind 'text')` a leaf with that text, a bare |
| 3 | ;; capitalised word a punctuation or keyword leaf, a bare lower-case word an identifier, digits a number, |
| 4 | ;; `"..."` a string literal. The expected value is whatever `typst eval` prints for the code. `%%[dep]` |
| 5 | ;; (or `%%[a,b]`) marks a case that also needs another unit (U3's library, U5/U6a/U7/U8 element schemas, |
| 6 | ;; the `symbol` element); it is enforced as soon as that dependency is present and reported as pending |
| 7 | ;; until then. |
| 8 | %% 1 + 2 * 3 |
| 9 | (Binary 1 Plus (Binary 2 Star 3)) |
| 10 | %% 7 / 2 |
| 11 | (Binary 7 Slash 2) |
| 12 | %% 6 / 2 |
| 13 | (Binary 6 Slash 2) |
| 14 | %% 0xff + 0b101 + 0o17 |
| 15 | (Binary (Binary 0xff Plus 0b101) Plus 0o17) |
| 16 | %% 1.5e3 |
| 17 | 1.5e3 |
| 18 | %% 5 - 2.5 |
| 19 | (Binary 5 Minus 2.5) |
| 20 | %% 2.5mm |
| 21 | 2.5mm |
| 22 | %% 1in |
| 23 | 1in |
| 24 | %% 45deg |
| 25 | 45deg |
| 26 | %% 1pt + 1em + 10% |
| 27 | (Binary (Binary 1pt Plus 1em) Plus 10%) |
| 28 | %% 50% + 50% |
| 29 | (Binary 50% Plus 50%) |
| 30 | %% 10% * 2pt |
| 31 | (Binary 10% Star 2pt) |
| 32 | %% 5pt * 2 |
| 33 | (Binary 5pt Star 2) |
| 34 | %% 2pt / 1pt |
| 35 | (Binary 2pt Slash 1pt) |
| 36 | %% 1fr / 2fr |
| 37 | (Binary 1fr Slash 2fr) |
| 38 | %% 2 * 1fr |
| 39 | (Binary 2 Star 1fr) |
| 40 | %% 90deg / 45deg |
| 41 | (Binary 90deg Slash 45deg) |
| 42 | %% "a" * 3 |
| 43 | (Binary "a" Star 3) |
| 44 | %% 3 * (1, 2) |
| 45 | (Binary 3 Star (Array LeftParen 1 Comma 2 RightParen)) |
| 46 | %% (1, 2) + (3,) |
| 47 | (Binary (Array LeftParen 1 Comma 2 RightParen) Plus (Array LeftParen 3 Comma RightParen)) |
| 48 | %% (a: 1) + (b: 2) |
| 49 | (Binary (Dict LeftParen (Named a Colon 1) RightParen) Plus (Dict LeftParen (Named b Colon 2) RightParen)) |
| 50 | %% (a: 1, b: 2) == (b: 2, a: 1) |
| 51 | (Binary (Dict LeftParen (Named a Colon 1) Comma (Named b Colon 2) RightParen) EqEq (Dict LeftParen (Named b Colon 2) Comma (Named a Colon 1) RightParen)) |
| 52 | %% (:) |
| 53 | (Dict LeftParen Colon RightParen) |
| 54 | %% ("k": 1, ..(j: 2), ..none) |
| 55 | (Dict LeftParen (Keyed "k" Colon 1) Comma (Spread Dots (Dict LeftParen (Named j Colon 2) RightParen)) Comma (Spread Dots none) RightParen) |
| 56 | %% (..(1, 2), 3, ..none) |
| 57 | (Array LeftParen (Spread Dots (Array LeftParen 1 Comma 2 RightParen)) Comma 3 Comma (Spread Dots none) RightParen) |
| 58 | %% 1.0 == 1 |
| 59 | (Binary 1.0 EqEq 1) |
| 60 | %% 1 != 2 |
| 61 | (Binary 1 ExclEq 2) |
| 62 | %% (1, 2) < (1, 3) |
| 63 | (Binary (Array LeftParen 1 Comma 2 RightParen) Lt (Array LeftParen 1 Comma 3 RightParen)) |
| 64 | %% "b" >= "a" |
| 65 | (Binary "b" GtEq "a") |
| 66 | %% "a" in "abc" |
| 67 | (Binary "a" In "abc") |
| 68 | %% 2 in (1, 2) |
| 69 | (Binary 2 In (Array LeftParen 1 Comma 2 RightParen)) |
| 70 | %% "a" in (a: 1) |
| 71 | (Binary "a" In (Dict LeftParen (Named a Colon 1) RightParen)) |
| 72 | %% 3 not in (1, 2) |
| 73 | (Binary 3 Not In (Array LeftParen 1 Comma 2 RightParen)) |
| 74 | %% none + 1 |
| 75 | (Binary none Plus 1) |
| 76 | %% false and 1 |
| 77 | (Binary false And 1) |
| 78 | %% true or x |
| 79 | (Binary true Or x) |
| 80 | %% not false |
| 81 | (Unary Not false) |
| 82 | %% -(3) |
| 83 | (Unary Minus (Parenthesized LeftParen 3 RightParen)) |
| 84 | %% 1pt == 1pt + 0% |
| 85 | (Binary 1pt EqEq (Binary 1pt Plus 0%)) |
| 86 | %% (10% + 1pt) == (1pt + 10%) |
| 87 | (Binary (Parenthesized LeftParen (Binary 10% Plus 1pt) RightParen) EqEq (Parenthesized LeftParen (Binary 1pt Plus 10%) RightParen)) |
| 88 | %% (1pt + 2em).em |
| 89 | (FieldAccess (Parenthesized LeftParen (Binary 1pt Plus 2em) RightParen) Dot em) |
| 90 | %% (10% + 2pt).ratio |
| 91 | (FieldAccess (Parenthesized LeftParen (Binary 10% Plus 2pt) RightParen) Dot ratio) |
| 92 | %% (x: (y: 7)).x.y |
| 93 | (FieldAccess (FieldAccess (Dict LeftParen (Named x Colon (Dict LeftParen (Named y Colon 7) RightParen)) RightParen) Dot x) Dot y) |
| 94 | %% {let x = 2; x *= 3; x /= 4; x} |
| 95 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 2) Semicolon (Binary x StarEq 3) Semicolon (Binary x SlashEq 4) Semicolon x) RightBrace) |
| 96 | %% {let s = "a"; s += "b"; s} |
| 97 | (CodeBlock LeftBrace (Code (LetBinding Let s Eq "a") Semicolon (Binary s PlusEq "b") Semicolon s) RightBrace) |
| 98 | %% {let x = 5; x -= 7; x} |
| 99 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 5) Semicolon (Binary x HyphEq 7) Semicolon x) RightBrace) |
| 100 | %% {let x; x} |
| 101 | (CodeBlock LeftBrace (Code (LetBinding Let x) Semicolon x) RightBrace) |
| 102 | %% {let (a, ..b) = (1, 2, 3); b} |
| 103 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma (Spread Dots b) RightParen) Eq (Array LeftParen 1 Comma 2 Comma 3 RightParen)) Semicolon b) RightBrace) |
| 104 | %% {let (..b, c) = (1, 2, 3); (b, c)} |
| 105 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen (Spread Dots b) Comma c RightParen) Eq (Array LeftParen 1 Comma 2 Comma 3 RightParen)) Semicolon (Array LeftParen b Comma c RightParen)) RightBrace) |
| 106 | %% {let (a, b: c) = (a: 1, b: 2); (a, c)} |
| 107 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma (Named b Colon c) RightParen) Eq (Dict LeftParen (Named a Colon 1) Comma (Named b Colon 2) RightParen)) Semicolon (Array LeftParen a Comma c RightParen)) RightBrace) |
| 108 | %% {let (a, ..r) = (a: 1, b: 2); r} |
| 109 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma (Spread Dots r) RightParen) Eq (Dict LeftParen (Named a Colon 1) Comma (Named b Colon 2) RightParen)) Semicolon r) RightBrace) |
| 110 | %% {let ((a, b), c) = ((1, 2), 3); b} |
| 111 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen (Destructuring LeftParen a Comma b RightParen) Comma c RightParen) Eq (Array LeftParen (Array LeftParen 1 Comma 2 RightParen) Comma 3 RightParen)) Semicolon b) RightBrace) |
| 112 | %% {let (a, _, c) = (1, 2, 3); c} |
| 113 | (CodeBlock LeftBrace (Code (LetBinding Let (Destructuring LeftParen a Comma Underscore Comma c RightParen) Eq (Array LeftParen 1 Comma 2 Comma 3 RightParen)) Semicolon c) RightBrace) |
| 114 | %% {let a = 1; let b = 2; (a, b) = (b, a); (a, b)} |
| 115 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq 1) Semicolon (LetBinding Let b Eq 2) Semicolon (DestructAssignment (Destructuring LeftParen a Comma b RightParen) Eq (Array LeftParen b Comma a RightParen)) Semicolon (Array LeftParen a Comma b RightParen)) RightBrace) |
| 116 | %% {let d = (x: (y: 1)); d.x.y = 5; d} |
| 117 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named x Colon (Dict LeftParen (Named y Colon 1) RightParen)) RightParen)) Semicolon (Binary (FieldAccess (FieldAccess d Dot x) Dot y) Eq 5) Semicolon d) RightBrace) |
| 118 | %% {let d = (a: 1); d.b = 2; d} |
| 119 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon (Binary (FieldAccess d Dot b) Eq 2) Semicolon d) RightBrace) |
| 120 | %% {let a = (1, 2); a.at(-1) = 9; a} |
| 121 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen 1 Comma 2 RightParen)) Semicolon (Binary (FuncCall (FieldAccess a Dot at) (Args LeftParen (Unary Minus 1) RightParen)) Eq 9) Semicolon a) RightBrace) |
| 122 | %% {let a = ((1, 2),); a.at(0).push(3); a} |
| 123 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen (Array LeftParen 1 Comma 2 RightParen) Comma RightParen)) Semicolon (FuncCall (FieldAccess (FuncCall (FieldAccess a Dot at) (Args LeftParen 0 RightParen)) Dot push) (Args LeftParen 3 RightParen)) Semicolon a) RightBrace) |
| 124 | %% {let a = (1, 2); a.insert(2, 0); a} |
| 125 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen 1 Comma 2 RightParen)) Semicolon (FuncCall (FieldAccess a Dot insert) (Args LeftParen 2 Comma 0 RightParen)) Semicolon a) RightBrace) |
| 126 | %% {let a = (1, 2, 3); (a.pop(), a.remove(0), a)} |
| 127 | (CodeBlock LeftBrace (Code (LetBinding Let a Eq (Array LeftParen 1 Comma 2 Comma 3 RightParen)) Semicolon (Array LeftParen (FuncCall (FieldAccess a Dot pop) (Args LeftParen RightParen)) Comma (FuncCall (FieldAccess a Dot remove) (Args LeftParen 0 RightParen)) Comma a RightParen)) RightBrace) |
| 128 | %% {let d = (a: 1); d.insert("b", 2); (d.remove("a"), d)} |
| 129 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon (FuncCall (FieldAccess d Dot insert) (Args LeftParen "b" Comma 2 RightParen)) Semicolon (Array LeftParen (FuncCall (FieldAccess d Dot remove) (Args LeftParen "a" RightParen)) Comma d RightParen)) RightBrace) |
| 130 | %% {let d = (a: 1); d.remove("b", default: 5)} |
| 131 | (CodeBlock LeftBrace (Code (LetBinding Let d Eq (Dict LeftParen (Named a Colon 1) RightParen)) Semicolon (FuncCall (FieldAccess d Dot remove) (Args LeftParen "b" Comma (Named default Colon 5) RightParen))) RightBrace) |
| 132 | %% {let f(x, y: 2, ..r) = (x, y, r); f(1, 3, y: 5, z: 6)} |
| 133 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x Comma (Named y Colon 2) Comma (Spread Dots r) RightParen) Eq (Array LeftParen x Comma y Comma r RightParen))) Semicolon (FuncCall f (Args LeftParen 1 Comma 3 Comma (Named y Colon 5) Comma (Named z Colon 6) RightParen))) RightBrace) |
| 134 | %% {let f(..r, x) = (x, r); f(1, 2, 3)} |
| 135 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Spread Dots r) Comma x RightParen) Eq (Array LeftParen x Comma r RightParen))) Semicolon (FuncCall f (Args LeftParen 1 Comma 2 Comma 3 RightParen))) RightBrace) |
| 136 | %% {let f(x, ..r, y: 1) = r; f(1, y: 2, 3, z: 4)} |
| 137 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x Comma (Spread Dots r) Comma (Named y Colon 1) RightParen) Eq r)) Semicolon (FuncCall f (Args LeftParen 1 Comma (Named y Colon 2) Comma 3 Comma (Named z Colon 4) RightParen))) RightBrace) |
| 138 | %% {let f((a, b), c) = a + b + c; f((1, 2), 3)} |
| 139 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Destructuring LeftParen a Comma b RightParen) Comma c RightParen) Eq (Binary (Binary a Plus b) Plus c))) Semicolon (FuncCall f (Args LeftParen (Array LeftParen 1 Comma 2 RightParen) Comma 3 RightParen))) RightBrace) |
| 140 | %% {let f(..r) = r; f(..(1, 2), ..(a: 3)).named()} |
| 141 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Spread Dots r) RightParen) Eq r)) Semicolon (FuncCall (FieldAccess (FuncCall f (Args LeftParen (Spread Dots (Array LeftParen 1 Comma 2 RightParen)) Comma (Spread Dots (Dict LeftParen (Named a Colon 3) RightParen)) RightParen)) Dot named) (Args LeftParen RightParen))) RightBrace) |
| 142 | %% {let f(..r) = r; (f(1, a: 2, 3).at(1), f(1, a: 2, 3).at("a"), f(1).at(4, default: 0))} |
| 143 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Spread Dots r) RightParen) Eq r)) Semicolon (Array LeftParen (FuncCall (FieldAccess (FuncCall f (Args LeftParen 1 Comma (Named a Colon 2) Comma 3 RightParen)) Dot at) (Args LeftParen 1 RightParen)) Comma (FuncCall (FieldAccess (FuncCall f (Args LeftParen 1 Comma (Named a Colon 2) Comma 3 RightParen)) Dot at) (Args LeftParen "a" RightParen)) Comma (FuncCall (FieldAccess (FuncCall f (Args LeftParen 1 RightParen)) Dot at) (Args LeftParen 4 Comma (Named default Colon 0) RightParen)) RightParen)) RightBrace) |
| 144 | %% {let f(..r) = r; f(1, a: 2, 3).pos()} |
| 145 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen (Spread Dots r) RightParen) Eq r)) Semicolon (FuncCall (FieldAccess (FuncCall f (Args LeftParen 1 Comma (Named a Colon 2) Comma 3 RightParen)) Dot pos) (Args LeftParen RightParen))) RightBrace) |
| 146 | %% {let f(n) = if n <= 1 { 1 } else { n * f(n - 1) }; f(5)} |
| 147 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen n RightParen) Eq (Conditional If (Binary n LtEq 1) (CodeBlock LeftBrace (Code 1) RightBrace) Else (CodeBlock LeftBrace (Code (Binary n Star (FuncCall f (Args LeftParen (Binary n Minus 1) RightParen)))) RightBrace)))) Semicolon (FuncCall f (Args LeftParen 5 RightParen))) RightBrace) |
| 148 | %% {let x = 1; let g() = x; x = 2; g()} |
| 149 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1) Semicolon (LetBinding Let (Closure g (Params LeftParen RightParen) Eq x)) Semicolon (Binary x Eq 2) Semicolon (FuncCall g (Args LeftParen RightParen))) RightBrace) |
| 150 | %% {let f = (a, b) => a + b; f.with(1)(2)} |
| 151 | (CodeBlock LeftBrace (Code (LetBinding Let f Eq (Closure (Params LeftParen a Comma b RightParen) Arrow (Binary a Plus b))) Semicolon (FuncCall (FuncCall (FieldAccess f Dot with) (Args LeftParen 1 RightParen)) (Args LeftParen 2 RightParen))) RightBrace) |
| 152 | %% {let add(a, b: 10) = a + b; (add.with(b: 1).with(2))()} |
| 153 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure add (Params LeftParen a Comma (Named b Colon 10) RightParen) Eq (Binary a Plus b))) Semicolon (FuncCall (Parenthesized LeftParen (FuncCall (FieldAccess (FuncCall (FieldAccess add Dot with) (Args LeftParen (Named b Colon 1) RightParen)) Dot with) (Args LeftParen 2 RightParen)) RightParen) (Args LeftParen RightParen))) RightBrace) |
| 154 | %% {let k = 3; let f = x => x * k; f(2)} |
| 155 | (CodeBlock LeftBrace (Code (LetBinding Let k Eq 3) Semicolon (LetBinding Let f Eq (Closure (Params x) Arrow (Binary x Star k))) Semicolon (FuncCall f (Args LeftParen 2 RightParen))) RightBrace) |
| 156 | %% {let f() = { [a]; return [c]; [b] }; f()} |
| 157 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen RightParen) Eq (CodeBlock LeftBrace (Code (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket) Semicolon (FuncReturn Return (ContentBlock LeftBracket (Markup (Text 'c')) RightBracket)) Semicolon (ContentBlock LeftBracket (Markup (Text 'b')) RightBracket)) RightBrace))) Semicolon (FuncCall f (Args LeftParen RightParen))) RightBrace) |
| 158 | %% {let f() = { [a]; return; [b] }; f()} |
| 159 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen RightParen) Eq (CodeBlock LeftBrace (Code (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket) Semicolon (FuncReturn Return) Semicolon (ContentBlock LeftBracket (Markup (Text 'b')) RightBracket)) RightBrace))) Semicolon (FuncCall f (Args LeftParen RightParen))) RightBrace) |
| 160 | %% {let f(x) = f; f(1)} |
| 161 | (CodeBlock LeftBrace (Code (LetBinding Let (Closure f (Params LeftParen x RightParen) Eq f)) Semicolon (FuncCall f (Args LeftParen 1 RightParen))) RightBrace) |
| 162 | %% {for (k, v) in (a: 1, b: 2) { (k, v) }} |
| 163 | (CodeBlock LeftBrace (Code (ForLoop For (Destructuring LeftParen k Comma v RightParen) In (Dict LeftParen (Named a Colon 1) Comma (Named b Colon 2) RightParen) (CodeBlock LeftBrace (Code (Array LeftParen k Comma v RightParen)) RightBrace))) RightBrace) |
| 164 | %% {for c in "ab" { (c,) }} |
| 165 | (CodeBlock LeftBrace (Code (ForLoop For c In "ab" (CodeBlock LeftBrace (Code (Array LeftParen c Comma RightParen)) RightBrace))) RightBrace) |
| 166 | %% {for c in "e\u{301}x" { (c,) }} |
| 167 | (CodeBlock LeftBrace (Code (ForLoop For c In "e\u{301}x" (CodeBlock LeftBrace (Code (Array LeftParen c Comma RightParen)) RightBrace))) RightBrace) |
| 168 | %% {let s = 0; for i in (0, 1, 2, 3, 4) { if i == 3 { break }; s += i }; s} |
| 169 | (CodeBlock LeftBrace (Code (LetBinding Let s Eq 0) Semicolon (ForLoop For i In (Array LeftParen 0 Comma 1 Comma 2 Comma 3 Comma 4 RightParen) (CodeBlock LeftBrace (Code (Conditional If (Binary i EqEq 3) (CodeBlock LeftBrace (Code (LoopBreak Break)) RightBrace)) Semicolon (Binary s PlusEq i)) RightBrace)) Semicolon s) RightBrace) |
| 170 | %% {let s = 0; for i in (1, 2, 3) { if i == 2 { continue }; s += i }; s} |
| 171 | (CodeBlock LeftBrace (Code (LetBinding Let s Eq 0) Semicolon (ForLoop For i In (Array LeftParen 1 Comma 2 Comma 3 RightParen) (CodeBlock LeftBrace (Code (Conditional If (Binary i EqEq 2) (CodeBlock LeftBrace (Code (LoopContinue Continue)) RightBrace)) Semicolon (Binary s PlusEq i)) RightBrace)) Semicolon s) RightBrace) |
| 172 | %% {let i = 0; while i < 3 { i += 1 }; i} |
| 173 | (CodeBlock LeftBrace (Code (LetBinding Let i Eq 0) Semicolon (WhileLoop While (Binary i Lt 3) (CodeBlock LeftBrace (Code (Binary i PlusEq 1)) RightBrace)) Semicolon i) RightBrace) |
| 174 | %% {let i = 0; while true { i += 1; if i > 4 { break } }; i} |
| 175 | (CodeBlock LeftBrace (Code (LetBinding Let i Eq 0) Semicolon (WhileLoop While true (CodeBlock LeftBrace (Code (Binary i PlusEq 1) Semicolon (Conditional If (Binary i Gt 4) (CodeBlock LeftBrace (Code (LoopBreak Break)) RightBrace))) RightBrace)) Semicolon i) RightBrace) |
| 176 | %% {if false { 1 }} |
| 177 | (CodeBlock LeftBrace (Code (Conditional If false (CodeBlock LeftBrace (Code 1) RightBrace))) RightBrace) |
| 178 | %% {if false { 1 } else if true { 2 } else { 3 }} |
| 179 | (CodeBlock LeftBrace (Code (Conditional If false (CodeBlock LeftBrace (Code 1) RightBrace) Else (Conditional If true (CodeBlock LeftBrace (Code 2) RightBrace) Else (CodeBlock LeftBrace (Code 3) RightBrace)))) RightBrace) |
| 180 | %% {none; 2; none} |
| 181 | (CodeBlock LeftBrace (Code none Semicolon 2 Semicolon none) RightBrace) |
| 182 | %% {"a"; "b"} |
| 183 | (CodeBlock LeftBrace (Code "a" Semicolon "b") RightBrace) |
| 184 | %% {(1,); (2,)} |
| 185 | (CodeBlock LeftBrace (Code (Array LeftParen 1 Comma RightParen) Semicolon (Array LeftParen 2 Comma RightParen)) RightBrace) |
| 186 | %% {let x = 1} |
| 187 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1)) RightBrace) |
| 188 | %% {let x = 1; {let x = 2}; x} |
| 189 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1) Semicolon (CodeBlock LeftBrace (Code (LetBinding Let x Eq 2)) RightBrace) Semicolon x) RightBrace) |
| 190 | %% {let x = 1; {x = 2}; x} |
| 191 | (CodeBlock LeftBrace (Code (LetBinding Let x Eq 1) Semicolon (CodeBlock LeftBrace (Code (Binary x Eq 2)) RightBrace) Semicolon x) RightBrace) |
| 192 | %% "tab\there \"q\" \u{41}" |
| 193 | "tab\there \"q\" \u{41}" |
| 194 | %% [a <l>] |
| 195 | (ContentBlock LeftBracket (Markup (Text 'a') Space (Label '<l>')) RightBracket) |
| 196 | %% [a #{} b] |
| 197 | (ContentBlock LeftBracket (Markup (Text 'a') Space Hash (CodeBlock LeftBrace (Code) RightBrace) Space (Text 'b')) RightBracket) |
| 198 | %%[U3] [x #1.5 #"s" #none] |
| 199 | (ContentBlock LeftBracket (Markup (Text 'x') Space Hash 1.5 Space Hash "s" Space Hash none) RightBracket) |
| 200 | %% [a \ b] |
| 201 | (ContentBlock LeftBracket (Markup (Text 'a') Space (Linebreak '\') Space (Text 'b')) RightBracket) |
| 202 | %%[symbol] [a -- b \#] |
| 203 | (ContentBlock LeftBracket (Markup (Text 'a') Space (Shorthand '--') Space (Text 'b') Space (Escape '\#')) RightBracket) |
| 204 | %% "a" + [b] |
| 205 | (Binary "a" Plus (ContentBlock LeftBracket (Markup (Text 'b')) RightBracket)) |
| 206 | %% [a] + [b] + [c] |
| 207 | (Binary (Binary (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket) Plus (ContentBlock LeftBracket (Markup (Text 'b')) RightBracket)) Plus (ContentBlock LeftBracket (Markup (Text 'c')) RightBracket)) |
| 208 | %% [a] * 2 |
| 209 | (Binary (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket) Star 2) |
| 210 | %% {show: it => [X]; [a]} |
| 211 | (CodeBlock LeftBrace (Code (ShowRule Show Colon (Closure (Params it) Arrow (ContentBlock LeftBracket (Markup (Text 'X')) RightBracket))) Semicolon (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket)) RightBrace) |
| 212 | %% [#show: it => [X #it]; a b] |
| 213 | (ContentBlock LeftBracket (Markup Hash (ShowRule Show Colon (Closure (Params it) Arrow (ContentBlock LeftBracket (Markup (Text 'X') Space Hash it) RightBracket))) Semicolon Space (Text 'a b')) RightBracket) |
| 214 | %% [#show: [gone]; a] |
| 215 | (ContentBlock LeftBracket (Markup Hash (ShowRule Show Colon (ContentBlock LeftBracket (Markup (Text 'gone')) RightBracket)) Semicolon Space (Text 'a')) RightBracket) |
| 216 | %% [a #let x = [b]; #x] |
| 217 | (ContentBlock LeftBracket (Markup (Text 'a') Space Hash (LetBinding Let x Eq (ContentBlock LeftBracket (Markup (Text 'b')) RightBracket)) Semicolon Space Hash x) RightBracket) |
| 218 | %%[U3] [#for x in (1, 2) [#x ]] |
| 219 | (ContentBlock LeftBracket (Markup Hash (ForLoop For x In (Array LeftParen 1 Comma 2 RightParen) (ContentBlock LeftBracket (Markup Hash x Space) RightBracket))) RightBracket) |
| 220 | %%[U3] [a <l>].children.first().label |
| 221 | (FieldAccess (FuncCall (FieldAccess (FieldAccess (ContentBlock LeftBracket (Markup (Text 'a') Space (Label '<l>')) RightBracket) Dot children) Dot first) (Args LeftParen RightParen)) Dot label) |
| 222 | %%[U3] [a <l>].children.at(0).fields() |
| 223 | (FuncCall (FieldAccess (FuncCall (FieldAccess (FieldAccess (ContentBlock LeftBracket (Markup (Text 'a') Space (Label '<l>')) RightBracket) Dot children) Dot at) (Args LeftParen 0 RightParen)) Dot fields) (Args LeftParen RightParen)) |
| 224 | %% [a b].has("children") |
| 225 | (FuncCall (FieldAccess (ContentBlock LeftBracket (Markup (Text 'a b')) RightBracket) Dot has) (Args LeftParen "children" RightParen)) |
| 226 | %% [x].at("nope", default: 3) |
| 227 | (FuncCall (FieldAccess (ContentBlock LeftBracket (Markup (Text 'x')) RightBracket) Dot at) (Args LeftParen "nope" Comma (Named default Colon 3) RightParen)) |
| 228 | %% [x].text |
| 229 | (FieldAccess (ContentBlock LeftBracket (Markup (Text 'x')) RightBracket) Dot text) |
| 230 | %% [x].location() |
| 231 | (FuncCall (FieldAccess (ContentBlock LeftBracket (Markup (Text 'x')) RightBracket) Dot location) (Args LeftParen RightParen)) |
| 232 | %% [x].func() == text |
| 233 | (Binary (FuncCall (FieldAccess (ContentBlock LeftBracket (Markup (Text 'x')) RightBracket) Dot func) (Args LeftParen RightParen)) EqEq text) |
| 234 | %% text("hi") |
| 235 | (FuncCall text (Args LeftParen "hi" RightParen)) |
| 236 | %% heading == heading |
| 237 | (Binary heading EqEq heading) |
| 238 | %% [a b].has("children") |
| 239 | (FuncCall (FieldAccess (ContentBlock LeftBracket (Markup (Text 'a') Space (Text 'b')) RightBracket) Dot has) (Args LeftParen "children" RightParen)) |
| 240 | %%[U5] [= Hi] |
| 241 | (ContentBlock LeftBracket (Markup (Heading (HeadingMarker '=') Space (Markup (Text 'Hi')))) RightBracket) |
| 242 | %%[U5] [*a* _b_] |
| 243 | (ContentBlock LeftBracket (Markup (Strong Star (Markup (Text 'a')) Star) Space (Emph Underscore (Markup (Text 'b')) Underscore)) RightBracket) |
| 244 | %%[U5] [*a* <l>] |
| 245 | (ContentBlock LeftBracket (Markup (Strong Star (Markup (Text 'a')) Star) Space (Label '<l>')) RightBracket) |
| 246 | %%[U5] [- a] |
| 247 | (ContentBlock LeftBracket (Markup (ListItem ListMarker Space (Markup (Text 'a')))) RightBracket) |
| 248 | %%[U5] [+ b] |
| 249 | (ContentBlock LeftBracket (Markup (EnumItem (EnumMarker '+') Space (Markup (Text 'b')))) RightBracket) |
| 250 | %%[U5] [5. c] |
| 251 | (ContentBlock LeftBracket (Markup (EnumItem (EnumMarker '5.') Space (Markup (Text 'c')))) RightBracket) |
| 252 | %%[U5] [/ T: d] |
| 253 | (ContentBlock LeftBracket (Markup (TermItem TermMarker Space (Markup (Text 'T')) Colon Space (Markup (Text 'd')))) RightBracket) |
| 254 | %%[U5] [`x`] |
| 255 | (ContentBlock LeftBracket (Markup (Raw (RawDelim '`') (Text 'x') (RawDelim '`'))) RightBracket) |
| 256 | %%[U5] [```rust y```] |
| 257 | (ContentBlock LeftBracket (Markup (Raw (RawDelim '```') (RawLang 'rust') (RawTrimmed ' ') (Text 'y') (RawDelim '```'))) RightBracket) |
| 258 | %%[U5] [@r] |
| 259 | (ContentBlock LeftBracket (Markup (Ref (RefMarker '@r'))) RightBracket) |
| 260 | %%[U5] [@r[see]] |
| 261 | (ContentBlock LeftBracket (Markup (Ref (RefMarker '@r') (ContentBlock LeftBracket (Markup (Text 'see')) RightBracket))) RightBracket) |
| 262 | %%[U5] [https://x.org] |
| 263 | (ContentBlock LeftBracket (Markup (Link 'https://x.org')) RightBracket) |
| 264 | %%[U3,U5] [#(1pt)] |
| 265 | (ContentBlock LeftBracket (Markup Hash (Parenthesized LeftParen 1pt RightParen)) RightBracket) |
| 266 | %%[U6a] ["q"] |
| 267 | (ContentBlock LeftBracket (Markup (SmartQuote '"') (Text 'q') (SmartQuote '"')) RightBracket) |
| 268 | %%[U7,symbol] $x^2_i'$ |
| 269 | (Equation Dollar (Math (MathAttach (MathText 'x') Hat (MathText '2') Underscore (MathAttach (MathText 'i') MathPrimes))) Dollar) |
| 270 | %%[U7,symbol] $ a/b $ |
| 271 | (Equation Dollar Space (Math (MathFrac (MathText 'a') Slash (MathText 'b'))) Space Dollar) |
| 272 | %%[U7,symbol] $(a+b)/(c)$ |
| 273 | (Equation Dollar (Math (MathFrac (MathDelimited (MathText '(') (Math (MathText 'a') (MathText '+') (MathText 'b')) (MathText ')')) Slash (MathDelimited (MathText '(') (Math (MathText 'c')) (MathText ')')))) Dollar) |
| 274 | %%[U7,symbol] $x^(a+b)$ |
| 275 | (Equation Dollar (Math (MathAttach (MathText 'x') Hat (MathDelimited (MathText '(') (Math (MathText 'a') (MathText '+') (MathText 'b')) (MathText ')')))) Dollar) |
| 276 | %%[U8] context 1 |
| 277 | (Contextual Context 1) |
| 278 | %%[U5] [== Sub] |
| 279 | (ContentBlock LeftBracket (Markup (Heading (HeadingMarker '==') Space (Markup (Text 'Sub')))) RightBracket) |
| 280 | %%[U7] $ 2/3 $ |
| 281 | (Equation Dollar Space (Math (MathFrac (MathText '2') Slash (MathText '3'))) Space Dollar) |
| 282 | %%[U7] $2^(34)_5$ |
| 283 | (Equation Dollar (Math (MathAttach (MathText '2') Hat (MathDelimited (MathText '(') (Math (MathText '34')) (MathText ')')) Underscore (MathText '5'))) Dollar) |
| 284 | %% {import list: item; item == list.item} |
| 285 | (CodeBlock LeftBrace (Code (ModuleImport Import list Colon (ImportItems (ImportItemPath item))) Semicolon (Binary item EqEq (FieldAccess list Dot item))) RightBrace) |
| 286 | %% {import table: cell as c, header; (c == table.cell, header == table.header)} |
| 287 | (CodeBlock LeftBrace (Code (ModuleImport Import table Colon (ImportItems (RenamedImportItem (ImportItemPath cell) As c) Comma (ImportItemPath header))) Semicolon (Array LeftParen (Binary c EqEq (FieldAccess table Dot cell)) Comma (Binary header EqEq (FieldAccess table Dot header)) RightParen)) RightBrace) |
| 288 | %% {import list as l; l == list} |
| 289 | (CodeBlock LeftBrace (Code (ModuleImport Import list As l) Semicolon (Binary l EqEq list)) RightBrace) |
| 290 | %% {show heading: it => it; [a]} |
| 291 | (CodeBlock LeftBrace (Code (ShowRule Show heading Colon (Closure (Params it) Arrow it)) Semicolon (ContentBlock LeftBracket (Markup (Text 'a')) RightBracket)) RightBrace) |
| 292 | %% [#show <l>: none; a] |
| 293 | (ContentBlock LeftBracket (Markup Hash (ShowRule Show (Label '<l>') Colon none) Semicolon Space (Text 'a')) RightBracket) |
| 294 | %% [#show "x": [y]; a] |
| 295 | (ContentBlock LeftBracket (Markup Hash (ShowRule Show "x" Colon (ContentBlock LeftBracket (Markup (Text 'y')) RightBracket)) Semicolon Space (Text 'a')) RightBracket) |
| 296 | ;; Plain content reports `sequence` and `styled` as its function (no hand tree: parser only). |
| 297 | %% [#[a b] <l>].func() == [#[c d] <e>].func() |
| 298 | %%[U6a] {set text(red); [a]}.func() == [#[a b] <l>].func() |
| 299 | %%[U6a] {set text(red); [a]}.func() == {set text(blue); [b]}.func() |