{ "name": "Scala", "scopeName": "source.scala", "patterns": [ { "include": "#code" } ], "repository": { "block-comments": { "name": "comment.block.scala", "begin": "/\\*", "end": "\\*/", "patterns": [ { "include": "#block-comments" } ], "beginCaptures": { "1": { "name": "punctuation.definition.comment.begin.scala" } }, "endCaptures": { "1": { "name": "punctuation.definition.comment.end.scala" } } }, "char-literal": { "name": "constant.character.literal.scala", "begin": "'", "end": "'", "patterns": [ { "name": "constant.character.escape.scala", "match": "\\\\(?:[btnfr\\\\\"']|[0-7]{1,3}|u[0-9A-Fa-f]{4})" }, { "name": "invalid.illegal.unrecognized-character-escape.scala", "match": "\\\\." }, { "name": "invalid.illegal.character-literal-too-long", "match": "[^']{2,}" }, { "name": "invalid.illegal.character-literal-too-long", "match": "(?\u003c!')[^']" } ], "beginCaptures": { "0": { "name": "punctuation.definition.character.begin.scala" } }, "endCaptures": { "0": { "name": "punctuation.definition.character.end.scala" } } }, "code": { "patterns": [ { "include": "#storage-modifiers" }, { "include": "#declarations" }, { "include": "#inheritance" }, { "include": "#imports" }, { "include": "#comments" }, { "include": "#strings" }, { "include": "#initialization" }, { "include": "#xml-literal" }, { "include": "#keywords" }, { "include": "#constants" }, { "include": "#scala-symbol" }, { "include": "#char-literal" }, { "include": "#empty-blocks" }, { "include": "#parameter-list" }, { "include": "#qualifiedClassName" }, { "include": "#meta-brackets" }, { "include": "#meta-bounds" }, { "include": "#meta-colons" } ] }, "comments": { "patterns": [ { "name": "comment.block.empty.scala", "match": "/\\*\\*/", "captures": { "0": { "name": "punctuation.definition.comment.scala" } } }, { "name": "comment.block.documentation.scala", "begin": "^\\s*(/\\*\\*)", "end": "\\*/", "patterns": [ { "match": "(@param)\\s+(\\S+)", "captures": { "1": { "name": "keyword.other.documentation.scaladoc.scala" }, "2": { "name": "variable.parameter.scala" } } }, { "match": "(@(?:tparam|throws))\\s+(\\S+)", "captures": { "1": { "name": "keyword.other.documentation.scaladoc.scala" }, "2": { "name": "entity.name.type.class.scala" } } }, { "name": "keyword.other.documentation.scaladoc.scala", "match": "@(return|see|note|example|usecase|author|version|since|todo|deprecated|migration|define|inheritdoc)\\b" }, { "match": "(\\[\\[)([^\\]]+)(\\]\\])", "captures": { "1": { "name": "punctuation.definition.documentation.link.scala" }, "2": { "name": "entity.name.type.class.documentation.link.scala" }, "3": { "name": "punctuation.definition.documentation.link.scala" } } } ], "beginCaptures": { "1": { "name": "punctuation.definition.comment.scala" } }, "endCaptures": { "0": { "name": "punctuation.definition.comment.scala" } } }, { "include": "#block-comments" }, { "match": "\\s*((//).*$\\n?)", "captures": { "1": { "name": "comment.line.double-slash.scala" }, "2": { "name": "punctuation.definition.comment.scala" } } } ] }, "constants": { "patterns": [ { "name": "constant.language.scala", "match": "\\b(false|null|true|Nil|None)\\b" }, { "name": "constant.numeric.scala", "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\\b" }, { "name": "variable.language.scala", "match": "\\b(this|super|self)\\b" }, { "name": "storage.type.primitive.scala", "match": "\\b(Unit|Boolean|Byte|Char|Short|Int|Float|Long|Double)\\b" }, { "name": "storage.type.scala", "match": "\\b(String|Symbol)\\b" } ] }, "declarations": { "patterns": [ { "match": "(?x)\n\t\t\t\t\t\t\\b(def)\\s+\n\t\t\t\t\t\t(`[^`]+`|[_$a-zA-Z][_$a-zA-Z0-9]*(?:_[^\\s])(?=[(\\t ])|[_$a-zA-Z][_$a-zA-Z0-9]*|[-?~\u003e\u003c^+*%:!#|/@\\\\]+)", "captures": { "1": { "name": "keyword.control.def.scala" }, "2": { "name": "entity.name.function.declaration.scala" } } }, { "match": "(?:(case) +)?\\b(class|trait|object)\\s+([^\\s\\{\\(\\[]+)", "captures": { "1": { "name": "storage.modifier.case.scala" }, "2": { "name": "storage.type.$1.scala" }, "3": { "name": "entity.name.type.class.declaration.scala" } } }, { "match": "\\b(type)\\s+(`[^`]+`|[_$a-zA-Z][_$a-zA-Z0-9]*(?:_[^\\s])(?=[\\t ])|[_$a-zA-Z][_$a-zA-Z0-9]*|[-?~\u003e\u003c^+*%:!#|/@\\\\]+)", "captures": { "1": { "name": "keyword.control.type.scala" }, "2": { "name": "entity.name.type.type.declaration.scala" } } }, { "match": "\\b(?:(val)|(var))\\s+(?:(`[^`]+`|[_$a-zA-Z][_$a-zA-Z0-9]*(?:_[^\\s])(?=[\\t ])|[_$a-zA-Z][_$a-zA-Z0-9]*|[-?~\u003e\u003c^+*%:!#|/@\\\\]+)|(?=\\())", "captures": { "1": { "name": "storage.type.stable.scala" }, "2": { "name": "storage.type.volatile.scala" }, "3": { "name": "entity.name.type.val.declaration.scala" } } }, { "match": "\\b(package) (object)\\s+([^\\s\\{\\(\\[]+)", "captures": { "1": { "name": "storage.type.package.scala" }, "2": { "name": "storage.type.package.object.scala" }, "3": { "name": "entity.name.type.class.declaration.scala" } } }, { "name": "meta.package.scala", "match": "\\b(package)\\s+([\\w\\.]+)", "captures": { "1": { "name": "storage.type.package.scala" }, "2": { "name": "entity.name.type.package.scala" } } } ] }, "empty-blocks": { "patterns": [ { "name": "meta.parentheses.scala", "match": "(\\()(\\))", "captures": { "1": { "name": "punctuation.definition.parentheses.begin.scala" }, "2": { "name": "punctuation.definition.parentheses.end.scala" } } }, { "name": "meta.braces.scala", "match": "(\\{)(\\})", "captures": { "1": { "name": "punctuation.definition.parentheses.begin.scala" }, "2": { "name": "punctuation.definition.parentheses.end.scala" } } } ] }, "imports": { "name": "meta.import.scala", "begin": "\\b(import)\\s+", "end": "(?\u003c=[\\n;])", "patterns": [ { "include": "#comments" }, { "name": "variable.other.package.scala", "match": "([^\\s{;.]+)\\s*\\.\\s*" }, { "name": "variable.other.import.scala", "match": "([^\\s{;.]+)\\s*" }, { "name": "meta.import.selector.scala", "begin": "{", "end": "}", "patterns": [ { "match": "(?x) \\s*\n\t\t\t\t([^\\s.,}]+) \\s*\n\t\t\t\t(=\u003e) \\s*\n\t\t\t\t([^\\s.,}]+) \\s*\n\t\t\t ", "captures": { "1": { "name": "variable.other.import.renamed-from.scala" }, "2": { "name": "keyword.operator.scala" }, "3": { "name": "variable.other.import.renamed-to.scala" } } }, { "name": "variable.other.import.scala", "match": "([^\\s.,}]+)" } ], "beginCaptures": { "0": { "name": "meta.bracket.scala" } }, "endCaptures": { "0": { "name": "meta.bracket.scala" } } } ], "beginCaptures": { "1": { "name": "keyword.control.import.scala" } } }, "inheritance": { "patterns": [ { "match": "(extends|with)\\s+([^\\s\\{\\(\\[\\]]+)", "captures": { "1": { "name": "storage.modifier.extends.scala" }, "2": { "name": "entity.other.inherited-class.scala" } } } ] }, "initialization": { "match": "\\b(new)\\s+([^\\s\\{\\(\\[]+)", "captures": { "1": { "name": "keyword.control.directive.scala" }, "2": { "name": "entity.name.type.class.scala" } } }, "keywords": { "patterns": [ { "name": "keyword.control.flow.jump.scala", "match": "\\b(return|throw)\\b" }, { "name": "support.function.type-of.scala", "match": "\\b(classOf|isInstanceOf|asInstanceOf)\\b" }, { "name": "keyword.control.flow.scala", "match": "\\b(else|if|do|while|for|yield|match|case)\\b" }, { "name": "keyword.control.exception.scala", "match": "\\b(catch|finally|try)\\b" }, { "name": "keyword.operator.comparison.scala", "match": "(==?|!=|\u003c=|\u003e=|\u003c\u003e|\u003c|\u003e)" }, { "name": "keyword.operator.arithmetic.scala", "match": "(\\-|\\+|\\*|/(?![/*])|%|~)" }, { "name": "keyword.operator.logical.scala", "match": "(!|\u0026\u0026|\\|\\|)" }, { "name": "keyword.operator.scala", "match": "(\u003c-|←|-\u003e|→|=\u003e|⇒|\\?|\\:+|@|\\|)+" } ] }, "meta-bounds": { "name": "meta.bounds.scala", "match": "\u003c%|=:=|\u003c:\u003c|\u003c%\u003c|\u003e:|\u003c:" }, "meta-brackets": { "patterns": [ { "name": "meta.bracket.scala", "match": "{|}|\\(|\\)|\\[|\\]" } ] }, "meta-colons": { "patterns": [ { "name": "meta.colon.scala", "match": "(?\u003c!:):(?!:)" } ] }, "parameter-list": { "patterns": [ { "match": "(?\u003c=[^\\._$a-zA-Z0-9])(`[^`]+`|[_$a-z][_$a-zA-Z0-9]*(?:_[^\\s])(?=[\\t ])|[_$a-z][_$a-zA-Z0-9]*|[-?~\u003e\u003c^+*%:!#|/@\\\\]+)\\s*(:)\\s+", "captures": { "1": { "name": "variable.parameter.scala" }, "2": { "name": "meta.colon.scala" } } } ] }, "qualifiedClassName": { "match": "(\\b([A-Z][\\w]*))", "captures": { "1": { "name": "entity.name.type.class.scala" } } }, "scala-symbol": { "name": "entity.name.type.symbol.scala", "match": "'\\w+(?=[^'\\w])" }, "storage-modifiers": { "patterns": [ { "name": "storage.modifier.access.scala", "match": "\\b(private\\[\\S+\\]|protected\\[\\S+\\]|private|protected)\\b" }, { "name": "storage.modifier.other.scala", "match": "\\b(synchronized|@volatile|abstract|final|lazy|sealed|implicit|override|@transient|@native)\\b" } ] }, "strings": { "patterns": [ { "name": "string.quoted.triple.scala", "begin": "\"\"\"", "end": "\"\"\"(?!\")", "patterns": [ { "name": "constant.character.escape.scala", "match": "\\\\\\\\|\\\\u[0-9A-Fa-f]{4}" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.scala" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.scala" } } }, { "name": "string.quoted.double.scala", "begin": "\"", "end": "\"", "patterns": [ { "name": "constant.character.escape.scala", "match": "\\\\(?:[btnfr\\\\\"']|[0-7]{1,3}|u[0-9A-Fa-f]{4})" }, { "name": "invalid.illegal.unrecognized-string-escape.scala", "match": "\\\\." } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.scala" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.scala" } } } ] }, "xml-doublequotedString": { "name": "string.quoted.double.xml", "begin": "\"", "end": "\"", "patterns": [ { "include": "#xml-entity" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.xml" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.xml" } } }, "xml-embedded-content": { "patterns": [ { "name": "meta.source.embedded.scala", "begin": "{", "end": "}", "patterns": [ { "include": "#code" } ], "captures": { "0": { "name": "meta.bracket.scala" } } }, { "match": " (?:([-_a-zA-Z0-9]+)((:)))?([_a-zA-Z-]+)=", "captures": { "1": { "name": "entity.other.attribute-name.namespace.xml" }, "2": { "name": "entity.other.attribute-name.xml" }, "3": { "name": "punctuation.separator.namespace.xml" }, "4": { "name": "entity.other.attribute-name.localname.xml" } } }, { "include": "#xml-doublequotedString" }, { "include": "#xml-singlequotedString" } ] }, "xml-entity": { "name": "constant.character.entity.xml", "match": "(\u0026)([:a-zA-Z_][:a-zA-Z0-9_.-]*|#[0-9]+|#x[0-9a-fA-F]+)(;)", "captures": { "1": { "name": "punctuation.definition.constant.xml" }, "3": { "name": "punctuation.definition.constant.xml" } } }, "xml-literal": { "patterns": [ { "name": "meta.tag.no-content.xml", "begin": "(\u003c)((?:([_a-zA-Z0-9][_a-zA-Z0-9]*)((:)))?([_a-zA-Z0-9][-_a-zA-Z0-9:]*))(?=(\\s[^\u003e]*)?\u003e\u003c/\\2\u003e)", "end": "(\u003e(\u003c))/(?:([-_a-zA-Z0-9]+)((:)))?([-_a-zA-Z0-9:]*[_a-zA-Z0-9])(\u003e)", "patterns": [ { "include": "#xml-embedded-content" } ], "beginCaptures": { "1": { "name": "punctuation.definition.tag.xml" }, "3": { "name": "entity.name.tag.namespace.xml" }, "4": { "name": "entity.name.tag.xml" }, "5": { "name": "punctuation.separator.namespace.xml" }, "6": { "name": "entity.name.tag.localname.xml" } }, "endCaptures": { "1": { "name": "punctuation.definition.tag.xml" }, "2": { "name": "meta.scope.between-tag-pair.xml" }, "3": { "name": "entity.name.tag.namespace.xml" }, "4": { "name": "entity.name.tag.xml" }, "5": { "name": "punctuation.separator.namespace.xml" }, "6": { "name": "entity.name.tag.localname.xml" }, "7": { "name": "punctuation.definition.tag.xml" } } }, { "name": "meta.tag.xml", "begin": "(\u003c/?)(?:([_a-zA-Z0-9][-_a-zA-Z0-9]*)((:)))?([_a-zA-Z0-9][-_a-zA-Z0-9:]*)(?=[^\u003e]*?\u003e)", "end": "(/?\u003e)", "patterns": [ { "include": "#xml-embedded-content" } ], "captures": { "1": { "name": "punctuation.definition.tag.xml" }, "2": { "name": "entity.name.tag.namespace.xml" }, "3": { "name": "entity.name.tag.xml" }, "4": { "name": "punctuation.separator.namespace.xml" }, "5": { "name": "entity.name.tag.localname.xml" } } }, { "include": "#xml-entity" } ] }, "xml-singlequotedString": { "name": "string.quoted.single.xml", "begin": "'", "end": "'", "patterns": [ { "include": "#xml-entity" } ], "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.xml" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.xml" } } } } }