aboutsummaryrefslogtreecommitdiff
path: root/ext/syntaxes/sloth.tmLanguage.json
blob: c5cd3dbe8f8a0652e3fb1872413b9dcbeb64aa29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
  "scopeName": "source.sloth",
  "patterns": [
    { "include": "#comments" },
    { "include": "#literals" },
    { "include": "#types" },
    { "include": "#decorator" }
  ],
  "repository": {
    "literals": {
      "patterns": [
        {
          "match": "(0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\\d+)(\\.\\d+)?",
          "name": "constant.numeric"
        },
        {
          "match": "'.'",
          "name": "constant.character"
        },
        {
          "match": "\\\\(u.{4}|\\S)",
          "name": "constant.character.escape"
        },
        {
          "match": "true|false",
          "name": "constant.language"
        },
        {
          "begin": "\"",
          "end": "\"",
          "name": "string.quoted.double"
        },
        {
          "begin": "\\s*(/)(?![/*])(?=(?:[^/\\\\\\[]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\])+/(?![/*])[gimy]*(?!\\s*[a-zA-Z0-9_$]))",
          "end": "(?<!\\\\)\\/",
          "name": "string.regexp"
        }
      ]
    },
    "comments": {
      "patterns": [
        {
          "match": "^\\s*##.*$",
          "name": "comment.block.documentation"
        },
        {
          "match": "#.*$",
          "name": "comment.line.number-sign"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "match": "return|if|match|for|while|break|continue",
          "name": "keyword.control"
        },
        {
          "match": "\\+|\\-|\\*|\\/|\\%",
          "name": "keyword.operator"
        },
        {
          "match": "pub|fn",
          "name": "keyword.other"
        },
        {
          "match": "let|const|type",
          "name": "storage.type"
        },
        {
          "match": "mut",
          "name": "storage.modifier"
        }
      ]
    },
    "types": {
      "patterns": [
        {
          "match": "[uif](8|16|32|64|128)",
          "name": "entity.name.type.numeric"
        },
        {
          "match": "([^[:alpha:]]|^)(char)([^[:alpha:]]|$)",
          "name": "entity.name.type.primitive"
        },
        {
          "match": "([^[:alpha:]]|^)(String|Regex)([^[:alpha:]]|$)",
          "name": "entity.name.type"
        }
      ]
    },
    "decorator": {
      "match": "@[^(]+",
      "name": "entity.name.function.decorator"
    }
  }
}