PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.9.2
Code Block Pro – Beautiful Syntax Highlighting v1.9.2
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / clarity.tmLanguage.json

clarity.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.9.2, at build/shiki/languages/clarity.tmLanguage.json

870 lines 23.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3 "name": "clarity",
4 "scopeName": "source.clar",
5 "uuid": "f9e9871d-2ea6-4be0-afd2-fc382d704716",
6 "patterns": [
7 {
8 "include": "#expression"
9 },
10 {
11 "include": "#define-constant"
12 },
13 {
14 "include": "#define-data-var"
15 },
16 {
17 "include": "#define-map"
18 },
19 {
20 "include": "#define-function"
21 },
22 {
23 "include": "#define-fungible-token"
24 },
25 {
26 "include": "#define-non-fungible-token"
27 },
28 {
29 "include": "#define-trait"
30 },
31 {
32 "include": "#use-trait"
33 }
34 ],
35 "repository": {
36 "comment": {
37 "name": "comment.line.semicolon.clarity",
38 "match": "(?x) (?<=^|[()\\[\\]{}\",'`;\\s]) (;) .* $"
39 },
40 "expression": {
41 "patterns": [
42 {
43 "include": "#comment"
44 },
45 {
46 "include": "#keyword"
47 },
48 {
49 "include": "#literal"
50 },
51 {
52 "include": "#let-func"
53 },
54 {
55 "include": "#built-in-func"
56 },
57 {
58 "include": "#get-set-func"
59 }
60 ]
61 },
62 "keyword": {
63 "name": "constant.language.clarity",
64 "match": "\\b(?:block-height|burn-block-height|contract-caller|is-in-regtest|stx-liquid-supply|tx-sender)\\b"
65 },
66 "define-function": {
67 "begin": "(?x) (\\() \\s* (define-(?:public|private|read-only)) \\s+",
68 "end": "(\\))",
69 "beginCaptures": {
70 "1": {
71 "name": "punctuation.define-function.start.clarity"
72 },
73 "2": {
74 "name": "keyword.declaration.define-function.clarity"
75 }
76 },
77 "endCaptures": {
78 "1": {
79 "name": "punctuation.define-function.end.clarity"
80 }
81 },
82 "name": "meta.define-function",
83 "patterns": [
84 {
85 "include": "#expression"
86 },
87 {
88 "begin": "(?x) (\\() \\s* ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s*",
89 "end": "(\\))",
90 "beginCaptures": {
91 "1": {
92 "name": "punctuation.function-signature.start.clarity"
93 },
94 "2": {
95 "name": "entity.name.function.clarity"
96 }
97 },
98 "endCaptures": {
99 "1": {
100 "name": "punctuation.function-signature.end.clarity"
101 }
102 },
103 "name": "meta.define-function-signature",
104 "patterns": [
105 {
106 "begin": "(?x) (\\() \\s* ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
107 "end": "(\\))",
108 "beginCaptures": {
109 "1": {
110 "name": "punctuation.function-argument.start.clarity"
111 },
112 "2": {
113 "name": "variable.parameter.clarity"
114 }
115 },
116 "endCaptures": {
117 "1": {
118 "name": "punctuation.function-argument.end.clarity"
119 }
120 },
121 "name": "meta.function-argument",
122 "patterns": [
123 {
124 "include": "#data-type"
125 }
126 ]
127 }
128 ]
129 }
130 ]
131 },
132 "define-fungible-token": {
133 "match": "(?x) (\\() \\s* (define-fungible-token) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) (?:\\s+(u\\d+))?",
134 "captures": {
135 "1": {
136 "name": "punctuation.define-fungible-token.start.clarity"
137 },
138 "2": {
139 "name": "keyword.declaration.define-fungible-token.clarity"
140 },
141 "3": {
142 "name": "entity.name.fungible-token-name.clarity variable.other.clarity"
143 },
144 "4": {
145 "name": "constant.numeric.fungible-token-total-supply.clarity"
146 },
147 "5": {
148 "name": "punctuation.define-fungible-token.end.clarity"
149 }
150 }
151 },
152 "define-non-fungible-token": {
153 "begin": "(?x) (\\() \\s* (define-non-fungible-token) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
154 "end": "(\\))",
155 "beginCaptures": {
156 "1": {
157 "name": "punctuation.define-non-fungible-token.start.clarity"
158 },
159 "2": {
160 "name": "keyword.declaration.define-non-fungible-token.clarity"
161 },
162 "3": {
163 "name": "entity.name.non-fungible-token-name.clarity variable.other.clarity"
164 }
165 },
166 "endCaptures": {
167 "1": {
168 "name": "punctuation.define-non-fungible-token.end.clarity"
169 }
170 },
171 "name": "meta.define-non-fungible-token",
172 "patterns": [
173 {
174 "include": "#data-type"
175 }
176 ]
177 },
178 "define-trait": {
179 "begin": "(?x) (\\() \\s* (define-trait) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
180 "end": "(\\))",
181 "beginCaptures": {
182 "1": {
183 "name": "punctuation.define-trait.start.clarity"
184 },
185 "2": {
186 "name": "keyword.declaration.define-trait.clarity"
187 },
188 "3": {
189 "name": "entity.name.trait-name.clarity variable.other.clarity"
190 }
191 },
192 "endCaptures": {
193 "1": {
194 "name": "punctuation.define-trait.end.clarity"
195 }
196 },
197 "name": "meta.define-trait",
198 "patterns": [
199 {
200 "begin": "(?x) (\\() \\s*",
201 "end": "(\\))",
202 "beginCaptures": {
203 "1": {
204 "name": "punctuation.define-trait-body.start.clarity"
205 }
206 },
207 "endCaptures": {
208 "1": {
209 "name": "punctuation.define-trait-body.end.clarity"
210 }
211 },
212 "name": "meta.define-trait-body",
213 "patterns": [
214 {
215 "include": "#expression"
216 },
217 {
218 "begin": "(?x) (\\() \\s* ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]+\\??) \\s+",
219 "end": "(\\))",
220 "beginCaptures": {
221 "1": {
222 "name": "punctuation.trait-function.start.clarity"
223 },
224 "2": {
225 "name": "entity.name.trait-function-name.clarity variable.other.clarity"
226 }
227 },
228 "endCaptures": {
229 "1": {
230 "name": "punctuation.trait-function.end.clarity"
231 }
232 },
233 "name": "meta.trait-function",
234 "patterns": [
235 {
236 "include": "#data-type"
237 },
238 {
239 "begin": "(?x) (\\() \\s*",
240 "end": "(\\))",
241 "beginCaptures": {
242 "1": {
243 "name": "punctuation.trait-function-args.start.clarity"
244 }
245 },
246 "endCaptures": {
247 "1": {
248 "name": "punctuation.trait-function-args.end.clarity"
249 }
250 },
251 "name": "meta.trait-function-args",
252 "patterns": [
253 {
254 "include": "#data-type"
255 }
256 ]
257 }
258 ]
259 }
260 ]
261 }
262 ]
263 },
264 "use-trait": {
265 "begin": "(?x) (\\() \\s* (use-trait) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
266 "end": "(\\))",
267 "beginCaptures": {
268 "1": {
269 "name": "punctuation.use-trait.start.clarity"
270 },
271 "2": {
272 "name": "keyword.declaration.use-trait.clarity"
273 },
274 "3": {
275 "name": "entity.name.trait-alias.clarity variable.other.clarity"
276 }
277 },
278 "endCaptures": {
279 "1": {
280 "name": "punctuation.use-trait.end.clarity"
281 }
282 },
283 "name": "meta.use-trait",
284 "patterns": [
285 {
286 "include": "#literal"
287 }
288 ]
289 },
290 "define-constant": {
291 "begin": "(?x) (\\() \\s* (define-constant) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
292 "end": "(\\))",
293 "beginCaptures": {
294 "1": {
295 "name": "punctuation.define-constant.start.clarity"
296 },
297 "2": {
298 "name": "keyword.declaration.define-constant.clarity"
299 },
300 "3": {
301 "name": "entity.name.constant-name.clarity variable.other.clarity"
302 }
303 },
304 "endCaptures": {
305 "1": {
306 "name": "punctuation.define-constant.end.clarity"
307 }
308 },
309 "name": "meta.define-constant",
310 "patterns": [
311 {
312 "include": "#expression"
313 }
314 ]
315 },
316 "define-data-var": {
317 "begin": "(?x) (\\() \\s* (define-data-var) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
318 "end": "(\\))",
319 "beginCaptures": {
320 "1": {
321 "name": "punctuation.define-data-var.start.clarity"
322 },
323 "2": {
324 "name": "keyword.declaration.define-data-var.clarity"
325 },
326 "3": {
327 "name": "entity.name.data-var-name.clarity variable.other.clarity"
328 }
329 },
330 "endCaptures": {
331 "1": {
332 "name": "punctuation.define-data-var.end.clarity"
333 }
334 },
335 "name": "meta.define-data-var",
336 "patterns": [
337 {
338 "include": "#data-type"
339 },
340 {
341 "include": "#expression"
342 }
343 ]
344 },
345 "define-map": {
346 "begin": "(?x) (\\() \\s* (define-map) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
347 "end": "(\\))",
348 "beginCaptures": {
349 "1": {
350 "name": "punctuation.define-map.start.clarity"
351 },
352 "2": {
353 "name": "keyword.declaration.define-map.clarity"
354 },
355 "3": {
356 "name": "entity.name.map-name.clarity variable.other.clarity"
357 }
358 },
359 "endCaptures": {
360 "1": {
361 "name": "punctuation.define-map.end.clarity"
362 }
363 },
364 "name": "meta.define-map",
365 "patterns": [
366 {
367 "include": "#data-type"
368 },
369 {
370 "include": "#expression"
371 }
372 ]
373 },
374 "literal": {
375 "patterns": [
376 {
377 "include": "#number-literal"
378 },
379 {
380 "include": "#bool-literal"
381 },
382 {
383 "include": "#string-literal"
384 },
385 {
386 "include": "#tuple-literal"
387 },
388 {
389 "include": "#principal-literal"
390 },
391 {
392 "include": "#list-literal"
393 },
394 {
395 "include": "#optional-literal"
396 },
397 {
398 "include": "#response-literal"
399 }
400 ],
401 "repository": {
402 "number-literal": {
403 "patterns": [
404 {
405 "comment": "unsigned integers",
406 "name": "constant.numeric.uint.clarity",
407 "match": "\\bu\\d+\\b"
408 },
409 {
410 "comment": "signed integers",
411 "name": "constant.numeric.int.clarity",
412 "match": "\\b\\d+\\b"
413 },
414 {
415 "comment": "hexadecimals",
416 "name": "constant.numeric.hex.clarity",
417 "match": "\\b0x[0-9a-f]*\\b"
418 }
419 ]
420 },
421 "bool-literal": {
422 "name": "constant.language.bool.clarity",
423 "match": "\\b(true|false)\\b"
424 },
425 "string-literal": {
426 "patterns": [
427 {
428 "name": "string.quoted.double.clarity",
429 "begin": "(u?)(\")",
430 "beginCaptures": {
431 "1": {
432 "name": "string.quoted.utf8.clarity"
433 },
434 "2": {
435 "name": "punctuation.definition.string.begin.clarity"
436 }
437 },
438 "end": "\"",
439 "endCaptures": {
440 "1": {
441 "name": "punctuation.definition.string.end.clarity"
442 }
443 }
444 }
445 ]
446 },
447 "tuple-literal": {
448 "begin": "(\\{)",
449 "end": "(\\})",
450 "beginCaptures": {
451 "1": {
452 "name": "punctuation.tuple.start.clarity"
453 }
454 },
455 "endCaptures": {
456 "1": {
457 "name": "punctuation.tuple.end.clarity"
458 }
459 },
460 "name": "meta.tuple",
461 "patterns": [
462 {
463 "name": "entity.name.tag.tuple-key.clarity",
464 "match": "([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*)(?=:)"
465 },
466 {
467 "include": "#expression"
468 },
469 {
470 "include": "#user-func"
471 }
472 ]
473 },
474 "principal-literal": {
475 "name": "constant.other.principal.clarity",
476 "match": "(?x) \\'[0-9A-Z]{28,41}(:?\\.[a-zA-Z][a-zA-Z0-9\\-]+){0,2} | (\\.[a-zA-Z][a-zA-Z0-9\\-]*){1,2} (?=[\\s(){},]|$)"
477 },
478 "list-literal": {
479 "begin": "(?x) (\\() \\s* (list) \\s+",
480 "end": "(\\))",
481 "beginCaptures": {
482 "1": {
483 "name": "punctuation.list.start.clarity"
484 },
485 "2": {
486 "name": "entity.name.type.list.clarity"
487 }
488 },
489 "endCaptures": {
490 "1": {
491 "names": "punctuation.list.end.clarity"
492 }
493 },
494 "name": "meta.list",
495 "patterns": [
496 {
497 "include": "#expression"
498 },
499 {
500 "include": "#user-func"
501 }
502 ]
503 },
504 "optional-literal": {
505 "patterns": [
506 {
507 "match": "\\b(none)\\b",
508 "name": "constant.language.none.clarity"
509 },
510 {
511 "begin": "(?x) (\\() \\s* (some) \\s+",
512 "end": "(\\))",
513 "beginCaptures": {
514 "1": {
515 "name": "punctuation.some.start.clarity"
516 },
517 "2": {
518 "name": "constant.language.some.clarity"
519 }
520 },
521 "endCaptures": {
522 "1": {
523 "name": "punctuation.some.end.clarity"
524 }
525 },
526 "name": "meta.some",
527 "patterns": [
528 {
529 "include": "#expression"
530 }
531 ]
532 }
533 ]
534 },
535 "response-literal": {
536 "begin": "(?x) (\\() \\s* (ok|err) \\s+",
537 "end": "(\\))",
538 "beginCaptures": {
539 "1": {
540 "name": "punctuation.response.start.clarity"
541 },
542 "2": {
543 "name": "constant.language.ok-err.clarity"
544 }
545 },
546 "endCaptures": {
547 "1": {
548 "name": "punctuation.response.end.clarity"
549 }
550 },
551 "name": "meta.response",
552 "patterns": [
553 {
554 "include": "#expression"
555 },
556 {
557 "include": "#user-func"
558 }
559 ]
560 }
561 }
562 },
563 "data-type": {
564 "patterns": [
565 {
566 "include": "#comment"
567 },
568 {
569 "comment": "numerics",
570 "name": "entity.name.type.numeric.clarity",
571 "match": "\\b(uint|int)\\b"
572 },
573 {
574 "comment": "principal",
575 "name": "entity.name.type.principal.clarity",
576 "match": "\\b(principal)\\b"
577 },
578 {
579 "comment": "bool",
580 "name": "entity.name.type.bool.clarity",
581 "match": "\\b(bool)\\b"
582 },
583 {
584 "match": "(?x) (\\() \\s* (?:(string-ascii|string-utf8)\\s+(\\d+)) \\s* (\\))",
585 "captures": {
586 "1": {
587 "name": "punctuation.string-def.start.clarity"
588 },
589 "2": {
590 "name": "entity.name.type.string.clarity"
591 },
592 "3": {
593 "name": "constant.numeric.string-len.clarity"
594 },
595 "4": {
596 "name": "punctuation.string-def.end.clarity"
597 }
598 }
599 },
600 {
601 "match": "(?x) (\\() \\s* (buff)\\s+(\\d+)\\s* (\\))",
602 "captures": {
603 "1": {
604 "name": "punctuation.buff-def.start.clarity"
605 },
606 "2": {
607 "name": "entity.name.type.buff.clarity"
608 },
609 "3": {
610 "name": "constant.numeric.buf-len.clarity"
611 },
612 "4": {
613 "name": "punctuation.buff-def.end.clarity"
614 }
615 }
616 },
617 {
618 "comment": "optional",
619 "begin": "(?x) (\\() \\s* (optional)\\s+",
620 "beginCaptures": {
621 "1": {
622 "name": "punctuation.optional-def.start.clarity"
623 },
624 "2": {
625 "name": "storage.type.modifier"
626 }
627 },
628 "end": "(\\))",
629 "endCaptures": {
630 "1": {
631 "name": "punctuation.optional-def.end.clarity"
632 }
633 },
634 "name": "meta.optional-def",
635 "patterns": [
636 {
637 "include": "#data-type"
638 }
639 ]
640 },
641 {
642 "comment": "response",
643 "begin": "(?x) (\\() \\s* (response)\\s+",
644 "beginCaptures": {
645 "1": {
646 "name": "punctuation.response-def.start.clarity"
647 },
648 "2": {
649 "name": "storage.type.modifier"
650 }
651 },
652 "end": "(\\))",
653 "endCaptures": {
654 "1": {
655 "name": "punctuation.response-def.end.clarity"
656 }
657 },
658 "name": "meta.response-def",
659 "patterns": [
660 {
661 "include": "#data-type"
662 }
663 ]
664 },
665 {
666 "comment": "list",
667 "begin": "(?x) (\\() \\s* (list) \\s+ (\\d+) \\s+",
668 "end": "(\\))",
669 "beginCaptures": {
670 "1": {
671 "name": "punctuation.list-def.start.clarity"
672 },
673 "2": {
674 "name": "entity.name.type.list.clarity"
675 },
676 "3": {
677 "name": "constant.numeric.list-len.clarity"
678 }
679 },
680 "endCaptures": {
681 "1": {
682 "name": "punctuation.list-def.end.clarity"
683 }
684 },
685 "name": "meta.list-def",
686 "patterns": [
687 {
688 "include": "#data-type"
689 }
690 ]
691 },
692 {
693 "begin": "(\\{)",
694 "beginCaptures": {
695 "1": {
696 "name": "punctuation.tuple-def.start.clarity"
697 }
698 },
699 "end": "(\\})",
700 "endCaptures": {
701 "1": {
702 "name": "punctuation.tuple-def.end.clarity"
703 }
704 },
705 "name": "meta.tuple-def",
706 "patterns": [
707 {
708 "name": "entity.name.tag.tuple-data-type-key.clarity",
709 "match": "([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*)(?=:)"
710 },
711 {
712 "include": "#data-type"
713 }
714 ]
715 }
716 ]
717 },
718 "built-in-func": {
719 "begin": "(?x) (\\() \\s* (\\-|\\+|<\\=|>\\=|<|>|\\*|/|and|append|as-contract|as-max-len\\?|asserts!|at-block|begin|concat|contract-call\\?|contract-of|default-to|element-at|filter|fold|ft-burn\\?|ft-get-balance|ft-get-supply|ft-mint\\?|ft-transfer\\?|get-block-info\\?|hash160|if|impl-trait|index-of|is-eq|is-err|is-none|is-ok|is-some|keccak256|len|log2|map|match|merge|mod|nft-burn\\?|nft-get-owner\\?|nft-mint\\?|nft-transfer\\?|not|or|pow|principal-of\\?|print|secp256k1-recover\\?|secp256k1-verify|sha256|sha512|sha512/256|sqrti|stx-burn\\?|stx-get-balance|stx-transfer\\?|to-int|to-uint|try!|unwrap-err-panic|unwrap-err!|unwrap-panic|unwrap!|xor) \\s+",
720 "end": "(\\))",
721 "beginCaptures": {
722 "1": {
723 "name": "punctuation.built-in-function.start.clarity"
724 },
725 "2": {
726 "name": "keyword.declaration.built-in-function.clarity"
727 }
728 },
729 "endCaptures": {
730 "1": {
731 "name": "punctuation.built-in-function.end.clarity"
732 }
733 },
734 "name": "meta.built-in-function",
735 "patterns": [
736 {
737 "include": "#expression"
738 },
739 {
740 "include": "#user-func"
741 }
742 ]
743 },
744 "get-set-func": {
745 "name": "meta.get-set-func",
746 "begin": "(?x) (\\() \\s* (var-get|var-set|map-get\\?|map-set|map-insert|map-delete|get) \\s+ ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s*",
747 "end": "(\\))",
748 "beginCaptures": {
749 "1": {
750 "name": "punctuation.get-set-func.start.clarity"
751 },
752 "2": {
753 "name": "keyword.control.clarity"
754 },
755 "3": {
756 "name": "variable.other.clarity"
757 }
758 },
759 "endCaptures": {
760 "1": {
761 "name": "punctuation.get-set-func.end.clarity"
762 }
763 },
764 "patterns": [
765 {
766 "include": "#expression"
767 }
768 ]
769 },
770 "let-func": {
771 "begin": "(?x) (\\() \\s* (let) \\s*",
772 "end": "(\\))",
773 "beginCaptures": {
774 "1": {
775 "name": "punctuation.let-function.start.clarity"
776 },
777 "2": {
778 "name": "keyword.declaration.let-function.clarity"
779 }
780 },
781 "endCaptures": {
782 "1": {
783 "name": "punctuation.let-function.end.clarity"
784 }
785 },
786 "name": "meta.let-function",
787 "patterns": [
788 {
789 "include": "#expression"
790 },
791 {
792 "include": "#user-func"
793 },
794 {
795 "begin": "(?x) (\\() \\s*",
796 "end": "(\\))",
797 "beginCaptures": {
798 "1": {
799 "name": "punctuation.let-var.start.clarity"
800 }
801 },
802 "endCaptures": {
803 "1": {
804 "name": "punctuation.let-var.end.clarity"
805 }
806 },
807 "name": "meta.let-var",
808 "patterns": [
809 {
810 "begin": "(?x) (\\() ([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*) \\s+",
811 "end": "(\\))",
812 "beginCaptures": {
813 "1": {
814 "name": "punctuation.let-local-var.start.clarity"
815 },
816 "2": {
817 "name": "entity.name.let-local-var-name.clarity variable.parameter.clarity"
818 }
819 },
820 "endCaptures": {
821 "1": {
822 "name": "punctuation.let-local-var.end.clarity"
823 }
824 },
825 "name": "meta.let-local-var",
826 "patterns": [
827 {
828 "include": "#expression"
829 },
830 {
831 "include": "#user-func"
832 }
833 ]
834 },
835 {
836 "include": "#expression"
837 }
838 ]
839 }
840 ]
841 },
842 "user-func": {
843 "begin": "(?x) (\\() \\s* (([a-zA-Z][a-zA-Z0-9_\\-\\!\\?]*)) \\s*",
844 "end": "(\\))",
845 "beginCaptures": {
846 "1": {
847 "name": "punctuation.user-function.start.clarity"
848 },
849 "2": {
850 "name": "entity.name.function.clarity"
851 }
852 },
853 "endCaptures": {
854 "1": {
855 "name": "punctuation.user-function.end.clarity"
856 }
857 },
858 "name": "meta.user-function",
859 "patterns": [
860 {
861 "include": "#expression"
862 },
863 {
864 "include": "$self"
865 }
866 ]
867 }
868 }
869 }
870