|
1 | 1 | { |
2 | 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
3 | 3 | "_comment": "SPDX-License-Identifier: PMPL-1.0-or-later", |
| 4 | + "_description": "TextMate grammar for TANGLE — Turing-complete topological programming language", |
4 | 5 | "name": "Tangle", |
5 | 6 | "scopeName": "source.tangle", |
6 | 7 | "fileTypes": [ |
7 | | - "tangle" |
| 8 | + "tangle", |
| 9 | + "tgl" |
8 | 10 | ], |
9 | 11 | "patterns": [ |
10 | 12 | { |
|
19 | 21 | { |
20 | 22 | "include": "#constants" |
21 | 23 | }, |
| 24 | + { |
| 25 | + "include": "#jtv-blocks" |
| 26 | + }, |
22 | 27 | { |
23 | 28 | "include": "#keywords" |
24 | 29 | }, |
|
42 | 47 | "comments": { |
43 | 48 | "patterns": [ |
44 | 49 | { |
45 | | - "name": "comment.line.double-dash.tangle", |
46 | | - "match": "--.*$" |
| 50 | + "name": "comment.line.hash.tangle", |
| 51 | + "match": "#.*$" |
47 | 52 | }, |
48 | 53 | { |
49 | 54 | "name": "comment.block.tangle", |
50 | | - "begin": "\\{-", |
51 | | - "end": "-\\}", |
| 55 | + "begin": "\\(\\*", |
| 56 | + "end": "\\*\\)", |
52 | 57 | "patterns": [ |
53 | 58 | { |
54 | 59 | "include": "#comments" |
|
74 | 79 | }, |
75 | 80 | "numbers": { |
76 | 81 | "patterns": [ |
| 82 | + { |
| 83 | + "name": "constant.numeric.hex.tangle", |
| 84 | + "match": "\\b0x[0-9a-fA-F]+\\b" |
| 85 | + }, |
| 86 | + { |
| 87 | + "name": "constant.numeric.binary.tangle", |
| 88 | + "match": "\\b0b[01]+\\b" |
| 89 | + }, |
77 | 90 | { |
78 | 91 | "name": "constant.numeric.float.tangle", |
79 | | - "match": "\\b[0-9]+\\.[0-9]+\\b" |
| 92 | + "match": "\\b[0-9]+\\.[0-9]+([eE][+-]?[0-9]+)?\\b" |
80 | 93 | }, |
81 | 94 | { |
82 | 95 | "name": "constant.numeric.integer.tangle", |
|
89 | 102 | { |
90 | 103 | "name": "constant.language.boolean.tangle", |
91 | 104 | "match": "\\b(true|false)\\b" |
| 105 | + }, |
| 106 | + { |
| 107 | + "name": "constant.language.identity.tangle", |
| 108 | + "match": "\\bidentity\\b" |
| 109 | + } |
| 110 | + ] |
| 111 | + }, |
| 112 | + "jtv-blocks": { |
| 113 | + "patterns": [ |
| 114 | + { |
| 115 | + "name": "meta.block.add.tangle", |
| 116 | + "begin": "\\b(add)\\s*(\\{)", |
| 117 | + "beginCaptures": { |
| 118 | + "1": { "name": "keyword.control.jtv.tangle" }, |
| 119 | + "2": { "name": "punctuation.definition.block.begin.tangle" } |
| 120 | + }, |
| 121 | + "end": "\\}", |
| 122 | + "endCaptures": { |
| 123 | + "0": { "name": "punctuation.definition.block.end.tangle" } |
| 124 | + }, |
| 125 | + "patterns": [ |
| 126 | + { "include": "#strings" }, |
| 127 | + { "include": "#numbers" }, |
| 128 | + { "include": "#constants" }, |
| 129 | + { "include": "#identifiers" } |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "name": "meta.block.harvard.tangle", |
| 134 | + "begin": "\\b(harvard)\\s*(\\{)", |
| 135 | + "beginCaptures": { |
| 136 | + "1": { "name": "keyword.control.jtv.tangle" }, |
| 137 | + "2": { "name": "punctuation.definition.block.begin.tangle" } |
| 138 | + }, |
| 139 | + "end": "\\}", |
| 140 | + "endCaptures": { |
| 141 | + "0": { "name": "punctuation.definition.block.end.tangle" } |
| 142 | + }, |
| 143 | + "patterns": [ |
| 144 | + { "include": "#jtv-keywords" }, |
| 145 | + { "include": "#jtv-purity" }, |
| 146 | + { "include": "#strings" }, |
| 147 | + { "include": "#numbers" }, |
| 148 | + { "include": "#constants" }, |
| 149 | + { "include": "#identifiers" } |
| 150 | + ] |
| 151 | + } |
| 152 | + ] |
| 153 | + }, |
| 154 | + "jtv-keywords": { |
| 155 | + "patterns": [ |
| 156 | + { |
| 157 | + "name": "keyword.control.jtv.tangle", |
| 158 | + "match": "\\b(fn|if|else|while|for|return|print|module|import|as|then|reverse)\\b" |
| 159 | + } |
| 160 | + ] |
| 161 | + }, |
| 162 | + "jtv-purity": { |
| 163 | + "patterns": [ |
| 164 | + { |
| 165 | + "name": "storage.modifier.purity.tangle", |
| 166 | + "match": "@(pure|total)\\b" |
92 | 167 | } |
93 | 168 | ] |
94 | 169 | }, |
|
100 | 175 | }, |
101 | 176 | { |
102 | 177 | "name": "keyword.declaration.tangle", |
103 | | - "match": "\\b(def|weave|into|strands|compute|assert|identity)\\b" |
| 178 | + "match": "\\b(def|weave|into|strands|compute|assert)\\b" |
104 | 179 | }, |
105 | 180 | { |
106 | 181 | "name": "keyword.other.topology.tangle", |
|
134 | 209 | "name": "keyword.operator.pipeline.tangle", |
135 | 210 | "match": ">>" |
136 | 211 | }, |
137 | | - { |
138 | | - "name": "keyword.operator.crossing.tangle", |
139 | | - "match": ">|<" |
140 | | - }, |
141 | 212 | { |
142 | 213 | "name": "keyword.operator.isotopy.tangle", |
143 | 214 | "match": "~" |
|
150 | 221 | "name": "keyword.operator.assignment.tangle", |
151 | 222 | "match": "=" |
152 | 223 | }, |
| 224 | + { |
| 225 | + "name": "keyword.operator.crossing.tangle", |
| 226 | + "match": "[><]" |
| 227 | + }, |
153 | 228 | { |
154 | 229 | "name": "keyword.operator.tensor.tangle", |
155 | 230 | "match": "\\|" |
|
0 commit comments