{ "name": "OCaml", "scopeName": "source.ocaml", "patterns": [ { "name": "meta.module.binding", "match": "\\b(let)\\s+(module)\\s+([A-Z][a-zA-Z0-9'_]*)\\s*(=)", "captures": { "1": { "name": "keyword.other.module-binding.ocaml" }, "2": { "name": "keyword.other.module-definition.ocaml" }, "3": { "name": "support.other.module.ocaml" }, "4": { "name": "punctuation.separator.module-binding.ocmal" } } }, { "name": "meta.module.openbinding", "begin": "\\b(let)\\s+(open)\\s+([A-Z][a-zA-Z0-9'_]*)(?=(\\.[A-Z][a-zA-Z0-9_]*)*)", "end": "(\\s|$)", "patterns": [ { "name": "support.other.module.ocaml", "match": "(\\.)([A-Z][a-zA-Z0-9'_]*)", "captures": { "1": { "name": "punctuation.separator.module-reference.ocaml" } } } ], "beginCaptures": { "1": { "name": "keyword.other.module-binding.ocaml" }, "2": { "name": "keyword.other.ocaml" }, "3": { "name": "support.other.module.ocaml" } } }, { "name": "meta.function.ocaml", "begin": "\\b(let|and)\\s+(?!\\(\\*)((rec\\s+)([a-z_][a-zA-Z0-9_']*)\\b|([a-z_][a-zA-Z0-9_']*|\\([^)]+\\))(?=\\s)((?=\\s*=\\s*(?=fun(?:ction)\\b))|(?!\\s*=)))", "end": "(?:(:)\\s*([^=]+))?(?:(=)|(=)\\s*(?=fun(?:ction)\\b))", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "1": { "name": "keyword.other.function-definition.ocaml" }, "3": { "name": "keyword.other.funtion-definition.ocaml" }, "4": { "name": "entity.name.function.ocaml" }, "5": { "name": "entity.name.function.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.separator.function.type-constraint.ocaml" }, "2": { "name": "storage.type.ocaml" }, "3": { "name": "keyword.operator.ocaml" }, "4": { "name": "keyword.operator.ocaml" } } }, { "name": "meta.function.anonymous.ocaml", "begin": "(\\(|\\s)(?=fun\\s)", "end": "(\\))", "patterns": [ { "name": "meta.function.anonymous.definition.ocaml", "begin": "(?\u003c=(\\(|\\s))(fun)\\s", "end": "(-\u003e)", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "2": { "name": "keyword.other.function-definition.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.separator.function-definition.ocaml" } } }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "punctuation.definition.function.anonymous.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.function.anonymous.ocaml" } } }, { "name": "meta.type-definition-group.ocaml", "begin": "^\\s*(?=type\\s)", "end": "\\b(?=let|end|val)|^\\s*$", "patterns": [ { "name": "meta.type-definition.ocaml", "begin": "\\b(type|and)\\s+([^=]*)(=)?", "end": "(?=\\b(type|and|let|end|val)\\b)|(?=^\\s*$)", "patterns": [ { "include": "#typedefs" } ], "beginCaptures": { "1": { "name": "keyword.other.type-definition.ocaml" }, "2": { "name": "storage.type.ocaml" }, "3": { "name": "punctuation.separator.type-definition.ocaml" } } } ] }, { "name": "meta.pattern-match.ocaml", "begin": "\\b(with|function)(?=(\\s*$|.*-\u003e))\\b|((?\u003c!\\S)(\\|)(?=(\\w|\\s).*-\u003e))", "end": "(?:(-\u003e)|\\b(when)\\b|\\s(?=\\|))", "patterns": [ { "include": "#matchpatterns" } ], "beginCaptures": { "1": { "name": "keyword.control.match-definition.ocaml" }, "2": { "name": "keyword.other.function-definition.ocaml" }, "3": { "name": "keyword.control.match-definition.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.separator.match-definition.ocaml" }, "2": { "name": "keyword.control.match-condition.ocaml" } } }, { "name": "meta.class.type-definition.ocaml", "match": "^[ \\t]*(class\\s+type\\s+)((\\[\\s*('[A-Za-z][a-zA-Z0-9_']*(?:\\s*,\\s*'[A-Za-z][a-zA-Z0-9_']*)*)\\s*\\]\\s+)?[a-z_][a-zA-Z0-9'_]*)", "captures": { "1": { "name": "keyword.other.class-type-definition.ocaml" }, "2": { "name": "entity.name.type.class-type.ocaml" }, "4": { "name": "storage.type.ocaml" } } }, { "name": "meta.class.ocaml", "begin": "^[ \\t]*(class)(?:\\s+(?!(?:virtual)\\s+))((\\[\\s*('[A-Za-z][a-zA-Z0-9_']*(?:\\s*,\\s*'[A-Za-z][a-zA-Z0-9_']*)*)\\s*\\]\\s+)?[a-z_][a-zA-Z0-9'_]*)", "end": "(=)", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "1": { "name": "keyword.other.class-definition.ocaml" }, "2": { "name": "entity.name.type.class.ocaml" }, "4": { "name": "storage.type.ocaml" } }, "endCaptures": { "1": { "name": "keyword.operator.ocaml" } } }, { "name": "meta.class.virtual.ocaml", "begin": "^[ \\t]*(class\\s+virtual\\s+)((\\[\\s*('[A-Za-z][a-zA-Z0-9_']*(?:\\s*,\\s*'[A-Za-z][a-zA-Z0-9_']*)*)\\s*\\]\\s+)?[a-z_][a-zA-Z0-9'_]*)", "end": "(=)", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "1": { "name": "keyword.other.class-definition.ocaml" }, "2": { "name": "entity.name.type.class.ocaml" }, "4": { "name": "storage.type.ocaml" } }, "endCaptures": { "1": { "name": "keyword.operator.ocaml" } } }, { "name": "meta.class.virtual.type-definition.ocaml", "match": "^[ \\t]*(class\\s+type\\s+virtual)((\\[\\s*('[A-Za-z][a-zA-Z0-9_']*(?:\\s*,\\s*'[A-Za-z][a-zA-Z0-9_']*)*)\\s*\\]\\s+)?[a-z_][a-zA-Z0-9'_]*)", "captures": { "1": { "name": "keyword.other.class-type-definition.ocaml" }, "2": { "name": "entity.name.type.class-type.ocaml" }, "4": { "name": "storage.type.ocaml" } } }, { "name": "meta.record.ocaml", "begin": "(\\{)", "end": "(\\})", "patterns": [ { "name": "keyword.other.language.ocaml", "match": "\\bwith\\b" }, { "name": "meta.record.definition.ocaml", "begin": "(\\bmutable\\s+)?\\b([a-z_][a-zA-Z0-9_']*)\\s*(:)", "end": "(;|(?=}))", "patterns": [ { "include": "#typedefs" } ], "beginCaptures": { "1": { "name": "keyword.other.storage.modifier.ocaml" }, "2": { "name": "source.ocaml" }, "3": { "name": "punctuation.definition.record.ocaml" } }, "endCaptures": { "1": { "name": "keyword.operator.ocaml" } } }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "punctuation.definition.record.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.record.ocaml" } } }, { "name": "meta.object.ocaml", "begin": "\\b(object)\\s*(?:(\\()(_?[a-z]+)(\\)))?\\s*$", "end": "\\b(end)\\b", "patterns": [ { "name": "meta.method.ocaml", "begin": "\\b(method)\\s+(virtual\\s+)?(private\\s+)?([a-z_][a-zA-Z0-9'_]*)", "end": "(=|:)", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "1": { "name": "keyword.other.method-definition.ocaml" }, "2": { "name": "keyword.other.method-definition.ocaml" }, "3": { "name": "keyword.other.method-restriction.ocaml" }, "4": { "name": "entity.name.function.method.ocaml" } }, "endCaptures": { "1": { "name": "keyword.operator.ocaml" } } }, { "name": "meta.object.type-constraint.ocaml", "begin": "(constraint)\\s+([a-z_'][a-zA-Z0-9'_]*)\\s+(=)", "end": "(#[a-z_][a-zA-Z0-9'_]*)|(int|char|float|string|list|array|bool|unit|exn|option|int32|int64|nativeint|format4|lazy_t)|([a-z_][a-zA-Z0-9'_]*)\\s*$", "beginCaptures": { "1": { "name": "keyword.other.language.ocaml" }, "2": { "name": "storage.type.ocaml" }, "3": { "name": "keyword.operator.ocaml" } }, "endCaptures": { "1": { "name": "storage.type.polymorphic-variant.ocaml" }, "2": { "name": "storage.type.ocaml" }, "3": { "name": "storage.type.ocaml" } } }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "keyword.other.object-definition.ocaml" }, "2": { "name": "punctuation.definition.self-binding.ocaml" }, "3": { "name": "entity.name.type.self-binding.ocaml" }, "4": { "name": "punctuation.definition.self-binding.ocaml" } }, "endCaptures": { "1": { "name": "keyword.control.object.ocaml" }, "2": { "name": "punctuation.terminator.expression.ocaml" } } }, { "name": "meta.method-call.ocaml", "match": "(?\u003c=\\w|\\)|')(#)[a-z_][a-zA-Z0-9'_]*", "captures": { "1": { "name": "punctuation.separator.method-call.ocaml" } } }, { "name": "meta.module.ocaml", "match": "^[ \\t]*(module)\\s+([A-Z_][a-zA-Z0-9'_]*)(?:\\s*(:)\\s*([A-Z][a-zA-Z0-9'_]*)?)?", "captures": { "1": { "name": "keyword.other.module-definition.ocaml" }, "2": { "name": "entity.name.type.module.ocaml" }, "3": { "name": "punctuation.separator.module-definition.ocaml" }, "4": { "name": "entity.name.type.module-type.ocaml" } } }, { "name": "meta.module.type.ocaml", "match": "^[ \\t]*(module\\s+type\\s+)([A-Z][a-zA-Z0-9'_]*)", "captures": { "1": { "name": "keyword.other.module-type-definition.ocaml" }, "2": { "name": "entity.name.type.module-type.ocaml" } } }, { "name": "meta.module.signature.ocaml", "begin": "\\b(sig)\\b", "end": "\\b(end)\\b", "patterns": [ { "include": "#module-signature" }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "keyword.other.module.signature.ocaml" } }, "endCaptures": { "1": { "name": "keyword.other.module.signature.ocaml" }, "2": { "name": "punctuation.terminator.expression.ocaml" }, "3": { "name": "keyword.operator.ocaml" } } }, { "name": "meta.module.structure.ocaml", "begin": "\\b(struct)\\b", "end": "\\b(end)\\b", "patterns": [ { "include": "$self" } ], "beginCaptures": { "1": { "name": "keyword.other.module.structure.ocaml" } }, "endCaptures": { "1": { "name": "keyword.other.module.structure.ocaml" } } }, { "include": "#moduleref" }, { "name": "meta.module.open.ocaml", "begin": "\\b(open)\\s+([A-Z][a-zA-Z0-9'_]*)(?=(\\.[A-Z][a-zA-Z0-9_]*)*)", "end": "(\\s|$)", "patterns": [ { "name": "support.other.module.ocaml", "match": "(\\.)([A-Z][a-zA-Z0-9'_]*)", "captures": { "1": { "name": "punctuation.separator.module-reference.ocaml" } } } ], "beginCaptures": { "1": { "name": "keyword.other.ocaml" }, "2": { "name": "support.other.module.ocaml" } } }, { "name": "meta.exception.ocaml", "match": "\\b(exception)\\s+([A-Z][a-zA-Z0-9'_]*)\\b", "captures": { "1": { "name": "keyword.other.ocaml" }, "2": { "name": "entity.name.type.exception.ocaml" } } }, { "name": "source.camlp4.embedded.ocaml", "begin": "(?=(\\[\u003c)(?![^\\[]+?[^\u003e]]))", "end": "(\u003e])", "patterns": [ { "include": "source.camlp4.ocaml" } ], "endCaptures": { "1": { "name": "punctuation.definition.camlp4-stream.ocaml" } } }, { "include": "#strings" }, { "include": "#constants" }, { "include": "#comments" }, { "include": "#lists" }, { "include": "#arrays" }, { "name": "meta.type-constraint.ocaml", "begin": "(\\()(?=(~[a-z][a-zA-Z0-9_]*:|(\"(\\\\\"|[^\"])*\")|[^\\(\\)~\"])+(?\u003c!:)(:\u003e|:(?![:=])))", "end": "(?\u003c!:)(:\u003e|:(?![:=]))(.*?)(\\))", "patterns": [ { "include": "$self" } ], "beginCaptures": { "1": { "name": "punctuation.section.type-constraint.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.separator.type-constraint.ocaml" }, "2": { "name": "storage.type.ocaml" }, "3": { "name": "punctuation.section.type-constraint.ocaml" } } }, { "name": "keyword.other.directive.ocaml", "match": "^[ \\t]*#[a-zA-Z]+" }, { "name": "keyword.other.directive.line-number.ocaml", "match": "^[ \\t]*#[0-9]*" }, { "include": "#storagetypes" }, { "name": "keyword.other.storage.modifier.ocaml", "match": "\\b(mutable|ref)\\b" }, { "name": "entity.name.type.variant.polymorphic.ocaml", "match": "`[A-Za-z][a-zA-Z0-9'_]*\\b" }, { "name": "entity.name.type.variant.ocaml", "match": "\\b[A-Z][a-zA-Z0-9'_]*\\b" }, { "name": "keyword.operator.symbol.ocaml", "match": "!=|:=|\u003e|\u003c" }, { "name": "keyword.operator.infix.floating-point.ocaml", "match": "[*+/-]\\." }, { "name": "keyword.operator.prefix.floating-point.ocaml", "match": "~-\\." }, { "name": "punctuation.definition.list.constructor.ocaml", "match": "::" }, { "name": "punctuation.terminator.expression.ocaml", "match": ";;" }, { "name": "punctuation.separator.ocaml", "match": ";" }, { "name": "punctuation.separator.function-return.ocaml", "match": "-\u003e" }, { "name": "keyword.operator.infix.ocaml", "match": "[=\u003c\u003e@^\u0026+\\-*/$%|][|!$%\u0026*+./:\u003c=\u003e?@^~-]*" }, { "name": "keyword.operator.prefix.ocaml", "match": "\\bnot\\b|!|[!\\?~][!$%\u0026*+./:\u003c=\u003e?@^~-]+" }, { "name": "entity.name.tag.label.ocaml", "match": "~[a-z][a-z0-9'_]*(:)?", "captures": { "1": { "name": "punctuation.separator.argument-label.ocaml" } } }, { "name": "meta.begin-end-group.ocaml", "begin": "\\b(begin)\\b", "end": "\\b(end)\\b", "patterns": [ { "include": "$self" } ], "beginCaptures": { "1": { "name": "keyword.control.begin-end.ocaml" } }, "endCaptures": { "1": { "name": "keyword.control.begin-end.ocaml" } } }, { "name": "meta.for-loop.ocaml", "begin": "\\b(for)\\b", "end": "\\b(done)\\b", "patterns": [ { "name": "keyword.control.loop.ocaml", "match": "\\bdo\\b" }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "keyword.control.for-loop.ocaml" } }, "endCaptures": { "1": { "name": "keyword.control.for-loop.ocaml" } } }, { "name": "meta.while-loop.ocaml", "begin": "\\b(while)\\b", "end": "\\b(done)\\b", "patterns": [ { "name": "keyword.control.loop.ocaml", "match": "\\bdo\\b" }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "keyword.control.while-loop.ocaml" } }, "endCaptures": { "1": { "name": "keyword.control.while-loop.ocaml" } } }, { "name": "meta.paren-group.ocaml", "begin": "\\(", "end": "\\)", "patterns": [ { "include": "$self" } ] }, { "name": "keyword.operator.ocaml", "match": "\\b(and|land|lor|lsl|lsr|asr|lnot|lxor|mod|or)\\b" }, { "name": "keyword.control.ocaml", "match": "\\b(downto|if|else|match|then|to|when|with|try)\\b" }, { "name": "keyword.other.ocaml", "match": "\\b(as|assert|class|constraint|exception|functor|in|include|inherit|initializer|lazy|let|mod|module|mutable|new|object|open|private|rec|sig|struct|type|virtual)\\b" }, { "include": "#module-signature" }, { "name": "invalid.illegal.unrecognized-character.ocaml", "match": "(’|‘|“|”)" } ], "repository": { "arrays": { "patterns": [ { "name": "meta.array.ocaml", "begin": "(\\[\\|)", "end": "(\\|])", "patterns": [ { "include": "#arrays" }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "punctuation.definition.array.begin.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.array.end.ocaml" } } } ] }, "comments": { "patterns": [ { "name": "comment.block.ocaml", "begin": "\\(\\*", "end": "\\*\\)", "patterns": [ { "include": "#comments" } ], "beginCaptures": { "0": { "name": "punctuation.definition.comment.begin.ocaml" } }, "endCaptures": { "0": { "name": "punctuation.definition.comment.end.ocaml" } } } ] }, "comments_inner": { "patterns": [ { "include": "#comments" }, { "name": "comment.block.string.quoted.double.ocaml", "begin": "(?=[^\\\\])(\")", "end": "\"", "patterns": [ { "name": "comment.block.string.constant.character.escape.ocaml", "match": "\\\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\\d\\d|[bnrt'\"\\\\])" } ] } ] }, "constants": { "patterns": [ { "name": "constant.language.pseudo-variable.ocaml", "match": "(?:\\[\\s*(\\])|\\((\\))|\\(\\s*(\\)))", "captures": { "1": { "name": "meta.empty-typing-pair.ocaml" }, "2": { "name": "meta.empty-typing-pair.parens.ocaml" }, "3": { "name": "meta.empty-typing-pair.ocaml" } } }, { "name": "constant.language.boolean.ocaml", "match": "\\b(true|false)\\b" }, { "name": "constant.numeric.floating-point.ocaml", "match": "\\b-?[0-9][0-9_]*((\\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))" }, { "name": "constant.numeric.integer.nativeint.ocaml", "match": "\\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))n" }, { "name": "constant.numeric.integer.int64.ocaml", "match": "\\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))L" }, { "name": "constant.numeric.integer.int32.ocaml", "match": "\\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))l" }, { "name": "constant.numeric.integer.ocaml", "match": "\\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))" }, { "name": "constant.character.ocaml", "match": "'(.|\\\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\\d\\d|[bnrt'\"\\\\]))'" } ] }, "definite_storagetypes": { "patterns": [ { "include": "#storagetypes" }, { "name": "storage.type.ocaml", "match": "\\b[a-zA-Z0-9'_]+\\b" } ] }, "lists": { "patterns": [ { "name": "meta.list.ocaml", "begin": "(\\[)(?!\\||\u003c|\u003e)", "end": "(?\u003c!\\||\u003e)(])", "patterns": [ { "include": "#lists" }, { "include": "$self" } ], "beginCaptures": { "1": { "name": "punctuation.definition.list.begin.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.list.end.ocaml" } } } ] }, "matchpatterns": { "patterns": [ { "name": "constant.language.universal-match.ocaml", "match": "\\b_\\b" }, { "name": "punctuation.separator.match-pattern.ocaml", "match": "\\|(?=\\s*\\S)" }, { "name": "meta.match-option.ocaml", "begin": "(\\()(?=(?!=.*?-\u003e).*?\\|)", "end": "(\\))", "patterns": [ { "name": "punctuation.separator.match-option.ocaml", "match": "\\|" }, { "include": "#matchpatterns" } ], "beginCaptures": { "1": { "name": "punctuation.definition.match-option.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.match-option.ocaml" } } }, { "include": "#moduleref" }, { "include": "#constants" }, { "include": "#variables" }, { "include": "$self" } ] }, "module-signature": { "patterns": [ { "name": "meta.module.signature.val.ocaml", "begin": "(val)\\s+([a-z_][a-zA-Z0-9_']*)\\s*(:)", "end": "(?=\\b(type|val|external|class|module|end)\\b)|^\\s*$", "patterns": [ { "name": "variable.parameter.ameter.optional.ocaml", "match": "(\\?)([a-z][a-zA-Z0-9_]*)\\s*(:)", "captures": { "1": { "name": "punctuation.definition.optional-parameter.ocaml" }, "2": { "name": "entity.name.tag.label.optional.ocaml" }, "3": { "name": "punctuation.separator.optional-parameter.ocaml" } } }, { "name": "variable.parameter.labeled.ocaml", "begin": "([a-z][a-zA-Z0-9'_]*)\\s*(:)\\s*", "end": "\\s", "patterns": [ { "include": "#definite_storagetypes" } ], "beginCaptures": { "1": { "name": "entity.name.tag.label.ocaml" }, "2": { "name": "punctuation.separator.label.ocaml" }, "3": { "name": "storage.type.ocaml" } } }, { "include": "#typedefs" } ], "beginCaptures": { "1": { "name": "keyword.other.ocaml" }, "2": { "name": "entity.name.type.value-signature.ocaml" }, "3": { "name": "punctuation.separator.type-constraint.ocaml" } } }, { "name": "meta.module.signature.external.ocaml", "begin": "(external)\\s+([a-z_][a-zA-Z0-9_']*)\\s*(:)", "end": "(?=\\b(type|val|external|class|module|let|end)\\b)|^\\s*$", "patterns": [ { "name": "variable.parameter.optional.ocaml", "match": "(\\?)([a-z][a-zA-Z0-9_]*)\\s*(:)", "captures": { "1": { "name": "punctuation.definition.optional-parameter.ocaml" }, "2": { "name": "entity.name.tag.label.optional.ocaml" }, "3": { "name": "punctuation.separator.optional-parameter.ocaml" } } }, { "name": "variable.parameter.labeled.ocaml", "begin": "(~)([a-z][a-zA-Z0-9'_]*)\\s*(:)\\s*", "end": "\\s", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "1": { "name": "punctuation.definition.labeled-parameter.ocaml" }, "2": { "name": "entity.name.tag.label.ocaml" }, "3": { "name": "punctuation.separator.label.ocaml" } } }, { "include": "#strings" }, { "include": "#typedefs" } ], "beginCaptures": { "1": { "name": "keyword.other.ocaml" }, "2": { "name": "entity.name.type.external-signature.ocaml" }, "3": { "name": "punctuation.separator.type-constraint.ocaml" } } } ] }, "moduleref": { "patterns": [ { "name": "meta.module-reference.ocaml", "match": "\\b([A-Z][a-zA-Z0-9'_]*)(\\.)", "beginCaptures": { "1": { "name": "support.other.module.ocaml" }, "2": { "name": "punctuation.separator.module-reference.ocaml" } } } ] }, "storagetypes": { "patterns": [ { "name": "storage.type.ocaml", "match": "\\b(int|char|float|string|list|array|bool|unit|exn|option|int32|int64|nativeint|format4|lazy_t)\\b" }, { "name": "storage.type.variant.polymorphic.ocaml", "match": "#[a-z_][a-zA-Z0-9_]*" } ] }, "strings": { "patterns": [ { "name": "string.quoted.double.ocaml", "begin": "(?=[^\\\\])(\")", "end": "(\")", "patterns": [ { "name": "punctuation.separator.string.ignore-eol.ocaml", "match": "\\\\$[ \\t]*" }, { "name": "constant.character.string.escape.ocaml", "match": "\\\\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\\d\\d|[bnrt'\"\\\\])" }, { "name": "constant.character.regexp.escape.ocaml", "match": "\\\\[\\|\\(\\)1-9$^.*+?\\[\\]]" }, { "name": "invalid.illegal.character.string.escape", "match": "\\\\(?!(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\\d\\d|[bnrt'\"\\\\]|[\\|\\(\\)1-9$^.*+?\\[\\]]|$[ \\t]*))(?:.)" } ], "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.string.end.ocaml" } } } ] }, "typedefs": { "patterns": [ { "name": "punctuation.separator.variant-definition.ocaml", "match": "\\|" }, { "include": "#comments_inner" }, { "name": "meta.paren-group.ocaml", "begin": "\\(", "end": "\\)", "patterns": [ { "include": "#typedefs" } ] }, { "name": "keyword.other.ocaml", "match": "\\bof\\b" }, { "include": "#storagetypes" }, { "name": "storage.type.ocaml", "match": "(?\u003c=\\s|\\()['a-z_][a-zA-Z0-9_]*\\b" }, { "name": "meta.module.type.ocaml", "match": "\\b((?:[A-Z][a-zA-Z0-9'_]*)(?:\\.[A-Z][a-zA-Z0-9'_]+)*)(\\.[a-zA-Z0-9'_]+)", "captures": { "1": { "name": "support.other.module.ocaml" }, "2": { "name": "storage.type.module.ocaml" } } }, { "name": "meta.polymorphic-variant.definition.ocaml", "begin": "(\\[(\u003e|\u003c)?)", "end": "(\\])", "patterns": [ { "include": "#typedefs" } ], "beginCaptures": { "1": { "name": "punctuation.definition.polymorphic-variant.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.polymorphic-variant.ocaml" } } }, { "include": "$self" }, { "name": "punctuation.separator.algebraic-type.ocaml", "match": "\\|" } ] }, "variables": { "patterns": [ { "name": "variable.parameter.unit.ocaml", "match": "\\(\\)" }, { "include": "#constants" }, { "include": "#moduleref" }, { "name": "variable.parameter.labeled.ocaml", "begin": "(~)([a-z][a-zA-Z0-9'_]*)(\\s*:\\s*)?", "end": "(?=(-\u003e|\\s))", "patterns": [ { "include": "#variables" } ], "beginCaptures": { "1": { "name": "punctuation.definition.labeled-parameter.ocaml" }, "2": { "name": "entity.name.tag.label.ocaml" }, "3": { "name": "punctuation.separator.label.ocaml" } } }, { "name": "variable.parameter.optional.ocaml", "match": "(\\?)([a-z][a-zA-Z0-9_]*)", "captures": { "1": { "name": "punctuation.definition.optional-parameter.ocaml" }, "2": { "name": "entity.name.tag.label.optional.ocaml" } } }, { "name": "variable.parameter.optional.ocaml", "begin": "(\\?)(\\()([a-z_][a-zA-Z0-9'_]*)\\s*(=)", "end": "(\\))", "patterns": [ { "include": "$self" } ], "beginCaptures": { "1": { "name": "punctuation.definition.optional-parameter.ocaml" }, "2": { "name": "punctuation.definition.optional-parameter.ocaml" }, "3": { "name": "entity.name.tag.label.optional.ocaml" }, "4": { "name": "punctuation.separator.optional-parameter-assignment.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.optional-parameter.ocaml" } } }, { "name": "meta.parameter.type-constrained.ocaml", "begin": "(\\()(?=(~[a-z][a-zA-Z0-9_]*:|(\"(\\\\\"|[^\"])*\")|[^\\(\\)~\"])+(?\u003c!:)(:\u003e|:(?![:=])))", "end": "(\\))", "patterns": [ { "name": "storage.type.ocaml", "begin": "(?\u003c!:)(:\u003e|:(?![:=]))", "end": "(?=\\))", "patterns": [ { "name": "meta.paren.group", "begin": "\\(", "end": "\\)" } ], "beginCaptures": { "1": { "name": "punctuation.separator.type-constraint.ocaml" } } }, { "include": "#variables" } ], "beginCaptures": { "1": { "name": "punctuation.section.type-constraint.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.section.type-constraint.ocaml" } } }, { "include": "#comments_inner" }, { "name": "meta.paren-group.ocaml", "begin": "\\(", "end": "\\)", "patterns": [ { "include": "#variables" } ] }, { "name": "variable.parameter.tuple.ocaml", "begin": "(\\()", "end": "(\\))", "patterns": [ { "include": "#matchpatterns" }, { "include": "#variables" }, { "name": "punctuation.separator.tuple.ocaml", "match": "," } ], "beginCaptures": { "1": { "name": "punctuation.definition.tuple.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.tuple.ocaml" } } }, { "name": "variable.parameter.record.ocaml", "begin": "(\\{)", "end": "(\\})", "patterns": [ { "include": "#moduleref" }, { "name": "meta.recordfield.match.ocaml", "begin": "\\b([a-z][a-zA-Z0-9'_]*)\\s*(=)", "end": "(;)|(?=\\})", "patterns": [ { "include": "#matchpatterns" } ], "beginCaptures": { "1": { "name": "entity.name.tag.record.ocaml" }, "2": { "name": "punctuation.separator.record.field-assignment.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.separator.record.ocaml" } } } ], "beginCaptures": { "1": { "name": "punctuation.definition.record.ocaml" } }, "endCaptures": { "1": { "name": "punctuation.definition.record.ocaml" } } }, { "include": "#storagetypes" }, { "name": "variable.parameter.ocaml", "match": "\\b[a-z_][a-zA-Z0-9'_]*" } ] } } }