├── .gitignore ├── package.json ├── grammars ├── reason-hover-type.json └── reason.json ├── README.md ├── settings └── language-reason.json ├── LICENSE.md └── snippets └── language-reason.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-reason", 3 | "repository": "https://github.com/reasonml-editor/language-reason", 4 | "private": true, 5 | "version": "0.0.7", 6 | "description": "Reason language support in Atom" 7 | } 8 | -------------------------------------------------------------------------------- /grammars/reason-hover-type.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.reason.hover.type", 3 | "patterns": [ 4 | { "include": "source.reason#signature-expression" }, 5 | { "include": "source.reason#module-item-type" }, 6 | { "include": "source.reason#type-expression" } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # language-reason package 2 | 3 | Syntax highlighting for the [Reason](https://github.com/facebook/reason) language. If you're using Atom and have already installed Nuclide, this one's unnecessary. 4 | 5 | This is the source of truth for our syntax regex-based highlighting. Hopefully Sublime, Atom, VSCode and the rest all use this same one or derive the highlighting from it. The latter two already do so. 6 | -------------------------------------------------------------------------------- /settings/language-reason.json: -------------------------------------------------------------------------------- 1 | { 2 | ".source.reason": { 3 | "editor": { 4 | "commentStart": "// ", 5 | "foldEndPattern": "^\\s*\\}|^\\s*\\]|^\\s*\\)", 6 | "increaseIndentPattern": "(?x) \\{ [^}\"']* $ | \\[ [^\\]\"']* $ | \\( [^)\"']* $", 7 | "decreaseIndentPattern": "(?x) ^ \\s* (\\s* /[*] .* [*]/ \\s*)* [}\\])]", 8 | "preferredLineLength": 110 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Cheng Lou 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /snippets/language-reason.json: -------------------------------------------------------------------------------- 1 | { 2 | ".source.reason": { 3 | "Reason: Special Comment": { 4 | "prefix": "sc", 5 | "body": "/**\n * ${1:comment}\n */" 6 | }, 7 | "Reason: Comment": { 8 | "prefix": "com", 9 | "body": "/*\n * ${1:comment}\n */" 10 | }, 11 | "Reason: Inline Comment": { 12 | "prefix": "ic", 13 | "body": "/* ${1:comment} */" 14 | }, 15 | "Reason: Type alias": { 16 | "prefix": "lt", 17 | "body": "type ${1:t} = ${2:typ};" 18 | }, 19 | "Reason: Let Binding": { 20 | "prefix": "lt", 21 | "body": "let ${1:name} = ${2:value};" 22 | }, 23 | "Reason: Let Function": { 24 | "prefix": "lf", 25 | "body": "let ${1:funcName} ${2:args} => {\n $0\n};" 26 | }, 27 | "Reason: Let Module": { 28 | "prefix": "lm", 29 | "body": "let module ${1:Module} = {\n ${0}\n};" 30 | }, 31 | "Reason: Switch Pattern Match": { 32 | "prefix": "sw", 33 | "body": "switch ${1:expression} {\n| ${2:firstCase} => ${3:result}\n};" 34 | }, 35 | "Reason: Try-catch": { 36 | "prefix": "try", 37 | "body": "try (${1:expression}) {\n| ${2:firstException} => ${3:firstHandler}\n};" 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /grammars/reason.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Reason", 3 | "scopeName": "source.reason", 4 | "fileTypes": [ 5 | "re", 6 | "rei" 7 | ], 8 | "patterns": [ 9 | { "include": "#structure-expression-block-item" }, 10 | { "include": "#value-expression" } 11 | ], 12 | "repository": { 13 | "attribute": { 14 | "begin": "(?=\\[(@{1,3})[[:space:]]*[[:alpha:]])", 15 | "end": "\\]", 16 | "patterns": [ 17 | { 18 | "begin": "\\[(@{1,3})", 19 | "end": "(?=[^_\\.'[:word:]])", 20 | "beginCaptures": { 21 | "1": { "name": "keyword.control.less" } 22 | }, 23 | "patterns": [ 24 | { "include": "#attribute-identifier" } 25 | ] 26 | }, 27 | { "include": "#attribute-payload" } 28 | ] 29 | }, 30 | "attribute-identifier": { 31 | "patterns": [ 32 | { 33 | "match": "\\b([[:alpha:]][[:word:]]*)\\b[[:space:]]*(?:(\\.))", 34 | "captures": { 35 | "1": { "name": "support.class entity.name.class" }, 36 | "2": { "name": "keyword.control.less" } 37 | } 38 | }, 39 | { 40 | "match": "\\b([[:alpha:]][[:word:]]*)\\b", 41 | "name": "entity.other.attribute-name.css constant.language constant.numeric" 42 | } 43 | ] 44 | }, 45 | "attribute-payload": { 46 | "patterns": [ 47 | { 48 | "begin": "(:)", 49 | "end": "(?=\\])", 50 | "beginCaptures": { 51 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 52 | }, 53 | "patterns": [ 54 | { "include": "#structure-expression" }, 55 | { "include": "#module-item-type" }, 56 | { "include": "#type-expression" } 57 | ] 58 | }, 59 | { 60 | "begin": "([\\?])", 61 | "end": "(?=\\])", 62 | "beginCaptures": { 63 | "1": { "name": "keyword.control.less" } 64 | }, 65 | "patterns": [ 66 | { "include": "#pattern-guard" }, 67 | { "include": "#pattern" } 68 | ] 69 | }, 70 | { "include": "#structure-expression-block-item" }, 71 | { "include": "#value-expression" } 72 | ] 73 | }, 74 | "class-item-inherit": { 75 | "begin": "\\b(inherit)\\b", 76 | "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 77 | "beginCaptures": { 78 | "1": { "name": "keyword.other" } 79 | }, 80 | "endCaptures": { 81 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 82 | }, 83 | "patterns": [ 84 | { "include": "#value-expression" } 85 | ] 86 | }, 87 | "class-item-method": { 88 | "begin": "\\b(method)\\b", 89 | "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|type|val|with)\\b)", 90 | "beginCaptures": { 91 | "1": { "name": "storage.type" } 92 | }, 93 | "endCaptures": { 94 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 95 | }, 96 | "patterns": [ 97 | { "include": "#module-item-let-value-bind-name-params-type-body" } 98 | ] 99 | }, 100 | "comment": { 101 | "patterns": [ 102 | { "include": "#comment-line" }, 103 | { "include": "#comment-block-doc" }, 104 | { "include": "#comment-block" } 105 | ] 106 | }, 107 | "comment-line": { 108 | "begin": "(^[ \\t]+)?(//)", 109 | "end": "$", 110 | "name": "comment.line.double-slash", 111 | "beginCaptures": { 112 | "1": { "name": "punctuation.whitespace.leading" }, 113 | "2": { "name": "punctuation.definition.comment" } 114 | } 115 | }, 116 | "comment-block": { 117 | "begin": "/\\*", 118 | "end": "\\*/", 119 | "name": "comment.block", 120 | "beginCaptures": { 121 | "0": { "name": "punctuation.definition.comment.begin" } 122 | }, 123 | "endCaptures": { 124 | "0": { "name": "punctuation.definition.comment.end" } 125 | } 126 | }, 127 | "comment-block-doc": { 128 | "begin": "/\\*\\*(?!/)", 129 | "end": "\\*/", 130 | "name": "comment.block.documentation", 131 | "beginCaptures": { 132 | "0": { "name": "punctuation.definition.comment.begin" } 133 | }, 134 | "endCaptures": { 135 | "0": { "name": "punctuation.definition.comment.end" } 136 | } 137 | }, 138 | "condition-lhs": { 139 | "begin": "(?|~$\\\\])([\\?])(?![#\\-:!?.@*/&%^+<=>|~$\\\\])", 140 | "end": "(?=[\\)])", 141 | "beginCaptures": { 142 | "1": { "name": "keyword.control message.error variable.interpolation" } 143 | }, 144 | "patterns": [ 145 | { 146 | "match": "(?:\\b|[[:space:]]+)([?])(?:\\b|[[:space:]]+)", 147 | "name": "keyword.control message.error variable.interpolation" 148 | }, 149 | { "include": "#value-expression" } 150 | ] 151 | }, 152 | "extension-node": { 153 | "begin": "(?=\\[(%{1,3})[[:space:]]*[[:alpha:]])", 154 | "end": "\\]", 155 | "patterns": [ 156 | { 157 | "begin": "\\[(%{1,3})", 158 | "end": "(?=[^_\\.'[:word:]])", 159 | "beginCaptures": { 160 | "1": { "name": "keyword.control.less" } 161 | }, 162 | "patterns": [ 163 | { "include": "#attribute-identifier" } 164 | ] 165 | }, 166 | { "include": "#attribute-payload" } 167 | ] 168 | }, 169 | "jsx": { 170 | "patterns": [ 171 | { "include": "#jsx-head" }, 172 | { "include": "#jsx-tail" } 173 | ] 174 | }, 175 | "jsx-attributes": { 176 | "patterns": [ 177 | { 178 | "begin": "\\b([[:lower:]][[:word:]]*)\\b[[:space:]]*(=)", 179 | "end": "(?[:lower:]])", 180 | "comment": "meta.separator", 181 | "beginCaptures": { 182 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, 183 | "2": { "name": "keyword.control.less" } 184 | }, 185 | "patterns": [ 186 | { "include": "#value-expression-atomic-with-paths" } 187 | ] 188 | }, 189 | { 190 | "match": "(\\b([[:lower:]][[:word:]]*)\\b[[:space:]]*+)", 191 | "captures": { 192 | "1": { "comment": "meta.separator" }, 193 | "2": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } 194 | } 195 | } 196 | ] 197 | }, 198 | "jsx-body": { 199 | "begin": "((>))", 200 | "end": "(?=))|(?=])[[:space:]]*+", 229 | "comment": "meta.separator", 230 | "patterns": [ 231 | { "include": "#module-path-simple" }, 232 | { 233 | "match": "\\b[[:lower:]][[:word:]]*\\b", 234 | "name": "entity.name.tag.inline.any.html" 235 | } 236 | ] 237 | }, 238 | { "include": "#jsx-attributes" }, 239 | { "include": "#jsx-body" }, 240 | { "include": "#comment" } 241 | ] 242 | }, 243 | "jsx-tail": { 244 | "begin": "\\G(/>)|()", 246 | "applyEndPatternLast": true, 247 | "comment": "meta.separator", 248 | "beginCaptures": { 249 | "1": { "name": "punctuation.definition.tag.end.js" }, 250 | "2": { "name": "punctuation.definition.tag.begin.js" } 251 | }, 252 | "endCaptures": { 253 | "1": { "name": "punctuation.definition.tag.end.js" } 254 | }, 255 | "patterns": [ 256 | { "include": "#module-path-simple" }, 257 | { 258 | "match": "\\b[[:lower:]][[:word:]]*\\b", 259 | "name": "entity.name.tag.inline.any.html" 260 | } 261 | ] 262 | }, 263 | "module-name-extended": { 264 | "patterns": [ 265 | { "include": "#module-name-simple" }, 266 | { 267 | "begin": "([\\(])", 268 | "end": "([\\)])", 269 | "captures": { 270 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 271 | }, 272 | "patterns": [ 273 | { "include": "#module-path-extended" } 274 | ] 275 | } 276 | ] 277 | }, 278 | "module-name-simple": { 279 | "match": "\\b[[:upper:]][[:word:]]*\\b", 280 | "name": "support.class entity.name.class" 281 | }, 282 | "module-path-extended": { 283 | "patterns": [ 284 | { "include": "#module-name-extended" }, 285 | { "include": "#comment" }, 286 | { 287 | "comment": "NOTE: end early to avoid too much reparsing", 288 | "begin": "([\\.])", 289 | "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", 290 | "beginCaptures": { 291 | "1": { "name": "keyword.control.less" } 292 | }, 293 | "patterns": [ 294 | { 295 | "begin": "(?<=[\\.])", 296 | "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", 297 | "patterns": [ 298 | { "include": "#comment" }, 299 | { "include": "#module-name-extended" } 300 | ] 301 | } 302 | ] 303 | } 304 | ] 305 | }, 306 | "module-path-extended-prefix": { 307 | "begin": "(?=\\b[[:upper:]])", 308 | "end": "([\\.])|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 309 | "endCaptures": { 310 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 311 | }, 312 | "patterns": [ 313 | { "include": "#module-path-extended" } 314 | ] 315 | }, 316 | "module-path-simple": { 317 | "patterns": [ 318 | { "include": "#module-name-simple" }, 319 | { "include": "#comment" }, 320 | { 321 | "comment": "NOTE: end early to avoid too much reparsing", 322 | "begin": "([\\.])", 323 | "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", 324 | "beginCaptures": { 325 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 326 | }, 327 | "patterns": [ 328 | { 329 | "begin": "(?<=[\\.])", 330 | "end": "(?<=[[:word:]\\)])|(?=[^\\.[:upper:]/])", 331 | "patterns": [ 332 | { "include": "#comment" }, 333 | { "include": "#module-name-simple" } 334 | ] 335 | } 336 | ] 337 | } 338 | ] 339 | }, 340 | "module-path-simple-prefix": { 341 | "begin": "(?=\\b[[:upper:]])", 342 | "end": "([\\.])|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 343 | "endCaptures": { 344 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 345 | }, 346 | "patterns": [ 347 | { "include": "#module-path-simple" } 348 | ] 349 | }, 350 | "module-item-class-type": { 351 | "comment": "FIXME: proper parsing", 352 | "begin": "\\b(class)\\b", 353 | "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|module|nonrec|open|private|rec|type|val|with)\\b)", 354 | "beginCaptures": { 355 | "1": { "name": "keyword.other" } 356 | }, 357 | "endCaptures": { 358 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 359 | }, 360 | "patterns": [ 361 | { 362 | "begin": "(?:\\G|^)[[:space:]]*\\b(type)\\b", 363 | "end": "(?==)", 364 | "beginCaptures": { 365 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 366 | }, 367 | "patterns": [ 368 | { "include": "#module-item-type-bind-name-tyvars" } 369 | ] 370 | }, 371 | { 372 | "begin": "(=)", 373 | "end": "(?=;)", 374 | "beginCaptures": { 375 | "1": { "name": "keyword.control.less" } 376 | }, 377 | "patterns": [ 378 | { "include": "#attribute" }, 379 | { "include": "#comment" }, 380 | { "include": "#class-item-inherit" }, 381 | { "include": "#class-item-method" } 382 | ] 383 | } 384 | ] 385 | }, 386 | "module-item-exception": { 387 | "begin": "\\b(exception)\\b", 388 | "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 389 | "beginCaptures": { 390 | "1": { "name": "keyword.other" } 391 | }, 392 | "endCaptures": { 393 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 394 | }, 395 | "patterns": [ 396 | { "include": "#module-item-type-bind-body-item" } 397 | ] 398 | }, 399 | "module-item-external": { 400 | "begin": "\\b(external)\\b", 401 | "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 402 | "beginCaptures": { 403 | "1": { "name": "storage.type" } 404 | }, 405 | "endCaptures": { 406 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 407 | }, 408 | "patterns": [ 409 | { "include": "#module-item-let-value-bind-name-or-pattern" }, 410 | { "include": "#module-item-let-value-bind-type" }, 411 | { 412 | "begin": "(=)", 413 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 414 | "beginCaptures": { 415 | "1": { "name": "keyword.control.less" } 416 | }, 417 | "patterns": [ 418 | { "include": "#attribute" }, 419 | { 420 | "begin": "\"", 421 | "end": "\"", 422 | "name": "string.double string.regexp", 423 | "patterns": [ 424 | { "include": "#value-literal-string-escape" }, 425 | { 426 | "match": "(?:(%)(.*?)|(caml.*?))(?=\"|(?:[^\\\\\\n]$))", 427 | "captures": { 428 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" }, 429 | "2": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 430 | "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error"} 431 | } 432 | } 433 | ] 434 | } 435 | ] 436 | } 437 | ] 438 | }, 439 | "module-item-include": { 440 | "begin": "\\b(include)\\b", 441 | "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val)\\b)", 442 | "beginCaptures": { 443 | "1": { "name": "keyword.control.include" } 444 | }, 445 | "endCaptures": { 446 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 447 | }, 448 | "patterns": [ 449 | { "include": "#signature-expression" } 450 | ] 451 | }, 452 | "module-item-let": { 453 | "begin": "\\b(let)\\b", 454 | "end": "(;)|(?=}|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 455 | "beginCaptures": { 456 | "1": { "name": "storage.type" } 457 | }, 458 | "endCaptures": { 459 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 460 | }, 461 | "patterns": [ 462 | { "include": "#module-item-let-module" }, 463 | { "include": "#module-item-let-value" } 464 | ] 465 | }, 466 | "module-item-let-module": { 467 | "begin": "(?:\\G|^)[[:space:]]*\\b(module)\\b", 468 | "end": "(?=[;}]|\\b(class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|type|val|with)\\b)", 469 | "beginCaptures": { 470 | "1": { "name": "variable.other.class.js variable.interpolation keyword.control storage.type message.error" } 471 | }, 472 | "patterns": [ 473 | { "include": "#comment" }, 474 | { "include": "#module-item-let-module-and" }, 475 | { "include": "#module-item-let-module-rec" }, 476 | { "include": "#module-item-let-module-bind-name-params-type-body" } 477 | ] 478 | }, 479 | "module-item-let-module-and": { 480 | "begin": "\\b(and)\\b", 481 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 482 | "beginCaptures": { 483 | "1": { "name": "storage.type" } 484 | }, 485 | "patterns": [ 486 | { "include": "#module-item-let-module-bind-name-params-type-body" } 487 | ] 488 | }, 489 | "module-item-let-module-bind-body": { 490 | "begin": "(=>?)", 491 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 492 | "beginCaptures": { 493 | "1": { "name": "keyword.control.less" } 494 | }, 495 | "patterns": [ 496 | { "include": "#structure-expression" } 497 | ] 498 | }, 499 | "module-item-let-module-bind-name-params": { 500 | "begin": "\\b([[:upper:]][[:word:]]*)\\b", 501 | "end": "(?=[;:}=]|\\b(class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 502 | "beginCaptures": { 503 | "1": { "name": "support.class entity.name.class" } 504 | }, 505 | "patterns": [ 506 | { "include": "#comment" }, 507 | { "include": "#module-item-let-module-param" } 508 | ] 509 | }, 510 | "module-item-let-module-bind-name-params-type-body": { 511 | "begin": "(?:\\G|^)", 512 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 513 | "patterns": [ 514 | { "include": "#comment" }, 515 | { "include": "#module-item-let-module-bind-name-params" }, 516 | { "include": "#module-item-let-module-bind-type" }, 517 | { "include": "#module-item-let-module-bind-body" } 518 | ] 519 | }, 520 | "module-item-let-module-bind-type": { 521 | "begin": "(:)", 522 | "end": "(?=[;}=]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val)\\b)", 523 | "beginCaptures": { 524 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 525 | }, 526 | "patterns": [ 527 | { "include": "#signature-expression" } 528 | ] 529 | }, 530 | "module-item-let-module-param": { 531 | "begin": "(?=\\()", 532 | "end": "\\)", 533 | "patterns": [ 534 | { 535 | "begin": "\\(", 536 | "end": "(?=[:])", 537 | "patterns": [ 538 | { "include": "#comment" }, 539 | { "include": "#module-name-simple" } 540 | ] 541 | }, 542 | { 543 | "begin": "(:)", 544 | "end": "(?=\\))", 545 | "beginCaptures": { 546 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 547 | }, 548 | "patterns": [ 549 | { "include": "#signature-expression" } 550 | ] 551 | } 552 | ] 553 | }, 554 | "module-item-let-module-rec": { 555 | "begin": "(?:\\G|^)[[:space:]]*\\b(rec)\\b", 556 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 557 | "beginCaptures": { 558 | "1": { "name": "keyword.control storage.modifier.rec" } 559 | }, 560 | "patterns": [ 561 | { "include": "#module-item-let-module-bind-name-params-type-body" } 562 | ] 563 | }, 564 | "module-item-let-value": { 565 | "patterns": [ 566 | { "include": "#module-item-let-value-and" }, 567 | { "include": "#module-item-let-value-rec" }, 568 | { "include": "#module-item-let-value-bind-name-params-type-body" } 569 | ] 570 | }, 571 | "module-item-let-value-and": { 572 | "begin": "\\b(and)\\b", 573 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 574 | "beginCaptures": { 575 | "1": { "name": "storage.type" } 576 | }, 577 | "patterns": [ 578 | { "include": "#module-item-let-value-bind-name-params-type-body" } 579 | ] 580 | }, 581 | "module-item-let-value-bind-body": { 582 | "begin": "(=>?)", 583 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 584 | "beginCaptures": { 585 | "1": { "name": "keyword.control.less" } 586 | }, 587 | "patterns": [ 588 | { "include": "#value-expression" } 589 | ] 590 | }, 591 | "module-item-let-value-bind-name-or-pattern": { 592 | "begin": "(?<=[^[:word:]]and|^and|[^[:word:]]external|^external|[^[:word:]]let|^let|[^[:word:]]method|^method|[^[:word:]]rec|^rec)[[:space:]]*", 593 | "end": "(?<=[^[:space:]])|(?=[[:space:]]|[;:}=]|\\b(and|as|class|constraint|exception|external|for|include|inherit|let|method|module|nonrec|open|private|rec|switch|try|type|val|while|with)\\b)", 594 | "patterns": [ 595 | { "include": "#comment" }, 596 | { 597 | "match": "\\b(?:([_][[:word:]]+)|([[:lower:]][[:word:]]*))\\b", 598 | "captures": { 599 | "1": { "name": "comment" }, 600 | "2": { "name": "entity.name.function" } 601 | } 602 | }, 603 | { "include": "#module-item-let-value-bind-parens-params" }, 604 | { "include": "#pattern" } 605 | ] 606 | }, 607 | "module-item-let-value-bind-name-params-type-body": { 608 | "begin": "(?<=[^[:word:]]and|^and|[^[:word:]]external|^external|[^[:word:]]let|^let|[^[:word:]]method|^method|[^[:word:]]rec|^rec)", 609 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 610 | "patterns": [ 611 | { 612 | "comment": "FIXME; hack for punned arguments", 613 | "begin": "(::)", 614 | "end": "(?<=[[:space:]])", 615 | "beginCaptures": { 616 | "1": { "name": "keyword.control" } 617 | }, 618 | "patterns": [ 619 | { "include": "#pattern" }, 620 | { 621 | "begin": "(=)", 622 | "end": "(\\?)|(?<=[^[:space:]=][[:space:]])(?=[[:space:]]*+[^\\.])", 623 | "beginCaptures": { 624 | "1": { "name": "markup.inserted keyword.control.less message.error" } 625 | }, 626 | "endCaptures": { 627 | "1": { "name": "storage.type" } 628 | }, 629 | "patterns": [ 630 | { "include": "#value-expression-atomic-with-paths" } 631 | ] 632 | } 633 | ] 634 | }, 635 | { "include": "#module-item-let-value-bind-name-or-pattern" }, 636 | { "include": "#module-item-let-value-bind-params-type" }, 637 | { "include": "#module-item-let-value-bind-type" }, 638 | { "include": "#module-item-let-value-bind-body" } 639 | ] 640 | }, 641 | "module-item-let-value-bind-params-type": { 642 | "begin": "(?=[^[:space:]:=])", 643 | "end": "(?=[;}=]|\\b(class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 644 | "patterns": [ 645 | { "include": "#comment" }, 646 | { "include": "#module-item-let-value-param" }, 647 | { 648 | "begin": "(?]|[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|val|with)\\b)", 682 | "beginCaptures": { 683 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 684 | }, 685 | "patterns": [ 686 | { 687 | "begin": "\\b(type)\\b", 688 | "end": "([\\.])", 689 | "beginCaptures": { 690 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 691 | }, 692 | "endCaptures": { 693 | "1": { "name": "entity.name.function" } 694 | }, 695 | "patterns": [ 696 | { "include": "#pattern-variable" } 697 | ] 698 | }, 699 | { "include": "#type-expression" } 700 | ] 701 | }, 702 | "module-item-let-value-param": { 703 | "patterns": [ 704 | { "include": "#module-item-let-value-param-label" }, 705 | { "include": "#module-item-let-value-param-type" }, 706 | { "include": "#module-item-let-value-param-module" }, 707 | { "include": "#pattern" } 708 | ] 709 | }, 710 | "module-item-let-value-param-label": { 711 | "patterns": [ 712 | { 713 | "begin": "(\\b[[:lower:]][[:word:]]*\\b)?[[:space:]]*(::)", 714 | "end": "(?<=[[:space:]])", 715 | "beginCaptures": { 716 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, 717 | "2": { "name": "keyword.control" } 718 | }, 719 | "patterns": [ 720 | { "include": "#pattern" }, 721 | { 722 | "begin": "(=)", 723 | "end": "(\\?)|(?<=[^[:space:]=][[:space:]])(?=[[:space:]]*+[^\\.])", 724 | "beginCaptures": { 725 | "1": { "name": "markup.inserted keyword.control.less message.error" } 726 | }, 727 | "endCaptures": { 728 | "1": { "name": "storage.type" } 729 | }, 730 | "patterns": [ 731 | { "include": "#value-expression-atomic-with-paths" } 732 | ] 733 | } 734 | ] 735 | } 736 | ] 737 | }, 738 | "module-item-let-value-param-module": { 739 | "comment": "FIXME: merge with pattern-parens", 740 | "begin": "\\([[:space:]]*(?=\\b(module)\\b)", 741 | "end": "\\)", 742 | "patterns": [ 743 | { 744 | "begin": "\\b(module)\\b", 745 | "end": "(?=\\))", 746 | "beginCaptures": { 747 | "1": { "name": "keyword.other message.error" } 748 | }, 749 | "patterns": [ 750 | { 751 | "match": "\\b[[:upper:]][[:word:]]*\\b", 752 | "name": "support.class entity.name.class" 753 | } 754 | ] 755 | } 756 | ] 757 | }, 758 | "module-item-let-value-param-type": { 759 | "comment": "FIXME: merge with pattern-parens", 760 | "begin": "\\((?=\\b(type)\\b)", 761 | "end": "\\)", 762 | "patterns": [ 763 | { 764 | "begin": "\\b(type)\\b", 765 | "end": "(?=\\))", 766 | "beginCaptures": { 767 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 768 | }, 769 | "patterns": [ 770 | { "include": "#pattern-variable" } 771 | ] 772 | } 773 | ] 774 | }, 775 | "module-item-let-value-rec": { 776 | "begin": "(?:\\G|^)[[:space:]]*\\b(rec)\\b", 777 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 778 | "beginCaptures": { 779 | "1": { "name": "keyword.control storage.modifier message.error" } 780 | }, 781 | "patterns": [ 782 | { "include": "#module-item-let-value-bind-name-params-type-body" } 783 | ] 784 | }, 785 | "module-item-module": { 786 | "comment": "NOTE: this is to support the let-module case without the let prefix", 787 | "begin": "\\b(module)\\b[[:space:]]*(?!\\b(type)\\b|$)", 788 | "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 789 | "beginCaptures": { 790 | "1": { "name": "storage.type message.error" } 791 | }, 792 | "endCaptures": { 793 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 794 | }, 795 | "patterns": [ 796 | { "include": "#module-item-let-module-and" }, 797 | { "include": "#module-item-let-module-rec" }, 798 | { "include": "#module-item-let-module-bind-name-params-type-body" } 799 | ] 800 | }, 801 | "module-item-module-type": { 802 | "begin": "\\b(module)\\b[[:space:]]*(?=\\b(type)\\b|$)", 803 | "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|val|with)\\b)", 804 | "beginCaptures": { 805 | "1": { "name": "keyword.control message.error" } 806 | }, 807 | "endCaptures": { 808 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 809 | }, 810 | "patterns": [ 811 | { 812 | "begin": "(?:\\G|^)[[:space:]]*\\b(type)\\b", 813 | "end": "(?==)", 814 | "beginCaptures": { 815 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 816 | }, 817 | "patterns": [ 818 | { "include": "#comment" }, 819 | { 820 | "match": "([[:upper:]][[:word:]]*)", 821 | "captures": { 822 | "1": { "name": "support.class entity.name.class" } 823 | } 824 | } 825 | ] 826 | }, 827 | { 828 | "begin": "(=)", 829 | "end": "(?=;)", 830 | "beginCaptures": { 831 | "1": { "name": "keyword.control.less" } 832 | }, 833 | "patterns": [ 834 | { "include": "#comment" }, 835 | { "include": "#signature-expression" } 836 | ] 837 | } 838 | ] 839 | }, 840 | "module-item-open": { 841 | "begin": "\\b(open)\\b", 842 | "end": "(;)|(?=}|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 843 | "beginCaptures": { 844 | "1": { "name": "keyword.control.open" } 845 | }, 846 | "endCaptures": { 847 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 848 | }, 849 | "patterns": [ 850 | { "include": "#comment" }, 851 | { "include": "#module-path-simple" } 852 | ] 853 | }, 854 | "module-item-type": { 855 | "comment": "FIXME: the semi-colon is optional so we can re-use this for hover, which does not print the trailing ;", 856 | "begin": "\\b(type)\\b", 857 | "end": "(;)|(?=[\\)}]|\\b(class|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 858 | "beginCaptures": { 859 | "1": { "name": "keyword.other" } 860 | }, 861 | "endCaptures": { 862 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 863 | }, 864 | "patterns": [ 865 | { "include": "#module-item-type-and" }, 866 | { "include": "#module-item-type-constraint" }, 867 | { "include": "#module-item-type-bind" } 868 | ] 869 | }, 870 | "module-item-type-and": { 871 | "comment": "FIXME: the optional `type` is for module constraints", 872 | "begin": "\\b(and)\\b([[:space:]]*type)?", 873 | "end": "(?=[;\\)}]|\\b(class|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 874 | "beginCaptures": { 875 | "1": { "name": "keyword.other" }, 876 | "2": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 877 | }, 878 | "patterns": [ 879 | { "include": "#module-item-type-bind-name-tyvars-body" } 880 | ] 881 | }, 882 | "module-item-type-bind": { 883 | "comment": "FIXME: only allow module paths before type variables", 884 | "patterns": [ 885 | { "include": "#module-item-type-bind-nonrec" }, 886 | { "include": "#module-item-type-bind-name-tyvars-body" } 887 | ] 888 | }, 889 | "module-item-type-bind-body": { 890 | "comment": "FIXME: parsing", 891 | "begin": "(\\+?=)", 892 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|rec|type|val|with)\\b)", 893 | "beginCaptures": { 894 | "1": { "name": "keyword.control.less" } 895 | }, 896 | "patterns": [ 897 | { "include": "#module-item-type-bind-body-item" } 898 | ] 899 | }, 900 | "module-item-type-bind-body-item": { 901 | "patterns": [ 902 | { 903 | "match": "(=)(?!>)|\\b(private)\\b", 904 | "captures": { 905 | "1": { "name": "keyword.control.less" }, 906 | "2": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } 907 | } 908 | }, 909 | { 910 | "comment": "FIXME: specialized version of variant rule that also scans for (", 911 | "match": "\\b([[:upper:]][[:word:]]*)\\b(?![[:space:]]*[\\.\\(])", 912 | "captures": { 913 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 914 | } 915 | }, 916 | { 917 | "begin": "(\\.\\.)", 918 | "end": "(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 919 | "beginCaptures": { 920 | "1": { "name": "keyword.control.less" } 921 | } 922 | }, 923 | { 924 | "begin": "(\\|)(?![#\\-:!?.@*/&%^+<=>|~$\\\\])[[:space:]]*", 925 | "end": "(?=[;\\)}]|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\])|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 926 | "beginCaptures": { 927 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 928 | }, 929 | "patterns": [ 930 | { "include": "#value-expression-constructor" }, 931 | { 932 | "match": "([:])|\\b(of)\\b", 933 | "captures": { 934 | "1": { "name": "keyword.control.less" }, 935 | "2": { "name": "keyword.other" } 936 | } 937 | }, 938 | { "include": "#type-expression" } 939 | ] 940 | }, 941 | { 942 | "comment": "FIXME: remove this once the pretty printer no longer outputs 'of'", 943 | "match": "(:)|(\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|\\b(of)\\b", 944 | "captures": { 945 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 946 | "2": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 947 | "3": { "name": "keyword.other" } 948 | } 949 | }, 950 | { "include": "#type-expression" } 951 | ] 952 | }, 953 | "module-item-type-bind-name-tyvars": { 954 | "begin": "(?<=\\G|^|\\.)[[:space:]]*\\b([[:lower:]][[:word:]]*)\\b", 955 | "end": "(?=\\+?=|[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 956 | "beginCaptures": { 957 | "1": { "name": "entity.name.function" } 958 | }, 959 | "patterns": [ 960 | { "include": "#comment" }, 961 | { "include": "#attribute" }, 962 | { 963 | "match": "_", 964 | "name": "comment" 965 | }, 966 | { 967 | "comment": "FIXME: add separate type-variable rule", 968 | "match": "([+\\-])?(?:(_)|(')([[:lower:]][[:word:]]*)\\b)(?!\\.[[:upper:]])", 969 | "captures": { 970 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 971 | "2": { "name": "comment" }, 972 | "3": { "name": "comment" }, 973 | "4": { "name": "variable.parameter string.other.link variable.language" } 974 | } 975 | } 976 | ] 977 | }, 978 | "module-item-type-bind-name-tyvars-body": { 979 | "begin": "(?=(\\G|^)[[:space:]]*\\b[[:alpha:]])", 980 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 981 | "patterns": [ 982 | { "include": "#module-path-simple-prefix" }, 983 | { "include": "#module-item-type-bind-name-tyvars" }, 984 | { "include": "#module-item-type-bind-body" } 985 | ] 986 | }, 987 | "module-item-type-bind-nonrec": { 988 | "begin": "(?:\\G|^)[[:space:]]*\\b(nonrec)\\b", 989 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 990 | "beginCaptures": { 991 | "1": { "name": "keyword.control storage.modifier message.error" } 992 | }, 993 | "patterns": [ 994 | { "include": "#module-item-type-bind-name-tyvars-body" } 995 | ] 996 | }, 997 | "module-item-type-constraint": { 998 | "comment": "FIXME: proper parsing", 999 | "begin": "\\b(constraint)\\b", 1000 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1001 | "beginCaptures": { 1002 | "1": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } 1003 | }, 1004 | "patterns": [ 1005 | { 1006 | "comment": "FIXME: add separate type-variable rule", 1007 | "match": "([+\\-])?(')([_[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", 1008 | "captures": { 1009 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 1010 | "2": { "name": "comment" }, 1011 | "3": { "name": "variable.parameter string.other.link variable.language" } 1012 | } 1013 | }, 1014 | { 1015 | "match": "=", 1016 | "name": "keyword.control.less" 1017 | }, 1018 | { "include": "#type-expression" } 1019 | ] 1020 | }, 1021 | "object-item": { 1022 | "begin": "\\G|(;)", 1023 | "end": "(?=[;}]|\\b(class|constraint|exception|external|include|let|module|nonrec|open|private|type|val|with)\\b)", 1024 | "beginCaptures": { 1025 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1026 | }, 1027 | "patterns": [ 1028 | { "include": "#class-item-method" } 1029 | ] 1030 | }, 1031 | "operator": { 1032 | "patterns": [ 1033 | { "include": "#operator-infix" }, 1034 | { "include": "#operator-prefix" } 1035 | ] 1036 | }, 1037 | "operator-infix": { 1038 | "patterns": [ 1039 | { 1040 | "match": ";", 1041 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" 1042 | }, 1043 | { "include": "#operator-infix-assign" }, 1044 | { "include": "#operator-infix-builtin" }, 1045 | { "include": "#operator-infix-custom" }, 1046 | { "comment": "#operator-infix-custom-hash" } 1047 | ] 1048 | }, 1049 | "operator-infix-assign": { 1050 | "match": "(?|~$\\\\])(=)(?![#\\-:!?.@*/&%^+<=>|~$\\\\])", 1051 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control.less message.error" 1052 | }, 1053 | "operator-infix-builtin": { 1054 | "match": ":=", 1055 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control.less message.error" 1056 | }, 1057 | "operator-infix-custom": { 1058 | "match": "(?:(?|~$\\\\])((<>))(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|([#\\-@*/&%^+<=>$\\\\][#\\-:!?.@*/&%^+<=>|~$\\\\]*|[|][#\\-:!?.@*/&%^+<=>|~$\\\\]+)", 1059 | "captures": { 1060 | "1": { "comment": "meta.separator" }, 1061 | "2": { "name": "punctuation.definition.tag.begin.js" }, 1062 | "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1063 | } 1064 | }, 1065 | "operator-infix-custom-hash": { 1066 | "match": "#[\\-:!?.@*/&%^+<=>|~$]+", 1067 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" 1068 | }, 1069 | "operator-prefix": { 1070 | "patterns": [ 1071 | { "include": "#operator-prefix-bang" }, 1072 | { "include": "#operator-prefix-label-token" } 1073 | ] 1074 | }, 1075 | "operator-prefix-bang": { 1076 | "match": "![\\-:!?.@*/&%^+<=>|~$]*", 1077 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" 1078 | }, 1079 | "operator-prefix-label-token": { 1080 | "match": "[?~][\\-:!?.@*/&%^+<=>|~$]+", 1081 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" 1082 | }, 1083 | "pattern": { 1084 | "patterns": [ 1085 | { "include": "#attribute" }, 1086 | { "include": "#comment" }, 1087 | { "include": "#pattern-atomic" }, 1088 | { 1089 | "match": "[[:space:]]*+(?:(\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|\\b(as)\\b|(\\.\\.\\.?))[[:space:]]*+", 1090 | "captures": { 1091 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 1092 | "2": { "name": "keyword.other" }, 1093 | "3": { "name": "keyword.control" } 1094 | } 1095 | } 1096 | ] 1097 | }, 1098 | "pattern-atomic": { 1099 | "patterns": [ 1100 | { 1101 | "match": "\\b(exception)\\b", 1102 | "name": "keyword.other" 1103 | }, 1104 | { "include": "#value-expression-literal" }, 1105 | { "include": "#module-path-simple-prefix" }, 1106 | { "include": "#pattern-list-or-array" }, 1107 | { "include": "#pattern-record" }, 1108 | { "include": "#pattern-variable" }, 1109 | { "include": "#pattern-parens" } 1110 | ] 1111 | }, 1112 | "pattern-guard": { 1113 | "begin": "\\b(when)\\b", 1114 | "end": "(?==>)", 1115 | "beginCaptures": { 1116 | "1": { "name": "keyword.other" } 1117 | }, 1118 | "patterns": [ 1119 | { "include": "#value-expression" } 1120 | ] 1121 | }, 1122 | "pattern-list-or-array": { 1123 | "begin": "(\\[\\|?)(?![@%])", 1124 | "end": "(\\|?\\])", 1125 | "beginCaptures": { 1126 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 1127 | }, 1128 | "endCaptures": { 1129 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 1130 | }, 1131 | "patterns": [ 1132 | { "include": "#value-expression-literal-list-or-array-separator" }, 1133 | { "include": "#pattern" } 1134 | ] 1135 | }, 1136 | "pattern-parens": { 1137 | "begin": "(?=\\()", 1138 | "end": "\\)|(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1139 | "patterns": [ 1140 | { "include": "#pattern-parens-lhs" }, 1141 | { "include": "#type-annotation-rhs" } 1142 | ] 1143 | }, 1144 | "pattern-parens-lhs": { 1145 | "begin": "\\(|(,)", 1146 | "end": "(?=(?:[,:\\)]))|(?=[;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1147 | "beginCaptures": { 1148 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1149 | }, 1150 | "patterns": [ 1151 | { "include": "#pattern" } 1152 | ] 1153 | }, 1154 | "record-path": { 1155 | "begin": "\\b[[:lower:]][[:word:]]*\\b", 1156 | "end": "(?=[^[:space:]\\.])(?!/\\*)", 1157 | "patterns": [ 1158 | { "include": "#comment" }, 1159 | { "include": "#record-path-suffix" } 1160 | ] 1161 | }, 1162 | "record-path-suffix": { 1163 | "begin": "(\\.)", 1164 | "end": "(\\))|\\b([[:upper:]][[:word:]]*)\\b|\\b([[:lower:]][[:word:]]*)\\b|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|with)\\b)", 1165 | "beginCaptures": { 1166 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1167 | }, 1168 | "endCaptures": { 1169 | "1": { "name": "keyword.control" }, 1170 | "2": { "name": "support.class entity.name.class" }, 1171 | "3": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } 1172 | }, 1173 | "patterns": [ 1174 | { "include": "#comment" }, 1175 | { 1176 | "begin": "([\\(])", 1177 | "end": "(?=[\\)])", 1178 | "beginCaptures": { 1179 | "1": { "name": "keyword.control" } 1180 | }, 1181 | "patterns": [ 1182 | { "include": "#comment" }, 1183 | { 1184 | "match": "\\b([[:lower:]][[:word:]]*)\\b(?=[^\\)]*([\\.]))", 1185 | "captures": { 1186 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, 1187 | "2": { "name": "keyword.other" } 1188 | } 1189 | }, 1190 | { 1191 | "match": "([\\.])", 1192 | "name": "keyword.control.less" 1193 | }, 1194 | { 1195 | "match": "\\b([[:lower:]][[:word:]]*)\\b[[:space:]]*", 1196 | "captures": { 1197 | "1": { "name": "variable.parameter string.other.link variable.language" } 1198 | } 1199 | }, 1200 | { "include": "#value-expression" } 1201 | ] 1202 | } 1203 | ] 1204 | }, 1205 | "pattern-record": { 1206 | "begin": "{", 1207 | "end": "}", 1208 | "patterns": [ 1209 | { "include": "#comment" }, 1210 | { "include": "#pattern-record-item" } 1211 | ] 1212 | }, 1213 | "pattern-record-field": { 1214 | "begin": "\\b([_][[:word:]]*)\\b|\\b([[:lower:]][[:word:]]*)\\b", 1215 | "end": "(,)|(?=})", 1216 | "beginCaptures": { 1217 | "1": { "name": "comment" }, 1218 | "2": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } 1219 | }, 1220 | "endCaptures": { 1221 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1222 | }, 1223 | "patterns": [ 1224 | { "include": "#comment" }, 1225 | { 1226 | "begin": "\\G(:)", 1227 | "end": "(?=[,}])", 1228 | "beginCaptures": { 1229 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1230 | }, 1231 | "patterns": [ 1232 | { "include": "#pattern" } 1233 | ] 1234 | } 1235 | ] 1236 | }, 1237 | "pattern-record-item": { 1238 | "patterns": [ 1239 | { "include": "#module-path-simple-prefix" }, 1240 | { "include": "#pattern-record-field" } 1241 | ] 1242 | }, 1243 | "pattern-variable": { 1244 | "patterns": [ 1245 | { 1246 | "match": "\\b(_(?:[[:lower:]][[:word:]]*)?)\\b(?!\\.[[:upper:]])", 1247 | "captures": { 1248 | "1": { "name": "comment" } 1249 | } 1250 | }, 1251 | { 1252 | "match": "\\b([[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", 1253 | "captures": { 1254 | "1": { "name": "variable.language string.other.link" } 1255 | } 1256 | } 1257 | ] 1258 | }, 1259 | "signature-expression": { 1260 | "patterns": [ 1261 | { 1262 | "comment": "FIXME: scan for :upper: to disambiguate type/signature in hover", 1263 | "begin": "(?=\\([[:space:]]*[[:upper:]][[:word:]]*[[:space:]]*:)", 1264 | "end": "(?=[;])", 1265 | "patterns": [ 1266 | { 1267 | "begin": "(?=\\()", 1268 | "end": "(?=[;]|=>)", 1269 | "patterns": [ 1270 | { "include": "#module-item-let-module-param" } 1271 | ] 1272 | }, 1273 | { 1274 | "begin": "(=>)", 1275 | "end": "(?=[;\\(])", 1276 | "beginCaptures": { 1277 | "1": { "name": "markup.inserted keyword.control.less" } 1278 | }, 1279 | "patterns": [ 1280 | { "include": "#structure-expression" } 1281 | ] 1282 | } 1283 | ] 1284 | }, 1285 | { 1286 | "begin": "\\b(module)\\b[[:space:]]*\\b(type)\\b([[:space:]]*\\b(of)\\b)?", 1287 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1288 | "beginCaptures": { 1289 | "1": { "name": "markup.inserted keyword.other variable.other.readwrite.instance" }, 1290 | "2": { "name": "entity.other.attribute-name.css constant.language constant.numeric" }, 1291 | "3": { "name": "markup.inserted keyword.other variable.other.readwrite.instance" } 1292 | }, 1293 | "patterns": [ 1294 | { "include": "#comment" }, 1295 | { "include": "#module-path-simple" }, 1296 | { 1297 | "match": "\\b([[:upper:]][[:word:]]*)\\b", 1298 | "name": "support.class entity.name.class" 1299 | } 1300 | ] 1301 | }, 1302 | { "include": "#signature-expression-constraints" }, 1303 | { "include": "#structure-expression" } 1304 | ] 1305 | }, 1306 | "signature-expression-constraints": { 1307 | "begin": "(?=\\b(with))", 1308 | "end": "(?=[;\\)}]|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val)\\b)", 1309 | "patterns": [ 1310 | { 1311 | "begin": "\\b(and|with)\\b", 1312 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val|with)\\b)", 1313 | "beginCaptures": { 1314 | "1": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } 1315 | }, 1316 | "patterns": [ 1317 | { "include": "#comment" }, 1318 | { 1319 | "comment": "FIXME: special version of #module-item-type with non-consuming `;`. Atom seems to need this to work.", 1320 | "begin": "\\b(type)\\b", 1321 | "end": "(?=[;\\)}]|\\b(class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val|with)\\b)", 1322 | "beginCaptures": { 1323 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 1324 | }, 1325 | "patterns": [ 1326 | { "include": "#module-item-type-and" }, 1327 | { "include": "#module-item-type-constraint" }, 1328 | { "include": "#module-item-type-bind" } 1329 | ] 1330 | }, 1331 | { 1332 | "begin": "(?=\\b(module)\\b)", 1333 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|val|with)\\b)", 1334 | "patterns": [ 1335 | { 1336 | "begin": "\\b(module)\\b", 1337 | "end": "(?=:?=|[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 1338 | "beginCaptures": { 1339 | "1": { "name": "markup.inserted keyword.control storage.type variable.other.readwrite.instance" } 1340 | }, 1341 | "patterns": [ 1342 | { "include": "#comment" }, 1343 | { "include": "#module-path-simple" }, 1344 | { 1345 | "match": "[[:upper:]][[:word:]]*", 1346 | "name": "support.class entity.name.class" 1347 | } 1348 | ] 1349 | }, 1350 | { 1351 | "begin": "(:=)|(=)", 1352 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|type|val|with)\\b)", 1353 | "beginCaptures": { 1354 | "1": { "name": "markup.inserted keyword.control.less message.error" }, 1355 | "2": { "name": "markup.inserted keyword.control.less" } 1356 | }, 1357 | "patterns": [ 1358 | { "include": "#structure-expression" } 1359 | ] 1360 | } 1361 | ] 1362 | } 1363 | ] 1364 | } 1365 | ] 1366 | }, 1367 | "structure-expression": { 1368 | "patterns": [ 1369 | { "include": "#comment" }, 1370 | { 1371 | "comment": "FIXME: scan for :upper: or `val` to disambiguate types from signatures for hover", 1372 | "begin": "\\((?=[[:space:]]*(\\b(val)\\b|[^'\\[<[:lower:]]))", 1373 | "end": "\\)|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|with)\\b)", 1374 | "patterns": [ 1375 | { "include": "#comment" }, 1376 | { 1377 | "comment": "FIXME: might need to refactor this or include more expressions", 1378 | "include": "#structure-expression-block" 1379 | }, 1380 | { 1381 | "begin": "\\b(val)\\b", 1382 | "end": "(?=\\))|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1383 | "beginCaptures": { 1384 | "1": { "name": "keyword.other" } 1385 | }, 1386 | "patterns": [ 1387 | { "include": "#comment" }, 1388 | { 1389 | "match": "\\b([[:lower:]][[:word:]]*)\\b", 1390 | "name": "support.class entity.name.class" 1391 | } 1392 | ] 1393 | }, 1394 | { "include": "#module-path-simple" }, 1395 | { 1396 | "begin": "(:)", 1397 | "end": "(?=[\\)])|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val)\\b)", 1398 | "beginCaptures": { 1399 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1400 | }, 1401 | "patterns": [ 1402 | { "include": "#signature-expression" } 1403 | ] 1404 | } 1405 | ] 1406 | }, 1407 | { "include": "#module-path-simple" }, 1408 | { "include": "#structure-expression-block" } 1409 | ] 1410 | }, 1411 | "structure-expression-block": { 1412 | "begin": "{", 1413 | "end": "}", 1414 | "patterns": [ 1415 | { "include": "#structure-expression-block-item" } 1416 | ] 1417 | }, 1418 | "structure-expression-block-item": { 1419 | "patterns": [ 1420 | { "include": "#attribute" }, 1421 | { "include": "#comment" }, 1422 | { "include": "#module-item-exception" }, 1423 | { "include": "#module-item-external" }, 1424 | { "include": "#module-item-include" }, 1425 | { "include": "#module-item-let" }, 1426 | { "include": "#module-item-class-type" }, 1427 | { "include": "#module-item-module-type" }, 1428 | { "include": "#module-item-module" }, 1429 | { "include": "#module-item-open" }, 1430 | { "include": "#module-item-type" } 1431 | ] 1432 | }, 1433 | "type-annotation-rhs": { 1434 | "begin": "(?|~$\\\\])([:])(?![#\\-:!?.@*/&%^+<=>|~$\\\\])", 1435 | "end": "(?=\\))|(?=[,;}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1436 | "beginCaptures": { 1437 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1438 | }, 1439 | "patterns": [ 1440 | { "include": "#type-expression" } 1441 | ] 1442 | }, 1443 | "type-expression": { 1444 | "patterns": [ 1445 | { 1446 | "match": "([\\.])", 1447 | "name": "entity.name.function" 1448 | }, 1449 | { "include": "#type-expression-atomic" }, 1450 | { "include": "#type-expression-arrow" } 1451 | ] 1452 | }, 1453 | "type-expression-atomic": { 1454 | "patterns": [ 1455 | { "include": "#attribute" }, 1456 | { "include": "#comment" }, 1457 | { "include": "#module-path-extended-prefix" }, 1458 | { "include": "#type-expression-label" }, 1459 | { 1460 | "match": "\\b(as)\\b", 1461 | "name": "variable.other.class.js variable.interpolation storage.modifier message.error" 1462 | }, 1463 | { "include": "#type-expression-constructor" }, 1464 | { "include": "#type-expression-object" }, 1465 | { "include": "#type-expression-parens" }, 1466 | { "include": "#type-expression-polymorphic-variant" }, 1467 | { "include": "#type-expression-record" }, 1468 | { "include": "#type-expression-variable" } 1469 | ] 1470 | }, 1471 | "type-expression-arrow": { 1472 | "match": "=>", 1473 | "name": "markup.inserted keyword.control.less" 1474 | }, 1475 | "type-expression-constructor": { 1476 | "match": "(_)(?![[:alnum:]])|\\b([_[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", 1477 | "captures": { 1478 | "1": { "name": "comment" }, 1479 | "2": { "name": "support.type string.regexp" } 1480 | } 1481 | }, 1482 | "type-expression-label": { 1483 | "begin": "\\b([_[:lower:]][[:word:]]*)\\b(::)", 1484 | "end": "(?<==>)", 1485 | "beginCaptures": { 1486 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, 1487 | "2": { "name": "keyword.control" } 1488 | }, 1489 | "patterns": [ 1490 | { "include": "#type-expression" }, 1491 | { 1492 | "match": "(\\?)", 1493 | "captures": { 1494 | "1": { "name": "keyword.control.less" } 1495 | } 1496 | } 1497 | ] 1498 | }, 1499 | "type-expression-object": { 1500 | "comment": "FIXME: separate sub-rules", 1501 | "begin": "(<)", 1502 | "end": "(>)", 1503 | "captures": { 1504 | "1": { "name": "entity.name.function" } 1505 | }, 1506 | "patterns": [ 1507 | { 1508 | "begin": "(\\.\\.)", 1509 | "end": "(?=>)", 1510 | "beginCaptures": { 1511 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 1512 | } 1513 | }, 1514 | { 1515 | "comment": "FIXME: method item", 1516 | "begin": "(?=[_[:lower:]])", 1517 | "end": "(,)|(?=>)", 1518 | "endCaptures": { 1519 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1520 | }, 1521 | "patterns": [ 1522 | { 1523 | "comment": "FIXME: method name", 1524 | "begin": "(?=[_[:lower:]])", 1525 | "end": "(?=:)", 1526 | "patterns": [ 1527 | { 1528 | "match": "\\b([_[:lower:]][[:word:]]*)\\b", 1529 | "captures": { 1530 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } 1531 | } 1532 | } 1533 | ] 1534 | }, 1535 | { 1536 | "comment": "FIXME: method type", 1537 | "begin": "(:)", 1538 | "end": "(?=[,>])", 1539 | "beginCaptures": { 1540 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1541 | }, 1542 | "patterns": [ 1543 | { "include": "#type-expression" } 1544 | ] 1545 | } 1546 | ] 1547 | } 1548 | ] 1549 | }, 1550 | "type-expression-parens": { 1551 | "comment": "FIXME: proper tuple types", 1552 | "begin": "\\(", 1553 | "end": "\\)", 1554 | "patterns": [ 1555 | { 1556 | "begin": "\\b(module)\\b", 1557 | "end": "(?=[\\)])", 1558 | "beginCaptures": { 1559 | "1": { "name": "keyword.other message.error" } 1560 | }, 1561 | "patterns": [ 1562 | { "include": "#module-path-extended" }, 1563 | { "include": "#signature-expression-constraints" } 1564 | ] 1565 | }, 1566 | { 1567 | "match": ",", 1568 | "name": "keyword.control.less" 1569 | }, 1570 | { "include": "#type-expression" } 1571 | ] 1572 | }, 1573 | "type-expression-polymorphic-variant": { 1574 | "comment": "FIXME: proper parsing", 1575 | "begin": "(\\[)([<>])?", 1576 | "end": "(\\])", 1577 | "captures": { 1578 | "1": { "name": "entity.name.function" }, 1579 | "2": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1580 | }, 1581 | "patterns": [ 1582 | { 1583 | "begin": "(\\|)?(?![#\\-:!?.@*/&%^+<=>|~$\\\\])[[:space:]]*", 1584 | "end": "(?=[;)}\\]]|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\])|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1585 | "beginCaptures": { 1586 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1587 | }, 1588 | "patterns": [ 1589 | { "include": "#value-expression-constructor" }, 1590 | { 1591 | "match": "([:])|\\b(of)\\b|([&])", 1592 | "captures": { 1593 | "1": { "name": "keyword.control.less" }, 1594 | "2": { "name": "keyword.other" }, 1595 | "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1596 | } 1597 | }, 1598 | { "include": "#value-expression-constructor-polymorphic" }, 1599 | { "include": "#type-expression" } 1600 | ] 1601 | } 1602 | ] 1603 | }, 1604 | "type-expression-record": { 1605 | "begin": "{", 1606 | "end": "}", 1607 | "patterns": [ 1608 | { "include": "#type-expression-record-item" } 1609 | ] 1610 | }, 1611 | "type-expression-record-field-sans-modifier": { 1612 | "begin": "\\b([_[:lower:]][[:word:]]*)\\b", 1613 | "end": "(,)|(?=[,}])", 1614 | "beginCaptures": { 1615 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" } 1616 | }, 1617 | "endCaptures": { 1618 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1619 | }, 1620 | "patterns": [ 1621 | { "include": "#comment" }, 1622 | { 1623 | "begin": "(:)", 1624 | "end": "(?=[,}])", 1625 | "beginCaptures": { 1626 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1627 | }, 1628 | "patterns": [ 1629 | { "include": "#type-expression" } 1630 | ] 1631 | } 1632 | ] 1633 | }, 1634 | "type-expression-record-field": { 1635 | "patterns": [ 1636 | { 1637 | "begin": "\\b(mutable)\\b", 1638 | "end": "(?<=[,])|(?=})", 1639 | "beginCaptures": { 1640 | "1": { "name": "variable.other.class.js variable.interpolation storage.modifier message.error" } 1641 | }, 1642 | "patterns": [ 1643 | { "include": "#type-expression-record-field-sans-modifier" } 1644 | ] 1645 | }, 1646 | { "include": "#type-expression-record-field-sans-modifier" } 1647 | ] 1648 | }, 1649 | "type-expression-record-item": { 1650 | "patterns": [ 1651 | { "include": "#comment" }, 1652 | { "include": "#module-path-simple-prefix" }, 1653 | { "include": "#type-expression-record-field" } 1654 | ] 1655 | }, 1656 | "type-expression-variable": { 1657 | "match": "(')([_[:lower:]][[:word:]]*)\\b(?!\\.[[:upper:]])", 1658 | "captures": { 1659 | "1": { "name": "comment" }, 1660 | "2": { "name": "variable.parameter string.other.link variable.language" } 1661 | } 1662 | }, 1663 | "value-expression": { 1664 | "patterns": [ 1665 | { "include": "#attribute" }, 1666 | { "include": "#comment" }, 1667 | { "include": "#extension-node" }, 1668 | { "include": "#jsx" }, 1669 | { "include": "#operator" }, 1670 | { "include": "#value-expression-builtin" }, 1671 | { "include": "#value-expression-if-then-else" }, 1672 | { "include": "#value-expression-atomic" }, 1673 | { "include": "#module-path-simple-prefix" }, 1674 | { 1675 | "match": "[:?]", 1676 | "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" 1677 | }, 1678 | { "include": "#record-path" } 1679 | ] 1680 | }, 1681 | "value-expression-atomic": { 1682 | "patterns": [ 1683 | { "include": "#value-expression-literal" }, 1684 | { "include": "#value-expression-literal-list-or-array" }, 1685 | { "include": "#value-expression-for" }, 1686 | { "include": "#value-expression-fun" }, 1687 | { "include": "#value-expression-block-or-record-or-object" }, 1688 | { "include": "#value-expression-label" }, 1689 | { "include": "#value-expression-parens" }, 1690 | { "include": "#value-expression-switch" }, 1691 | { "include": "#value-expression-try" }, 1692 | { "include": "#value-expression-while" } 1693 | ] 1694 | }, 1695 | "value-expression-atomic-with-paths": { 1696 | "patterns": [ 1697 | { "include": "#value-expression-atomic" }, 1698 | { "include": "#module-path-simple-prefix" }, 1699 | { "include": "#record-path-suffix" } 1700 | ] 1701 | }, 1702 | "value-expression-block": { 1703 | "begin": "{", 1704 | "end": "}", 1705 | "patterns": [ 1706 | { "include": "#value-expression-block-item" } 1707 | ] 1708 | }, 1709 | "value-expression-block-item": { 1710 | "patterns": [ 1711 | { "include": "#module-item-let" }, 1712 | { "include": "#module-item-open" }, 1713 | { "include": "#value-expression" } 1714 | ] 1715 | }, 1716 | "value-expression-block-look": { 1717 | "begin": "(?![[:space:]]*($|\\.\\.\\.|([[:upper:]][[:word:]]*\\.)*([[:lower:]][[:word:]]*)[[:space:]]*(?:,|:(?![=]))))", 1718 | "end": "(?=})", 1719 | "patterns": [ 1720 | { "include": "#value-expression-block-item" } 1721 | ] 1722 | }, 1723 | "value-expression-block-or-record-or-object": { 1724 | "begin": "{", 1725 | "end": "}", 1726 | "patterns": [ 1727 | { "include": "#comment" }, 1728 | { "include": "#module-path-simple-prefix" }, 1729 | { "include": "#value-expression-object-look" }, 1730 | { "include": "#value-expression-record-look" }, 1731 | { "include": "#value-expression-block-look" } 1732 | ] 1733 | }, 1734 | "value-expression-builtin": { 1735 | "match": "\\b(assert|decr|failwith|fprintf|ignore|incr|land|lazy|lor|lsl|lsr|lxor|mod|new|not|printf|ref)\\b|\\b(raise)\\b", 1736 | "captures": { 1737 | "1": { "name": "keyword.control message.error" }, 1738 | "2": { "name": "keyword.control.trycatch" } 1739 | } 1740 | }, 1741 | "value-expression-constructor": { 1742 | "match": "\\b([[:upper:]][[:word:]]*)\\b(?![[:space:]]*[\\.])", 1743 | "captures": { 1744 | "1": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 1745 | } 1746 | }, 1747 | "value-expression-constructor-polymorphic": { 1748 | "match": "(`)([[:alpha:]][[:word:]]*)\\b(?!\\.)", 1749 | "captures": { 1750 | "1": { "name": "constant.other.symbol keyword.control.less variable.parameter" }, 1751 | "2": { "name": "entity.other.attribute-name.css constant.language constant.numeric" } 1752 | } 1753 | }, 1754 | "value-expression-for": { 1755 | "begin": "(?=\\b(for)\\b)", 1756 | "end": "(?<=})|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", 1757 | "patterns": [ 1758 | { "include": "#value-expression-for-head" }, 1759 | { "include": "#value-expression-block" } 1760 | ] 1761 | }, 1762 | "value-expression-for-head": { 1763 | "begin": "(?=\\b(for)\\b)", 1764 | "end": "(?={)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", 1765 | "patterns": [ 1766 | { 1767 | "begin": "\\b(for)\\b", 1768 | "end": "(?=\\b(in)\\b)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", 1769 | "beginCaptures": { 1770 | "1": { "name": "keyword.control.loop" } 1771 | }, 1772 | "patterns": [ 1773 | { "include": "#comment" }, 1774 | { "include": "#pattern-variable" } 1775 | ] 1776 | }, 1777 | { 1778 | "begin": "\\b(in)\\b", 1779 | "end": "(?=\\b(to)\\b)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", 1780 | "beginCaptures": { 1781 | "1": { "name": "keyword.control.loop" } 1782 | }, 1783 | "patterns": [ 1784 | { "include": "#comment" }, 1785 | { "include": "#value-expression-atomic-with-paths" } 1786 | ] 1787 | }, 1788 | { 1789 | "begin": "\\b(to)\\b", 1790 | "end": "(?={)|(?=[;]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", 1791 | "beginCaptures": { 1792 | "1": { "name": "keyword.control.loop" } 1793 | }, 1794 | "patterns": [ 1795 | { "include": "#comment" }, 1796 | { "include": "#value-expression-atomic-with-paths" } 1797 | ] 1798 | }, 1799 | { "include": "#value-expression-block" } 1800 | ] 1801 | }, 1802 | "value-expression-fun": { 1803 | "begin": "\\b(fun)\\b", 1804 | "end": "(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1805 | "beginCaptures": { 1806 | "1": { "name": "keyword.control" } 1807 | }, 1808 | "patterns": [ 1809 | { "include": "#value-expression-fun-pattern-match-rule-lhs" }, 1810 | { "include": "#value-expression-fun-pattern-match-rule-rhs" } 1811 | ] 1812 | }, 1813 | "value-expression-fun-pattern-match-rule-lhs": { 1814 | "begin": "(?=\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|(?<=fun)", 1815 | "end": "(\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))|(?==>)|(?=[;\\)}]|\\b(and|class|constraint|exception|external|include|inherit|let|method|module|nonrec|open|private|rec|type|val|with)\\b)", 1816 | "applyEndPatternLast": true, 1817 | "beginCaptures": { 1818 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1819 | }, 1820 | "endCaptures": { 1821 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" } 1822 | }, 1823 | "patterns": [ 1824 | { "include": "#module-item-let-value-param" } 1825 | ] 1826 | }, 1827 | "value-expression-fun-pattern-match-rule-rhs": { 1828 | "begin": "(=>)", 1829 | "end": "(?=[;\\)}]|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\])|\\b(and)\\b)", 1830 | "beginCaptures": { 1831 | "1": { "name": "keyword.control.less" } 1832 | }, 1833 | "patterns": [ 1834 | { "include": "#value-expression" } 1835 | ] 1836 | }, 1837 | "value-expression-if-then-else": { 1838 | "begin": "\\b(if)\\b", 1839 | "end": "(?=[;\\)\\]}])", 1840 | "applyEndPatternLast": true, 1841 | "beginCaptures": { 1842 | "1": { "name": "keyword.control.conditional" } 1843 | }, 1844 | "patterns": [ 1845 | { "include": "#comment" }, 1846 | { 1847 | "begin": "\\b(else)\\b", 1848 | "end": "(?=[;\\)\\]}])", 1849 | "beginCaptures": { 1850 | "1": { "name": "keyword.control.conditional" } 1851 | }, 1852 | "patterns": [ 1853 | { "include": "#value-expression" } 1854 | ] 1855 | }, 1856 | { "include": "#value-expression-atomic-with-paths" } 1857 | ] 1858 | }, 1859 | "value-expression-lazy": { 1860 | "comment": "FIXME", 1861 | "match": "\\b(lazy)\\b", 1862 | "captures": { 1863 | "1": { "name": "keyword.other" } 1864 | } 1865 | }, 1866 | "value-expression-label": { 1867 | "begin": "\\b([_[:lower:]][[:word:]]*)\\b[[:space:]]*(::)(\\?)?", 1868 | "end": "(?![[:space:]])", 1869 | "beginCaptures": { 1870 | "1": { "name": "markup.inserted constant.language support.property-value entity.name.filename" }, 1871 | "2": { "name": "keyword.control" }, 1872 | "3": { "name": "storage.type" } 1873 | }, 1874 | "patterns": [ 1875 | { "include": "#value-expression" } 1876 | ] 1877 | }, 1878 | "value-expression-literal": { 1879 | "patterns": [ 1880 | { "include": "#value-expression-literal-boolean" }, 1881 | { "include": "#value-expression-literal-character" }, 1882 | { "include": "#value-expression-constructor" }, 1883 | { "include": "#value-expression-constructor-polymorphic" }, 1884 | { "include": "#value-expression-lazy" }, 1885 | { "include": "#value-expression-literal-numeric" }, 1886 | { "include": "#value-expression-literal-string" }, 1887 | { "include": "#value-expression-literal-unit" } 1888 | ] 1889 | }, 1890 | "value-expression-literal-boolean": { 1891 | "match": "\\b(false|true)\\b", 1892 | "name": "entity.other.attribute-name.css constant.language constant.numeric" 1893 | }, 1894 | "value-expression-literal-character": { 1895 | "match": "(')([[:space:]]|[[:graph:]]|\\\\[\\\\\"'ntbr]|\\\\[[:digit:]][[:digit:]][[:digit:]]|\\\\x[[:xdigit:]][[:xdigit:]]|\\\\o[0-3][0-7][0-7])(')", 1896 | "name": "constant.character" 1897 | }, 1898 | "value-expression-literal-list-or-array": { 1899 | "begin": "(\\[\\|?)(?![@%])", 1900 | "end": "(\\|?\\])", 1901 | "beginCaptures": { 1902 | "1": { "name": "constant.language.list" } 1903 | }, 1904 | "endCaptures": { 1905 | "1": { "name": "constant.language.list" } 1906 | }, 1907 | "patterns": [ 1908 | { "include": "#value-expression-literal-list-or-array-separator" }, 1909 | { "include": "#value-expression" }, 1910 | { "include": "#value-expression-literal-list-or-array" } 1911 | ] 1912 | }, 1913 | "value-expression-literal-list-or-array-separator": { 1914 | "match": "(,)|(\\.\\.\\.)", 1915 | "captures": { 1916 | "1": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 1917 | "2": { "name": "keyword.control" } 1918 | } 1919 | }, 1920 | "value-expression-literal-numeric": { 1921 | "patterns": [ 1922 | { 1923 | "match": "([-])?([[:digit:]][_[:digit:]]*)(?:(\\.)([_[:digit:]]*))?(?:([eE])([\\-\\+])?([[:digit:]][_[:digit:]]*))?(?![bBoOxX])", 1924 | "captures": { 1925 | "1": { "name": "keyword.control.less" }, 1926 | "2": { "name": "constant.numeric" }, 1927 | "3": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 1928 | "4": { "name": "constant.numeric" }, 1929 | "5": { "name": "keyword.control.less" }, 1930 | "6": { "name": "keyword.control.less" }, 1931 | "7": { "name": "constant.numeric" } 1932 | } 1933 | }, 1934 | { 1935 | "match": "([-])?(0[xX])([[:xdigit:]][_[:xdigit:]]*)(?:(\\.)([_[:xdigit:]]*))?(?:([pP])([\\-\\+])?([[:digit:]][_[:digit:]]*))?", 1936 | "captures": { 1937 | "1": { "name": "keyword.control.less" }, 1938 | "2": { "name": "keyword.control.less" }, 1939 | "3": { "name": "constant.numeric" }, 1940 | "4": { "name": "variable.other.class.js variable.interpolation keyword.operator keyword.control message.error" }, 1941 | "5": { "name": "constant.numeric" }, 1942 | "6": { "name": "keyword.control.less" }, 1943 | "7": { "name": "keyword.control.less" }, 1944 | "8": { "name": "constant.numeric" } 1945 | } 1946 | }, 1947 | { 1948 | "match": "([-])?(0[oO])([0-7][_0-7]*)", 1949 | "captures": { 1950 | "1": { "name": "keyword.control.less" }, 1951 | "2": { "name": "keyword.control.less" }, 1952 | "3": { "name": "constant.numeric" } 1953 | } 1954 | }, 1955 | { 1956 | "match": "([-])?(0[bB])([0-1][_0-1]*)", 1957 | "captures": { 1958 | "1": { "name": "keyword.control.less" }, 1959 | "2": { "name": "keyword.control.less" }, 1960 | "3": { "name": "constant.numeric" } 1961 | } 1962 | } 1963 | ] 1964 | }, 1965 | "value-expression-literal-string": { 1966 | "patterns": [ 1967 | { 1968 | "begin": "(?|~$\\\\]))", 2223 | "end": "(?==>|[;\\)}])", 2224 | "patterns": [ 2225 | { "include": "#pattern-guard" }, 2226 | { "include": "#pattern" } 2227 | ] 2228 | }, 2229 | "value-expression-switch-pattern-match-rule-rhs": { 2230 | "begin": "(=>)", 2231 | "end": "(?=}|\\|(?![#\\-:!?.@*/&%^+<=>|~$\\\\]))", 2232 | "beginCaptures": { 2233 | "1": { "name": "keyword.control.less" } 2234 | }, 2235 | "patterns": [ 2236 | { "include": "#value-expression-block-item" } 2237 | ] 2238 | }, 2239 | "value-expression-try": { 2240 | "begin": "\\b(try)\\b", 2241 | "end": "(?<=})|(?=[;\\)]|\\b(and|as|class|constraint|exception|external|include|inherit|let|method|nonrec|open|private|rec|type|val|with)\\b)", 2242 | "beginCaptures": { 2243 | "1": { "name": "keyword.control.trycatch" } 2244 | }, 2245 | "patterns": [ 2246 | { "include": "#value-expression-try-head" }, 2247 | { "include": "#value-expression-switch-body" } 2248 | ] 2249 | }, 2250 | "value-expression-try-head": { 2251 | "begin": "(?<=try)", 2252 | "end": "(?