@exponential-at/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +54 -0
  3. package/README.md +360 -2
  4. package/catalog/a11y.json +668 -0
  5. package/catalog/basic-map.json +104 -0
  6. package/catalog/code.json +58 -0
  7. package/catalog/core.catalog.json +4752 -0
  8. package/catalog/core.schema.json +22667 -0
  9. package/catalog/host.json +64 -0
  10. package/catalog/layout.json +20 -0
  11. package/catalog/limits.json +9 -0
  12. package/catalog/locale.json +48 -0
  13. package/catalog/macros.json +3417 -0
  14. package/catalog/recipes.json +61 -0
  15. package/catalog/strings.json +72 -0
  16. package/catalog/style.json +128 -0
  17. package/catalog/theme.schema.json +42543 -0
  18. package/catalog/tokens.json +47 -0
  19. package/conformance/README.md +217 -0
  20. package/conformance/baseline.ts +101 -0
  21. package/conformance/browser-page.ts +146 -0
  22. package/conformance/browser-suites.ts +683 -0
  23. package/conformance/compare.ts +201 -0
  24. package/conformance/dom.ts +96 -0
  25. package/conformance/dump.ts +163 -0
  26. package/conformance/fonts.json +154 -0
  27. package/conformance/manifest.json +224 -0
  28. package/conformance/parity-compare.ts +191 -0
  29. package/conformance/parity-report.schema.json +73 -0
  30. package/conformance/parity.ts +412 -0
  31. package/conformance/pixel.ts +177 -0
  32. package/conformance/primitives-page.ts +49 -0
  33. package/conformance/report.schema.json +66 -0
  34. package/conformance/run.ts +118 -0
  35. package/dist/chunks/index-98npjvsd.js +3940 -0
  36. package/dist/chunks/index-98npjvsd.js.map +27 -0
  37. package/dist/chunks/index-gwkt14w3.js +7314 -0
  38. package/dist/chunks/index-gwkt14w3.js.map +10 -0
  39. package/dist/chunks/index-njt7yzzm.js +134 -0
  40. package/dist/chunks/index-njt7yzzm.js.map +9 -0
  41. package/dist/chunks/index-we7va6v6.js +7984 -0
  42. package/dist/chunks/index-we7va6v6.js.map +15 -0
  43. package/dist/chunks/index-xrm6f7wc.js +2563 -0
  44. package/dist/chunks/index-xrm6f7wc.js.map +10 -0
  45. package/dist/conformance.js +182749 -0
  46. package/dist/conformance.js.map +10 -0
  47. package/dist/entries/prompt.js +251 -0
  48. package/dist/entries/prompt.js.map +11 -0
  49. package/dist/entries/schema.js +1725 -0
  50. package/dist/entries/schema.js.map +11 -0
  51. package/dist/host/index.js +122 -0
  52. package/dist/host/index.js.map +9 -0
  53. package/dist/index.js +3213 -0
  54. package/dist/index.js.map +27 -0
  55. package/dist/types/src/a11y.d.ts +21 -0
  56. package/dist/types/src/animation.d.ts +76 -0
  57. package/dist/types/src/basic-map.d.ts +38 -0
  58. package/dist/types/src/builder.d.ts +50 -0
  59. package/dist/types/src/catalog.d.ts +54 -0
  60. package/dist/types/src/catalog.described.d.ts +33 -0
  61. package/dist/types/src/catalog.generated.d.ts +829 -0
  62. package/dist/types/src/chart.d.ts +46 -0
  63. package/dist/types/src/code.d.ts +44 -0
  64. package/dist/types/src/color.d.ts +20 -0
  65. package/dist/types/src/conformance.d.ts +39 -0
  66. package/dist/types/src/connector/app.d.ts +14 -0
  67. package/dist/types/src/connector/connector.d.ts +77 -0
  68. package/dist/types/src/connector/index.d.ts +4 -0
  69. package/dist/types/src/css.d.ts +29 -0
  70. package/dist/types/src/define.d.ts +66 -0
  71. package/dist/types/src/direction.d.ts +16 -0
  72. package/dist/types/src/dynamic.d.ts +159 -0
  73. package/dist/types/src/entries/prompt.d.ts +11 -0
  74. package/dist/types/src/entries/schema.d.ts +8 -0
  75. package/dist/types/src/expr.d.ts +71 -0
  76. package/dist/types/src/extension.d.ts +4 -0
  77. package/dist/types/src/format.d.ts +112 -0
  78. package/dist/types/src/geometry.d.ts +40 -0
  79. package/dist/types/src/host/contract.d.ts +188 -0
  80. package/dist/types/src/host/decoders.d.ts +61 -0
  81. package/dist/types/src/host/index.d.ts +11 -0
  82. package/dist/types/src/host/package.d.ts +58 -0
  83. package/dist/types/src/host/policy.d.ts +105 -0
  84. package/dist/types/src/host/router.d.ts +34 -0
  85. package/dist/types/src/host/runtime.d.ts +205 -0
  86. package/dist/types/src/host/sources.d.ts +15 -0
  87. package/dist/types/src/host/transports.d.ts +109 -0
  88. package/dist/types/src/index.d.ts +63 -0
  89. package/dist/types/src/layout.d.ts +20 -0
  90. package/dist/types/src/limits.d.ts +21 -0
  91. package/dist/types/src/list.d.ts +133 -0
  92. package/dist/types/src/locale.d.ts +22 -0
  93. package/dist/types/src/macros.d.ts +29 -0
  94. package/dist/types/src/overlay.d.ts +27 -0
  95. package/dist/types/src/prompt.d.ts +44 -0
  96. package/dist/types/src/recipes.d.ts +17 -0
  97. package/dist/types/src/reducer.d.ts +41 -0
  98. package/dist/types/src/resizable.d.ts +38 -0
  99. package/dist/types/src/schema.d.ts +7 -0
  100. package/dist/types/src/strings.d.ts +13 -0
  101. package/dist/types/src/style.d.ts +201 -0
  102. package/dist/types/src/test-preload.d.ts +1 -0
  103. package/dist/types/src/text-shimmer.d.ts +24 -0
  104. package/dist/types/src/theme-types.d.ts +162 -0
  105. package/dist/types/src/theme.d.ts +73 -0
  106. package/dist/types/src/themes.d.ts +22 -0
  107. package/dist/types/src/tree-guides.d.ts +17 -0
  108. package/dist/types/src/types.d.ts +314 -0
  109. package/dist/types/src/validate.d.ts +31 -0
  110. package/dist/types/src/web/base-css.d.ts +1 -0
  111. package/dist/types/src/web/box-css.d.ts +55 -0
  112. package/dist/types/src/web/coerce.d.ts +32 -0
  113. package/dist/types/src/web/data.d.ts +105 -0
  114. package/dist/types/src/web/dates.d.ts +12 -0
  115. package/dist/types/src/web/form.d.ts +44 -0
  116. package/dist/types/src/web/host-types.d.ts +119 -0
  117. package/dist/types/src/web/index.d.ts +28 -0
  118. package/dist/types/src/web/inputs.d.ts +55 -0
  119. package/dist/types/src/web/list.d.ts +13 -0
  120. package/dist/types/src/web/listbox.d.ts +14 -0
  121. package/dist/types/src/web/markdown.d.ts +96 -0
  122. package/dist/types/src/web/media.d.ts +62 -0
  123. package/dist/types/src/web/parts.d.ts +4 -0
  124. package/dist/types/src/web/primitives/alert-dialog.d.ts +10 -0
  125. package/dist/types/src/web/primitives/alert.d.ts +9 -0
  126. package/dist/types/src/web/primitives/avatar-color.d.ts +2 -0
  127. package/dist/types/src/web/primitives/avatar.d.ts +13 -0
  128. package/dist/types/src/web/primitives/badge.d.ts +10 -0
  129. package/dist/types/src/web/primitives/breadcrumb.d.ts +10 -0
  130. package/dist/types/src/web/primitives/button.d.ts +6 -0
  131. package/dist/types/src/web/primitives/calendar.d.ts +43 -0
  132. package/dist/types/src/web/primitives/card.d.ts +9 -0
  133. package/dist/types/src/web/primitives/checkbox.d.ts +5 -0
  134. package/dist/types/src/web/primitives/choice-tiles.d.ts +32 -0
  135. package/dist/types/src/web/primitives/cn.d.ts +3 -0
  136. package/dist/types/src/web/primitives/code-block.d.ts +24 -0
  137. package/dist/types/src/web/primitives/command.d.ts +134 -0
  138. package/dist/types/src/web/primitives/context-ring.d.ts +24 -0
  139. package/dist/types/src/web/primitives/dialog-arms.d.ts +6 -0
  140. package/dist/types/src/web/primitives/dialog.d.ts +24 -0
  141. package/dist/types/src/web/primitives/disclosure-header.d.ts +5 -0
  142. package/dist/types/src/web/primitives/dock.d.ts +42 -0
  143. package/dist/types/src/web/primitives/dropdown-menu.d.ts +14 -0
  144. package/dist/types/src/web/primitives/empty-state.d.ts +15 -0
  145. package/dist/types/src/web/primitives/glass-card.d.ts +4 -0
  146. package/dist/types/src/web/primitives/hover-card.d.ts +7 -0
  147. package/dist/types/src/web/primitives/icon-disc.d.ts +12 -0
  148. package/dist/types/src/web/primitives/index.d.ts +48 -0
  149. package/dist/types/src/web/primitives/input.d.ts +5 -0
  150. package/dist/types/src/web/primitives/kbd.d.ts +4 -0
  151. package/dist/types/src/web/primitives/label.d.ts +3 -0
  152. package/dist/types/src/web/primitives/menu-surface.d.ts +17 -0
  153. package/dist/types/src/web/primitives/meter.d.ts +21 -0
  154. package/dist/types/src/web/primitives/popover.d.ts +3 -0
  155. package/dist/types/src/web/primitives/progress-ring.d.ts +5 -0
  156. package/dist/types/src/web/primitives/progress.d.ts +8 -0
  157. package/dist/types/src/web/primitives/scroll-area.d.ts +49 -0
  158. package/dist/types/src/web/primitives/segmented-control.d.ts +5 -0
  159. package/dist/types/src/web/primitives/select.d.ts +47 -0
  160. package/dist/types/src/web/primitives/separator.d.ts +3 -0
  161. package/dist/types/src/web/primitives/sheet-chrome.d.ts +4 -0
  162. package/dist/types/src/web/primitives/sheet.d.ts +20 -0
  163. package/dist/types/src/web/primitives/skeleton.d.ts +3 -0
  164. package/dist/types/src/web/primitives/spinner.d.ts +3 -0
  165. package/dist/types/src/web/primitives/switch.d.ts +4 -0
  166. package/dist/types/src/web/primitives/table.d.ts +11 -0
  167. package/dist/types/src/web/primitives/tabs.d.ts +13 -0
  168. package/dist/types/src/web/primitives/textarea.d.ts +3 -0
  169. package/dist/types/src/web/primitives/toast.d.ts +163 -0
  170. package/dist/types/src/web/primitives/tooltip.d.ts +3 -0
  171. package/dist/types/src/web/primitives/truncate.d.ts +7 -0
  172. package/dist/types/src/web/primitives/typeahead-portal.d.ts +12 -0
  173. package/dist/types/src/web/share.d.ts +6 -0
  174. package/dist/types/src/web/table.d.ts +20 -0
  175. package/dist/types/src/web/theme-css.d.ts +69 -0
  176. package/dist/types/src/web/urls.d.ts +21 -0
  177. package/dist/web/index.js +2303 -0
  178. package/dist/web/index.js.map +26 -0
  179. package/dist/web/primitives/index.js +1450 -0
  180. package/dist/web/primitives/index.js.map +57 -0
  181. package/docs/components.generated.json +6238 -0
  182. package/docs/round-1-contract.md +679 -0
  183. package/docs/round-2-contract.md +476 -0
  184. package/docs/round-3-contract.md +174 -0
  185. package/docs/themes.generated.json +3503 -0
  186. package/fixtures/animations.json +2890 -0
  187. package/fixtures/bench-list.json +58 -0
  188. package/fixtures/bind-time.json +30664 -0
  189. package/fixtures/catalog-basic-map.json +1692 -0
  190. package/fixtures/catalog-components.json +9323 -0
  191. package/fixtures/catalog-extension.json +620 -0
  192. package/fixtures/catalog-macros.json +36370 -0
  193. package/fixtures/code-tokens.json +1993 -0
  194. package/fixtures/conformance-baseline.json +55544 -0
  195. package/fixtures/conformance-cases.json +49 -0
  196. package/fixtures/conformance-known.json +2123 -0
  197. package/fixtures/control-geometry.json +4200 -0
  198. package/fixtures/dashboard.data.json +74 -0
  199. package/fixtures/dashboard.json +752 -0
  200. package/fixtures/demo-surface.json +47 -0
  201. package/fixtures/format.json +870 -0
  202. package/fixtures/host-policy.json +1067 -0
  203. package/fixtures/host-router.json +1152 -0
  204. package/fixtures/host-transport.json +590 -0
  205. package/fixtures/interactions-round1.json +773 -0
  206. package/fixtures/kitchen-sink.expanded.json +10844 -0
  207. package/fixtures/kitchen-sink.json +3049 -0
  208. package/fixtures/layout-geometry-round1.json +7278 -0
  209. package/fixtures/layout-geometry.json +2072 -0
  210. package/fixtures/overlay-geometry.json +272 -0
  211. package/fixtures/primitive-specimens.json +58 -0
  212. package/fixtures/prompt-budget.json +33 -0
  213. package/fixtures/resizable.json +714 -0
  214. package/fixtures/round4-contract.json +2985 -0
  215. package/fixtures/specimens.json +9832 -0
  216. package/fixtures/style-conditions.json +336 -0
  217. package/fixtures/template-items.json +2215 -0
  218. package/fixtures/text-direction.json +309 -0
  219. package/fixtures/text-shimmer.json +96 -0
  220. package/fixtures/theme-extends.json +573 -0
  221. package/fixtures/theme-invalid.json +1296 -0
  222. package/fixtures/theme-recipes.json +58600 -0
  223. package/fixtures/theme-resolved.json +23949 -0
  224. package/fixtures/toast-stack.json +215 -0
  225. package/fixtures/tree-guides.json +224 -0
  226. package/fixtures/virtual-list.json +733 -0
  227. package/generated/ExponentialUICatalog.generated.kt +67 -0
  228. package/generated/ExponentialUICatalog.generated.swift +67 -0
  229. package/generated/ExponentialUIThemes.generated.kt +23 -0
  230. package/generated/ExponentialUIThemes.generated.swift +23 -0
  231. package/generated/catalog.descriptions.generated.rs +6 -0
  232. package/generated/catalog.generated.rs +80 -0
  233. package/generated/catalog.themes.generated.rs +34 -0
  234. package/generated/core.descriptions.json +2505 -0
  235. package/generated/core.runtime.json +3609 -0
  236. package/package.json +87 -4
  237. package/themes/exponential.recipes.json +49 -0
  238. package/themes/exponential.theme.json +755 -0
  239. package/themes/neutral.theme.json +5676 -0
  240. package/themes/orange.theme.json +43 -0
  241. package/themes/playful.theme.json +219 -0
  242. package/vendor/a2ui/LICENSE.txt +203 -0
  243. package/vendor/a2ui/README.md +27 -0
  244. package/vendor/a2ui/v0_9/basic_catalog.json +1387 -0
  245. package/vendor/a2ui/v0_9/basic_catalog_rules.txt +5 -0
  246. package/vendor/a2ui/v0_9/client_capabilities.json +97 -0
  247. package/vendor/a2ui/v0_9/client_to_server.json +104 -0
  248. package/vendor/a2ui/v0_9/common_types.json +315 -0
  249. package/vendor/a2ui/v0_9/server_to_client.json +132 -0
  250. package/vendor/json-render/LICENSE.txt +201 -0
  251. package/vendor/json-render/README.md +13 -0
