src/Tools/VSCode/extension/isabelle-ml-grammar.json
author wenzelm
Mon Mar 25 17:21:26 2019 +0100 (7 weeks ago)
changeset 69981 3dced198b9ec
parent 64804 b2b05fdff3a7
permissions -rw-r--r--
more strict AFP properties;
     1 {
     2   "name": "Isabelle/ML",
     3   "scopeName": "source.isabelle-ml",
     4   "fileTypes": ["ML", "sml", "sig"],
     5   "uuid": "aa32eb5e-d0d9-11e6-b7a4-37ba001f1e6e",
     6   "keyEquivalent": "^~M",
     7   "repository": {
     8     "comments": {
     9       "patterns": [
    10         {
    11           "end": "\\*\\)",
    12           "begin": "\\(\\*",
    13           "beginCaptures": {
    14             "0": {
    15               "name": "punctuation.definition.comment.begin.ml"
    16             }
    17           },
    18           "patterns": [
    19             {
    20               "include": "#comments"
    21             }
    22           ],
    23           "endCaptures": {
    24             "0": {
    25               "name": "punctuation.definition.comment.end.ml"
    26             }
    27           },
    28           "name": "comment.block.ml"
    29         }
    30       ]
    31     },
    32     "spec": {
    33       "patterns": [
    34         {
    35           "match": "\\b(exception|type)\\s+([a-zA-Z][a-zA-Z0-9'_]*)",
    36           "captures": {
    37             "1": {
    38               "name": "keyword.other.ml"
    39             },
    40             "2": {
    41               "name": "entity.name.type.abbrev.ml"
    42             }
    43           },
    44           "name": "meta.spec.ml.type"
    45         },
    46         {
    47           "end": "(?=val|type|eqtype|datatype|structure|include|exception)",
    48           "begin": "\\b(datatype)\\s+([a-zA-Z][a-zA-Z0-9'_]*)\\s*(?==)",
    49           "patterns": [
    50             {
    51               "match": "\\b(and)\\s+([a-zA-Z][a-zA-Z0-9'_]*)\\s*(?==)",
    52               "captures": {
    53                 "1": {
    54                   "name": "keyword.other.ml"
    55                 },
    56                 "2": {
    57                   "name": "entity.name.type.datatype.ml"
    58                 }
    59               },
    60               "name": "meta.spec.ml.datatype"
    61             },
    62             {
    63               "match": "(?x)\n\t\t\t\t\t\t\t=\\s*([a-zA-Z][a-zA-Z0-9'_]*)(\\s+of)?",
    64               "captures": {
    65                 "1": {
    66                   "name": "variable.other.dcon.ml"
    67                 },
    68                 "2": {
    69                   "name": "keyword.other.ml"
    70                 }
    71               },
    72               "name": "meta.datatype.rule.main.ml"
    73             },
    74             {
    75               "match": "\\|\\s*([a-zA-Z][a-zA-Z0-9'_]*)(\\s+of)?",
    76               "captures": {
    77                 "1": {
    78                   "name": "variable.other.dcon.ml"
    79                 },
    80                 "2": {
    81                   "name": "keyword.other.ml"
    82                 }
    83               },
    84               "name": "meta.datatype.rule.other.ml"
    85             }
    86           ],
    87           "captures": {
    88             "1": {
    89               "name": "keyword.other.ml"
    90             },
    91             "2": {
    92               "name": "entity.name.type.datatype.ml"
    93             }
    94           },
    95           "name": "meta.spec.ml.datatype"
    96         },
    97         {
    98           "match": "\\b(val)\\s*([^:]+)\\s*:",
    99           "captures": {
   100             "1": {
   101               "name": "keyword.other.ml"
   102             }
   103           },
   104           "name": "meta.spec.ml.val"
   105         },
   106         {
   107           "end": "(?=val|type|eqtype|datatype|structure|include)",
   108           "begin": "\\b(structure)\\s*(\\w+)\\s*:",
   109           "patterns": [
   110             {
   111               "match": "\\b(sharing)\\b",
   112               "name": "keyword.other.ml"
   113             }
   114           ],
   115           "captures": {
   116             "1": {
   117               "name": "keyword.other.ml"
   118             },
   119             "2": {
   120               "name": "entity.name.type.module.ml"
   121             }
   122           },
   123           "name": "meta.spec.ml.structure"
   124         },
   125         {
   126           "match": "\\b(include)\\b",
   127           "captures": {
   128             "1": {
   129               "name": "keyword.other.ml"
   130             }
   131           },
   132           "name": "meta.spec.ml.include"
   133         },
   134         {
   135           "include": "#comments"
   136         }
   137       ]
   138     }
   139   },
   140   "patterns": [
   141     {
   142       "include": "#comments"
   143     },
   144     {
   145       "match": "\\b(val|datatype|signature|type|op|sharing|struct|as|let|in|abstype|local|where|case|of|fn|raise|exception|handle|ref|infix|infixr|before|end|structure|withtype)\\b",
   146       "name": "keyword.other.ml"
   147     },
   148     {
   149       "end": "\\b(end)\\b",
   150       "begin": "\\b(let)\\b",
   151       "patterns": [
   152         {
   153           "include": "$self"
   154         }
   155       ],
   156       "captures": {
   157         "1": {
   158           "name": "keyword.other.ml"
   159         },
   160         "2": {
   161           "name": "keyword.other.ml"
   162         }
   163       },
   164       "name": "meta.exp.let.ml"
   165     },
   166     {
   167       "end": "\\b(end)\\b",
   168       "begin": "\\b(sig)\\b",
   169       "patterns": [
   170         {
   171           "include": "#spec"
   172         }
   173       ],
   174       "captures": {
   175         "1": {
   176           "name": "keyword.other.delimiter.ml"
   177         },
   178         "2": {
   179           "name": "keyword.other.delimiter.ml"
   180         }
   181       },
   182       "name": "meta.module.sigdec.ml"
   183     },
   184     {
   185       "match": "\\b(if|then|else)\\b",
   186       "name": "keyword.control.ml"
   187     },
   188     {
   189       "end": "(?=val|type|eqtype|datatype|structure|local)",
   190       "begin": "\\b(fun|and)\\s+([\\w]+)\\b",
   191       "patterns": [
   192         {
   193           "include": "source.isabelle-ml"
   194         }
   195       ],
   196       "captures": {
   197         "1": {
   198           "name": "keyword.control.fun.ml"
   199         },
   200         "2": {
   201           "name": "entity.name.function.ml"
   202         }
   203       },
   204       "name": "meta.definition.fun.ml"
   205     },
   206     {
   207       "end": "\"",
   208       "begin": "\"",
   209       "beginCaptures": {
   210         "0": {
   211           "name": "punctuation.definition.string.begin.ml"
   212         }
   213       },
   214       "patterns": [
   215         {
   216           "match": "\\\\.",
   217           "name": "constant.character.escape.ml"
   218         }
   219       ],
   220       "endCaptures": {
   221         "0": {
   222           "name": "punctuation.definition.string.end.ml"
   223         }
   224       },
   225       "name": "string.quoted.double.ml"
   226     },
   227     {
   228       "match": "(#\")(\\\\)?.(\")",
   229       "captures": {
   230         "3": {
   231           "name": "punctuation.definition.constant.ml"
   232         },
   233         "1": {
   234           "name": "punctuation.definition.constant.ml"
   235         }
   236       },
   237       "name": "constant.character.ml"
   238     },
   239     {
   240       "match": "\\b\\d*\\.?\\d+\\b",
   241       "name": "constant.numeric.ml"
   242     },
   243     {
   244       "match": "\\b(andalso|orelse|not)\\b",
   245       "name": "keyword.operator.logical.ml"
   246     },
   247     {
   248       "end": "(?==|:|\\()",
   249       "begin": "(?x)\\b\n\t\t\t\t\t(functor|structure|signature)\\s+\n\t\t\t\t\t(\\w+)\\s* # identifier",
   250       "captures": {
   251         "1": {
   252           "name": "storage.type.module.binder.ml"
   253         },
   254         "2": {
   255           "name": "entity.name.type.module.ml"
   256         }
   257       },
   258       "name": "meta.module.dec.ml"
   259     },
   260     {
   261       "match": "\\b(open)\\b",
   262       "name": "keyword.other.module.ml"
   263     },
   264     {
   265       "match": "\\b(nil|true|false|NONE|SOME)\\b",
   266       "name": "constant.language.ml"
   267     },
   268     {
   269       "end": "$",
   270       "begin": "\\b(type|eqtype) .* =",
   271       "patterns": [
   272         {
   273           "match": "(([a-zA-Z0-9\\.\\* ]|(\\->))*)",
   274           "name": "meta.typeexp.ml"
   275         }
   276       ],
   277       "captures": {
   278         "1": {
   279           "name": "keyword.other.typeabbrev.ml"
   280         },
   281         "2": {
   282           "name": "variable.other.typename.ml"
   283         }
   284       },
   285       "name": "meta.typeabbrev.ml"
   286     }
   287   ]
   288 }