moxie.tmLanguage.json raw

   1  {
   2    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
   3    "name": "Moxie",
   4    "scopeName": "source.moxie",
   5    "patterns": [
   6      { "include": "#comments" },
   7      { "include": "#strings" },
   8      { "include": "#raw-strings" },
   9      { "include": "#char-literals" },
  10      { "include": "#numbers" },
  11      { "include": "#keywords" },
  12      { "include": "#builtin-functions" },
  13      { "include": "#builtin-types" },
  14      { "include": "#constants" },
  15      { "include": "#operators" },
  16      { "include": "#func-declaration" },
  17      { "include": "#type-declaration" },
  18      { "include": "#identifiers" }
  19    ],
  20    "repository": {
  21      "comments": {
  22        "patterns": [
  23          {
  24            "name": "comment.line.double-slash.moxie",
  25            "match": "//.*$"
  26          },
  27          {
  28            "name": "comment.block.moxie",
  29            "begin": "/\\*",
  30            "end": "\\*/"
  31          }
  32        ]
  33      },
  34      "strings": {
  35        "name": "string.quoted.double.moxie",
  36        "begin": "\"",
  37        "end": "\"",
  38        "patterns": [
  39          {
  40            "name": "constant.character.escape.moxie",
  41            "match": "\\\\."
  42          }
  43        ]
  44      },
  45      "raw-strings": {
  46        "name": "string.quoted.backtick.moxie",
  47        "begin": "`",
  48        "end": "`"
  49      },
  50      "char-literals": {
  51        "name": "string.quoted.single.moxie",
  52        "begin": "'",
  53        "end": "'",
  54        "patterns": [
  55          {
  56            "name": "constant.character.escape.moxie",
  57            "match": "\\\\."
  58          }
  59        ]
  60      },
  61      "numbers": {
  62        "patterns": [
  63          {
  64            "name": "constant.numeric.float.moxie",
  65            "match": "\\b[0-9][0-9_]*\\.[0-9_]*([eE][+-]?[0-9_]+)?\\b"
  66          },
  67          {
  68            "name": "constant.numeric.hex.moxie",
  69            "match": "\\b0[xX][0-9a-fA-F_]+\\b"
  70          },
  71          {
  72            "name": "constant.numeric.octal.moxie",
  73            "match": "\\b0[oO][0-7_]+\\b"
  74          },
  75          {
  76            "name": "constant.numeric.binary.moxie",
  77            "match": "\\b0[bB][01_]+\\b"
  78          },
  79          {
  80            "name": "constant.numeric.integer.moxie",
  81            "match": "\\b[0-9][0-9_]*\\b"
  82          }
  83        ]
  84      },
  85      "keywords": {
  86        "patterns": [
  87          {
  88            "name": "keyword.control.moxie",
  89            "match": "\\b(break|case|continue|default|defer|else|for|goto|if|range|return|select|switch)\\b"
  90          },
  91          {
  92            "name": "keyword.declaration.moxie",
  93            "match": "\\b(chan|const|func|import|interface|map|package|struct|type|var)\\b"
  94          },
  95          {
  96            "name": "keyword.other.spawn.moxie",
  97            "match": "\\bspawn\\b"
  98          }
  99        ]
 100      },
 101      "builtin-functions": {
 102        "name": "support.function.builtin.moxie",
 103        "match": "\\b(append|cap|clear|close|copy|delete|len|make|panic|print|println|recover)\\b"
 104      },
 105      "builtin-types": {
 106        "name": "support.type.builtin.moxie",
 107        "match": "\\b(bool|byte|error|float32|float64|int|int8|int16|int32|int64|rune|string|uint|uint8|uint16|uint32|uint64|any|comparable)\\b"
 108      },
 109      "constants": {
 110        "name": "constant.language.moxie",
 111        "match": "\\b(true|false|nil|iota)\\b"
 112      },
 113      "operators": {
 114        "patterns": [
 115          {
 116            "name": "keyword.operator.channel.moxie",
 117            "match": "<-"
 118          },
 119          {
 120            "name": "keyword.operator.define.moxie",
 121            "match": ":="
 122          },
 123          {
 124            "name": "keyword.operator.concat.moxie",
 125            "match": "\\|=?"
 126          },
 127          {
 128            "name": "keyword.operator.moxie",
 129            "match": "(\\+|-|\\*|/|%|&|\\^|<<|>>|&\\^|==|!=|<=|>=|<|>|=|!|&&|\\|\\|)"
 130          }
 131        ]
 132      },
 133      "func-declaration": {
 134        "match": "\\b(func)\\s+([A-Za-z_][A-Za-z0-9_]*)",
 135        "captures": {
 136          "1": { "name": "keyword.declaration.moxie" },
 137          "2": { "name": "entity.name.function.moxie" }
 138        }
 139      },
 140      "type-declaration": {
 141        "match": "\\b(type)\\s+([A-Za-z_][A-Za-z0-9_]*)",
 142        "captures": {
 143          "1": { "name": "keyword.declaration.moxie" },
 144          "2": { "name": "entity.name.type.moxie" }
 145        }
 146      },
 147      "identifiers": {
 148        "name": "variable.other.moxie",
 149        "match": "\\b[A-Za-z_][A-Za-z0-9_]*\\b"
 150      }
 151    }
 152  }
 153