@@ -0,0 +1,1993 @@
1
+ {
2
+ "$comment": "Round 1 (docs/round-1-contract.md §3): the CodeBlock tokenizer contract (catalog/code.json). Inputs hand-written (name, language, code); `expected` = src/code.ts tokenizeCode: one token list per LINE, each line's tokens concatenating to exactly its text, adjacent tokens of one kind merged. Every renderer's tokenizer replays it. EXP-1324: the `ansi` cases strip ANSI CSI escapes first (SGR colours → success/warning/error/comment runs); their lines concatenate to codeText(code, `ansi`), the escape-free text.",
3
+ "cases": [
4
+ {
5
+ "name": "ts: keywords, types, functions, properties, numbers, comments, template strings",
6
+ "language": "ts",
7
+ "code": "// the answer\nconst answer: number = 42\nexport function ask(q: string): Promise<Answer> {\n return fetch(`/ask?q=${q}`).then((r) => r.json())\n}",
8
+ "expected": [
9
+ [
10
+ {
11
+ "kind": "comment",
12
+ "text": "// the answer"
13
+ }
14
+ ],
15
+ [
16
+ {
17
+ "kind": "keyword",
18
+ "text": "const"
19
+ },
20
+ {
21
+ "kind": "plain",
22
+ "text": " answer"
23
+ },
24
+ {
25
+ "kind": "operator",
26
+ "text": ":"
27
+ },
28
+ {
29
+ "kind": "plain",
30
+ "text": " "
31
+ },
32
+ {
33
+ "kind": "type",
34
+ "text": "number"
35
+ },
36
+ {
37
+ "kind": "plain",
38
+ "text": " "
39
+ },
40
+ {
41
+ "kind": "operator",
42
+ "text": "="
43
+ },
44
+ {
45
+ "kind": "plain",
46
+ "text": " "
47
+ },
48
+ {
49
+ "kind": "number",
50
+ "text": "42"
51
+ }
52
+ ],
53
+ [
54
+ {
55
+ "kind": "keyword",
56
+ "text": "export"
57
+ },
58
+ {
59
+ "kind": "plain",
60
+ "text": " "
61
+ },
62
+ {
63
+ "kind": "keyword",
64
+ "text": "function"
65
+ },
66
+ {
67
+ "kind": "plain",
68
+ "text": " "
69
+ },
70
+ {
71
+ "kind": "function",
72
+ "text": "ask"
73
+ },
74
+ {
75
+ "kind": "punctuation",
76
+ "text": "("
77
+ },
78
+ {
79
+ "kind": "plain",
80
+ "text": "q"
81
+ },
82
+ {
83
+ "kind": "operator",
84
+ "text": ":"
85
+ },
86
+ {
87
+ "kind": "plain",
88
+ "text": " "
89
+ },
90
+ {
91
+ "kind": "type",
92
+ "text": "string"
93
+ },
94
+ {
95
+ "kind": "punctuation",
96
+ "text": ")"
97
+ },
98
+ {
99
+ "kind": "operator",
100
+ "text": ":"
101
+ },
102
+ {
103
+ "kind": "plain",
104
+ "text": " "
105
+ },
106
+ {
107
+ "kind": "type",
108
+ "text": "Promise"
109
+ },
110
+ {
111
+ "kind": "operator",
112
+ "text": "<"
113
+ },
114
+ {
115
+ "kind": "type",
116
+ "text": "Answer"
117
+ },
118
+ {
119
+ "kind": "operator",
120
+ "text": ">"
121
+ },
122
+ {
123
+ "kind": "plain",
124
+ "text": " "
125
+ },
126
+ {
127
+ "kind": "punctuation",
128
+ "text": "{"
129
+ }
130
+ ],
131
+ [
132
+ {
133
+ "kind": "plain",
134
+ "text": " "
135
+ },
136
+ {
137
+ "kind": "keyword",
138
+ "text": "return"
139
+ },
140
+ {
141
+ "kind": "plain",
142
+ "text": " "
143
+ },
144
+ {
145
+ "kind": "function",
146
+ "text": "fetch"
147
+ },
148
+ {
149
+ "kind": "punctuation",
150
+ "text": "("
151
+ },
152
+ {
153
+ "kind": "string",
154
+ "text": "`/ask?q=${q}`"
155
+ },
156
+ {
157
+ "kind": "punctuation",
158
+ "text": ")."
159
+ },
160
+ {
161
+ "kind": "function",
162
+ "text": "then"
163
+ },
164
+ {
165
+ "kind": "punctuation",
166
+ "text": "(("
167
+ },
168
+ {
169
+ "kind": "plain",
170
+ "text": "r"
171
+ },
172
+ {
173
+ "kind": "punctuation",
174
+ "text": ")"
175
+ },
176
+ {
177
+ "kind": "plain",
178
+ "text": " "
179
+ },
180
+ {
181
+ "kind": "operator",
182
+ "text": "=>"
183
+ },
184
+ {
185
+ "kind": "plain",
186
+ "text": " r"
187
+ },
188
+ {
189
+ "kind": "punctuation",
190
+ "text": "."
191
+ },
192
+ {
193
+ "kind": "function",
194
+ "text": "json"
195
+ },
196
+ {
197
+ "kind": "punctuation",
198
+ "text": "())"
199
+ }
200
+ ],
201
+ [
202
+ {
203
+ "kind": "punctuation",
204
+ "text": "}"
205
+ }
206
+ ]
207
+ ]
208
+ },
209
+ {
210
+ "name": "js: a block comment across lines and an escaped quote",
211
+ "language": "js",
212
+ "code": "/* multi\n line */\nlet s = 'it\\'s' + 0x1F + .5",
213
+ "expected": [
214
+ [
215
+ {
216
+ "kind": "comment",
217
+ "text": "/* multi"
218
+ }
219
+ ],
220
+ [
221
+ {
222
+ "kind": "comment",
223
+ "text": " line */"
224
+ }
225
+ ],
226
+ [
227
+ {
228
+ "kind": "keyword",
229
+ "text": "let"
230
+ },
231
+ {
232
+ "kind": "plain",
233
+ "text": " s "
234
+ },
235
+ {
236
+ "kind": "operator",
237
+ "text": "="
238
+ },
239
+ {
240
+ "kind": "plain",
241
+ "text": " "
242
+ },
243
+ {
244
+ "kind": "string",
245
+ "text": "'it\\'s'"
246
+ },
247
+ {
248
+ "kind": "plain",
249
+ "text": " "
250
+ },
251
+ {
252
+ "kind": "operator",
253
+ "text": "+"
254
+ },
255
+ {
256
+ "kind": "plain",
257
+ "text": " "
258
+ },
259
+ {
260
+ "kind": "number",
261
+ "text": "0x1F"
262
+ },
263
+ {
264
+ "kind": "plain",
265
+ "text": " "
266
+ },
267
+ {
268
+ "kind": "operator",
269
+ "text": "+"
270
+ },
271
+ {
272
+ "kind": "plain",
273
+ "text": " "
274
+ },
275
+ {
276
+ "kind": "number",
277
+ "text": ".5"
278
+ }
279
+ ]
280
+ ]
281
+ },
282
+ {
283
+ "name": "tsx: JSX reads as operators and identifiers (no markup mode)",
284
+ "language": "tsx",
285
+ "code": "export const App = () => <Button variant=\"ghost\">Go</Button>",
286
+ "expected": [
287
+ [
288
+ {
289
+ "kind": "keyword",
290
+ "text": "export"
291
+ },
292
+ {
293
+ "kind": "plain",
294
+ "text": " "
295
+ },
296
+ {
297
+ "kind": "keyword",
298
+ "text": "const"
299
+ },
300
+ {
301
+ "kind": "plain",
302
+ "text": " "
303
+ },
304
+ {
305
+ "kind": "type",
306
+ "text": "App"
307
+ },
308
+ {
309
+ "kind": "plain",
310
+ "text": " "
311
+ },
312
+ {
313
+ "kind": "operator",
314
+ "text": "="
315
+ },
316
+ {
317
+ "kind": "plain",
318
+ "text": " "
319
+ },
320
+ {
321
+ "kind": "punctuation",
322
+ "text": "()"
323
+ },
324
+ {
325
+ "kind": "plain",
326
+ "text": " "
327
+ },
328
+ {
329
+ "kind": "operator",
330
+ "text": "=>"
331
+ },
332
+ {
333
+ "kind": "plain",
334
+ "text": " "
335
+ },
336
+ {
337
+ "kind": "operator",
338
+ "text": "<"
339
+ },
340
+ {
341
+ "kind": "type",
342
+ "text": "Button"
343
+ },
344
+ {
345
+ "kind": "plain",
346
+ "text": " variant"
347
+ },
348
+ {
349
+ "kind": "operator",
350
+ "text": "="
351
+ },
352
+ {
353
+ "kind": "string",
354
+ "text": "\"ghost\""
355
+ },
356
+ {
357
+ "kind": "operator",
358
+ "text": ">"
359
+ },
360
+ {
361
+ "kind": "type",
362
+ "text": "Go"
363
+ },
364
+ {
365
+ "kind": "operator",
366
+ "text": "</"
367
+ },
368
+ {
369
+ "kind": "type",
370
+ "text": "Button"
371
+ },
372
+ {
373
+ "kind": "operator",
374
+ "text": ">"
375
+ }
376
+ ]
377
+ ]
378
+ },
379
+ {
380
+ "name": "json: keys are properties",
381
+ "language": "json",
382
+ "code": "{\n \"name\": \"exp\",\n \"private\": true,\n \"count\": 3,\n \"tags\": [\"a\", null]\n}",
383
+ "expected": [
384
+ [
385
+ {
386
+ "kind": "punctuation",
387
+ "text": "{"
388
+ }
389
+ ],
390
+ [
391
+ {
392
+ "kind": "plain",
393
+ "text": " "
394
+ },
395
+ {
396
+ "kind": "property",
397
+ "text": "\"name\""
398
+ },
399
+ {
400
+ "kind": "operator",
401
+ "text": ":"
402
+ },
403
+ {
404
+ "kind": "plain",
405
+ "text": " "
406
+ },
407
+ {
408
+ "kind": "string",
409
+ "text": "\"exp\""
410
+ },
411
+ {
412
+ "kind": "punctuation",
413
+ "text": ","
414
+ }
415
+ ],
416
+ [
417
+ {
418
+ "kind": "plain",
419
+ "text": " "
420
+ },
421
+ {
422
+ "kind": "property",
423
+ "text": "\"private\""
424
+ },
425
+ {
426
+ "kind": "operator",
427
+ "text": ":"
428
+ },
429
+ {
430
+ "kind": "plain",
431
+ "text": " "
432
+ },
433
+ {
434
+ "kind": "keyword",
435
+ "text": "true"
436
+ },
437
+ {
438
+ "kind": "punctuation",
439
+ "text": ","
440
+ }
441
+ ],
442
+ [
443
+ {
444
+ "kind": "plain",
445
+ "text": " "
446
+ },
447
+ {
448
+ "kind": "property",
449
+ "text": "\"count\""
450
+ },
451
+ {
452
+ "kind": "operator",
453
+ "text": ":"
454
+ },
455
+ {
456
+ "kind": "plain",
457
+ "text": " "
458
+ },
459
+ {
460
+ "kind": "number",
461
+ "text": "3"
462
+ },
463
+ {
464
+ "kind": "punctuation",
465
+ "text": ","
466
+ }
467
+ ],
468
+ [
469
+ {
470
+ "kind": "plain",
471
+ "text": " "
472
+ },
473
+ {
474
+ "kind": "property",
475
+ "text": "\"tags\""
476
+ },
477
+ {
478
+ "kind": "operator",
479
+ "text": ":"
480
+ },
481
+ {
482
+ "kind": "plain",
483
+ "text": " "
484
+ },
485
+ {
486
+ "kind": "punctuation",
487
+ "text": "["
488
+ },
489
+ {
490
+ "kind": "string",
491
+ "text": "\"a\""
492
+ },
493
+ {
494
+ "kind": "punctuation",
495
+ "text": ","
496
+ },
497
+ {
498
+ "kind": "plain",
499
+ "text": " "
500
+ },
501
+ {
502
+ "kind": "keyword",
503
+ "text": "null"
504
+ },
505
+ {
506
+ "kind": "punctuation",
507
+ "text": "]"
508
+ }
509
+ ],
510
+ [
511
+ {
512
+ "kind": "punctuation",
513
+ "text": "}"
514
+ }
515
+ ]
516
+ ]
517
+ },
518
+ {
519
+ "name": "rust: lifetimes, macros and type names",
520
+ "language": "rust",
521
+ "code": "pub fn len(v: &Vec<u8>) -> usize {\n println!(\"{}\", v.len()); // len\n v.len()\n}",
522
+ "expected": [
523
+ [
524
+ {
525
+ "kind": "keyword",
526
+ "text": "pub"
527
+ },
528
+ {
529
+ "kind": "plain",
530
+ "text": " "
531
+ },
532
+ {
533
+ "kind": "keyword",
534
+ "text": "fn"
535
+ },
536
+ {
537
+ "kind": "plain",
538
+ "text": " "
539
+ },
540
+ {
541
+ "kind": "function",
542
+ "text": "len"
543
+ },
544
+ {
545
+ "kind": "punctuation",
546
+ "text": "("
547
+ },
548
+ {
549
+ "kind": "plain",
550
+ "text": "v"
551
+ },
552
+ {
553
+ "kind": "operator",
554
+ "text": ":"
555
+ },
556
+ {
557
+ "kind": "plain",
558
+ "text": " "
559
+ },
560
+ {
561
+ "kind": "operator",
562
+ "text": "&"
563
+ },
564
+ {
565
+ "kind": "type",
566
+ "text": "Vec"
567
+ },
568
+ {
569
+ "kind": "operator",
570
+ "text": "<"
571
+ },
572
+ {
573
+ "kind": "type",
574
+ "text": "u8"
575
+ },
576
+ {
577
+ "kind": "operator",
578
+ "text": ">"
579
+ },
580
+ {
581
+ "kind": "punctuation",
582
+ "text": ")"
583
+ },
584
+ {
585
+ "kind": "plain",
586
+ "text": " "
587
+ },
588
+ {
589
+ "kind": "operator",
590
+ "text": "->"
591
+ },
592
+ {
593
+ "kind": "plain",
594
+ "text": " "
595
+ },
596
+ {
597
+ "kind": "type",
598
+ "text": "usize"
599
+ },
600
+ {
601
+ "kind": "plain",
602
+ "text": " "
603
+ },
604
+ {
605
+ "kind": "punctuation",
606
+ "text": "{"
607
+ }
608
+ ],
609
+ [
610
+ {
611
+ "kind": "plain",
612
+ "text": " println"
613
+ },
614
+ {
615
+ "kind": "operator",
616
+ "text": "!"
617
+ },
618
+ {
619
+ "kind": "punctuation",
620
+ "text": "("
621
+ },
622
+ {
623
+ "kind": "string",
624
+ "text": "\"{}\""
625
+ },
626
+ {
627
+ "kind": "punctuation",
628
+ "text": ","
629
+ },
630
+ {
631
+ "kind": "plain",
632
+ "text": " v"
633
+ },
634
+ {
635
+ "kind": "punctuation",
636
+ "text": "."
637
+ },
638
+ {
639
+ "kind": "function",
640
+ "text": "len"
641
+ },
642
+ {
643
+ "kind": "punctuation",
644
+ "text": "());"
645
+ },
646
+ {
647
+ "kind": "plain",
648
+ "text": " "
649
+ },
650
+ {
651
+ "kind": "comment",
652
+ "text": "// len"
653
+ }
654
+ ],
655
+ [
656
+ {
657
+ "kind": "plain",
658
+ "text": " v"
659
+ },
660
+ {
661
+ "kind": "punctuation",
662
+ "text": "."
663
+ },
664
+ {
665
+ "kind": "function",
666
+ "text": "len"
667
+ },
668
+ {
669
+ "kind": "punctuation",
670
+ "text": "()"
671
+ }
672
+ ],
673
+ [
674
+ {
675
+ "kind": "punctuation",
676
+ "text": "}"
677
+ }
678
+ ]
679
+ ]
680
+ },
681
+ {
682
+ "name": "swift",
683
+ "language": "swift",
684
+ "code": "struct Card: View {\n let title: String\n var body: some View { Text(title).font(.headline) }\n}",
685
+ "expected": [
686
+ [
687
+ {
688
+ "kind": "keyword",
689
+ "text": "struct"
690
+ },
691
+ {
692
+ "kind": "plain",
693
+ "text": " "
694
+ },
695
+ {
696
+ "kind": "type",
697
+ "text": "Card"
698
+ },
699
+ {
700
+ "kind": "operator",
701
+ "text": ":"
702
+ },
703
+ {
704
+ "kind": "plain",
705
+ "text": " "
706
+ },
707
+ {
708
+ "kind": "type",
709
+ "text": "View"
710
+ },
711
+ {
712
+ "kind": "plain",
713
+ "text": " "
714
+ },
715
+ {
716
+ "kind": "punctuation",
717
+ "text": "{"
718
+ }
719
+ ],
720
+ [
721
+ {
722
+ "kind": "plain",
723
+ "text": " "
724
+ },
725
+ {
726
+ "kind": "keyword",
727
+ "text": "let"
728
+ },
729
+ {
730
+ "kind": "plain",
731
+ "text": " title"
732
+ },
733
+ {
734
+ "kind": "operator",
735
+ "text": ":"
736
+ },
737
+ {
738
+ "kind": "plain",
739
+ "text": " "
740
+ },
741
+ {
742
+ "kind": "type",
743
+ "text": "String"
744
+ }
745
+ ],
746
+ [
747
+ {
748
+ "kind": "plain",
749
+ "text": " "
750
+ },
751
+ {
752
+ "kind": "keyword",
753
+ "text": "var"
754
+ },
755
+ {
756
+ "kind": "plain",
757
+ "text": " body"
758
+ },
759
+ {
760
+ "kind": "operator",
761
+ "text": ":"
762
+ },
763
+ {
764
+ "kind": "plain",
765
+ "text": " "
766
+ },
767
+ {
768
+ "kind": "keyword",
769
+ "text": "some"
770
+ },
771
+ {
772
+ "kind": "plain",
773
+ "text": " "
774
+ },
775
+ {
776
+ "kind": "type",
777
+ "text": "View"
778
+ },
779
+ {
780
+ "kind": "plain",
781
+ "text": " "
782
+ },
783
+ {
784
+ "kind": "punctuation",
785
+ "text": "{"
786
+ },
787
+ {
788
+ "kind": "plain",
789
+ "text": " "
790
+ },
791
+ {
792
+ "kind": "function",
793
+ "text": "Text"
794
+ },
795
+ {
796
+ "kind": "punctuation",
797
+ "text": "("
798
+ },
799
+ {
800
+ "kind": "plain",
801
+ "text": "title"
802
+ },
803
+ {
804
+ "kind": "punctuation",
805
+ "text": ")."
806
+ },
807
+ {
808
+ "kind": "function",
809
+ "text": "font"
810
+ },
811
+ {
812
+ "kind": "punctuation",
813
+ "text": "(."
814
+ },
815
+ {
816
+ "kind": "property",
817
+ "text": "headline"
818
+ },
819
+ {
820
+ "kind": "punctuation",
821
+ "text": ")"
822
+ },
823
+ {
824
+ "kind": "plain",
825
+ "text": " "
826
+ },
827
+ {
828
+ "kind": "punctuation",
829
+ "text": "}"
830
+ }
831
+ ],
832
+ [
833
+ {
834
+ "kind": "punctuation",
835
+ "text": "}"
836
+ }
837
+ ]
838
+ ]
839
+ },
840
+ {
841
+ "name": "kotlin",
842
+ "language": "kotlin",
843
+ "code": "data class Seat(val count: Int)\nfun main() { println(Seat(3).count) }",
844
+ "expected": [
845
+ [
846
+ {
847
+ "kind": "keyword",
848
+ "text": "data"
849
+ },
850
+ {
851
+ "kind": "plain",
852
+ "text": " "
853
+ },
854
+ {
855
+ "kind": "keyword",
856
+ "text": "class"
857
+ },
858
+ {
859
+ "kind": "plain",
860
+ "text": " "
861
+ },
862
+ {
863
+ "kind": "function",
864
+ "text": "Seat"
865
+ },
866
+ {
867
+ "kind": "punctuation",
868
+ "text": "("
869
+ },
870
+ {
871
+ "kind": "keyword",
872
+ "text": "val"
873
+ },
874
+ {
875
+ "kind": "plain",
876
+ "text": " count"
877
+ },
878
+ {
879
+ "kind": "operator",
880
+ "text": ":"
881
+ },
882
+ {
883
+ "kind": "plain",
884
+ "text": " "
885
+ },
886
+ {
887
+ "kind": "type",
888
+ "text": "Int"
889
+ },
890
+ {
891
+ "kind": "punctuation",
892
+ "text": ")"
893
+ }
894
+ ],
895
+ [
896
+ {
897
+ "kind": "keyword",
898
+ "text": "fun"
899
+ },
900
+ {
901
+ "kind": "plain",
902
+ "text": " "
903
+ },
904
+ {
905
+ "kind": "function",
906
+ "text": "main"
907
+ },
908
+ {
909
+ "kind": "punctuation",
910
+ "text": "()"
911
+ },
912
+ {
913
+ "kind": "plain",
914
+ "text": " "
915
+ },
916
+ {
917
+ "kind": "punctuation",
918
+ "text": "{"
919
+ },
920
+ {
921
+ "kind": "plain",
922
+ "text": " "
923
+ },
924
+ {
925
+ "kind": "function",
926
+ "text": "println"
927
+ },
928
+ {
929
+ "kind": "punctuation",
930
+ "text": "("
931
+ },
932
+ {
933
+ "kind": "function",
934
+ "text": "Seat"
935
+ },
936
+ {
937
+ "kind": "punctuation",
938
+ "text": "("
939
+ },
940
+ {
941
+ "kind": "number",
942
+ "text": "3"
943
+ },
944
+ {
945
+ "kind": "punctuation",
946
+ "text": ")."
947
+ },
948
+ {
949
+ "kind": "property",
950
+ "text": "count"
951
+ },
952
+ {
953
+ "kind": "punctuation",
954
+ "text": ")"
955
+ },
956
+ {
957
+ "kind": "plain",
958
+ "text": " "
959
+ },
960
+ {
961
+ "kind": "punctuation",
962
+ "text": "}"
963
+ }
964
+ ]
965
+ ]
966
+ },
967
+ {
968
+ "name": "python: decorators, def, self",
969
+ "language": "python",
970
+ "code": "@dataclass\nclass Point:\n def norm(self) -> float:\n return (self.x ** 2) ** 0.5 # length",
971
+ "expected": [
972
+ [
973
+ {
974
+ "kind": "operator",
975
+ "text": "@"
976
+ },
977
+ {
978
+ "kind": "plain",
979
+ "text": "dataclass"
980
+ }
981
+ ],
982
+ [
983
+ {
984
+ "kind": "keyword",
985
+ "text": "class"
986
+ },
987
+ {
988
+ "kind": "plain",
989
+ "text": " "
990
+ },
991
+ {
992
+ "kind": "type",
993
+ "text": "Point"
994
+ },
995
+ {
996
+ "kind": "operator",
997
+ "text": ":"
998
+ }
999
+ ],
1000
+ [
1001
+ {
1002
+ "kind": "plain",
1003
+ "text": " "
1004
+ },
1005
+ {
1006
+ "kind": "keyword",
1007
+ "text": "def"
1008
+ },
1009
+ {
1010
+ "kind": "plain",
1011
+ "text": " "
1012
+ },
1013
+ {
1014
+ "kind": "function",
1015
+ "text": "norm"
1016
+ },
1017
+ {
1018
+ "kind": "punctuation",
1019
+ "text": "("
1020
+ },
1021
+ {
1022
+ "kind": "keyword",
1023
+ "text": "self"
1024
+ },
1025
+ {
1026
+ "kind": "punctuation",
1027
+ "text": ")"
1028
+ },
1029
+ {
1030
+ "kind": "plain",
1031
+ "text": " "
1032
+ },
1033
+ {
1034
+ "kind": "operator",
1035
+ "text": "->"
1036
+ },
1037
+ {
1038
+ "kind": "plain",
1039
+ "text": " float"
1040
+ },
1041
+ {
1042
+ "kind": "operator",
1043
+ "text": ":"
1044
+ }
1045
+ ],
1046
+ [
1047
+ {
1048
+ "kind": "plain",
1049
+ "text": " "
1050
+ },
1051
+ {
1052
+ "kind": "keyword",
1053
+ "text": "return"
1054
+ },
1055
+ {
1056
+ "kind": "plain",
1057
+ "text": " "
1058
+ },
1059
+ {
1060
+ "kind": "punctuation",
1061
+ "text": "("
1062
+ },
1063
+ {
1064
+ "kind": "keyword",
1065
+ "text": "self"
1066
+ },
1067
+ {
1068
+ "kind": "punctuation",
1069
+ "text": "."
1070
+ },
1071
+ {
1072
+ "kind": "property",
1073
+ "text": "x"
1074
+ },
1075
+ {
1076
+ "kind": "plain",
1077
+ "text": " "
1078
+ },
1079
+ {
1080
+ "kind": "operator",
1081
+ "text": "**"
1082
+ },
1083
+ {
1084
+ "kind": "plain",
1085
+ "text": " "
1086
+ },
1087
+ {
1088
+ "kind": "number",
1089
+ "text": "2"
1090
+ },
1091
+ {
1092
+ "kind": "punctuation",
1093
+ "text": ")"
1094
+ },
1095
+ {
1096
+ "kind": "plain",
1097
+ "text": " "
1098
+ },
1099
+ {
1100
+ "kind": "operator",
1101
+ "text": "**"
1102
+ },
1103
+ {
1104
+ "kind": "plain",
1105
+ "text": " "
1106
+ },
1107
+ {
1108
+ "kind": "number",
1109
+ "text": "0.5"
1110
+ },
1111
+ {
1112
+ "kind": "plain",
1113
+ "text": " "
1114
+ },
1115
+ {
1116
+ "kind": "comment",
1117
+ "text": "# length"
1118
+ }
1119
+ ]
1120
+ ]
1121
+ },
1122
+ {
1123
+ "name": "bash: an unterminated quote runs across lines (multiline quotes)",
1124
+ "language": "bash",
1125
+ "code": "if [ -f \"$HOME/.rc\" ]; then\n echo 'loaded\nfi",
1126
+ "expected": [
1127
+ [
1128
+ {
1129
+ "kind": "keyword",
1130
+ "text": "if"
1131
+ },
1132
+ {
1133
+ "kind": "plain",
1134
+ "text": " "
1135
+ },
1136
+ {
1137
+ "kind": "punctuation",
1138
+ "text": "["
1139
+ },
1140
+ {
1141
+ "kind": "plain",
1142
+ "text": " "
1143
+ },
1144
+ {
1145
+ "kind": "operator",
1146
+ "text": "-"
1147
+ },
1148
+ {
1149
+ "kind": "plain",
1150
+ "text": "f "
1151
+ },
1152
+ {
1153
+ "kind": "string",
1154
+ "text": "\"$HOME/.rc\""
1155
+ },
1156
+ {
1157
+ "kind": "plain",
1158
+ "text": " "
1159
+ },
1160
+ {
1161
+ "kind": "punctuation",
1162
+ "text": "];"
1163
+ },
1164
+ {
1165
+ "kind": "plain",
1166
+ "text": " "
1167
+ },
1168
+ {
1169
+ "kind": "keyword",
1170
+ "text": "then"
1171
+ }
1172
+ ],
1173
+ [
1174
+ {
1175
+ "kind": "plain",
1176
+ "text": " "
1177
+ },
1178
+ {
1179
+ "kind": "keyword",
1180
+ "text": "echo"
1181
+ },
1182
+ {
1183
+ "kind": "plain",
1184
+ "text": " "
1185
+ },
1186
+ {
1187
+ "kind": "string",
1188
+ "text": "'loaded"
1189
+ }
1190
+ ],
1191
+ [
1192
+ {
1193
+ "kind": "string",
1194
+ "text": "fi"
1195
+ }
1196
+ ]
1197
+ ]
1198
+ },
1199
+ {
1200
+ "name": "html: tags, attributes and a comment",
1201
+ "language": "html",
1202
+ "code": "<!-- card -->\n<div class=\"card\" data-id='7'>\n <img src=\"a.png\" alt=\"\" />Hi &amp; bye\n</div>",
1203
+ "expected": [
1204
+ [
1205
+ {
1206
+ "kind": "comment",
1207
+ "text": "<!-- card -->"
1208
+ }
1209
+ ],
1210
+ [
1211
+ {
1212
+ "kind": "punctuation",
1213
+ "text": "<"
1214
+ },
1215
+ {
1216
+ "kind": "tag",
1217
+ "text": "div"
1218
+ },
1219
+ {
1220
+ "kind": "plain",
1221
+ "text": " "
1222
+ },
1223
+ {
1224
+ "kind": "attribute",
1225
+ "text": "class"
1226
+ },
1227
+ {
1228
+ "kind": "operator",
1229
+ "text": "="
1230
+ },
1231
+ {
1232
+ "kind": "string",
1233
+ "text": "\"card\""
1234
+ },
1235
+ {
1236
+ "kind": "plain",
1237
+ "text": " "
1238
+ },
1239
+ {
1240
+ "kind": "attribute",
1241
+ "text": "data-id"
1242
+ },
1243
+ {
1244
+ "kind": "operator",
1245
+ "text": "="
1246
+ },
1247
+ {
1248
+ "kind": "string",
1249
+ "text": "'7'"
1250
+ },
1251
+ {
1252
+ "kind": "punctuation",
1253
+ "text": ">"
1254
+ }
1255
+ ],
1256
+ [
1257
+ {
1258
+ "kind": "plain",
1259
+ "text": " "
1260
+ },
1261
+ {
1262
+ "kind": "punctuation",
1263
+ "text": "<"
1264
+ },
1265
+ {
1266
+ "kind": "tag",
1267
+ "text": "img"
1268
+ },
1269
+ {
1270
+ "kind": "plain",
1271
+ "text": " "
1272
+ },
1273
+ {
1274
+ "kind": "attribute",
1275
+ "text": "src"
1276
+ },
1277
+ {
1278
+ "kind": "operator",
1279
+ "text": "="
1280
+ },
1281
+ {
1282
+ "kind": "string",
1283
+ "text": "\"a.png\""
1284
+ },
1285
+ {
1286
+ "kind": "plain",
1287
+ "text": " "
1288
+ },
1289
+ {
1290
+ "kind": "attribute",
1291
+ "text": "alt"
1292
+ },
1293
+ {
1294
+ "kind": "operator",
1295
+ "text": "="
1296
+ },
1297
+ {
1298
+ "kind": "string",
1299
+ "text": "\"\""
1300
+ },
1301
+ {
1302
+ "kind": "plain",
1303
+ "text": " "
1304
+ },
1305
+ {
1306
+ "kind": "punctuation",
1307
+ "text": "/>"
1308
+ },
1309
+ {
1310
+ "kind": "plain",
1311
+ "text": "Hi &amp; bye"
1312
+ }
1313
+ ],
1314
+ [
1315
+ {
1316
+ "kind": "punctuation",
1317
+ "text": "</"
1318
+ },
1319
+ {
1320
+ "kind": "tag",
1321
+ "text": "div"
1322
+ },
1323
+ {
1324
+ "kind": "punctuation",
1325
+ "text": ">"
1326
+ }
1327
+ ]
1328
+ ]
1329
+ },
1330
+ {
1331
+ "name": "css: selectors, properties, at-rules, units",
1332
+ "language": "css",
1333
+ "code": "@media (min-width: 768px) {\n .card:hover { color: #fff; margin: 0 -4px; }\n}",
1334
+ "expected": [
1335
+ [
1336
+ {
1337
+ "kind": "keyword",
1338
+ "text": "@media"
1339
+ },
1340
+ {
1341
+ "kind": "plain",
1342
+ "text": " "
1343
+ },
1344
+ {
1345
+ "kind": "punctuation",
1346
+ "text": "("
1347
+ },
1348
+ {
1349
+ "kind": "property",
1350
+ "text": "min-width"
1351
+ },
1352
+ {
1353
+ "kind": "operator",
1354
+ "text": ":"
1355
+ },
1356
+ {
1357
+ "kind": "plain",
1358
+ "text": " "
1359
+ },
1360
+ {
1361
+ "kind": "number",
1362
+ "text": "768px"
1363
+ },
1364
+ {
1365
+ "kind": "punctuation",
1366
+ "text": ")"
1367
+ },
1368
+ {
1369
+ "kind": "plain",
1370
+ "text": " "
1371
+ },
1372
+ {
1373
+ "kind": "punctuation",
1374
+ "text": "{"
1375
+ }
1376
+ ],
1377
+ [
1378
+ {
1379
+ "kind": "plain",
1380
+ "text": " "
1381
+ },
1382
+ {
1383
+ "kind": "punctuation",
1384
+ "text": "."
1385
+ },
1386
+ {
1387
+ "kind": "property",
1388
+ "text": "card"
1389
+ },
1390
+ {
1391
+ "kind": "operator",
1392
+ "text": ":"
1393
+ },
1394
+ {
1395
+ "kind": "plain",
1396
+ "text": "hover "
1397
+ },
1398
+ {
1399
+ "kind": "punctuation",
1400
+ "text": "{"
1401
+ },
1402
+ {
1403
+ "kind": "plain",
1404
+ "text": " "
1405
+ },
1406
+ {
1407
+ "kind": "property",
1408
+ "text": "color"
1409
+ },
1410
+ {
1411
+ "kind": "operator",
1412
+ "text": ":"
1413
+ },
1414
+ {
1415
+ "kind": "plain",
1416
+ "text": " "
1417
+ },
1418
+ {
1419
+ "kind": "operator",
1420
+ "text": "#"
1421
+ },
1422
+ {
1423
+ "kind": "plain",
1424
+ "text": "fff"
1425
+ },
1426
+ {
1427
+ "kind": "punctuation",
1428
+ "text": ";"
1429
+ },
1430
+ {
1431
+ "kind": "plain",
1432
+ "text": " "
1433
+ },
1434
+ {
1435
+ "kind": "property",
1436
+ "text": "margin"
1437
+ },
1438
+ {
1439
+ "kind": "operator",
1440
+ "text": ":"
1441
+ },
1442
+ {
1443
+ "kind": "plain",
1444
+ "text": " "
1445
+ },
1446
+ {
1447
+ "kind": "number",
1448
+ "text": "0"
1449
+ },
1450
+ {
1451
+ "kind": "plain",
1452
+ "text": " -4px"
1453
+ },
1454
+ {
1455
+ "kind": "punctuation",
1456
+ "text": ";"
1457
+ },
1458
+ {
1459
+ "kind": "plain",
1460
+ "text": " "
1461
+ },
1462
+ {
1463
+ "kind": "punctuation",
1464
+ "text": "}"
1465
+ }
1466
+ ],
1467
+ [
1468
+ {
1469
+ "kind": "punctuation",
1470
+ "text": "}"
1471
+ }
1472
+ ]
1473
+ ]
1474
+ },
1475
+ {
1476
+ "name": "sql: keywords are case-insensitive",
1477
+ "language": "sql",
1478
+ "code": "SELECT id, name FROM users\nwhere created_at > '2026-01-01' -- recent\nORDER BY name;",
1479
+ "expected": [
1480
+ [
1481
+ {
1482
+ "kind": "keyword",
1483
+ "text": "SELECT"
1484
+ },
1485
+ {
1486
+ "kind": "plain",
1487
+ "text": " id"
1488
+ },
1489
+ {
1490
+ "kind": "punctuation",
1491
+ "text": ","
1492
+ },
1493
+ {
1494
+ "kind": "plain",
1495
+ "text": " name "
1496
+ },
1497
+ {
1498
+ "kind": "keyword",
1499
+ "text": "FROM"
1500
+ },
1501
+ {
1502
+ "kind": "plain",
1503
+ "text": " users"
1504
+ }
1505
+ ],
1506
+ [
1507
+ {
1508
+ "kind": "keyword",
1509
+ "text": "where"
1510
+ },
1511
+ {
1512
+ "kind": "plain",
1513
+ "text": " created_at "
1514
+ },
1515
+ {
1516
+ "kind": "operator",
1517
+ "text": ">"
1518
+ },
1519
+ {
1520
+ "kind": "plain",
1521
+ "text": " "
1522
+ },
1523
+ {
1524
+ "kind": "string",
1525
+ "text": "'2026-01-01'"
1526
+ },
1527
+ {
1528
+ "kind": "plain",
1529
+ "text": " "
1530
+ },
1531
+ {
1532
+ "kind": "comment",
1533
+ "text": "-- recent"
1534
+ }
1535
+ ],
1536
+ [
1537
+ {
1538
+ "kind": "keyword",
1539
+ "text": "ORDER"
1540
+ },
1541
+ {
1542
+ "kind": "plain",
1543
+ "text": " "
1544
+ },
1545
+ {
1546
+ "kind": "keyword",
1547
+ "text": "BY"
1548
+ },
1549
+ {
1550
+ "kind": "plain",
1551
+ "text": " name"
1552
+ },
1553
+ {
1554
+ "kind": "punctuation",
1555
+ "text": ";"
1556
+ }
1557
+ ]
1558
+ ]
1559
+ },
1560
+ {
1561
+ "name": "yaml: keys, booleans, comments",
1562
+ "language": "yaml",
1563
+ "code": "name: exp # the app\nprivate: true\nlist:\n - one\n - \"two\"",
1564
+ "expected": [
1565
+ [
1566
+ {
1567
+ "kind": "property",
1568
+ "text": "name"
1569
+ },
1570
+ {
1571
+ "kind": "operator",
1572
+ "text": ":"
1573
+ },
1574
+ {
1575
+ "kind": "plain",
1576
+ "text": " exp "
1577
+ },
1578
+ {
1579
+ "kind": "comment",
1580
+ "text": "# the app"
1581
+ }
1582
+ ],
1583
+ [
1584
+ {
1585
+ "kind": "property",
1586
+ "text": "private"
1587
+ },
1588
+ {
1589
+ "kind": "operator",
1590
+ "text": ":"
1591
+ },
1592
+ {
1593
+ "kind": "plain",
1594
+ "text": " "
1595
+ },
1596
+ {
1597
+ "kind": "keyword",
1598
+ "text": "true"
1599
+ }
1600
+ ],
1601
+ [
1602
+ {
1603
+ "kind": "property",
1604
+ "text": "list"
1605
+ },
1606
+ {
1607
+ "kind": "operator",
1608
+ "text": ":"
1609
+ }
1610
+ ],
1611
+ [
1612
+ {
1613
+ "kind": "plain",
1614
+ "text": " - one"
1615
+ }
1616
+ ],
1617
+ [
1618
+ {
1619
+ "kind": "plain",
1620
+ "text": " - "
1621
+ },
1622
+ {
1623
+ "kind": "string",
1624
+ "text": "\"two\""
1625
+ }
1626
+ ]
1627
+ ]
1628
+ },
1629
+ {
1630
+ "name": "markdown: headings, quotes and code spans only",
1631
+ "language": "markdown",
1632
+ "code": "# Title\n\n> a quote\nSome `code` and *emphasis* - 3 items.",
1633
+ "expected": [
1634
+ [
1635
+ {
1636
+ "kind": "keyword",
1637
+ "text": "# Title"
1638
+ }
1639
+ ],
1640
+ [],
1641
+ [
1642
+ {
1643
+ "kind": "comment",
1644
+ "text": "> a quote"
1645
+ }
1646
+ ],
1647
+ [
1648
+ {
1649
+ "kind": "plain",
1650
+ "text": "Some "
1651
+ },
1652
+ {
1653
+ "kind": "string",
1654
+ "text": "`code`"
1655
+ },
1656
+ {
1657
+ "kind": "plain",
1658
+ "text": " and *emphasis* - 3 items."
1659
+ }
1660
+ ]
1661
+ ]
1662
+ },
1663
+ {
1664
+ "name": "plain: one token per line, CRLF normalised, empty lines kept",
1665
+ "language": "plain",
1666
+ "code": "first line\r\n\r\nthird line",
1667
+ "expected": [
1668
+ [
1669
+ {
1670
+ "kind": "plain",
1671
+ "text": "first line"
1672
+ }
1673
+ ],
1674
+ [],
1675
+ [
1676
+ {
1677
+ "kind": "plain",
1678
+ "text": "third line"
1679
+ }
1680
+ ]
1681
+ ]
1682
+ },
1683
+ {
1684
+ "name": "an unknown language tokenizes as plain",
1685
+ "language": "cobol",
1686
+ "code": "MOVE 1 TO X.",
1687
+ "expected": [
1688
+ [
1689
+ {
1690
+ "kind": "plain",
1691
+ "text": "MOVE 1 TO X."
1692
+ }
1693
+ ]
1694
+ ]
1695
+ },
1696
+ {
1697
+ "name": "an unterminated string stops at the line end",
1698
+ "language": "ts",
1699
+ "code": "const s = \"open\nconst t = 1",
1700
+ "expected": [
1701
+ [
1702
+ {
1703
+ "kind": "keyword",
1704
+ "text": "const"
1705
+ },
1706
+ {
1707
+ "kind": "plain",
1708
+ "text": " s "
1709
+ },
1710
+ {
1711
+ "kind": "operator",
1712
+ "text": "="
1713
+ },
1714
+ {
1715
+ "kind": "plain",
1716
+ "text": " "
1717
+ },
1718
+ {
1719
+ "kind": "string",
1720
+ "text": "\"open"
1721
+ }
1722
+ ],
1723
+ [
1724
+ {
1725
+ "kind": "keyword",
1726
+ "text": "const"
1727
+ },
1728
+ {
1729
+ "kind": "plain",
1730
+ "text": " t "
1731
+ },
1732
+ {
1733
+ "kind": "operator",
1734
+ "text": "="
1735
+ },
1736
+ {
1737
+ "kind": "plain",
1738
+ "text": " "
1739
+ },
1740
+ {
1741
+ "kind": "number",
1742
+ "text": "1"
1743
+ }
1744
+ ]
1745
+ ]
1746
+ },
1747
+ {
1748
+ "name": "ansi: SGR colours, a bold+red pair, resets (0, 39, empty)",
1749
+ "language": "ansi",
1750
+ "code": "\u001b[32m✓\u001b[0m warm start \u001b[2m(0.2ms)\u001b[0m\n\u001b[1;31mFAIL\u001b[39m cold start\n\u001b[33mslow\u001b[m done",
1751
+ "expected": [
1752
+ [
1753
+ {
1754
+ "kind": "success",
1755
+ "text": "✓"
1756
+ },
1757
+ {
1758
+ "kind": "plain",
1759
+ "text": " warm start "
1760
+ },
1761
+ {
1762
+ "kind": "comment",
1763
+ "text": "(0.2ms)"
1764
+ }
1765
+ ],
1766
+ [
1767
+ {
1768
+ "kind": "error",
1769
+ "text": "FAIL"
1770
+ },
1771
+ {
1772
+ "kind": "plain",
1773
+ "text": " cold start"
1774
+ }
1775
+ ],
1776
+ [
1777
+ {
1778
+ "kind": "warning",
1779
+ "text": "slow"
1780
+ },
1781
+ {
1782
+ "kind": "plain",
1783
+ "text": " done"
1784
+ }
1785
+ ]
1786
+ ]
1787
+ },
1788
+ {
1789
+ "name": "ansi: other params keep the colour; bright colours; non-SGR CSI removed",
1790
+ "language": "ansi",
1791
+ "code": "\u001b[91merror \u001b[1mbold\u001b[22m still red\u001b[0m\n\u001b[2K\u001b[92mok\u001b[0m \u001b[90mdim\u001b[0m \u001b[93mwarn\u001b[0m",
1792
+ "expected": [
1793
+ [
1794
+ {
1795
+ "kind": "error",
1796
+ "text": "error bold still red"
1797
+ }
1798
+ ],
1799
+ [
1800
+ {
1801
+ "kind": "success",
1802
+ "text": "ok"
1803
+ },
1804
+ {
1805
+ "kind": "plain",
1806
+ "text": " "
1807
+ },
1808
+ {
1809
+ "kind": "comment",
1810
+ "text": "dim"
1811
+ },
1812
+ {
1813
+ "kind": "plain",
1814
+ "text": " "
1815
+ },
1816
+ {
1817
+ "kind": "warning",
1818
+ "text": "warn"
1819
+ }
1820
+ ]
1821
+ ]
1822
+ },
1823
+ {
1824
+ "name": "ansi: lineKinds prefixes on uncoloured lines (longest wins, indent allowed)",
1825
+ "language": "ansi",
1826
+ "code": "$ ./gradlew :app:startupProfile\n> Task :app:compileKotlin\nwarning: unused variable\nerror[E0425]: cannot find value\nFAILED tests/test_startup.py::test_cold\nFAIL src/a.test.ts\n PASS src/b.test.ts\n(pass) Store > put\n(fail) Store > get\n✗ cold start\nplain output 42",
1827
+ "expected": [
1828
+ [
1829
+ {
1830
+ "kind": "comment",
1831
+ "text": "$ ./gradlew :app:startupProfile"
1832
+ }
1833
+ ],
1834
+ [
1835
+ {
1836
+ "kind": "comment",
1837
+ "text": "> Task :app:compileKotlin"
1838
+ }
1839
+ ],
1840
+ [
1841
+ {
1842
+ "kind": "warning",
1843
+ "text": "warning: unused variable"
1844
+ }
1845
+ ],
1846
+ [
1847
+ {
1848
+ "kind": "error",
1849
+ "text": "error[E0425]: cannot find value"
1850
+ }
1851
+ ],
1852
+ [
1853
+ {
1854
+ "kind": "error",
1855
+ "text": "FAILED tests/test_startup.py::test_cold"
1856
+ }
1857
+ ],
1858
+ [
1859
+ {
1860
+ "kind": "error",
1861
+ "text": "FAIL src/a.test.ts"
1862
+ }
1863
+ ],
1864
+ [
1865
+ {
1866
+ "kind": "plain",
1867
+ "text": " "
1868
+ },
1869
+ {
1870
+ "kind": "success",
1871
+ "text": "PASS src/b.test.ts"
1872
+ }
1873
+ ],
1874
+ [
1875
+ {
1876
+ "kind": "success",
1877
+ "text": "(pass) Store > put"
1878
+ }
1879
+ ],
1880
+ [
1881
+ {
1882
+ "kind": "error",
1883
+ "text": "(fail) Store > get"
1884
+ }
1885
+ ],
1886
+ [
1887
+ {
1888
+ "kind": "error",
1889
+ "text": "✗ cold start"
1890
+ }
1891
+ ],
1892
+ [
1893
+ {
1894
+ "kind": "plain",
1895
+ "text": "plain output 42"
1896
+ }
1897
+ ]
1898
+ ]
1899
+ },
1900
+ {
1901
+ "name": "ansi: an escape-only line stays an empty line; a run mid-line is no line start",
1902
+ "language": "ansi",
1903
+ "code": "\u001b[0m\n\u001b[2mtime \u001b[0mFAIL is not a prefix here\n\u001b[32m\u001b[0mPASS after an empty colour run",
1904
+ "expected": [
1905
+ [],
1906
+ [
1907
+ {
1908
+ "kind": "comment",
1909
+ "text": "time "
1910
+ },
1911
+ {
1912
+ "kind": "plain",
1913
+ "text": "FAIL is not a prefix here"
1914
+ }
1915
+ ],
1916
+ [
1917
+ {
1918
+ "kind": "success",
1919
+ "text": "PASS after an empty colour run"
1920
+ }
1921
+ ]
1922
+ ]
1923
+ },
1924
+ {
1925
+ "name": "ansi: gradle BUILD SUCCESSFUL",
1926
+ "language": "ansi",
1927
+ "code": "> Task :app:test\n\nBUILD SUCCESSFUL in 41s\n12 actionable tasks: 3 executed, 9 up-to-date",
1928
+ "expected": [
1929
+ [
1930
+ {
1931
+ "kind": "comment",
1932
+ "text": "> Task :app:test"
1933
+ }
1934
+ ],
1935
+ [],
1936
+ [
1937
+ {
1938
+ "kind": "success",
1939
+ "text": "BUILD SUCCESSFUL in 41s"
1940
+ }
1941
+ ],
1942
+ [
1943
+ {
1944
+ "kind": "plain",
1945
+ "text": "12 actionable tasks: 3 executed, 9 up-to-date"
1946
+ }
1947
+ ]
1948
+ ]
1949
+ },
1950
+ {
1951
+ "name": "ansi: cargo test result: FAILED, CRLF normalised, an incomplete escape stays",
1952
+ "language": "ansi",
1953
+ "code": "running 2 tests\r\ntest startup::cold_start ... \u001b[31mFAILED\u001b[0m\r\n\r\ntest result: FAILED. 1 passed; 1 failed; 0 ignored\r\ntest result: ok. 2 passed\r\nlast \u001b[3",
1954
+ "expected": [
1955
+ [
1956
+ {
1957
+ "kind": "plain",
1958
+ "text": "running 2 tests"
1959
+ }
1960
+ ],
1961
+ [
1962
+ {
1963
+ "kind": "plain",
1964
+ "text": "test startup::cold_start ... "
1965
+ },
1966
+ {
1967
+ "kind": "error",
1968
+ "text": "FAILED"
1969
+ }
1970
+ ],
1971
+ [],
1972
+ [
1973
+ {
1974
+ "kind": "error",
1975
+ "text": "test result: FAILED. 1 passed; 1 failed; 0 ignored"
1976
+ }
1977
+ ],
1978
+ [
1979
+ {
1980
+ "kind": "success",
1981
+ "text": "test result: ok. 2 passed"
1982
+ }
1983
+ ],
1984
+ [
1985
+ {
1986
+ "kind": "plain",
1987
+ "text": "last \u001b[3"
1988
+ }
1989
+ ]
1990
+ ]
1991
+ }
1992
+ ]
1993
+ }