ox

The Ox programming language, compiler and tools (WIP)
Log | Files | Refs | README | LICENSE

ox.tmLanguage.json (4661B)


      1 {
      2     "name": "Ox",
      3     "scopeName": "source.ox",
      4     "fileTypes": [
      5         "ox"
      6     ],
      7     "patterns": [
      8         {
      9             "include": "#comments"
     10         },
     11         {
     12             "include": "#keywords"
     13         },
     14         {
     15             "include": "#numbers"
     16         },
     17         {
     18             "include": "#strings"
     19         },
     20         {
     21             "include": "#basic-types"
     22         },
     23         {
     24             "include": "#functions"
     25         },
     26         {
     27             "include": "#typedefs"
     28         },
     29         {
     30             "include": "#builtins"
     31         }
     32     ],
     33     "repository": {
     34         "keywords": {
     35             "patterns": [
     36                 {
     37                     "match": "\\b(const|else|for|if|pkg|record|return|typedef|match|case|while)\\b",
     38                     "name": "keyword.control"
     39                 },
     40                 {
     41                     "match": "\\b(and|by|in|not|or)\\b",
     42                     "name": "keyword.operator"
     43                 },
     44                 {
     45                     "match": "\\b(false|nil|true)\\b",
     46                     "name": "constant.language"
     47                 }
     48             ]
     49         },
     50         "builtins": {
     51             "patterns": [
     52                 {
     53                     "match": "\\b(abs|len|assert|print|exit|panic)\\b",
     54                     "name": "variable.function support.function.builtin"
     55                 }
     56             ]
     57         },
     58         "numbers": {
     59             "patterns": [
     60                 {
     61                     "match": "\\b([+-])?[0-9]+(.[0-9]*(e[0-9]+))?\\b",
     62                     "name": "constant.numeric"
     63                 },
     64                 {
     65                     "match": "\\b([+-])?0x[0-9A-Fa-f]+\\b",
     66                     "name": "constant.numeric"
     67                 }
     68             ]
     69         },
     70         "basic-types": {
     71             "patterns": [
     72                 {
     73                     "match": "\\b(int|void|float|char|string|bool)\\b",
     74                     "name": "storage.type"
     75                 }
     76             ]
     77         },
     78         "functions": {
     79             "patterns": [
     80                 {
     81                     "match": "\\b([A-Za-z_][A-Za-z0-9_]*)\\s*(?=\\()",
     82                     "name": "entity.name.function"
     83                 }
     84             ]
     85         },
     86         "typedefs": {
     87             "patterns": [
     88                 {
     89                     "match": "\\b[A-Z][A-Za-z0-9_]*\\b",
     90                     "name": "entity.name.type"
     91                 }
     92             ]
     93         },
     94         "strings": {
     95             "patterns": [
     96                 {
     97                     "begin": "\\\"",
     98                     "beginCaptures": {
     99                         "0": {
    100                             "name": "punctuation.definition.string.begin"
    101                         }
    102                     },
    103                     "end": "\\\"",
    104                     "endCaptures": {
    105                         "0": {
    106                             "name": "punctuation.definition.string.end"
    107                         }
    108                     },
    109                     "name": "string.quoted.double",
    110                     "patterns": [
    111                         {
    112                             "match": "\\\\.",
    113                             "name": "constant.character.escape"
    114                         }
    115                     ]
    116                 }
    117             ]
    118         },
    119         "block-comment": {
    120             "begin": "/\\*",
    121             "beginCaptures": {
    122                 "0": {
    123                     "name": "punctuation.definition.comment"
    124                 }
    125             },
    126             "end": "\\*/",
    127             "endCaptures": {
    128                 "0": {
    129                     "name": "punctuation.definition.comment"
    130                 }
    131             },
    132             "name": "comment.block",
    133             "patterns": [
    134                 {
    135                     "include": "#block-comment"
    136                 }
    137             ]
    138         },
    139         "comments": {
    140             "patterns": [
    141                 {
    142                     "include": "#block-comment"
    143                 },
    144                 {
    145                     "begin": "//",
    146                     "beginCaptures": {
    147                         "0": {
    148                             "name": "punctuation.definition.comment"
    149                         }
    150                     },
    151                     "end": "\\n",
    152                     "name": "comment.line.double-slash"
    153                 },
    154                 {
    155                     "begin": "#!",
    156                     "beginCaptures": {
    157                         "0": {
    158                             "name": "punctuation.definition.comment"
    159                         }
    160                     },
    161                     "end": "\\n",
    162                     "name": "comment.line.double-slash"
    163                 }
    164             ]
    165         }
    166     }
    167 }