|
18 | 18 | "include": "#literal"
|
19 | 19 | },
|
20 | 20 | {
|
21 |
| - "include": "#type" |
| 21 | + "include": "#invalid" |
22 | 22 | },
|
23 | 23 | {
|
24 | 24 | "include": "#constant"
|
25 | 25 | },
|
| 26 | + { |
| 27 | + "include": "#type" |
| 28 | + }, |
26 | 29 | {
|
27 | 30 | "include": "#expression"
|
28 | 31 | },
|
|
234 | 237 | }
|
235 | 238 | },
|
236 | 239 |
|
| 240 | + "invalid": { |
| 241 | + "patterns": [ |
| 242 | + { |
| 243 | + "comment": "Anything starting with __gen or __tact", |
| 244 | + "match": "\\b__(?:gen|tact)[a-zA-Z0-9_]*\\b", |
| 245 | + "name": "invalid.illegal.identifier.tact" |
| 246 | + } |
| 247 | + ] |
| 248 | + }, |
| 249 | + |
| 250 | + "constant": { |
| 251 | + "patterns": [ |
| 252 | + { |
| 253 | + "comment": "self.storageReserve", |
| 254 | + "match": "(?<=self\\.)(storageReserve)\\b", |
| 255 | + "name": "constant.other.builtin.tact" |
| 256 | + }, |
| 257 | + { |
| 258 | + "comment": "Other constants from the core library", |
| 259 | + "match": "(?<!\\.)\\b(SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\\b", |
| 260 | + "name": "constant.other.builtin.tact" |
| 261 | + }, |
| 262 | + { |
| 263 | + "comment": "ALL CAPS constants", |
| 264 | + "match": "\\b([A-Z]{2}[A-Z0-9_]*)\\b", |
| 265 | + "name": "constant.other.caps.tact" |
| 266 | + }, |
| 267 | + { |
| 268 | + "comment": "Constant declaration or definition", |
| 269 | + "match": "^\\s*(const)\\s+([a-zA-Z_][A-Za-z0-9_]*)\\b", |
| 270 | + "captures": { |
| 271 | + "1": { |
| 272 | + "name": "keyword.other.tact" |
| 273 | + }, |
| 274 | + "2": { |
| 275 | + "name": "constant.other.declaration.tact" |
| 276 | + } |
| 277 | + } |
| 278 | + }, |
| 279 | + { |
| 280 | + "comment": "null", |
| 281 | + "match": "(?<!\\.)\\b(null)\\b", |
| 282 | + "name": "constant.language.null.tact" |
| 283 | + } |
| 284 | + ] |
| 285 | + }, |
| 286 | + |
237 | 287 | "type": {
|
238 | 288 | "patterns": [
|
239 | 289 | {
|
|
328 | 378 | ]
|
329 | 379 | },
|
330 | 380 |
|
331 |
| - "constant": { |
332 |
| - "patterns": [ |
333 |
| - { |
334 |
| - "comment": "ALL CAPS constants", |
335 |
| - "match": "\\b([A-Z]{2}[A-Z0-9_]*)\\b", |
336 |
| - "name": "constant.other.caps.tact" |
337 |
| - }, |
338 |
| - { |
339 |
| - "comment": "Constant declaration or definition", |
340 |
| - "match": "^\\s*(const)\\s+([A-Z][A-Za-z0-9_]*)\\b", |
341 |
| - "captures": { |
342 |
| - "1": { |
343 |
| - "name": "keyword.other.tact" |
344 |
| - }, |
345 |
| - "2": { |
346 |
| - "name": "constant.other.caps.tact" |
347 |
| - } |
348 |
| - } |
349 |
| - }, |
350 |
| - { |
351 |
| - "comment": "null", |
352 |
| - "match": "(?<!\\.)\\b(null)\\b", |
353 |
| - "name": "constant.language.null.tact" |
354 |
| - } |
355 |
| - ] |
356 |
| - }, |
357 |
| - |
358 | 381 | "expression": {
|
359 | 382 | "patterns": [
|
360 | 383 | {
|
|
450 | 473 | "match": "(?<!\\.)\\b(import)\\b",
|
451 | 474 | "name": "keyword.control.import.tact"
|
452 | 475 | },
|
| 476 | + { |
| 477 | + "comment": "Control flow keywords, prefixed by more than one dot", |
| 478 | + "match": "(?<=\\.\\.)\\b(else|catch|until|in)\\b", |
| 479 | + "name": "keyword.control.tact" |
| 480 | + }, |
453 | 481 | {
|
454 | 482 | "comment": "Control flow keywords",
|
455 | 483 | "match": "(?<!\\.)\\b(if|else|try|catch|repeat|do|until|while|foreach|in|return)\\b",
|
|
493 | 521 | },
|
494 | 522 | {
|
495 | 523 | "comment": "Function declaration/definition keywords",
|
496 |
| - "match": "(?<!\\.)\\b(fun|native|init|receive|bounced|external)\\b", |
| 524 | + "match": "(?<!\\.)\\b(fun|native)\\b", |
| 525 | + "name": "keyword.other.function.tact" |
| 526 | + }, |
| 527 | + { |
| 528 | + "comment": "Special functions", |
| 529 | + "match": "(?<!\\.)\\b(init|receive|bounced|external)(?=\\s*\\()", |
497 | 530 | "name": "keyword.other.function.tact"
|
498 | 531 | },
|
499 | 532 | {
|
|
0 commit comments