shiki 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import c from './c.mjs';
5
5
  import javascript from './javascript.mjs';
6
6
  import shellscript from './shellscript.mjs';
7
7
 
8
- const lang = Object.freeze({ "displayName": "Crystal", "fileTypes": ["cr"], "firstLineMatch": "^#!/.*\\bcrystal", "foldingStartMarker": `(?x)^(\\s*+(annotation|module|class|struct|union|enum|def(?!.*\\bend\\s*$)|unless|if|case|begin|for|while|until|^=begin|("(\\\\.|[^"])*+"|'(\\\\.|[^'])*+'|[^#"'])*(\\s(do|begin|case)|(?<!\\$)[-+=&|*/~%^<>~]\\s*+(if|unless)))\\b(?![^;]*+;.*?\\bend\\b)|("(\\\\.|[^"])*+"|'(\\\\.|[^'])*+'|[^#"'])*(\\{(?![^}]*+\\})|\\[(?![^\\]]*+\\]))).*$|[#].*?\\(fold\\)\\s*+$`, "foldingStopMarker": "(?x)((^|;)\\s*+end\\s*+([#].*)?$|(^|;)\\s*+end\\..*$|^\\s*+[}\\]] ,?\\s*+([#].*)?$|[#].*?\\(end\\)\\s*+$|^=end)", "name": "crystal", "patterns": [{ "captures": { "1": { "name": "keyword.control.class.crystal" }, "2": { "name": "keyword.control.class.crystal" }, "3": { "name": "entity.name.type.class.crystal" }, "5": { "name": "punctuation.separator.crystal" }, "6": { "name": "support.class.other.type-param.crystal" }, "7": { "name": "entity.other.inherited-class.crystal" }, "8": { "name": "punctuation.separator.crystal" }, "9": { "name": "punctuation.separator.crystal" }, "10": { "name": "support.class.other.type-param.crystal" }, "11": { "name": "punctuation.definition.variable.crystal" } }, "match": "(?x)^\\s*(abstract)?\\s*(class|struct|union|annotation|enum)\\s+(([.A-Z_:\\x{80}-\\x{10FFFF}][.\\w:\\x{80}-\\x{10FFFF}]*(\\(([,\\s.a-zA-Z0-9_:\\x{80}-\\x{10FFFF}]+)\\))?(\\s*(<)\\s*[.:A-Z\\x{80}-\\x{10FFFF}][.:\\w\\x{80}-\\x{10FFFF}]*(\\(([.a-zA-Z0-9_:]+\\s,)\\))?)?)|((<<)\\s*[.A-Z0-9_:\\x{80}-\\x{10FFFF}]+))", "name": "meta.class.crystal" }, { "captures": { "1": { "name": "keyword.control.module.crystal" }, "2": { "name": "entity.name.type.module.crystal" }, "3": { "name": "entity.other.inherited-class.module.first.crystal" }, "4": { "name": "punctuation.separator.inheritance.crystal" }, "5": { "name": "entity.other.inherited-class.module.second.crystal" }, "6": { "name": "punctuation.separator.inheritance.crystal" }, "7": { "name": "entity.other.inherited-class.module.third.crystal" }, "8": { "name": "punctuation.separator.inheritance.crystal" } }, "match": "^\\s*(module)\\s+(([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))?([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))?([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))*[A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*)", "name": "meta.module.crystal" }, { "captures": { "1": { "name": "keyword.control.lib.crystal" }, "2": { "name": "entity.name.type.lib.crystal" }, "3": { "name": "entity.other.inherited-class.lib.first.crystal" }, "4": { "name": "punctuation.separator.inheritance.crystal" }, "5": { "name": "entity.other.inherited-class.lib.second.crystal" }, "6": { "name": "punctuation.separator.inheritance.crystal" }, "7": { "name": "entity.other.inherited-class.lib.third.crystal" }, "8": { "name": "punctuation.separator.inheritance.crystal" } }, "match": "^\\s*(lib)\\s+(([A-Z]\\w*(::))?([A-Z]\\w*(::))?([A-Z]\\w*(::))*[A-Z]\\w*)", "name": "meta.lib.crystal" }, { "captures": { "1": { "name": "keyword.control.lib.type.crystal" }, "2": { "name": "entity.name.lib.type.crystal" }, "3": { "name": "keyword.control.lib.crystal" }, "4": { "name": "entity.name.lib.type.value.crystal" } }, "comment": "type in lib", "match": "(?<!\\.)\\b(type)\\s+([A-Z]\\w+)\\s*(=)\\s*(.+)", "name": "meta.lib.type.crystal" }, { "comment": "everything being a reserved word, not a value and needing a 'end' is a..", "match": "(?<!\\.)\\b(fun|begin|case|class|else|elsif|end|ensure|enum|for|if|macro|module|rescue|struct|then|union|unless|until|when|while)\\b(?![?!:])", "name": "keyword.control.crystal" }, { "comment": "everything being a reserved word, not a value and not needing a 'end' is a..", "match": "(?<!\\.)\\b(abstract|alias|asm|break|extend|in|include|next|of|private|protected|struct|return|select|super|with|yield)\\b(?![?!:])", "name": "keyword.control.primary.crystal" }, { "comment": "contextual smart pair support for block parameters", "match": "(?<!\\.)\\bdo\\b\\s*", "name": "keyword.control.start-block.crystal" }, { "comment": "contextual smart pair support", "match": "(?<=\\{)(\\s+)", "name": "meta.syntax.crystal.start-block" }, { "comment": "Just as above but being not a logical operation", "match": "(?<!\\.)\\b(pointerof|typeof|sizeof|instance_sizeof|offsetof|previous_def|forall|out|uninitialized)\\b(?![?!:])|\\.(is_a\\?|nil\\?|responds_to\\?|as\\?|as\b)", "name": "keyword.control.pseudo-method.crystal" }, { "match": "\\bnil\\b(?![?!:])", "name": "constant.language.nil.crystal" }, { "match": "\\b(true|false)\\b(?![?!:])", "name": "constant.language.boolean.crystal" }, { "match": "\\b(__(DIR|FILE|LINE|END_LINE)__)\\b(?![?!:])", "name": "variable.language.crystal" }, { "match": "\\b(self)\\b(?![?!:])", "name": "variable.language.self.crystal" }, { "comment": "https://crystal-lang.org/api/0.36.1/Object.html#macro-summary", "match": "(?<!\\.)\\b(((class_)?((getter|property)\\b[!?]?|setter\\b))|(def_(clone|equals|equals_and_hash|hash)|delegate|forward_missing_to)\\b)(?![?!:])", "name": "support.function.kernel.crystal" }, { "begin": "\\b(require)\\b", "captures": { "1": { "name": "keyword.other.special-method.crystal" } }, "end": "$|(?=#)", "name": "meta.require.crystal", "patterns": [{ "include": "$self" }] }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(@)[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*[?!=]?", "name": "variable.other.readwrite.instance.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(@@)[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*[?!=]?", "name": "variable.other.readwrite.class.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(\\$)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.global.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(?!%[Qxrqwi]?[\\(\\[\\{\\<\\|])%([a-zA-Z_]\\w*\\.)*[a-zA-Z_]\\w*", "name": "variable.other.readwrite.fresh.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(\\$)(!|@|&|`|'|\\+|\\d+|~|=|/|\\\\|,|;|\\.|<|>|_|\\*|\\$|\\?|:|\"|-[0adFiIlpv])", "name": "variable.other.readwrite.global.pre-defined.crystal" }, { "begin": "\\b(ENV)\\[", "beginCaptures": { "1": { "name": "variable.other.constant.crystal" } }, "end": "\\]", "name": "meta.environment-variable.crystal", "patterns": [{ "include": "$self" }] }, { "comment": "Literals name of Crystal", "match": "\\b[A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*", "name": "support.class.crystal" }, { "comment": "Fetch from https://crystal-lang.org/api/0.36.1/toplevel.html", "match": "(?<!\\.)\\b(abort|at_exit|caller|exit|gets|loop|main|p|pp|print|printf|puts|raise|rand|read_line|sleep|spawn|sprintf|system|debugger|record|spawn)\\b(?![?!:])", "name": "support.function.kernel.crystal" }, { "comment": "Constant name in any where", "match": "\\b[_A-Z]+\\b", "name": "variable.other.constant.crystal" }, { "begin": "(?x)\n(?=def\\b)\n(?<=^|\\s)(def)\\s+\n(\n(?>[a-zA-Z_]\\w*(?>\\.|::))?\n(?>\n[a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n|\n\\^|===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[][?=]?|\\[]=?\n)\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.control.def.crystal" }, "2": { "name": "entity.name.function.crystal" }, "3": { "name": "punctuation.definition.parameters.crystal" } }, "comment": "The method pattern comes from the symbol pattern. See there for an explanation.", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.crystal" } }, "name": "meta.function.method.with-arguments.crystal", "patterns": [{ "begin": "(?![\\s,)])", "end": "(?=,|\\)\\s*)", "patterns": [{ "captures": { "1": { "name": "storage.type.variable.crystal" }, "2": { "name": "constant.other.symbol.hashkey.parameter.function.crystal" }, "3": { "name": "punctuation.definition.constant.hashkey.crystal" }, "4": { "name": "variable.parameter.function.crystal" } }, "match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))" }, { "include": "$self" }] }] }, { "captures": { "1": { "name": "keyword.control.def.crystal" }, "3": { "name": "entity.name.function.crystal" } }, "comment": " the optional name is just to catch the def also without a method-name", "match": "(?x)\n(?=def\\b)\n(?<=^|\\s)(def)\\b\n(\n\\s+\n(\n(?>[a-zA-Z_]\\w*(?>\\.|::))?\n(?>\n[a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n|\n\\^|===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[][?=]?|\\[]=?\n)\n)\n)?", "name": "meta.function.method.without-arguments.crystal" }, { "comment": "Floating point literal (fraction)", "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b", "name": "constant.numeric.float.crystal" }, { "comment": "Floating point literal (exponent)", "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b", "name": "constant.numeric.float.crystal" }, { "comment": "Floating point literal (typed)", "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b", "name": "constant.numeric.float.crystal" }, { "comment": "Integer literal (decimal)", "match": "\\b(?!0[0-9])[0-9][0-9_]*([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.decimal.crystal" }, { "comment": "Integer literal (hexadecimal)", "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.hexadecimal.crystal" }, { "comment": "Integer literal (octal)", "match": "\\b0o[0-7_]+([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.octal.crystal" }, { "comment": "Integer literal (binary)", "match": "\\b0b[01_]+([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.binary.crystal" }, { "begin": ":'", "beginCaptures": { "0": { "name": "punctuation.definition.symbol.begin.crystal" } }, "comment": "symbol literal with '' delimiter", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.symbol.end.crystal" } }, "name": "constant.other.symbol.crystal", "patterns": [{ "match": "\\\\['\\\\]", "name": "constant.character.escape.crystal" }] }, { "begin": ':"', "beginCaptures": { "0": { "name": "punctuation.section.symbol.begin.crystal" } }, "comment": 'symbol literal with "" delimiter', "end": '"', "endCaptures": { "0": { "name": "punctuation.section.symbol.end.crystal" } }, "name": "constant.other.symbol.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "comment": "Needs higher precedence than regular expressions.", "match": "(?<!\\()/=", "name": "keyword.operator.assignment.augmented.crystal" }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "string literal with '' delimiter", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.single.crystal", "patterns": [{ "match": "\\\\'|\\\\\\\\", "name": "constant.character.escape.crystal" }] }, { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": 'string literal with interpolation and "" delimiter', "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.double.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allows for interpolation)", "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "%x\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_curly_i" }] }, { "begin": "%x\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_brackets_i" }] }, { "begin": "%x\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\>", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_ltgt_i" }] }, { "begin": "%x\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_parens_i" }] }, { "begin": "%x\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\|", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?x) (?: ^| (?<=[=>~(?:\\[,|&;] | [\\s;]if\\s| [\\s;]elsif\\s | [\\s;]while\\s | [\\s;]unless\\s | [\\s;]when\\s | [\\s;]assert_match\\s | [\\s;]or\\s| [\\s;]and\\s | [\\s;]not\\s | [\\s.]index\\s| [\\s.]scan\\s | [\\s.]sub\\s | [\\s.]sub!\\s | [\\s.]gsub\\s | [\\s.]gsub!\\s | [\\s.]match\\s ) | (?<=^when\\s| ^if\\s | ^elsif\\s | ^while\\s | ^unless\\s ) ) \\s*((/))(?![*+{}?])", "captures": { "1": { "name": "string.regexp.classic.crystal" }, "2": { "name": "punctuation.definition.string.crystal" } }, "comment": "regular expressions (normal) we only start a regexp if the character before it (excluding whitespace) is what we think is before a regexp", "contentName": "string.regexp.classic.crystal", "end": "((/[imsx]*))", "patterns": [{ "include": "#regex_sub" }] }, { "begin": "%r\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\}[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_curly_r" }] }, { "begin": "%r\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\][imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_brackets_r" }] }, { "begin": "%r\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\)[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_parens_r" }] }, { "begin": "%r\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\>[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_ltgt_r" }] }, { "begin": "%r\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\|[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }] }, { "begin": "%Q?\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation ()", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_parens_i" }] }, { "begin": "%Q?\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation []", "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_brackets_i" }] }, { "begin": "%Q?\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation <>", "end": "\\>", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_ltgt_i" }] }, { "begin": "%Q?\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation -- {}", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.double.crystal.mod", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_curly_i" }] }, { "begin": "%Q\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation -- ||", "end": "\\|", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "%[qwi]\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- ()", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\)|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_parens" }] }, { "begin": "%[qwi]\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- <>", "end": "\\>", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\>|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_ltgt" }] }, { "begin": "%[qwi]\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- []", "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\]|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_brackets" }] }, { "begin": "%[qwi]\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- {}", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\}|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_curly" }] }, { "begin": "%[qwi]\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- ||", "end": "\\|", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "comment": "Cant be named because its not necessarily an escape.", "match": "\\\\." }] }, { "captures": { "1": { "name": "punctuation.definition.constant.crystal" } }, "comment": "symbols", "match": "(?<!:)(:)(?>[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[\\][?=]?|@@?[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*)", "name": "constant.other.symbol.crystal" }, { "captures": { "1": { "name": "punctuation.definition.constant.crystal" } }, "comment": "symbols", "match": "(?>[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(?>[?!])?)(:)(?!:)", "name": "constant.other.symbol.crystal.19syntax" }, { "captures": { "1": { "name": "punctuation.definition.comment.crystal" } }, "match": "(?:^[ \\t]+)?(#).*$\\n?", "name": "comment.line.number-sign.crystal" }, { "match": "\\b_([\\w]+[?!]?)", "name": "comment.unused.crystal" }, { "begin": "(?><<-('?)((?:[_\\w]+_|)HTML)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded HTML and indented terminator", "contentName": "text.html.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.html.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "text.html.basic" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)SQL)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded SQL and indented terminator", "contentName": "text.sql.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.sql.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.sql" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)CSS)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded css and intented terminator", "contentName": "text.css.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.css.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.css" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)CPP)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded c++ and intented terminator", "contentName": "text.c++.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.cplusplus.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.c++" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)C)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded c++ and intented terminator", "contentName": "text.c.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.c.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.c" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded javascript and intented terminator", "contentName": "text.js.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.js.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.js" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)JQUERY)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded javascript and intented terminator", "contentName": "text.js.jquery.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.js.jquery.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.js.jquery" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded shell and intented terminator", "contentName": "text.shell.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.shell.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.shell" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)CRYSTAL)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded crystal and intented terminator", "contentName": "text.crystal.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.crystal.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.crystal" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-'(\\w+)')", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with indented terminator", "end": "\\s*\\1\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.heredoc.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-(\\w+)\\b)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with indented terminator", "end": "\\s*\\1\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.heredoc.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?<={|{\\s|[^A-Za-z0-9_]do|^do|[^A-Za-z0-9_]do\\s|^do\\s)(\\|)", "captures": { "1": { "name": "punctuation.separator.variable.crystal" } }, "end": "(?<!\\|)(\\|)(?!\\|)", "patterns": [{ "include": "source.crystal" }, { "match": "[_a-zA-Z][_a-zA-Z0-9]*", "name": "variable.other.block.crystal" }, { "match": ",", "name": "punctuation.separator.variable.crystal" }] }, { "match": "=>", "name": "punctuation.separator.key-value" }, { "match": "->", "name": "support.function.kernel.crystal" }, { "match": "<<=|%=|&{1,2}=|\\*=|\\*\\*=|\\+=|-=|\\^=|\\|{1,2}=|<<", "name": "keyword.operator.assignment.augmented.crystal" }, { "match": "<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \\t])\\?", "name": "keyword.operator.comparison.crystal" }, { "match": "(?<=^|[ \\t])!|&&|\\|\\||\\^", "name": "keyword.operator.logical.crystal" }, { "match": "(\\{\\%|\\%\\}|\\{\\{|\\}\\})", "name": "keyword.operator.macro.crystal" }, { "captures": { "1": { "name": "punctuation.separator.method.crystal" } }, "comment": "Safe navigation operator", "match": "(&\\.)\\s*(?![A-Z])" }, { "match": "(%|&|\\*\\*|\\*|\\+|\\-|/)", "name": "keyword.operator.arithmetic.crystal" }, { "match": "=", "name": "keyword.operator.assignment.crystal" }, { "match": "\\||~|>>", "name": "keyword.operator.other.crystal" }, { "match": ":", "name": "punctuation.separator.other.crystal" }, { "match": "\\;", "name": "punctuation.separator.statement.crystal" }, { "match": ",", "name": "punctuation.separator.object.crystal" }, { "match": "\\.|::", "name": "punctuation.separator.method.crystal" }, { "match": "\\{|\\}", "name": "punctuation.section.scope.crystal" }, { "match": "\\[|\\]", "name": "punctuation.section.array.crystal" }, { "match": "\\(|\\)", "name": "punctuation.section.function.crystal" }, { "begin": "(?=[a-zA-Z0-9_!?]+\\()", "end": "(?<=\\))", "name": "meta.function-call.crystal", "patterns": [{ "match": "([a-zA-Z0-9_!?]+)(?=\\()", "name": "entity.name.function.crystal" }, { "include": "$self" }] }, { "comment": "This is kindof experimental. There really is no way to perfectly match all regular variables, but you can pretty well assume that any normal word in certain curcumstances that havnt already been scoped as something else are probably variables, and the advantages beat the potential errors", "match": "((?<=\\W)\\b|^)\\w+\\b(?=\\s*([\\]\\)\\}\\=\\+\\-\\*\\/\\^\\$\\,\\.]|<\\s|<<[\\s|\\.]))", "name": "variable.other.crystal" }], "repository": { "escaped_char": { "comment": "https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html", "match": "\\\\(?:[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\\{[a-fA-F0-9 ]+\\}|.)", "name": "constant.character.escape.crystal" }, "heredoc": { "begin": "^<<-?\\w+", "end": "$", "patterns": [{ "include": "$self" }] }, "interpolated_crystal": { "patterns": [{ "begin": "#\\{", "beginCaptures": { "0": { "name": "punctuation.section.embedded.begin.crystal" } }, "contentName": "source.crystal", "end": "(\\})", "endCaptures": { "0": { "name": "punctuation.section.embedded.end.crystal" }, "1": { "name": "source.crystal" } }, "name": "meta.embedded.line.crystal", "patterns": [{ "include": "#nest_curly_and_self" }, { "include": "$self" }], "repository": { "nest_curly_and_self": { "patterns": [{ "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#nest_curly_and_self" }] }, { "include": "$self" }] } } }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(#@)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.instance.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(#@@)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.class.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(#\\$)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.global.crystal" }] }, "nest_brackets": { "begin": "\\[", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\]", "patterns": [{ "include": "#nest_brackets" }] }, "nest_brackets_i": { "begin": "\\[", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\]", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_brackets_i" }] }, "nest_brackets_r": { "begin": "\\[", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\]", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_brackets_r" }] }, "nest_curly": { "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#nest_curly" }] }, "nest_curly_and_self": { "patterns": [{ "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#nest_curly_and_self" }] }, { "include": "$self" }] }, "nest_curly_i": { "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_curly_i" }] }, "nest_curly_r": { "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_curly_r" }] }, "nest_ltgt": { "begin": "\\<", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\>", "patterns": [{ "include": "#nest_ltgt" }] }, "nest_ltgt_i": { "begin": "\\<", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\>", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_ltgt_i" }] }, "nest_ltgt_r": { "begin": "\\<", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\>", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_ltgt_r" }] }, "nest_parens": { "begin": "\\(", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\)", "patterns": [{ "include": "#nest_parens" }] }, "nest_parens_i": { "begin": "\\(", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\)", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_parens_i" }] }, "nest_parens_r": { "begin": "\\(", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\)", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_parens_r" }] }, "regex_sub": { "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "captures": { "1": { "name": "punctuation.definition.arbitrary-repetition.crystal" }, "3": { "name": "punctuation.definition.arbitrary-repetition.crystal" } }, "match": "({)\\d+(,\\d+)?(})", "name": "string.regexp.arbitrary-repetition.crystal" }, { "begin": "\\[(?:\\^?])?", "captures": { "0": { "name": "punctuation.definition.character-class.crystal" } }, "end": "]", "name": "string.regexp.character-class.crystal", "patterns": [{ "include": "#escaped_char" }] }, { "begin": "\\(", "captures": { "0": { "name": "punctuation.definition.group.crystal" } }, "end": "\\)", "name": "string.regexp.group.crystal", "patterns": [{ "include": "#regex_sub" }] }, { "captures": { "1": { "name": "punctuation.definition.comment.crystal" } }, "comment": "We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.", "match": "(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$", "name": "comment.line.number-sign.crystal" }] } }, "scopeName": "source.crystal", "embeddedLangs": ["html", "sql", "css", "c", "javascript", "shellscript"] });
8
+ const lang = Object.freeze({ "displayName": "Crystal", "fileTypes": ["cr"], "firstLineMatch": "^#!/.*\\bcrystal", "foldingStartMarker": `(?x)^(\\s*+(annotation|module|class|struct|union|enum|def(?!.*\\bend\\s*$)|unless|if|case|begin|for|while|until|^=begin|("(\\\\.|[^"])*+"|'(\\\\.|[^'])*+'|[^#"'])*(\\s(do|begin|case)|(?<!\\$)[-+=&|*/~%^<>~]\\s*+(if|unless)))\\b(?![^;]*+;.*?\\bend\\b)|("(\\\\.|[^"])*+"|'(\\\\.|[^'])*+'|[^#"'])*(\\{(?![^}]*+\\})|\\[(?![^\\]]*+\\]))).*$|[#].*?\\(fold\\)\\s*+$`, "foldingStopMarker": "(?x)((^|;)\\s*+end\\s*+([#].*)?$|(^|;)\\s*+end\\..*$|^\\s*+[}\\]] ,?\\s*+([#].*)?$|[#].*?\\(end\\)\\s*+$|^=end)", "name": "crystal", "patterns": [{ "captures": { "1": { "name": "keyword.control.class.crystal" }, "2": { "name": "keyword.control.class.crystal" }, "3": { "name": "entity.name.type.class.crystal" }, "5": { "name": "punctuation.separator.crystal" }, "6": { "name": "support.class.other.type-param.crystal" }, "7": { "name": "entity.other.inherited-class.crystal" }, "8": { "name": "punctuation.separator.crystal" }, "9": { "name": "punctuation.separator.crystal" }, "10": { "name": "support.class.other.type-param.crystal" }, "11": { "name": "punctuation.definition.variable.crystal" } }, "match": "(?x)^\\s*(abstract)?\\s*(class|struct|union|annotation|enum)\\s+(([.A-Z_:\\x{80}-\\x{10FFFF}][.\\w:\\x{80}-\\x{10FFFF}]*(\\(([,\\s.a-zA-Z0-9_:\\x{80}-\\x{10FFFF}]+)\\))?(\\s*(<)\\s*[.:A-Z\\x{80}-\\x{10FFFF}][.:\\w\\x{80}-\\x{10FFFF}]*(\\(([.a-zA-Z0-9_:]+\\s,)\\))?)?)|((<<)\\s*[.A-Z0-9_:\\x{80}-\\x{10FFFF}]+))", "name": "meta.class.crystal" }, { "captures": { "1": { "name": "keyword.control.module.crystal" }, "2": { "name": "entity.name.type.module.crystal" }, "3": { "name": "entity.other.inherited-class.module.first.crystal" }, "4": { "name": "punctuation.separator.inheritance.crystal" }, "5": { "name": "entity.other.inherited-class.module.second.crystal" }, "6": { "name": "punctuation.separator.inheritance.crystal" }, "7": { "name": "entity.other.inherited-class.module.third.crystal" }, "8": { "name": "punctuation.separator.inheritance.crystal" } }, "match": "^\\s*(module)\\s+(([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))?([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))?([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))*[A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*)", "name": "meta.module.crystal" }, { "captures": { "1": { "name": "keyword.control.lib.crystal" }, "2": { "name": "entity.name.type.lib.crystal" }, "3": { "name": "entity.other.inherited-class.lib.first.crystal" }, "4": { "name": "punctuation.separator.inheritance.crystal" }, "5": { "name": "entity.other.inherited-class.lib.second.crystal" }, "6": { "name": "punctuation.separator.inheritance.crystal" }, "7": { "name": "entity.other.inherited-class.lib.third.crystal" }, "8": { "name": "punctuation.separator.inheritance.crystal" } }, "match": "^\\s*(lib)\\s+(([A-Z]\\w*(::))?([A-Z]\\w*(::))?([A-Z]\\w*(::))*[A-Z]\\w*)", "name": "meta.lib.crystal" }, { "captures": { "1": { "name": "keyword.control.lib.type.crystal" }, "2": { "name": "entity.name.lib.type.crystal" }, "3": { "name": "keyword.control.lib.crystal" }, "4": { "name": "entity.name.lib.type.value.crystal" } }, "comment": "type in lib", "match": "(?<!\\.)\\b(type)\\s+([A-Z]\\w+)\\s*(=)\\s*(.+)", "name": "meta.lib.type.crystal" }, { "comment": "everything being a reserved word, not a value, and needing a 'end' is a..", "match": "(?<!\\.)\\b(fun|begin|case|class|else|elsif|end|ensure|enum|for|if|macro|module|rescue|struct|then|union|unless|until|when|while)\\b(?![?!:])", "name": "keyword.control.crystal" }, { "comment": "everything being a reserved word, not a value, and not needing a 'end' is a..", "match": "(?<!\\.)\\b(abstract|alias|asm|break|extend|in|include|next|of|private|protected|struct|return|select|super|with|yield)\\b(?![?!:])", "name": "keyword.control.primary.crystal" }, { "comment": "everything being a spec keyword, not a value, and needing a block is a..", "match": "(?<!\\.)\\b(describe|context|it|expect_raises)\\b(?![?!:])", "name": "keyword.control.crystal" }, { "comment": "contextual smart pair support for block parameters", "match": "(?<!\\.)\\bdo\\b\\s*", "name": "keyword.control.start-block.crystal" }, { "comment": "contextual smart pair support", "match": "(?<=\\{)(\\s+)", "name": "meta.syntax.crystal.start-block" }, { "comment": "Just as above but being not a logical operation", "match": "(?<!\\.)\\b(pointerof|typeof|sizeof|instance_sizeof|offsetof|previous_def|forall|out|uninitialized)\\b(?![?!:])|\\.(is_a\\?|nil\\?|responds_to\\?|as\\?|as\b)", "name": "keyword.control.pseudo-method.crystal" }, { "match": "\\bnil\\b(?![?!:])", "name": "constant.language.nil.crystal" }, { "match": "\\b(true|false)\\b(?![?!:])", "name": "constant.language.boolean.crystal" }, { "match": "\\b(__(DIR|FILE|LINE|END_LINE)__)\\b(?![?!:])", "name": "variable.language.crystal" }, { "match": "\\b(self)\\b(?![?!:])", "name": "variable.language.self.crystal" }, { "comment": "https://crystal-lang.org/api/0.36.1/Object.html#macro-summary", "match": "(?<!\\.)\\b(((class_)?((getter|property)\\b[!?]?|setter\\b))|(def_(clone|equals|equals_and_hash|hash)|delegate|forward_missing_to)\\b)(?![?!:])", "name": "support.function.kernel.crystal" }, { "begin": "\\b(require)\\b", "captures": { "1": { "name": "keyword.other.special-method.crystal" } }, "end": "$|(?=#)", "name": "meta.require.crystal", "patterns": [{ "include": "$self" }] }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(@)[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*[?!=]?", "name": "variable.other.readwrite.instance.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(@@)[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*[?!=]?", "name": "variable.other.readwrite.class.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(\\$)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.global.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(?!%[Qxrqwi]?[\\(\\[\\{\\<\\|])%([a-zA-Z_]\\w*\\.)*[a-zA-Z_]\\w*", "name": "variable.other.readwrite.fresh.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(\\$)(!|@|&|`|'|\\+|\\d+|~|=|/|\\\\|,|;|\\.|<|>|_|\\*|\\$|\\?|:|\"|-[0adFiIlpv])", "name": "variable.other.readwrite.global.pre-defined.crystal" }, { "begin": "\\b(ENV)\\[", "beginCaptures": { "1": { "name": "variable.other.constant.crystal" } }, "end": "\\]", "name": "meta.environment-variable.crystal", "patterns": [{ "include": "$self" }] }, { "comment": "Literals name of Crystal", "match": "\\b[A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*", "name": "support.class.crystal" }, { "comment": "Fetch from https://crystal-lang.org/api/0.36.1/toplevel.html", "match": "(?<!\\.)\\b(abort|at_exit|caller|exit|gets|loop|main|p|pp|print|printf|puts|raise|rand|read_line|sleep|spawn|sprintf|system|debugger|record|spawn)\\b(?![?!:])", "name": "support.function.kernel.crystal" }, { "comment": "Constant name in any where", "match": "\\b[_A-Z]+\\b", "name": "variable.other.constant.crystal" }, { "begin": "(?x)\n(?=def\\b)\n(?<=^|\\s)(def)\\s+\n(\n(?>[a-zA-Z_]\\w*(?>\\.|::))?\n(?>\n[a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n|\n\\^|===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[][?=]?|\\[]=?\n)\n)\n\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.control.def.crystal" }, "2": { "name": "entity.name.function.crystal" }, "3": { "name": "punctuation.definition.parameters.crystal" } }, "comment": "The method pattern comes from the symbol pattern. See there for an explanation.", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.crystal" } }, "name": "meta.function.method.with-arguments.crystal", "patterns": [{ "begin": "(?![\\s,)])", "end": "(?=,|\\)\\s*)", "patterns": [{ "captures": { "1": { "name": "storage.type.variable.crystal" }, "2": { "name": "constant.other.symbol.hashkey.parameter.function.crystal" }, "3": { "name": "punctuation.definition.constant.hashkey.crystal" }, "4": { "name": "variable.parameter.function.crystal" } }, "match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))" }, { "include": "$self" }] }] }, { "captures": { "1": { "name": "keyword.control.def.crystal" }, "3": { "name": "entity.name.function.crystal" } }, "comment": " the optional name is just to catch the def also without a method-name", "match": "(?x)\n(?=def\\b)\n(?<=^|\\s)(def)\\b\n(\n\\s+\n(\n(?>[a-zA-Z_]\\w*(?>\\.|::))?\n(?>\n[a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n|\n\\^|===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[][?=]?|\\[]=?\n)\n)\n)?", "name": "meta.function.method.without-arguments.crystal" }, { "comment": "Floating point literal (fraction)", "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b", "name": "constant.numeric.float.crystal" }, { "comment": "Floating point literal (exponent)", "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b", "name": "constant.numeric.float.crystal" }, { "comment": "Floating point literal (typed)", "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b", "name": "constant.numeric.float.crystal" }, { "comment": "Integer literal (decimal)", "match": "\\b(?!0[0-9])[0-9][0-9_]*([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.decimal.crystal" }, { "comment": "Integer literal (hexadecimal)", "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.hexadecimal.crystal" }, { "comment": "Integer literal (octal)", "match": "\\b0o[0-7_]+([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.octal.crystal" }, { "comment": "Integer literal (binary)", "match": "\\b0b[01_]+([ui](8|16|32|64|128))?\\b", "name": "constant.numeric.integer.binary.crystal" }, { "begin": ":'", "beginCaptures": { "0": { "name": "punctuation.definition.symbol.begin.crystal" } }, "comment": "symbol literal with '' delimiter", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.symbol.end.crystal" } }, "name": "constant.other.symbol.crystal", "patterns": [{ "match": "\\\\['\\\\]", "name": "constant.character.escape.crystal" }] }, { "begin": ':"', "beginCaptures": { "0": { "name": "punctuation.section.symbol.begin.crystal" } }, "comment": 'symbol literal with "" delimiter', "end": '"', "endCaptures": { "0": { "name": "punctuation.section.symbol.end.crystal" } }, "name": "constant.other.symbol.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "comment": "Needs higher precedence than regular expressions.", "match": "(?<!\\()/=", "name": "keyword.operator.assignment.augmented.crystal" }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "string literal with '' delimiter", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.single.crystal", "patterns": [{ "match": "\\\\'|\\\\\\\\", "name": "constant.character.escape.crystal" }] }, { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": 'string literal with interpolation and "" delimiter', "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.double.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allows for interpolation)", "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "%x\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_curly_i" }] }, { "begin": "%x\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_brackets_i" }] }, { "begin": "%x\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\>", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_ltgt_i" }] }, { "begin": "%x\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_parens_i" }] }, { "begin": "%x\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "execute string (allow for interpolation)", "end": "\\|", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.interpolated.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?x) (?: ^| (?<=[=>~(?:\\[,|&;] | [\\s;]if\\s| [\\s;]elsif\\s | [\\s;]while\\s | [\\s;]unless\\s | [\\s;]when\\s | [\\s;]assert_match\\s | [\\s;]or\\s| [\\s;]and\\s | [\\s;]not\\s | [\\s.]index\\s| [\\s.]scan\\s | [\\s.]sub\\s | [\\s.]sub!\\s | [\\s.]gsub\\s | [\\s.]gsub!\\s | [\\s.]match\\s ) | (?<=^when\\s| ^if\\s | ^elsif\\s | ^while\\s | ^unless\\s ) ) \\s*((/))(?![*+{}?])", "captures": { "1": { "name": "string.regexp.classic.crystal" }, "2": { "name": "punctuation.definition.string.crystal" } }, "comment": "regular expressions (normal) we only start a regexp if the character before it (excluding whitespace) is what we think is before a regexp", "contentName": "string.regexp.classic.crystal", "end": "((/[imsx]*))", "patterns": [{ "include": "#regex_sub" }] }, { "begin": "%r\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\}[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_curly_r" }] }, { "begin": "%r\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\][imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_brackets_r" }] }, { "begin": "%r\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\)[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_parens_r" }] }, { "begin": "%r\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\>[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_ltgt_r" }] }, { "begin": "%r\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "regular expressions (literal)", "end": "\\|[imsx]*", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.regexp.mod-r.crystal", "patterns": [{ "include": "#regex_sub" }] }, { "begin": "%Q?\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation ()", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_parens_i" }] }, { "begin": "%Q?\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation []", "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_brackets_i" }] }, { "begin": "%Q?\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation <>", "end": "\\>", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_ltgt_i" }] }, { "begin": "%Q?\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation -- {}", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.double.crystal.mod", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_curly_i" }] }, { "begin": "%Q\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal capable of interpolation -- ||", "end": "\\|", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.upper.crystal", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "%[qwi]\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- ()", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\)|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_parens" }] }, { "begin": "%[qwi]\\<", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- <>", "end": "\\>", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\>|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_ltgt" }] }, { "begin": "%[qwi]\\[", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- []", "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\]|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_brackets" }] }, { "begin": "%[qwi]\\{", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- {}", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "match": "\\\\\\}|\\\\\\\\", "name": "constant.character.escape.crystal" }, { "include": "#nest_curly" }] }, { "begin": "%[qwi]\\|", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "literal incapable of interpolation -- ||", "end": "\\|", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.quoted.other.literal.lower.crystal", "patterns": [{ "comment": "Cant be named because its not necessarily an escape.", "match": "\\\\." }] }, { "captures": { "1": { "name": "punctuation.definition.constant.crystal" } }, "comment": "symbols", "match": "(?<!:)(:)(?>[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[\\][?=]?|@@?[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*)", "name": "constant.other.symbol.crystal" }, { "captures": { "1": { "name": "punctuation.definition.constant.crystal" } }, "comment": "symbols", "match": "(?>[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(?>[?!])?)(:)(?!:)", "name": "constant.other.symbol.crystal.19syntax" }, { "captures": { "1": { "name": "punctuation.definition.comment.crystal" } }, "match": "(?:^[ \\t]+)?(#).*$\\n?", "name": "comment.line.number-sign.crystal" }, { "match": "\\b_([\\w]+[?!]?)\\b(?!\\()", "name": "comment.unused.crystal" }, { "begin": "(?><<-('?)((?:[_\\w]+_|)HTML)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded HTML and indented terminator", "contentName": "text.html.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.html.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "text.html.basic" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)SQL)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded SQL and indented terminator", "contentName": "text.sql.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.sql.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.sql" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)CSS)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded css and intented terminator", "contentName": "text.css.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.css.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.css" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)CPP)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded c++ and intented terminator", "contentName": "text.c++.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.cplusplus.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.c++" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)C)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded c++ and intented terminator", "contentName": "text.c.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.c.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.c" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded javascript and intented terminator", "contentName": "text.js.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.js.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.js" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)JQUERY)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded javascript and intented terminator", "contentName": "text.js.jquery.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.js.jquery.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.js.jquery" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded shell and intented terminator", "contentName": "text.shell.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.shell.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.shell" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-('?)((?:[_\\w]+_|)CRYSTAL)\\b\\1)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with embedded crystal and intented terminator", "contentName": "text.crystal.embedded.crystal", "end": "\\s*\\2\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.embedded.crystal.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "source.crystal" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-'(\\w+)')", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with indented terminator", "end": "\\s*\\1\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.heredoc.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "#escaped_char" }] }, { "begin": "(?><<-(\\w+)\\b)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.crystal" } }, "comment": "heredoc with indented terminator", "end": "\\s*\\1\\b", "endCaptures": { "0": { "name": "punctuation.definition.string.end.crystal" } }, "name": "string.unquoted.heredoc.crystal", "patterns": [{ "include": "#heredoc" }, { "include": "#interpolated_crystal" }, { "include": "#escaped_char" }] }, { "begin": "(?<={|{\\s|[^A-Za-z0-9_]do|^do|[^A-Za-z0-9_]do\\s|^do\\s)(\\|)", "captures": { "1": { "name": "punctuation.separator.variable.crystal" } }, "end": "(?<!\\|)(\\|)(?!\\|)", "patterns": [{ "include": "source.crystal" }, { "match": "[_a-zA-Z][_a-zA-Z0-9]*", "name": "variable.other.block.crystal" }, { "match": ",", "name": "punctuation.separator.variable.crystal" }] }, { "match": "=>", "name": "punctuation.separator.key-value" }, { "match": "->", "name": "support.function.kernel.crystal" }, { "match": "<<=|%=|&{1,2}=|\\*=|\\*\\*=|\\+=|-=|\\^=|\\|{1,2}=|<<", "name": "keyword.operator.assignment.augmented.crystal" }, { "match": "<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \\t])\\?", "name": "keyword.operator.comparison.crystal" }, { "match": "(?<=^|[ \\t])!|&&|\\|\\||\\^", "name": "keyword.operator.logical.crystal" }, { "match": "(\\{\\%|\\%\\}|\\{\\{|\\}\\})", "name": "keyword.operator.macro.crystal" }, { "captures": { "1": { "name": "punctuation.separator.method.crystal" } }, "comment": "Safe navigation operator", "match": "(&\\.)\\s*(?![A-Z])" }, { "match": "(%|&|\\*\\*|\\*|\\+|\\-|/)", "name": "keyword.operator.arithmetic.crystal" }, { "match": "=", "name": "keyword.operator.assignment.crystal" }, { "match": "\\||~|>>", "name": "keyword.operator.other.crystal" }, { "match": ":", "name": "punctuation.separator.other.crystal" }, { "match": "\\;", "name": "punctuation.separator.statement.crystal" }, { "match": ",", "name": "punctuation.separator.object.crystal" }, { "match": "\\.|::", "name": "punctuation.separator.method.crystal" }, { "match": "\\{|\\}", "name": "punctuation.section.scope.crystal" }, { "match": "\\[|\\]", "name": "punctuation.section.array.crystal" }, { "match": "\\(|\\)", "name": "punctuation.section.function.crystal" }, { "begin": "(?=[a-zA-Z0-9_!?]+\\()", "end": "(?<=\\))", "name": "meta.function-call.crystal", "patterns": [{ "match": "([a-zA-Z0-9_!?]+)(?=\\()", "name": "entity.name.function.crystal" }, { "include": "$self" }] }, { "comment": "This is kindof experimental. There really is no way to perfectly match all regular variables, but you can pretty well assume that any normal word in certain curcumstances that havnt already been scoped as something else are probably variables, and the advantages beat the potential errors", "match": "((?<=\\W)\\b|^)\\w+\\b(?=\\s*([\\]\\)\\}\\=\\+\\-\\*\\/\\^\\$\\,\\.]|<\\s|<<[\\s|\\.]))", "name": "variable.other.crystal" }], "repository": { "escaped_char": { "comment": "https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html", "match": "\\\\(?:[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\\{[a-fA-F0-9 ]+\\}|.)", "name": "constant.character.escape.crystal" }, "heredoc": { "begin": "^<<-?\\w+", "end": "$", "patterns": [{ "include": "$self" }] }, "interpolated_crystal": { "patterns": [{ "begin": "#\\{", "beginCaptures": { "0": { "name": "punctuation.section.embedded.begin.crystal" } }, "contentName": "source.crystal", "end": "(\\})", "endCaptures": { "0": { "name": "punctuation.section.embedded.end.crystal" }, "1": { "name": "source.crystal" } }, "name": "meta.embedded.line.crystal", "patterns": [{ "include": "#nest_curly_and_self" }, { "include": "$self" }], "repository": { "nest_curly_and_self": { "patterns": [{ "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#nest_curly_and_self" }] }, { "include": "$self" }] } } }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(#@)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.instance.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(#@@)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.class.crystal" }, { "captures": { "1": { "name": "punctuation.definition.variable.crystal" } }, "match": "(#\\$)[a-zA-Z_]\\w*", "name": "variable.other.readwrite.global.crystal" }] }, "nest_brackets": { "begin": "\\[", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\]", "patterns": [{ "include": "#nest_brackets" }] }, "nest_brackets_i": { "begin": "\\[", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\]", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_brackets_i" }] }, "nest_brackets_r": { "begin": "\\[", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\]", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_brackets_r" }] }, "nest_curly": { "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#nest_curly" }] }, "nest_curly_and_self": { "patterns": [{ "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#nest_curly_and_self" }] }, { "include": "$self" }] }, "nest_curly_i": { "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_curly_i" }] }, "nest_curly_r": { "begin": "\\{", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\}", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_curly_r" }] }, "nest_ltgt": { "begin": "\\<", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\>", "patterns": [{ "include": "#nest_ltgt" }] }, "nest_ltgt_i": { "begin": "\\<", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\>", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_ltgt_i" }] }, "nest_ltgt_r": { "begin": "\\<", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\>", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_ltgt_r" }] }, "nest_parens": { "begin": "\\(", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\)", "patterns": [{ "include": "#nest_parens" }] }, "nest_parens_i": { "begin": "\\(", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\)", "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "include": "#nest_parens_i" }] }, "nest_parens_r": { "begin": "\\(", "captures": { "0": { "name": "punctuation.section.scope.crystal" } }, "end": "\\)", "patterns": [{ "include": "#regex_sub" }, { "include": "#nest_parens_r" }] }, "regex_sub": { "patterns": [{ "include": "#interpolated_crystal" }, { "include": "#escaped_char" }, { "captures": { "1": { "name": "punctuation.definition.arbitrary-repetition.crystal" }, "3": { "name": "punctuation.definition.arbitrary-repetition.crystal" } }, "match": "({)\\d+(,\\d+)?(})", "name": "string.regexp.arbitrary-repetition.crystal" }, { "begin": "\\[(?:\\^?])?", "captures": { "0": { "name": "punctuation.definition.character-class.crystal" } }, "end": "]", "name": "string.regexp.character-class.crystal", "patterns": [{ "include": "#escaped_char" }] }, { "begin": "\\(", "captures": { "0": { "name": "punctuation.definition.group.crystal" } }, "end": "\\)", "name": "string.regexp.group.crystal", "patterns": [{ "include": "#regex_sub" }] }, { "captures": { "1": { "name": "punctuation.definition.comment.crystal" } }, "comment": "We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.", "match": "(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$", "name": "comment.line.number-sign.crystal" }] } }, "scopeName": "source.crystal", "embeddedLangs": ["html", "sql", "css", "c", "javascript", "shellscript"] });
9
9
  var crystal = [
10
10
  ...html,
11
11
  ...sql,
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "GDScript", "fileTypes": ["gd"], "name": "gdscript", "patterns": [{ "include": "#statement" }, { "include": "#expression" }], "repository": { "annotated_parameter": { "begin": "(?x)\n\\s* ([a-zA-Z_]\\w*) \\s* (:)\\s* ([a-zA-Z_]\\w*)?\n", "beginCaptures": { "1": { "name": "variable.parameter.function.language.gdscript" }, "2": { "name": "punctuation.separator.annotation.gdscript" }, "3": { "name": "entity.name.type.class.builtin.gdscript" } }, "end": "(,)|(?=\\))", "endCaptures": { "1": { "name": "punctuation.separator.parameters.gdscript" } }, "patterns": [{ "include": "#base_expression" }, { "match": "=(?!=)", "name": "keyword.operator.assignment.gdscript" }] }, "annotations": { "captures": { "1": { "name": "entity.name.function.decorator.gdscript" }, "2": { "name": "entity.name.function.decorator.gdscript" } }, "match": "(@)(export|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_global_dir|export_global_file|export_multiline|export_node_path|export_placeholder|export_range|icon|onready|rpc|tool|warning_ignore|abstract)\\b" }, "any_method": { "match": "\\b([A-Za-z_]\\w*)\\b(?=\\s*(?:[(]))", "name": "support.function.any-method.gdscript" }, "any_property": { "captures": { "1": { "name": "punctuation.accessor.gdscript" }, "2": { "name": "constant.language.gdscript" }, "3": { "name": "variable.other.property.gdscript" } }, "match": "\\b(\\.)\\s*(?<![@\\$#%])(?:([A-Z_][A-Z_0-9]*)|([A-Za-z_]\\w*))\\b(?![(])" }, "any_variable": { "match": "\\b(?<![@\\$#%])([A-Za-z_]\\w*)\\b(?![(])", "name": "variable.other.gdscript" }, "arithmetic_operator": { "match": "->|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~|!", "name": "keyword.operator.arithmetic.gdscript" }, "assignment_operator": { "match": "=", "name": "keyword.operator.assignment.gdscript" }, "base_expression": { "patterns": [{ "include": "#builtin_get_node_shorthand" }, { "include": "#nodepath_object" }, { "include": "#nodepath_function" }, { "include": "#strings" }, { "include": "#const_vars" }, { "include": "#keywords" }, { "include": "#logic_operator" }, { "include": "#compare_operator" }, { "include": "#arithmetic_operator" }, { "include": "#lambda_declaration" }, { "include": "#class_declaration" }, { "include": "#variable_declaration" }, { "include": "#signal_declaration_bare" }, { "include": "#signal_declaration" }, { "include": "#function_declaration" }, { "include": "#statement_keyword" }, { "include": "#assignment_operator" }, { "include": "#in_keyword" }, { "include": "#control_flow" }, { "include": "#round_braces" }, { "include": "#function_call" }, { "include": "#comment" }, { "include": "#self" }, { "include": "#letter" }, { "include": "#numbers" }, { "include": "#builtin_classes" }, { "include": "#pascal_case_class" }, { "include": "#line_continuation" }] }, "builtin_classes": { "match": "(?<![^.]\\.|:)\\b(OS|GDScript|Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b", "name": "entity.name.type.class.builtin.gdscript" }, "builtin_get_node_shorthand": { "patterns": [{ "include": "#builtin_get_node_shorthand_quoted" }, { "include": "#builtin_get_node_shorthand_bare" }, { "include": "#builtin_get_node_shorthand_bare_multi" }] }, "builtin_get_node_shorthand_bare": { "captures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "constant.character.escape.gdscript" }, "3": { "name": "constant.character.escape.gdscript" } }, "match": "(?<!/\\s*)(\\$|%|\\$%)([a-zA-Z_]\\w*)\\b(?!\\s*/)", "name": "meta.literal.nodepath.gdscript" }, "builtin_get_node_shorthand_bare_multi": { "begin": "(\\$|%|\\$%)([a-zA-Z_]\\w*)", "beginCaptures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "constant.character.escape.gdscript" } }, "end": "(?!\\s*/\\s*%?\\s*[a-zA-Z_]\\w*)", "name": "meta.literal.nodepath.gdscript", "patterns": [{ "captures": { "1": { "name": "constant.character.escape.gdscript" }, "2": { "name": "keyword.control.flow.gdscript" }, "3": { "name": "constant.character.escape.gdscript" } }, "match": "(/)\\s*(%)?\\s*([a-zA-Z_]\\w*)\\s*" }] }, "builtin_get_node_shorthand_quoted": { "begin": `(?:(\\$)|(&|\\^|@))("|')`, "beginCaptures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "variable.other.enummember.gdscript" } }, "end": "(\\3)", "name": "string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape.gdscript", "patterns": [{ "match": "%", "name": "keyword.control.flow" }] }, "class_declaration": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "class.other.gdscript" } }, "match": "(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)" }, "class_enum": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "constant.language.gdscript" } }, "match": "\\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)" }, "class_is": { "captures": { "1": { "name": "storage.type.is.gdscript" }, "2": { "name": "entity.name.type.class.gdscript" } }, "match": "\\s+(is)\\s+([a-zA-Z_]\\w*)" }, "class_name": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "class.other.gdscript" } }, "match": "(?<=class_name)\\s+([a-zA-Z_]\\w*(\\.([a-zA-Z_]\\w*))?)" }, "class_new": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "storage.type.new.gdscript" }, "3": { "name": "punctuation.parenthesis.begin.gdscript" } }, "match": "\\b([a-zA-Z_]\\w*).(new)\\(" }, "comment": { "captures": { "1": { "name": "punctuation.definition.comment.number-sign.gdscript" } }, "match": "(#).*$\\n?", "name": "comment.line.number-sign.gdscript" }, "compare_operator": { "match": "<=|>=|==|<|>|!=", "name": "keyword.operator.comparison.gdscript" }, "const_vars": { "match": "\\b([A-Z_][A-Z_0-9]*)\\b", "name": "constant.language.gdscript" }, "control_flow": { "match": "\\b(?:if|elif|else|while|break|continue|pass|return|match|yield|await)\\b", "name": "keyword.control.gdscript" }, "expression": { "patterns": [{ "include": "#base_expression" }, { "include": "#getter_setter_godot4" }, { "include": "#assignment_operator" }, { "include": "#annotations" }, { "include": "#class_name" }, { "include": "#builtin_classes" }, { "include": "#class_new" }, { "include": "#class_is" }, { "include": "#class_enum" }, { "include": "#any_method" }, { "include": "#any_variable" }, { "include": "#any_property" }] }, "extends_statement": { "captures": { "1": { "name": "keyword.language.gdscript" }, "2": { "name": "entity.other.inherited-class.gdscript" } }, "match": "(extends)\\s+([a-zA-Z_]\\w*\\.[a-zA-Z_]\\w*)?" }, "function_arguments": { "begin": "(\\()", "beginCaptures": { "1": { "name": "punctuation.definition.arguments.begin.gdscript" } }, "contentName": "meta.function.parameters.gdscript", "end": "(?=\\))(?!\\)\\s*\\()", "patterns": [{ "match": "(,)", "name": "punctuation.separator.arguments.gdscript" }, { "captures": { "1": { "name": "variable.parameter.function-call.gdscript" }, "2": { "name": "keyword.operator.assignment.gdscript" } }, "match": "\\b([a-zA-Z_]\\w*)\\s*(=)(?!=)" }, { "match": "=(?!=)", "name": "keyword.operator.assignment.gdscript" }, { "include": "#base_expression" }, { "captures": { "1": { "name": "punctuation.definition.arguments.end.gdscript" }, "2": { "name": "punctuation.definition.arguments.begin.gdscript" } }, "match": "\\s*(\\))\\s*(\\()" }, { "include": "#letter" }, { "include": "#any_variable" }, { "include": "#any_property" }, { "include": "#keywords" }] }, "function_call": { "begin": "(?x)\n\\b(?=\n([a-zA-Z_]\\w*) \\s* (\\()\n)\n", "beginCaptures": { "2": { "name": "punctuation.definition.arguments.begin.gdscript" } }, "comment": 'Regular function call of the type "name(args)"', "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.arguments.end.gdscript" } }, "name": "meta.function-call.gdscript", "patterns": [{ "include": "#function_name" }, { "include": "#function_arguments" }] }, "function_declaration": { "begin": "(?x) \\s*\n(func) \\s+\n([a-zA-Z_]\\w*) \\s*\n(?=\\()", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.function.gdscript" }, "2": { "name": "entity.name.function.gdscript" } }, "end": `(:|(?=[#'"\\n]))`, "end2": "(\\s*(\\-\\>)\\s*(void\\w*)|([a-zA-Z_]\\w*)\\s*\\:)", "endCaptures2": { "1": { "name": "punctuation.separator.annotation.result.gdscript" }, "2": { "name": "keyword.language.void.gdscript" }, "3": { "name": "entity.name.type.class.gdscript markup.italic" } }, "name": "meta.function.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }, { "include": "#base_expression" }] }, "function_name": { "patterns": [{ "include": "#builtin_classes" }, { "comment": "Some color schemas support meta.function-call.generic scope", "match": "(?x)\n\\b ([a-zA-Z_]\\w*) \\b\n", "name": "support.function.any-method.gdscript" }] }, "getter_setter_godot4": { "patterns": [{ "captures": { "1": { "name": "entity.name.function.gdscript" } }, "match": "\\b(get):" }, { "begin": "(?x) \\s+\n(set) \\s*\n(?=\\()", "beginCaptures": { "1": { "name": "entity.name.function.gdscript" } }, "end": `(:|(?=[#'"\\n]))`, "name": "meta.function.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }] }] }, "in_keyword": { "patterns": [{ "begin": "\\b(for)\\b", "captures": { "1": { "name": "keyword.control.gdscript" } }, "end": ":", "patterns": [{ "match": "\\bin\\b", "name": "keyword.control.gdscript" }, { "include": "#base_expression" }, { "include": "#any_variable" }, { "include": "#any_property" }] }, { "match": "\\bin\\b", "name": "keyword.operator.wordlike.gdscript" }] }, "keywords": { "match": "\\b(?:class|class_name|is|onready|tool|static|export|as|void|enum|preload|assert|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace)\\b", "name": "keyword.language.gdscript" }, "lambda_declaration": { "begin": "(func)\\s?(?=\\()", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.function.gdscript" }, "2": { "name": "entity.name.function.gdscript" } }, "end": `(:|(?=[#'"\\n]))`, "end2": "(\\s*(\\-\\>)\\s*(void\\w*)|([a-zA-Z_]\\w*)\\s*\\:)", "endCaptures2": { "1": { "name": "punctuation.separator.annotation.result.gdscript" }, "2": { "name": "keyword.language.void.gdscript" }, "3": { "name": "entity.name.type.class.gdscript markup.italic" } }, "name": "meta.function.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }, { "include": "#base_expression" }, { "include": "#any_variable" }, { "include": "#any_property" }] }, "letter": { "match": "\\b(?:true|false|null)\\b", "name": "constant.language.gdscript" }, "line_continuation": { "patterns": [{ "captures": { "1": { "name": "punctuation.separator.continuation.line.gdscript" }, "2": { "name": "invalid.illegal.line.continuation.gdscript" } }, "match": "(\\\\)\\s*(\\S.*$\\n?)" }, { "begin": "(\\\\)\\s*$\\n?", "beginCaptures": { "1": { "name": "punctuation.separator.continuation.line.gdscript" } }, "end": `(?x)
1
+ const lang = Object.freeze({ "displayName": "GDScript", "fileTypes": ["gd"], "name": "gdscript", "patterns": [{ "include": "#statement" }, { "include": "#expression" }], "repository": { "annotated_parameter": { "begin": "(?x)\n\\s* ([a-zA-Z_]\\w*) \\s* (:)\\s* ([a-zA-Z_]\\w*)?\n", "beginCaptures": { "1": { "name": "variable.parameter.function.language.gdscript" }, "2": { "name": "punctuation.separator.annotation.gdscript" }, "3": { "name": "entity.name.type.class.builtin.gdscript" } }, "end": "(,)|(?=\\))", "endCaptures": { "1": { "name": "punctuation.separator.parameters.gdscript" } }, "patterns": [{ "include": "#base_expression" }, { "match": "=(?!=)", "name": "keyword.operator.assignment.gdscript" }] }, "annotations": { "captures": { "1": { "name": "entity.name.function.decorator.gdscript" }, "2": { "name": "entity.name.function.decorator.gdscript" } }, "match": "(@)(export|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_global_dir|export_global_file|export_multiline|export_node_path|export_placeholder|export_range|icon|onready|rpc|tool|warning_ignore|abstract)\\b" }, "any_method": { "match": "\\b([A-Za-z_]\\w*)\\b(?=\\s*(?:[(]))", "name": "support.function.any-method.gdscript" }, "any_property": { "captures": { "1": { "name": "punctuation.accessor.gdscript" }, "2": { "name": "constant.language.gdscript" }, "3": { "name": "variable.other.property.gdscript" } }, "match": "\\b(\\.)\\s*(?<![@\\$#%])(?:([A-Z_][A-Z_0-9]*)|([A-Za-z_]\\w*))\\b(?![(])" }, "any_variable": { "match": "\\b(?<![@\\$#%])([A-Za-z_]\\w*)\\b(?![(])", "name": "variable.other.gdscript" }, "arithmetic_operator": { "match": "->|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~|!", "name": "keyword.operator.arithmetic.gdscript" }, "assignment_operator": { "match": "=", "name": "keyword.operator.assignment.gdscript" }, "base_expression": { "patterns": [{ "include": "#builtin_get_node_shorthand" }, { "include": "#nodepath_object" }, { "include": "#nodepath_function" }, { "include": "#strings" }, { "include": "#const_vars" }, { "include": "#keywords" }, { "include": "#logic_operator" }, { "include": "#compare_operator" }, { "include": "#arithmetic_operator" }, { "include": "#lambda_declaration" }, { "include": "#class_declaration" }, { "include": "#variable_declaration" }, { "include": "#signal_declaration_bare" }, { "include": "#signal_declaration" }, { "include": "#function_declaration" }, { "include": "#statement_keyword" }, { "include": "#assignment_operator" }, { "include": "#in_keyword" }, { "include": "#control_flow" }, { "include": "#round_braces" }, { "include": "#function_call" }, { "include": "#comment" }, { "include": "#self" }, { "include": "#func" }, { "include": "#letter" }, { "include": "#numbers" }, { "include": "#builtin_classes" }, { "include": "#pascal_case_class" }, { "include": "#line_continuation" }] }, "builtin_classes": { "match": "(?<![^.]\\.|:)\\b(OS|GDScript|Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b", "name": "entity.name.type.class.builtin.gdscript" }, "builtin_get_node_shorthand": { "patterns": [{ "include": "#builtin_get_node_shorthand_quoted" }, { "include": "#builtin_get_node_shorthand_bare" }, { "include": "#builtin_get_node_shorthand_bare_multi" }] }, "builtin_get_node_shorthand_bare": { "captures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "constant.character.escape.gdscript" }, "3": { "name": "constant.character.escape.gdscript" } }, "match": "(?<!/\\s*)(\\$|%|\\$%)([a-zA-Z_]\\w*)\\b(?!\\s*/)", "name": "meta.literal.nodepath.gdscript" }, "builtin_get_node_shorthand_bare_multi": { "begin": "(\\$|%|\\$%)([a-zA-Z_]\\w*)", "beginCaptures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "constant.character.escape.gdscript" } }, "end": "(?!\\s*/\\s*%?\\s*[a-zA-Z_]\\w*)", "name": "meta.literal.nodepath.gdscript", "patterns": [{ "captures": { "1": { "name": "constant.character.escape.gdscript" }, "2": { "name": "keyword.control.flow.gdscript" }, "3": { "name": "constant.character.escape.gdscript" } }, "match": "(/)\\s*(%)?\\s*([a-zA-Z_]\\w*)\\s*" }] }, "builtin_get_node_shorthand_quoted": { "begin": `(?:(\\$)|(&|\\^|@))("|')`, "beginCaptures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "variable.other.enummember.gdscript" } }, "end": "(\\3)", "name": "string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape.gdscript", "patterns": [{ "match": "%", "name": "keyword.control.flow" }] }, "class_declaration": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "class.other.gdscript" } }, "match": "(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)" }, "class_enum": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "constant.language.gdscript" } }, "match": "\\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)" }, "class_is": { "captures": { "1": { "name": "storage.type.is.gdscript" }, "2": { "name": "entity.name.type.class.gdscript" } }, "match": "\\s+(is)\\s+([a-zA-Z_]\\w*)" }, "class_name": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "class.other.gdscript" } }, "match": "(?<=class_name)\\s+([a-zA-Z_]\\w*(\\.([a-zA-Z_]\\w*))?)" }, "class_new": { "captures": { "1": { "name": "entity.name.type.class.gdscript" }, "2": { "name": "storage.type.new.gdscript" }, "3": { "name": "punctuation.parenthesis.begin.gdscript" } }, "match": "\\b([a-zA-Z_]\\w*).(new)\\(" }, "comment": { "captures": { "1": { "name": "punctuation.definition.comment.number-sign.gdscript" } }, "match": "(#).*$\\n?", "name": "comment.line.number-sign.gdscript" }, "compare_operator": { "match": "<=|>=|==|<|>|!=", "name": "keyword.operator.comparison.gdscript" }, "const_vars": { "match": "\\b([A-Z_][A-Z_0-9]*)\\b", "name": "constant.language.gdscript" }, "control_flow": { "match": "\\b(?:if|elif|else|while|break|continue|pass|return|match|yield|await)\\b", "name": "keyword.control.gdscript" }, "expression": { "patterns": [{ "include": "#base_expression" }, { "include": "#getter_setter_godot4" }, { "include": "#assignment_operator" }, { "include": "#annotations" }, { "include": "#class_name" }, { "include": "#builtin_classes" }, { "include": "#class_new" }, { "include": "#class_is" }, { "include": "#class_enum" }, { "include": "#any_method" }, { "include": "#any_variable" }, { "include": "#any_property" }] }, "extends_statement": { "captures": { "1": { "name": "keyword.language.gdscript" }, "2": { "name": "entity.other.inherited-class.gdscript" } }, "match": "(extends)\\s+([a-zA-Z_]\\w*\\.[a-zA-Z_]\\w*)?" }, "func": { "match": "\\bfunc\\b", "name": "keyword.language.gdscript" }, "function_arguments": { "begin": "(\\()", "beginCaptures": { "1": { "name": "punctuation.definition.arguments.begin.gdscript" } }, "contentName": "meta.function.parameters.gdscript", "end": "(?=\\))(?!\\)\\s*\\()", "patterns": [{ "match": "(,)", "name": "punctuation.separator.arguments.gdscript" }, { "captures": { "1": { "name": "variable.parameter.function-call.gdscript" }, "2": { "name": "keyword.operator.assignment.gdscript" } }, "match": "\\b([a-zA-Z_]\\w*)\\s*(=)(?!=)" }, { "match": "=(?!=)", "name": "keyword.operator.assignment.gdscript" }, { "include": "#base_expression" }, { "captures": { "1": { "name": "punctuation.definition.arguments.end.gdscript" }, "2": { "name": "punctuation.definition.arguments.begin.gdscript" } }, "match": "\\s*(\\))\\s*(\\()" }, { "include": "#letter" }, { "include": "#any_variable" }, { "include": "#any_property" }, { "include": "#keywords" }] }, "function_call": { "begin": "(?x)\n\\b(?=\n([a-zA-Z_]\\w*) \\s* (\\()\n)\n", "beginCaptures": { "2": { "name": "punctuation.definition.arguments.begin.gdscript" } }, "comment": 'Regular function call of the type "name(args)"', "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.arguments.end.gdscript" } }, "name": "meta.function-call.gdscript", "patterns": [{ "include": "#function_name" }, { "include": "#function_arguments" }] }, "function_declaration": { "begin": "(?x) \\s*\n(func) \\s+\n([a-zA-Z_]\\w*) \\s*\n(?=\\()", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.function.gdscript" }, "2": { "name": "entity.name.function.gdscript" } }, "end": `(:|(?=[#'"\\n]))`, "end2": "(\\s*(\\-\\>)\\s*(void\\w*)|([a-zA-Z_]\\w*)\\s*\\:)", "endCaptures2": { "1": { "name": "punctuation.separator.annotation.result.gdscript" }, "2": { "name": "keyword.language.void.gdscript" }, "3": { "name": "entity.name.type.class.gdscript markup.italic" } }, "name": "meta.function.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }, { "include": "#base_expression" }] }, "function_name": { "patterns": [{ "include": "#builtin_classes" }, { "comment": "Some color schemas support meta.function-call.generic scope", "match": "(?x)\n\\b ([a-zA-Z_]\\w*) \\b\n", "name": "support.function.any-method.gdscript" }] }, "getter_setter_godot4": { "patterns": [{ "captures": { "1": { "name": "entity.name.function.gdscript" } }, "match": "\\b(get):" }, { "begin": "(?x) \\s+\n(set) \\s*\n(?=\\()", "beginCaptures": { "1": { "name": "entity.name.function.gdscript" } }, "end": `(:|(?=[#'"\\n]))`, "name": "meta.function.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }] }] }, "in_keyword": { "patterns": [{ "begin": "\\b(for)\\b", "captures": { "1": { "name": "keyword.control.gdscript" } }, "end": ":", "patterns": [{ "match": "\\bin\\b", "name": "keyword.control.gdscript" }, { "include": "#base_expression" }, { "include": "#any_variable" }, { "include": "#any_property" }] }, { "match": "\\bin\\b", "name": "keyword.operator.wordlike.gdscript" }] }, "keywords": { "match": "\\b(?:class|class_name|is|onready|tool|static|export|as|void|enum|preload|assert|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace)\\b", "name": "keyword.language.gdscript" }, "lambda_declaration": { "begin": "(func)\\s?(?=\\()", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.function.gdscript" }, "2": { "name": "entity.name.function.gdscript" } }, "end": `(:|(?=[#'"\\n]))`, "end2": "(\\s*(\\-\\>)\\s*(void\\w*)|([a-zA-Z_]\\w*)\\s*\\:)", "endCaptures2": { "1": { "name": "punctuation.separator.annotation.result.gdscript" }, "2": { "name": "keyword.language.void.gdscript" }, "3": { "name": "entity.name.type.class.gdscript markup.italic" } }, "name": "meta.function.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }, { "include": "#base_expression" }, { "include": "#any_variable" }, { "include": "#any_property" }] }, "letter": { "match": "\\b(?:true|false|null)\\b", "name": "constant.language.gdscript" }, "line_continuation": { "patterns": [{ "captures": { "1": { "name": "punctuation.separator.continuation.line.gdscript" }, "2": { "name": "invalid.illegal.line.continuation.gdscript" } }, "match": "(\\\\)\\s*(\\S.*$\\n?)" }, { "begin": "(\\\\)\\s*$\\n?", "beginCaptures": { "1": { "name": "punctuation.separator.continuation.line.gdscript" } }, "end": `(?x)
2
2
  (?=^\\s*$)
3
3
  |
4
4
  (?! (\\s* [rR]? (\\'\\'\\'|\\"\\"\\"|\\'|\\"))
@@ -9,7 +9,7 @@ const lang = Object.freeze({ "displayName": "GDScript", "fileTypes": ["gd"], "na
9
9
  ^\\s*(
10
10
  case | match
11
11
  )(?=\\s*([-+\\w\\d(\\[{'":#]|$))\\b
12
- ` }] }, "string_formatting": { "captures": { "1": { "name": "constant.character.format.placeholder.other.gdscript" } }, "match": "(?x)\n(\n% (\\([\\w\\s]*\\))?\n[-+#0 ]*\n(\\d+|\\*)? (\\.(\\d+|\\*))?\n([hlL])?\n[diouxXeEfFgGcrsab%]\n)\n", "name": "meta.format.percent.gdscript" }, "strings": { "begin": `(r)?("""|'''|"|')`, "beginCaptures": { "1": { "name": "constant.character.escape.gdscript" } }, "end": "\\2", "name": "string.quoted.gdscript", "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.gdscript" }, { "include": "#string_formatting" }] }, "variable_declaration": { "begin": "\\b(?:(var)|(const))\\s+(?:(\\b[A-Z_][A-Z_0-9]*\\b)|([A-Za-z_]\\w*))\\s*", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.var.gdscript" }, "2": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "3": { "name": "constant.language.gdscript" }, "4": { "name": "variable.other.gdscript" } }, "end": "$|;", "name": "meta.variable.gdscript", "patterns": [{ "match": ":=|=(?!=)", "name": "keyword.operator.assignment.gdscript" }, { "captures": { "1": { "name": "punctuation.separator.annotation.gdscript" }, "2": { "name": "entity.name.type.class.gdscript" } }, "match": "(:)\\s*([a-zA-Z_]\\w*)?" }, { "captures": { "1": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "2": { "name": "entity.name.function.gdscript" }, "3": { "name": "entity.name.function.gdscript" } }, "match": "(setget)\\s+([a-zA-Z_]\\w*)(?:[,]\\s*([a-zA-Z_]\\w*))?" }, { "include": "#expression" }, { "include": "#letter" }, { "include": "#any_variable" }, { "include": "#any_property" }, { "include": "#keywords" }] } }, "scopeName": "source.gdscript" });
12
+ ` }] }, "string_formatting": { "captures": { "1": { "name": "constant.character.format.placeholder.other.gdscript" } }, "match": "(?x)\n(\n% (\\([\\w\\s]*\\))?\n[-+#0 ]*\n(\\d+|\\*)? (\\.(\\d+|\\*))?\n([hlL])?\n[diouxXeEfFgGcrsab%]\n)\n", "name": "meta.format.percent.gdscript" }, "strings": { "begin": `(r)?("""|'''|"|')`, "beginCaptures": { "1": { "name": "constant.character.escape.gdscript" } }, "end": "\\2", "name": "string.quoted.gdscript", "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.gdscript" }, { "include": "#string_formatting" }] }, "variable_declaration": { "begin": "\\b(?:(var)|(const))\\s+(?:(\\b[A-Z_][A-Z_0-9]*\\b)|([A-Za-z_]\\w*))\\s*", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.var.gdscript" }, "2": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "3": { "name": "constant.language.gdscript" }, "4": { "name": "variable.other.gdscript" } }, "end": "$|;", "name": "meta.variable.gdscript", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.annotation.gdscript" }, "2": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "3": { "name": "entity.name.function.gdscript" } }, "match": "(:)?\\s*(set|get)\\s+=\\s+([a-zA-Z_]\\w*)" }, { "match": ":=|=(?!=)", "name": "keyword.operator.assignment.gdscript" }, { "captures": { "1": { "name": "punctuation.separator.annotation.gdscript" }, "2": { "name": "entity.name.type.class.gdscript" } }, "match": "(:)\\s*([a-zA-Z_]\\w*)?" }, { "captures": { "1": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "2": { "name": "entity.name.function.gdscript" }, "3": { "name": "entity.name.function.gdscript" } }, "match": "(setget)\\s+([a-zA-Z_]\\w*)(?:[,]\\s*([a-zA-Z_]\\w*))?" }, { "include": "#expression" }, { "include": "#letter" }, { "include": "#any_variable" }, { "include": "#any_property" }, { "include": "#keywords" }] } }, "scopeName": "source.gdscript" });
13
13
  var gdscript = [
14
14
  lang
15
15
  ];
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "nushell", "name": "nushell", "patterns": [{ "include": "#define-variable" }, { "include": "#define-alias" }, { "include": "#function" }, { "include": "#extern" }, { "include": "#module" }, { "include": "#use-module" }, { "include": "#expression" }, { "include": "#comment" }], "repository": { "binary": { "begin": "\\b(0x)(\\[)", "beginCaptures": { "1": { "name": "constant.numeric.nushell" }, "2": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.begin.nushell" } }, "name": "constant.binary.nushell", "patterns": [{ "match": "[0-9a-fA-F]{2}", "name": "constant.numeric.nushell" }] }, "braced-expression": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.block.begin.bracket.curly.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.nushell" } }, "name": "meta.expression.braced.nushell", "patterns": [{ "begin": "(?<=\\{)\\s*\\|", "end": "\\|", "name": "meta.closure.parameters.nushell", "patterns": [{ "include": "#function-parameter" }] }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "keyword.control.nushell" } }, "match": "(\\w+)\\s*(:)\\s*" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "variable.other.nushell", "patterns": [{ "include": "#paren-expression" }] }, "3": { "name": "keyword.control.nushell" } }, "match": '(\\$"((?:[^"\\\\]|\\\\.)*)")\\s*(:)\\s*', "name": "meta.record-entry.nushell" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "keyword.control.nushell" } }, "match": '("(?:[^"\\\\]|\\\\.)*")\\s*(:)\\s*', "name": "meta.record-entry.nushell" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "variable.other.nushell", "patterns": [{ "include": "#paren-expression" }] }, "3": { "name": "keyword.control.nushell" } }, "match": "(\\$'([^']*)')\\s*(:)\\s*", "name": "meta.record-entry.nushell" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "keyword.control.nushell" } }, "match": "('[^']*')\\s*(:)\\s*", "name": "meta.record-entry.nushell" }, { "include": "source.nushell" }] }, "command": { "begin": `(?<!\\w)(?:(\\^)|(?![0-9]|\\$))([\\w.!]+(?:(?: (?!-)[\\w\\-.!]+(?:(?= |\\))|$)|[\\w\\-.!]+))*|(?<=\\^)\\$?(?:"[^"]+"|'[^']+'))`, "beginCaptures": { "1": { "name": "keyword.operator.nushell" }, "2": { "patterns": [{ "include": "#control-keywords" }, { "captures": { "0": { "name": "keyword.other.builtin.nushell" } }, "match": "(?:ansi|char) \\w+" }, { "captures": { "1": { "name": "keyword.other.builtin.nushell" }, "2": { "patterns": [{ "include": "#value" }] } }, "comment": "Regex generated with list-to-tree (https://github.com/glcraft/list-to-tree)", "match": "(a(?:ll|n(?:si(?: (?:gradient|link|strip))?|y)|ppend|st)|b(?:its(?: (?:and|not|or|ro(?:l|r)|sh(?:l|r)|xor))?|reak|ytes(?: (?:a(?:dd|t)|build|collect|ends-with|index-of|length|re(?:move|place|verse)|starts-with))?)|c(?:al|d|har|lear|o(?:l(?:lect|umns)|m(?:mandline|p(?:act|lete))|n(?:fig(?: (?:env|nu|reset))?|tinue))|p)|d(?:ate(?: (?:format|humanize|list-timezone|now|to-(?:record|t(?:able|imezone))))?|e(?:bug|code(?: (?:base64|hex))?|fault|scribe|tect columns)|fr (?:a(?:gg(?:-groups)?|ll-(?:false|true)|ppend|rg-(?:m(?:ax|in)|sort|true|unique|where)|s(?:-date(?:time)?)?)|c(?:ache|o(?:l(?:lect|umns)?|n(?:cat(?:-str|enate)|tains)|unt(?:-null)?)|umulative)|d(?:atepart|rop(?:-(?:duplicates|nulls))?|types|ummies)|exp(?:lode|r-not)|f(?:etch|i(?:l(?:l-n(?:an|ull)|ter(?:-with)?)|rst)|latten)|g(?:et(?:-(?:day|hour|m(?:inute|onth)|nanosecond|ordinal|second|week(?:day)?|year))?|roup-by)|i(?:mplode|nto-(?:df|lazy|nu)|s-(?:duplicated|in|n(?:ot-null|ull)|unique))|join|l(?:ast|it|owercase|s)|m(?:ax|e(?:an|dian|lt)|in)|n(?:-unique|ot)|o(?:pen|therwise)|qu(?:antile|ery)|r(?:e(?:name|place(?:-all)?|verse)|olling)|s(?:ample|e(?:lect|t(?:-with-idx)?)|h(?:ape|ift)|lice|ort-by|t(?:d|r(?:-(?:lengths|slice)|ftime))|um(?:mary)?)|t(?:ake|o-(?:a(?:rrow|vro)|csv|jsonl|parquet))|u(?:nique|ppercase)|va(?:lue-counts|r)|w(?:hen|ith-column))|o|rop(?: (?:column|nth))?|u)|e(?:ach(?: while)?|cho|n(?:code(?: (?:base64|hex))?|umerate)|rror make|very|x(?:ec|it|p(?:l(?:ain|ore)|ort-env)))|f(?:i(?:l(?:l|ter)|nd|rst)|latten|mt|ormat(?: (?:d(?:ate|uration)|filesize))?|rom(?: (?:csv|json|nuon|ods|ssv|t(?:oml|sv)|url|x(?:lsx|ml)|y(?:aml|ml)))?)|g(?:et|lob|r(?:id|oup(?:-by)?))|h(?:ash(?: (?:md5|sha256))?|e(?:aders|lp(?: (?:aliases|commands|externs|modules|operators))?)|i(?:de-env|sto(?:gram|ry(?: session)?))|ttp(?: (?:delete|get|head|options|p(?:atch|ost|ut)))?)|i(?:f|gnore|n(?:put(?: list(?:en)?)?|s(?:ert|pect)|to(?: (?:b(?:i(?:nary|ts)|ool)|d(?:atetime|ecimal|uration)|f(?:ilesize|loat)|int|record|s(?:qlite|tring)))?)|s-(?:admin|empty)|tems)|join|k(?:eybindings(?: (?:default|list(?:en)?))?|ill)|l(?:a(?:st|zy make)|e(?:ngth|t-env)|ines|o(?:ad-env|op)|s)|m(?:at(?:ch|h(?: (?:a(?:bs|rc(?:cos(?:h)?|sin(?:h)?|tan(?:h)?)|vg)|c(?:eil|os(?:h)?)|exp|floor|l(?:n|og)|m(?:ax|edian|in|ode)|product|round|s(?:in(?:h)?|qrt|tddev|um)|tan(?:h)?|variance))?)|e(?:rge|tadata)|kdir|ove|v)|nu-(?:check|highlight)|o(?:pen|verlay list)|p(?:a(?:r(?:-each|se)|th(?: (?:basename|dirname|ex(?:ists|pand)|join|parse|relative-to|split|type))?)|ort|r(?:epend|int|ofile)|s)|query db|r(?:an(?:dom(?: (?:bool|chars|d(?:ecimal|ice)|float|integer|uuid))?|ge)|e(?:duce|ject|name|verse)|m|o(?:ll(?: (?:down|left|right|up))?|tate)|un-external)|s(?:ave|c(?:hema|ope (?:aliases|commands|e(?:ngine-stats|xterns)|modules|variables))|e(?:lect|q(?: (?:char|date))?)|huffle|ize|kip(?: (?:until|while))?|leep|o(?:rt(?:-by)?|urce-env)|plit(?: (?:c(?:hars|olumn)|list|row|words)|-by)?|t(?:art|r(?: (?:c(?:a(?:mel-case|pitalize)|ontains)|d(?:istance|owncase)|e(?:nds-with|xpand)|index-of|join|kebab-case|length|pascal-case|re(?:place|verse)|s(?:creaming-snake-case|nake-case|tarts-with|ubstring)|t(?:itle-case|rim)|upcase))?)|ys)|t(?:a(?:ble|ke(?: (?:until|while))?)|erm size|imeit|o(?: (?:csv|html|json|md|nuon|t(?:ext|oml|sv)|xml|yaml)|uch)?|r(?:anspose|y)|utor)|u(?:cp|niq(?:-by)?|p(?:date(?: cells)?|sert)|rl(?: (?:build-query|encode|join|parse))?)|v(?:alues|ersion|iew(?: (?:files|s(?:ource|pan)))?)|w(?:atch|h(?:ere|i(?:ch|le))|i(?:ndow|th-env)|rap)|zip)(?![\\w-])( (.*))?" }, { "captures": { "1": { "patterns": [{ "include": "#paren-expression" }] } }, "match": `(?<=\\^)(?:\\$("[^"]+"|'[^']+')|"[^"]+"|'[^']+')`, "name": "entity.name.type.external.nushell" }, { "captures": { "1": { "name": "entity.name.type.external.nushell" }, "2": { "patterns": [{ "include": "#value" }] } }, "match": "([\\w.]+(?:-[\\w.!]+)*)(?: (.*))?" }, { "include": "#value" }] } }, "end": "(?=\\||\\)|\\}|;)|$", "name": "meta.command.nushell", "patterns": [{ "include": "#value" }] }, "comment": { "match": "(#.*)$", "name": "comment.nushell" }, "constant-keywords": { "match": "\\b(?:true|false|null)\\b", "name": "constant.language.nushell" }, "constant-value": { "patterns": [{ "include": "#constant-keywords" }, { "include": "#datetime" }, { "include": "#numbers" }, { "include": "#numbers-hexa" }, { "include": "#binary" }] }, "control-keywords": { "comment": "Regex generated with list-to-tree (https://github.com/glcraft/list-to-tree)", "match": "(?<![0-9a-zA-Z_\\-.\\/:\\\\])(?:break|continue|else(?: if)?|for|if|loop|mut|return|try|while)(?![0-9a-zA-Z_\\-.\\/:\\\\])", "name": "keyword.control.nushell" }, "datetime": { "match": "\\b\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:\\+\\d{2}:?\\d{2}|Z)?)?\\b", "name": "constant.numeric.nushell" }, "define-alias": { "captures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.type.nushell" }, "3": { "patterns": [{ "include": "#operators" }] } }, "match": "((?:export )?alias)\\s+([\\w\\-!]+)\\s*(=)" }, "define-variable": { "captures": { "1": { "name": "keyword.other.nushell" }, "2": { "name": "variable.other.nushell" }, "3": { "patterns": [{ "include": "#operators" }] } }, "match": "(let|mut|(?:export\\s+)?const)\\s+(\\w+)\\s+(=)" }, "expression": { "patterns": [{ "include": "#pre-command" }, { "include": "#for-loop" }, { "include": "#operators" }, { "match": "\\|", "name": "keyword.control.nushell" }, { "include": "#control-keywords" }, { "include": "#constant-value" }, { "include": "#command" }, { "include": "#value" }] }, "extern": { "begin": '((?:export\\s+)?extern)\\s+([\\w\\-]+|"[\\w\\- ]+")', "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.type.nushell" } }, "end": "(?<=\\])", "endCaptures": { "0": { "name": "punctuation.definition.function.end.nushell" } }, "patterns": [{ "include": "#function-parameters" }] }, "for-loop": { "begin": "(for)\\s+(\\$?\\w+)\\s+(in)\\s+(.+)\\s*(\\{)", "beginCaptures": { "1": { "name": "keyword.other.nushell" }, "2": { "name": "variable.other.nushell" }, "3": { "name": "keyword.other.nushell" }, "4": { "patterns": [{ "include": "#value" }] }, "5": { "name": "punctuation.section.block.begin.bracket.curly.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.nushell" } }, "name": "meta.for-loop.nushell", "patterns": [{ "include": "source.nushell" }] }, "function": { "begin": '((?:export\\s+)?def(?:\\s+--\\w+)?)\\s+([\\w\\-]+|"[\\w\\- ]+")(\\s+--\\w+)?', "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.type.nushell" }, "3": { "name": "entity.name.function.nushell" } }, "end": "(?<=\\})", "patterns": [{ "include": "#function-parameters" }, { "include": "#function-body" }, { "include": "#function-inout" }] }, "function-body": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.function.begin.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.function.end.nushell" } }, "name": "meta.function.body.nushell", "patterns": [{ "include": "source.nushell" }] }, "function-inout": { "patterns": [{ "include": "#types" }, { "match": "->", "name": "keyword.operator.nushell" }, { "include": "#function-multiple-inout" }] }, "function-multiple-inout": { "begin": "(?<=]\\s*)(:)\\s+(\\[)", "beginCaptures": { "1": { "name": "punctuation.definition.in-out.nushell" }, "2": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.end.nushell" } }, "patterns": [{ "include": "#types" }, { "captures": { "1": { "name": "punctuation.separator.nushell" } }, "match": "\\s*(,)\\s*" }, { "captures": { "1": { "name": "keyword.operator.nushell" } }, "match": "\\s+(->)\\s+" }] }, "function-parameter": { "patterns": [{ "match": "((?:-{0,2}|\\.{3})[\\w-]+)(?:\\((-[\\w?])\\))?", "name": "variable.parameter.nushell" }, { "begin": "\\??:\\s*", "end": "(?=(?:\\s+(?:-{0,2}|\\.{3})[\\w-]+)|(?:\\s*(?:,|\\]|\\||@|=|#|$)))", "patterns": [{ "include": "#types" }] }, { "begin": `@(?="|')`, "end": `(?<="|')`, "patterns": [{ "include": "#string" }] }, { "begin": "=\\s*", "end": "(?=(?:\\s+-{0,2}[\\w-]+)|(?:\\s*(?:,|\\]|\\||#|$)))", "name": "default.value.nushell", "patterns": [{ "include": "#value" }] }] }, "function-parameters": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.end.nushell" } }, "name": "meta.function.parameters.nushell", "patterns": [{ "include": "#function-parameter" }, { "include": "#comment" }] }, "internal-variables": { "match": "\\$(?:nu|env)\\b", "name": "variable.language.nushell" }, "keyword": { "match": "(?:def(?:-env)?)", "name": "keyword.other.nushell" }, "module": { "begin": "((?:export\\s+)?module)\\s+([\\w\\-]+)\\s*\\{", "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.namespace.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.module.end.nushell" } }, "name": "meta.module.nushell", "patterns": [{ "include": "source.nushell" }] }, "numbers": { "match": "(?<![\\w-])[-+]?(?:\\d+|\\d{1,3}(?:_\\d{3})*)(?:\\.\\d*)?(?i:ns|us|ms|sec|min|hr|day|wk|b|kb|mb|gb|tb|pt|eb|zb|kib|mib|gib|tib|pit|eib|zib)?(?:(?![\\w.])|(?=\\.\\.))", "name": "constant.numeric.nushell" }, "numbers-hexa": { "match": "(?<![\\w-])0x[0-9a-fA-F]+(?![\\w.])", "name": "constant.numeric.nushell" }, "operators": { "patterns": [{ "include": "#operators-word" }, { "include": "#operators-symbols" }, { "include": "#ranges" }] }, "operators-symbols": { "match": "(?<= )(?:(?:\\+|\\-|\\*|\\/)=?|\\/\\/|\\*\\*|!=|[<>=]=?|[!=]~|\\+\\+=?)(?= |$)", "name": "keyword.control.nushell" }, "operators-word": { "match": "(?<= |\\()(?:mod|in|not-in|not|and|or|xor|bit-or|bit-and|bit-xor|bit-shl|bit-shr|starts-with|ends-with)(?= |\\)|$)", "name": "keyword.control.nushell" }, "parameters": { "match": "\\b-{1,2}[\\w-]*", "name": "variable.parameter.nushell" }, "paren-expression": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.brace.round.begin.nushell" } }, "end": "\\)", "endCaptures": { "0": { "name": "meta.brace.round.end.nushell" } }, "name": "meta.expression.parenthesis.nushell", "patterns": [{ "include": "#expression" }] }, "pre-command": { "begin": "(\\w+)(=)", "beginCaptures": { "1": { "name": "variable.other.nushell" }, "2": { "patterns": [{ "include": "#operators" }] } }, "end": "(?=\\s+)", "patterns": [{ "include": "#value" }] }, "ranges": { "match": "\\.\\.<?|:", "name": "keyword.control.nushell" }, "string": { "patterns": [{ "include": "#string-single-quote" }, { "include": "#string-backtick" }, { "include": "#string-double-quote" }, { "include": "#string-interpolated-double" }, { "include": "#string-interpolated-single" }, { "include": "#string-bare" }] }, "string-backtick": { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.quoted.single.nushell" }, "string-bare": { "match": `[^$\\[{("',|#\\s|][^\\[\\]{}()"'\\s#,|]*`, "name": "string.bare.nushell" }, "string-double-quote": { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.quoted.double.nushell", "patterns": [{ "match": "\\w+" }, { "include": "#string-escape" }] }, "string-escape": { "match": `\\\\(?:[bfrnt\\\\'"/]|u[0-9a-fA-F]{4})`, "name": "constant.character.escape.nushell" }, "string-interpolated-double": { "begin": '\\$"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.interpolated.double.nushell", "patterns": [{ "match": "\\\\[()]", "name": "constant.character.escape.nushell" }, { "include": "#string-escape" }, { "include": "#paren-expression" }] }, "string-interpolated-single": { "begin": "\\$'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.interpolated.single.nushell", "patterns": [{ "include": "#paren-expression" }] }, "string-single-quote": { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.quoted.single.nushell" }, "table": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.end.nushell" } }, "name": "meta.table.nushell", "patterns": [{ "include": "#value" }, { "match": ",", "name": "punctuation.separator.nushell" }, { "include": "#comment" }] }, "types": { "patterns": [{ "begin": "\\b(list)\\s*<", "beginCaptures": { "1": { "name": "entity.name.type.nushell" } }, "end": ">", "name": "meta.list.nushell", "patterns": [{ "include": "#types" }] }, { "begin": "\\b(record)\\s*<", "beginCaptures": { "1": { "name": "entity.name.type.nushell" } }, "end": ">", "name": "meta.record.nushell", "patterns": [{ "captures": { "1": { "name": "variable.parameter.nushell" } }, "match": `([\\w\\-]+|"[\\w\\- ]+"|'[^']+')\\s*:\\s*` }, { "include": "#types" }] }, { "match": "\\b(\\w+)\\b", "name": "entity.name.type.nushell" }] }, "use-module": { "patterns": [{ "captures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.namespace.nushell" }, "3": { "name": "keyword.other.nushell" } }, "match": `^\\s*((?:export )?use)\\s+([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+')(?:\\s+([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+'|\\*))?\\s*;?$` }, { "begin": `^\\s*((?:export )?use)\\s+([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+')\\s*\\[`, "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.namespace.nushell" } }, "end": "(\\])\\s*;?\\s*$", "endCaptures": { "1": { "name": "meta.brace.square.end.nushell" } }, "patterns": [{ "captures": { "1": { "name": "keyword.other.nushell" } }, "match": `([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+'|\\*),?` }, { "include": "#comment" }] }, { "captures": { "2": { "name": "entity.name.function.nushell" }, "3": { "name": "string.bare.nushell", "patterns": [{ "captures": { "1": { "name": "entity.name.namespace.nushell" } }, "match": `([\\w\\- ]+)(?:\\.nu)?(?=$|"|')` }] }, "4": { "name": "keyword.other.nushell" } }, "match": `(?<path>(?:/|\\\\|~[\\/\\\\]|\\.\\.?[\\/\\\\])?(?:[^\\/\\\\]+[\\/\\\\])*[\\w\\- ]+(?:\\.nu)?){0}^\\s*((?:export )?use)\\s+("\\g<path>"|'\\g<path>\\'|(?!["'])\\g<path>)(?:\\s+([\\w\\-]+|"[\\w\\- ]+"|'[^']+'|\\*))?\\s*;?$` }, { "begin": `(?<path>(?:/|\\\\|~[\\/\\\\]|\\.\\.?[\\/\\\\])?(?:[^\\/\\\\]+[\\/\\\\])*[\\w\\- ]+(?:\\.nu)?){0}^\\s*((?:export )?use)\\s+("\\g<path>"|'\\g<path>\\'|(?!["'])\\g<path>)\\s+\\[`, "beginCaptures": { "2": { "name": "entity.name.function.nushell" }, "3": { "name": "string.bare.nushell", "patterns": [{ "captures": { "1": { "name": "entity.name.namespace.nushell" } }, "match": `([\\w\\- ]+)(?:\\.nu)?(?=$|"|')` }] } }, "end": "(\\])\\s*;?\\s*$", "endCaptures": { "1": { "name": "meta.brace.square.end.nushell" } }, "patterns": [{ "captures": { "0": { "name": "keyword.other.nushell" } }, "match": `([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+'|\\*),?` }, { "include": "#comment" }] }, { "captures": { "0": { "name": "entity.name.function.nushell" } }, "match": "^\\s*(?:export )?use\\b" }] }, "value": { "patterns": [{ "include": "#variables" }, { "include": "#variable-fields" }, { "include": "#control-keywords" }, { "include": "#constant-value" }, { "include": "#table" }, { "include": "#parameters" }, { "include": "#operators" }, { "include": "#paren-expression" }, { "include": "#braced-expression" }, { "include": "#string" }, { "include": "#comment" }] }, "variable-fields": { "match": '(?<=\\)|\\}|\\])(?:\\.(?:[\\w-]+|"[\\w\\- ]+"))+', "name": "variable.other.nushell" }, "variables": { "captures": { "1": { "patterns": [{ "include": "#internal-variables" }, { "match": "\\$.+", "name": "variable.other.nushell" }] }, "2": { "name": "variable.other.nushell" } }, "match": '(\\$[a-zA-Z0-9_]+)((?:\\.(?:[\\w-]+|"[\\w\\- ]+"))*)' } }, "scopeName": "source.nushell", "aliases": ["nu"] });
1
+ const lang = Object.freeze({ "displayName": "nushell", "name": "nushell", "patterns": [{ "include": "#define-variable" }, { "include": "#define-alias" }, { "include": "#function" }, { "include": "#extern" }, { "include": "#module" }, { "include": "#use-module" }, { "include": "#expression" }, { "include": "#comment" }], "repository": { "binary": { "begin": "\\b(0x)(\\[)", "beginCaptures": { "1": { "name": "constant.numeric.nushell" }, "2": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.begin.nushell" } }, "name": "constant.binary.nushell", "patterns": [{ "match": "[0-9a-fA-F]{2}", "name": "constant.numeric.nushell" }] }, "braced-expression": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.block.begin.bracket.curly.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.nushell" } }, "name": "meta.expression.braced.nushell", "patterns": [{ "begin": "(?<=\\{)\\s*\\|", "end": "\\|", "name": "meta.closure.parameters.nushell", "patterns": [{ "include": "#function-parameter" }] }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "keyword.control.nushell" } }, "match": "(\\w+)\\s*(:)\\s*" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "variable.other.nushell", "patterns": [{ "include": "#paren-expression" }] }, "3": { "name": "keyword.control.nushell" } }, "match": '(\\$"((?:[^"\\\\]|\\\\.)*)")\\s*(:)\\s*', "name": "meta.record-entry.nushell" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "keyword.control.nushell" } }, "match": '("(?:[^"\\\\]|\\\\.)*")\\s*(:)\\s*', "name": "meta.record-entry.nushell" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "variable.other.nushell", "patterns": [{ "include": "#paren-expression" }] }, "3": { "name": "keyword.control.nushell" } }, "match": "(\\$'([^']*)')\\s*(:)\\s*", "name": "meta.record-entry.nushell" }, { "captures": { "1": { "name": "variable.other.nushell" }, "2": { "name": "keyword.control.nushell" } }, "match": "('[^']*')\\s*(:)\\s*", "name": "meta.record-entry.nushell" }, { "include": "#spread" }, { "include": "source.nushell" }] }, "command": { "begin": `(?<!\\w)(?:(\\^)|(?![0-9]|\\$))([\\w.!]+(?:(?: (?!-)[\\w\\-.!]+(?:(?= |\\))|$)|[\\w\\-.!]+))*|(?<=\\^)\\$?(?:"[^"]+"|'[^']+'))`, "beginCaptures": { "1": { "name": "keyword.operator.nushell" }, "2": { "patterns": [{ "include": "#control-keywords" }, { "captures": { "0": { "name": "keyword.other.builtin.nushell" } }, "match": "(?:ansi|char) \\w+" }, { "captures": { "1": { "name": "keyword.other.builtin.nushell" }, "2": { "patterns": [{ "include": "#value" }] } }, "comment": "Regex generated with list-to-tree (https://github.com/glcraft/list-to-tree)", "match": "(a(?:ll|n(?:si(?: (?:gradient|link|strip))?|y)|ppend|st)|b(?:its(?: (?:and|not|or|ro(?:l|r)|sh(?:l|r)|xor))?|reak|ytes(?: (?:a(?:dd|t)|build|collect|ends-with|index-of|length|re(?:move|place|verse)|starts-with))?)|c(?:al|d|har|lear|o(?:l(?:lect|umns)|m(?:mandline|p(?:act|lete))|n(?:fig(?: (?:env|nu|reset))?|tinue))|p)|d(?:ate(?: (?:format|humanize|list-timezone|now|to-(?:record|t(?:able|imezone))))?|e(?:bug|code(?: (?:base64|hex))?|fault|scribe|tect columns)|fr (?:a(?:gg(?:-groups)?|ll-(?:false|true)|ppend|rg-(?:m(?:ax|in)|sort|true|unique|where)|s(?:-date(?:time)?)?)|c(?:ache|o(?:l(?:lect|umns)?|n(?:cat(?:-str|enate)|tains)|unt(?:-null)?)|umulative)|d(?:atepart|rop(?:-(?:duplicates|nulls))?|types|ummies)|exp(?:lode|r-not)|f(?:etch|i(?:l(?:l-n(?:an|ull)|ter(?:-with)?)|rst)|latten)|g(?:et(?:-(?:day|hour|m(?:inute|onth)|nanosecond|ordinal|second|week(?:day)?|year))?|roup-by)|i(?:mplode|nto-(?:df|lazy|nu)|s-(?:duplicated|in|n(?:ot-null|ull)|unique))|join|l(?:ast|it|owercase|s)|m(?:ax|e(?:an|dian|lt)|in)|n(?:-unique|ot)|o(?:pen|therwise)|qu(?:antile|ery)|r(?:e(?:name|place(?:-all)?|verse)|olling)|s(?:ample|e(?:lect|t(?:-with-idx)?)|h(?:ape|ift)|lice|ort-by|t(?:d|r(?:-(?:lengths|slice)|ftime))|um(?:mary)?)|t(?:ake|o-(?:a(?:rrow|vro)|csv|jsonl|parquet))|u(?:nique|ppercase)|va(?:lue-counts|r)|w(?:hen|ith-column))|o|rop(?: (?:column|nth))?|u)|e(?:ach(?: while)?|cho|n(?:code(?: (?:base64|hex))?|umerate)|rror make|very|x(?:ec|it|p(?:l(?:ain|ore)|ort-env)))|f(?:i(?:l(?:l|ter)|nd|rst)|latten|mt|ormat(?: (?:d(?:ate|uration)|filesize))?|rom(?: (?:csv|json|nuon|ods|ssv|t(?:oml|sv)|url|x(?:lsx|ml)|y(?:aml|ml)))?)|g(?:et|lob|r(?:id|oup(?:-by)?))|h(?:ash(?: (?:md5|sha256))?|e(?:aders|lp(?: (?:aliases|commands|externs|modules|operators))?)|i(?:de-env|sto(?:gram|ry(?: session)?))|ttp(?: (?:delete|get|head|options|p(?:atch|ost|ut)))?)|i(?:f|gnore|n(?:put(?: list(?:en)?)?|s(?:ert|pect)|to(?: (?:b(?:i(?:nary|ts)|ool)|d(?:atetime|ecimal|uration)|f(?:ilesize|loat)|int|record|s(?:qlite|tring)))?)|s-(?:admin|empty)|tems)|join|k(?:eybindings(?: (?:default|list(?:en)?))?|ill)|l(?:a(?:st|zy make)|e(?:ngth|t-env)|ines|o(?:ad-env|op)|s)|m(?:at(?:ch|h(?: (?:a(?:bs|rc(?:cos(?:h)?|sin(?:h)?|tan(?:h)?)|vg)|c(?:eil|os(?:h)?)|exp|floor|l(?:n|og)|m(?:ax|edian|in|ode)|product|round|s(?:in(?:h)?|qrt|tddev|um)|tan(?:h)?|variance))?)|e(?:rge|tadata)|kdir|ove|v)|nu-(?:check|highlight)|o(?:pen|verlay list)|p(?:a(?:r(?:-each|se)|th(?: (?:basename|dirname|ex(?:ists|pand)|join|parse|relative-to|split|type))?)|ort|r(?:epend|int|ofile)|s)|query db|r(?:an(?:dom(?: (?:bool|chars|d(?:ecimal|ice)|float|integer|uuid))?|ge)|e(?:duce|ject|name|verse)|m|o(?:ll(?: (?:down|left|right|up))?|tate)|un-external)|s(?:ave|c(?:hema|ope (?:aliases|commands|e(?:ngine-stats|xterns)|modules|variables))|e(?:lect|q(?: (?:char|date))?)|huffle|ize|kip(?: (?:until|while))?|leep|o(?:rt(?:-by)?|urce-env)|plit(?: (?:c(?:hars|olumn)|list|row|words)|-by)?|t(?:art|r(?: (?:c(?:a(?:mel-case|pitalize)|ontains)|d(?:istance|owncase)|e(?:nds-with|xpand)|index-of|join|kebab-case|length|pascal-case|re(?:place|verse)|s(?:creaming-snake-case|nake-case|tarts-with|ubstring)|t(?:itle-case|rim)|upcase))?)|ys)|t(?:a(?:ble|ke(?: (?:until|while))?)|erm size|imeit|o(?: (?:csv|html|json|md|nuon|t(?:ext|oml|sv)|xml|yaml)|uch)?|r(?:anspose|y)|utor)|u(?:cp|niq(?:-by)?|p(?:date(?: cells)?|sert)|rl(?: (?:build-query|encode|join|parse))?)|v(?:alues|ersion|iew(?: (?:files|s(?:ource|pan)))?)|w(?:atch|h(?:ere|i(?:ch|le))|i(?:ndow|th-env)|rap)|zip)(?![\\w-])( (.*))?" }, { "captures": { "1": { "patterns": [{ "include": "#paren-expression" }] } }, "match": `(?<=\\^)(?:\\$("[^"]+"|'[^']+')|"[^"]+"|'[^']+')`, "name": "entity.name.type.external.nushell" }, { "captures": { "1": { "name": "entity.name.type.external.nushell" }, "2": { "patterns": [{ "include": "#value" }] } }, "match": "([\\w.]+(?:-[\\w.!]+)*)(?: (.*))?" }, { "include": "#value" }] } }, "end": "(?=\\||\\)|\\}|;)|$", "name": "meta.command.nushell", "patterns": [{ "include": "#parameters" }, { "include": "#spread" }, { "include": "#value" }] }, "comment": { "match": "(#.*)$", "name": "comment.nushell" }, "constant-keywords": { "match": "\\b(?:true|false|null)\\b", "name": "constant.language.nushell" }, "constant-value": { "patterns": [{ "include": "#constant-keywords" }, { "include": "#datetime" }, { "include": "#numbers" }, { "include": "#numbers-hexa" }, { "include": "#binary" }] }, "control-keywords": { "comment": "Regex generated with list-to-tree (https://github.com/glcraft/list-to-tree)", "match": "(?<![0-9a-zA-Z_\\-.\\/:\\\\])(?:break|continue|else(?: if)?|for|if|loop|mut|return|try|while)(?![0-9a-zA-Z_\\-.\\/:\\\\])", "name": "keyword.control.nushell" }, "datetime": { "match": "\\b\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:\\+\\d{2}:?\\d{2}|Z)?)?\\b", "name": "constant.numeric.nushell" }, "define-alias": { "captures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.type.nushell" }, "3": { "patterns": [{ "include": "#operators" }] } }, "match": "((?:export )?alias)\\s+([\\w\\-!]+)\\s*(=)" }, "define-variable": { "captures": { "1": { "name": "keyword.other.nushell" }, "2": { "name": "variable.other.nushell" }, "3": { "patterns": [{ "include": "#operators" }] } }, "match": "(let|mut|(?:export\\s+)?const)\\s+(\\w+)\\s+(=)" }, "expression": { "patterns": [{ "include": "#pre-command" }, { "include": "#for-loop" }, { "include": "#operators" }, { "match": "\\|", "name": "keyword.control.nushell" }, { "include": "#control-keywords" }, { "include": "#constant-value" }, { "include": "#command" }, { "include": "#value" }] }, "extern": { "begin": '((?:export\\s+)?extern)\\s+([\\w\\-]+|"[\\w\\- ]+")', "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.type.nushell" } }, "end": "(?<=\\])", "endCaptures": { "0": { "name": "punctuation.definition.function.end.nushell" } }, "patterns": [{ "include": "#function-parameters" }] }, "for-loop": { "begin": "(for)\\s+(\\$?\\w+)\\s+(in)\\s+(.+)\\s*(\\{)", "beginCaptures": { "1": { "name": "keyword.other.nushell" }, "2": { "name": "variable.other.nushell" }, "3": { "name": "keyword.other.nushell" }, "4": { "patterns": [{ "include": "#value" }] }, "5": { "name": "punctuation.section.block.begin.bracket.curly.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.bracket.curly.nushell" } }, "name": "meta.for-loop.nushell", "patterns": [{ "include": "source.nushell" }] }, "function": { "begin": '((?:export\\s+)?def(?:\\s+--\\w+)?)\\s+([\\w\\-]+|"[\\w\\- ]+")(\\s+--\\w+)?', "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.type.nushell" }, "3": { "name": "entity.name.function.nushell" } }, "end": "(?<=\\})", "patterns": [{ "include": "#function-parameters" }, { "include": "#function-body" }, { "include": "#function-inout" }] }, "function-body": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.function.begin.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.function.end.nushell" } }, "name": "meta.function.body.nushell", "patterns": [{ "include": "source.nushell" }] }, "function-inout": { "patterns": [{ "include": "#types" }, { "match": "->", "name": "keyword.operator.nushell" }, { "include": "#function-multiple-inout" }] }, "function-multiple-inout": { "begin": "(?<=]\\s*)(:)\\s+(\\[)", "beginCaptures": { "1": { "name": "punctuation.definition.in-out.nushell" }, "2": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.end.nushell" } }, "patterns": [{ "include": "#types" }, { "captures": { "1": { "name": "punctuation.separator.nushell" } }, "match": "\\s*(,)\\s*" }, { "captures": { "1": { "name": "keyword.operator.nushell" } }, "match": "\\s+(->)\\s+" }] }, "function-parameter": { "patterns": [{ "captures": { "1": { "name": "keyword.control.nushell" } }, "match": "(-{0,2}|\\.{3})[\\w-]+(?:\\((-[\\w?])\\))?", "name": "variable.parameter.nushell" }, { "begin": "\\??:\\s*", "end": "(?=(?:\\s+(?:-{0,2}|\\.{3})[\\w-]+)|(?:\\s*(?:,|\\]|\\||@|=|#|$)))", "patterns": [{ "include": "#types" }] }, { "begin": `@(?="|')`, "end": `(?<="|')`, "patterns": [{ "include": "#string" }] }, { "begin": "=\\s*", "end": "(?=(?:\\s+-{0,2}[\\w-]+)|(?:\\s*(?:,|\\]|\\||#|$)))", "name": "default.value.nushell", "patterns": [{ "include": "#value" }] }] }, "function-parameters": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.end.nushell" } }, "name": "meta.function.parameters.nushell", "patterns": [{ "include": "#function-parameter" }, { "include": "#comment" }] }, "internal-variables": { "match": "\\$(?:nu|env)\\b", "name": "variable.language.nushell" }, "keyword": { "match": "(?:def(?:-env)?)", "name": "keyword.other.nushell" }, "module": { "begin": "((?:export\\s+)?module)\\s+([\\w\\-]+)\\s*\\{", "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.namespace.nushell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.module.end.nushell" } }, "name": "meta.module.nushell", "patterns": [{ "include": "source.nushell" }] }, "numbers": { "match": "(?<![\\w-])[-+]?(?:\\d+|\\d{1,3}(?:_\\d{3})*)(?:\\.\\d*)?(?i:ns|us|ms|sec|min|hr|day|wk|b|kb|mb|gb|tb|pt|eb|zb|kib|mib|gib|tib|pit|eib|zib)?(?:(?![\\w.])|(?=\\.\\.))", "name": "constant.numeric.nushell" }, "numbers-hexa": { "match": "(?<![\\w-])0x[0-9a-fA-F]+(?![\\w.])", "name": "constant.numeric.nushell" }, "operators": { "patterns": [{ "include": "#operators-word" }, { "include": "#operators-symbols" }, { "include": "#ranges" }] }, "operators-symbols": { "match": "(?<= )(?:(?:\\+|\\-|\\*|\\/)=?|\\/\\/|\\*\\*|!=|[<>=]=?|[!=]~|\\+\\+=?)(?= |$)", "name": "keyword.control.nushell" }, "operators-word": { "match": "(?<= |\\()(?:mod|in|not-in|not|and|or|xor|bit-or|bit-and|bit-xor|bit-shl|bit-shr|starts-with|ends-with)(?= |\\)|$)", "name": "keyword.control.nushell" }, "parameters": { "captures": { "1": { "name": "keyword.control.nushell" } }, "match": "(?<=\\s)(-{1,2})[\\w-]+", "name": "variable.parameter.nushell" }, "paren-expression": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.brace.round.begin.nushell" } }, "end": "\\)", "endCaptures": { "0": { "name": "meta.brace.round.end.nushell" } }, "name": "meta.expression.parenthesis.nushell", "patterns": [{ "include": "#expression" }] }, "pre-command": { "begin": "(\\w+)(=)", "beginCaptures": { "1": { "name": "variable.other.nushell" }, "2": { "patterns": [{ "include": "#operators" }] } }, "end": "(?=\\s+)", "patterns": [{ "include": "#value" }] }, "ranges": { "match": "\\.\\.<?", "name": "keyword.control.nushell" }, "spread": { "match": "\\.\\.\\.(?=[^\\s\\]}])", "name": "keyword.control.nushell" }, "string": { "patterns": [{ "include": "#string-single-quote" }, { "include": "#string-backtick" }, { "include": "#string-double-quote" }, { "include": "#string-interpolated-double" }, { "include": "#string-interpolated-single" }, { "include": "#string-bare" }] }, "string-backtick": { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.quoted.single.nushell" }, "string-bare": { "match": `[^$\\[{("',|#\\s|][^\\[\\]{}()"'\\s#,|]*`, "name": "string.bare.nushell" }, "string-double-quote": { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.quoted.double.nushell", "patterns": [{ "match": "\\w+" }, { "include": "#string-escape" }] }, "string-escape": { "match": `\\\\(?:[bfrnt\\\\'"/]|u[0-9a-fA-F]{4})`, "name": "constant.character.escape.nushell" }, "string-interpolated-double": { "begin": '\\$"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.interpolated.double.nushell", "patterns": [{ "match": "\\\\[()]", "name": "constant.character.escape.nushell" }, { "include": "#string-escape" }, { "include": "#paren-expression" }] }, "string-interpolated-single": { "begin": "\\$'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.interpolated.single.nushell", "patterns": [{ "include": "#paren-expression" }] }, "string-single-quote": { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.nushell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.nushell" } }, "name": "string.quoted.single.nushell" }, "table": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.begin.nushell" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.end.nushell" } }, "name": "meta.table.nushell", "patterns": [{ "include": "#spread" }, { "include": "#value" }, { "match": ",", "name": "punctuation.separator.nushell" }] }, "types": { "patterns": [{ "begin": "\\b(list)\\s*<", "beginCaptures": { "1": { "name": "entity.name.type.nushell" } }, "end": ">", "name": "meta.list.nushell", "patterns": [{ "include": "#types" }] }, { "begin": "\\b(record)\\s*<", "beginCaptures": { "1": { "name": "entity.name.type.nushell" } }, "end": ">", "name": "meta.record.nushell", "patterns": [{ "captures": { "1": { "name": "variable.parameter.nushell" } }, "match": `([\\w\\-]+|"[\\w\\- ]+"|'[^']+')\\s*:\\s*` }, { "include": "#types" }] }, { "match": "\\b(\\w+)\\b", "name": "entity.name.type.nushell" }] }, "use-module": { "patterns": [{ "captures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.namespace.nushell" }, "3": { "name": "keyword.other.nushell" } }, "match": `^\\s*((?:export )?use)\\s+([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+')(?:\\s+([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+'|\\*))?\\s*;?$` }, { "begin": `^\\s*((?:export )?use)\\s+([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+')\\s*\\[`, "beginCaptures": { "1": { "name": "entity.name.function.nushell" }, "2": { "name": "entity.name.namespace.nushell" } }, "end": "(\\])\\s*;?\\s*$", "endCaptures": { "1": { "name": "meta.brace.square.end.nushell" } }, "patterns": [{ "captures": { "1": { "name": "keyword.other.nushell" } }, "match": `([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+'|\\*),?` }, { "include": "#comment" }] }, { "captures": { "2": { "name": "entity.name.function.nushell" }, "3": { "name": "string.bare.nushell", "patterns": [{ "captures": { "1": { "name": "entity.name.namespace.nushell" } }, "match": `([\\w\\- ]+)(?:\\.nu)?(?=$|"|')` }] }, "4": { "name": "keyword.other.nushell" } }, "match": `(?<path>(?:/|\\\\|~[\\/\\\\]|\\.\\.?[\\/\\\\])?(?:[^\\/\\\\]+[\\/\\\\])*[\\w\\- ]+(?:\\.nu)?){0}^\\s*((?:export )?use)\\s+("\\g<path>"|'\\g<path>\\'|(?!["'])\\g<path>)(?:\\s+([\\w\\-]+|"[\\w\\- ]+"|'[^']+'|\\*))?\\s*;?$` }, { "begin": `(?<path>(?:/|\\\\|~[\\/\\\\]|\\.\\.?[\\/\\\\])?(?:[^\\/\\\\]+[\\/\\\\])*[\\w\\- ]+(?:\\.nu)?){0}^\\s*((?:export )?use)\\s+("\\g<path>"|'\\g<path>\\'|(?!["'])\\g<path>)\\s+\\[`, "beginCaptures": { "2": { "name": "entity.name.function.nushell" }, "3": { "name": "string.bare.nushell", "patterns": [{ "captures": { "1": { "name": "entity.name.namespace.nushell" } }, "match": `([\\w\\- ]+)(?:\\.nu)?(?=$|"|')` }] } }, "end": "(\\])\\s*;?\\s*$", "endCaptures": { "1": { "name": "meta.brace.square.end.nushell" } }, "patterns": [{ "captures": { "0": { "name": "keyword.other.nushell" } }, "match": `([\\w\\-]+|"[\\w\\- ]+"|'[\\w\\- ]+'|\\*),?` }, { "include": "#comment" }] }, { "captures": { "0": { "name": "entity.name.function.nushell" } }, "match": "^\\s*(?:export )?use\\b" }] }, "value": { "patterns": [{ "include": "#variables" }, { "include": "#variable-fields" }, { "include": "#control-keywords" }, { "include": "#constant-value" }, { "include": "#table" }, { "include": "#operators" }, { "include": "#paren-expression" }, { "include": "#braced-expression" }, { "include": "#string" }, { "include": "#comment" }] }, "variable-fields": { "match": '(?<=\\)|\\}|\\])(?:\\.(?:[\\w-]+|"[\\w\\- ]+"))+', "name": "variable.other.nushell" }, "variables": { "captures": { "1": { "patterns": [{ "include": "#internal-variables" }, { "match": "\\$.+", "name": "variable.other.nushell" }] }, "2": { "name": "variable.other.nushell" } }, "match": '(\\$[a-zA-Z0-9_]+)((?:\\.(?:[\\w-]+|"[\\w\\- ]+"))*)' } }, "scopeName": "source.nushell", "aliases": ["nu"] });
2
2
  var nushell = [
3
3
  lang
4
4
  ];
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "Shell", "name": "shellscript", "patterns": [{ "include": "#initial_context" }], "repository": { "alias_statement": { "begin": "(alias)[ \\t]*+[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))", "beginCaptures": { "1": { "name": "storage.type.alias.shell" }, "2": { "name": "storage.modifier.$2.shell" }, "3": { "name": "variable.other.assignment.shell" }, "4": { "name": "punctuation.definition.array.access.shell" }, "5": { "name": "variable.other.assignment.shell" }, "6": { "name": "punctuation.definition.array.access.shell" }, "7": { "name": "keyword.operator.assignment.shell" }, "8": { "name": "keyword.operator.assignment.compound.shell" }, "9": { "name": "keyword.operator.assignment.compound.shell" } }, "end": "(?:(?= |\\t|$)|(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.semicolon.shell" }, "2": { "name": "punctuation.separator.statement.and.shell" }, "3": { "name": "punctuation.separator.statement.or.shell" }, "4": { "name": "punctuation.separator.statement.background.shell" } }, "name": "meta.expression.assignment.shell", "patterns": [{ "include": "#normal_statement_context" }] }, "argument": { "begin": "[ \\t]++(?!(?:&|\\||\\(|\\[|#|\\n|$|;))", "beginCaptures": {}, "end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)", "endCaptures": {}, "name": "meta.argument.shell", "patterns": [{ "include": "#argument_context" }, { "include": "#line_continuation" }] }, "argument_context": { "patterns": [{ "captures": { "1": { "name": "string.unquoted.argument.shell", "patterns": [{ "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "captures": { "1": { "name": "constant.language.$1.shell" } }, "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)" }] } }, "match": "[ \\t]*+([^\n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))" }, { "include": "#normal_statement_context" }] }, "assignment": { "patterns": [{ "begin": "[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))[ \\t]*+(\\()", "beginCaptures": { "1": { "name": "storage.modifier.$1.shell" }, "2": { "name": "variable.other.assignment.shell" }, "3": { "name": "punctuation.definition.array.access.shell" }, "4": { "name": "variable.other.assignment.shell" }, "5": { "name": "punctuation.definition.array.access.shell" }, "6": { "name": "keyword.operator.assignment.shell" }, "7": { "name": "keyword.operator.assignment.compound.shell" }, "8": { "name": "keyword.operator.assignment.compound.shell" }, "9": { "name": "punctuation.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.shell" } }, "name": "meta.expression.assignment.shell", "patterns": [{ "include": "#comment" }, { "include": "#argument_context" }] }, { "begin": "[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))", "beginCaptures": { "1": { "name": "storage.modifier.$1.shell" }, "2": { "name": "variable.other.assignment.shell" }, "3": { "name": "punctuation.definition.array.access.shell" }, "4": { "name": "variable.other.assignment.shell" }, "5": { "name": "punctuation.definition.array.access.shell" }, "6": { "name": "keyword.operator.assignment.shell" }, "7": { "name": "keyword.operator.assignment.compound.shell" }, "8": { "name": "keyword.operator.assignment.compound.shell" } }, "end": "(?:(?= |\\t|$)|(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.semicolon.shell" }, "2": { "name": "punctuation.separator.statement.and.shell" }, "3": { "name": "punctuation.separator.statement.or.shell" }, "4": { "name": "punctuation.separator.statement.background.shell" } }, "name": "meta.expression.assignment.shell", "patterns": [{ "include": "#comment" }, { "include": "#argument_context" }] }] }, "basic_command_name": { "captures": { "1": { "name": "storage.modifier.$1.shell" }, "2": { "name": "entity.name.function.call.shell entity.name.command.shell", "patterns": [{ "match": "(?<!\\w)(?:continue|return|break)(?!\\w)", "name": "keyword.control.$0.shell" }, { "match": "(?<!\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|:|\\.)(?!\\/)(?!\\w)", "name": "support.function.builtin.shell" }, { "include": "#variable" }] } }, "match": `(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!"|'|\\\\\\n?$)[^!'" \\t\\n\\r]+?))(?:(?= |\\t)|(?=;|\\||&|\\n|\\)|\\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))`, "name": "meta.statement.command.name.basic.shell" }, "block_comment": { "begin": "\\s*+(\\/\\*)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.begin.shell" } }, "end": "\\*\\/", "endCaptures": { "0": { "name": "punctuation.definition.comment.end.shell" } }, "name": "comment.block.shell" }, "boolean": { "match": "\\b(?:true|false)\\b", "name": "constant.language.$0.shell" }, "case-clause": { "patterns": [{ "begin": "(?=\\S)", "end": ";;&?|;&", "endCaptures": { "0": { "name": "punctuation.terminator.case-clause.shell" } }, "name": "meta.scope.case-clause.shell", "patterns": [{ "begin": "\\(|(?=\\S)", "beginCaptures": { "0": { "name": "punctuation.definition.case-pattern.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.case-pattern.shell" } }, "name": "meta.scope.case-pattern.shell", "patterns": [{ "match": "\\|", "name": "punctuation.separator.pipe-sign.shell" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#pathname" }] }, { "begin": "(?<=\\))", "end": "(?=;;&?|;&)", "name": "meta.scope.case-clause-body.shell", "patterns": [{ "include": "#initial_context" }] }] }] }, "comment": { "captures": { "1": { "name": "comment.line.number-sign.shell meta.shebang.shell" }, "2": { "name": "punctuation.definition.comment.shebang.shell" }, "3": { "name": "comment.line.number-sign.shell" }, "4": { "name": "punctuation.definition.comment.shell" } }, "match": "(?:^|[ \\t]++)(?:((#!).*)|((#).*))" }, "comments": { "patterns": [{ "include": "#block_comment" }, { "include": "#line_comment" }] }, "compound-command": { "patterns": [{ "begin": "\\[{1,2}", "beginCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "end": "\\]{1,2}", "endCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "name": "meta.scope.logical-expression.shell", "patterns": [{ "include": "#logical-expression" }, { "include": "#initial_context" }] }, { "begin": "\\({2}", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "\\){2}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.other.math.shell", "patterns": [{ "include": "#math" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.subshell.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.subshell.shell" } }, "name": "meta.scope.subshell.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=\\s|^){(?=\\s|$)", "beginCaptures": { "0": { "name": "punctuation.definition.group.shell" } }, "end": "(?<=^|;)\\s*(})", "endCaptures": { "1": { "name": "punctuation.definition.group.shell" } }, "name": "meta.scope.group.shell", "patterns": [{ "include": "#initial_context" }] }] }, "continuation_of_double_quoted_command_name": { "begin": '\\G(?<=")', "beginCaptures": {}, "contentName": "meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command", "end": '"', "endCaptures": { "0": { "name": "string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell" } }, "patterns": [{ "match": '\\\\[\\$\\n`"\\\\]', "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" }] }, "continuation_of_single_quoted_command_name": { "begin": "\\G(?<=')", "beginCaptures": {}, "contentName": "meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command", "end": "'", "endCaptures": { "0": { "name": "string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell" } } }, "custom_command_names": { "patterns": [] }, "custom_commands": { "patterns": [] }, "double_quote_context": { "patterns": [{ "match": '\\\\[\\$`"\\\\\\n]', "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" }] }, "double_quote_escape_char": { "match": '\\\\[\\$`"\\\\\\n]', "name": "constant.character.escape.shell" }, "function_definition": { "applyEndPatternLast": 1, "begin": "[ \\t]*+(?:(\\bfunction\\b)[ \\t]*+([^ \\t\\n\\r\\(\\)=]+)(?:(\\()[ \\t]*+(\\)))?|([^ \\t\\n\\r\\(\\)=]+)[ \\t]*+(\\()[ \\t]*+(\\)))", "beginCaptures": { "1": { "name": "storage.type.function.shell" }, "2": { "name": "entity.name.function.shell" }, "3": { "name": "punctuation.definition.arguments.shell" }, "4": { "name": "punctuation.definition.arguments.shell" }, "5": { "name": "entity.name.function.shell" }, "6": { "name": "punctuation.definition.arguments.shell" }, "7": { "name": "punctuation.definition.arguments.shell" } }, "end": "(?<=\\}|\\))", "endCaptures": {}, "name": "meta.function.shell", "patterns": [{ "match": "\\G(?:\\t| |\\n)" }, { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "name": "meta.function.body.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "name": "meta.function.body.shell", "patterns": [{ "include": "#initial_context" }] }] }, "heredoc": { "patterns": [{ "begin": `((?<!<)<<-)[ \\t]*+("|')[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(?:\\2)(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": {}, "3": { "name": "punctuation.definition.string.heredoc.shell" }, "4": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.quoted.heredoc.indent", "end": "^\\t*(?:\\3)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [] }, { "begin": `((?<!<)<<(?!<))[ \\t]*+("|')[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(?:\\2)(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": {}, "3": { "name": "punctuation.definition.string.heredoc.shell" }, "4": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.quoted.heredoc.no-indent", "end": "^(?:\\3)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [] }, { "begin": `((?<!<)<<-)[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": { "name": "punctuation.definition.string.heredoc.shell" }, "3": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.unquoted.heredoc.indent", "end": "^\\t*(?:\\2)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [{ "include": "#double_quote_escape_char" }, { "include": "#variable" }, { "include": "#interpolation" }] }, { "begin": `((?<!<)<<(?!<))[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": { "name": "punctuation.definition.string.heredoc.shell" }, "3": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.unquoted.heredoc.no-indent", "end": "^(?:\\2)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [{ "include": "#double_quote_escape_char" }, { "include": "#variable" }, { "include": "#interpolation" }] }] }, "herestring": { "patterns": [{ "begin": "(<<<)\\s*(('))", "beginCaptures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { "name": "string.quoted.single.shell" }, "3": { "name": "punctuation.definition.string.begin.shell" } }, "contentName": "string.quoted.single.shell", "end": "(')", "endCaptures": { "0": { "name": "string.quoted.single.shell" }, "1": { "name": "punctuation.definition.string.end.shell" } }, "name": "meta.herestring.shell" }, { "begin": '(<<<)\\s*(("))', "beginCaptures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { "name": "string.quoted.double.shell" }, "3": { "name": "punctuation.definition.string.begin.shell" } }, "contentName": "string.quoted.double.shell", "end": '(")', "endCaptures": { "0": { "name": "string.quoted.double.shell" }, "1": { "name": "punctuation.definition.string.end.shell" } }, "name": "meta.herestring.shell", "patterns": [{ "include": "#double_quote_context" }] }, { "captures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { "name": "string.unquoted.herestring.shell", "patterns": [{ "include": "#initial_context" }] } }, "match": "(<<<)\\s*(([^\\s)\\\\]|\\\\.)+)", "name": "meta.herestring.shell" }] }, "initial_context": { "patterns": [{ "include": "#comment" }, { "include": "#pipeline" }, { "include": "#normal_statement_seperator" }, { "include": "#logical_expression_double" }, { "include": "#logical_expression_single" }, { "include": "#misc_ranges" }, { "include": "#loop" }, { "include": "#function_definition" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#alias_statement" }, { "include": "#normal_statement" }, { "include": "#string" }, { "include": "#support" }] }, "inline_comment": { "captures": { "1": { "name": "comment.block.shell punctuation.definition.comment.begin.shell" }, "2": { "name": "comment.block.shell" }, "3": { "patterns": [{ "match": "\\*\\/", "name": "comment.block.shell punctuation.definition.comment.end.shell" }, { "match": "\\*", "name": "comment.block.shell" }] } }, "match": "(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/))" }, "interpolation": { "patterns": [{ "begin": "\\$\\({2}", "beginCaptures": { "0": { "name": "punctuation.definition.evaluation.arithmetic.begin.shell" } }, "end": "\\)\\s*\\)", "endCaptures": { "0": { "name": "punctuation.definition.evaluation.arithmetic.end.shell" } }, "name": "string.other.math.shell", "patterns": [{ "include": "#math" }] }, { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.evaluation.backticks.shell" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.evaluation.backticks.shell" } }, "name": "string.interpolated.backtick.shell", "patterns": [{ "match": "\\\\[`\\\\$]", "name": "constant.character.escape.shell" }, { "begin": "(?<=\\W)(?=#)(?!#{)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.shell" } }, "end": "(?!\\G)", "patterns": [{ "begin": "#", "beginCaptures": { "0": { "name": "punctuation.definition.comment.shell" } }, "end": "(?=`)", "name": "comment.line.number-sign.shell" }] }, { "include": "#initial_context" }] }, { "begin": "\\$\\(", "beginCaptures": { "0": { "name": "punctuation.definition.evaluation.parens.begin.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.evaluation.parens.end.shell" } }, "name": "string.interpolated.dollar.shell", "patterns": [{ "include": "#initial_context" }] }] }, "keyword": { "patterns": [{ "match": "(?<=^|;|&| |\\t)(?:continue|foreach|return|select|repeat|break|until|while|case|done|elif|else|esac|then|for|end|do|if|fi|in)(?= |\\t|;|&|$)", "name": "keyword.control.$0.shell" }] }, "line_comment": { "begin": "\\s*+(\\/\\/)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.shell" } }, "end": "(?<=\\n)(?<!\\\\\\n)", "endCaptures": {}, "name": "comment.line.double-slash.shell", "patterns": [{ "include": "#line_continuation_character" }] }, "line_continuation": { "match": "\\\\(?=\\n)", "name": "constant.character.escape.line-continuation.shell" }, "logical-expression": { "patterns": [{ "comment": "do we want a special rule for ( expr )?", "match": "=[=~]?|!=?|<|>|&&|\\|\\|", "name": "keyword.operator.logical.shell" }, { "match": "(?<!\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])\\b", "name": "keyword.operator.logical.shell" }] }, "logical_expression_context": { "patterns": [{ "include": "#regex_comparison" }, { "include": "#logical-expression" }, { "include": "#logical_expression_single" }, { "include": "#logical_expression_double" }, { "include": "#comment" }, { "include": "#boolean" }, { "include": "#redirect_number" }, { "include": "#numeric_literal" }, { "include": "#pipeline" }, { "include": "#normal_statement_seperator" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" }] }, "logical_expression_double": { "begin": "\\[\\[", "beginCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "end": "\\]\\]", "endCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "name": "meta.scope.logical-expression.shell", "patterns": [{ "include": "#logical_expression_context" }] }, "logical_expression_single": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "name": "meta.scope.logical-expression.shell", "patterns": [{ "include": "#logical_expression_context" }] }, "loop": { "patterns": [{ "begin": "(?<=^|;|&|\\s)(for)\\s+(?=\\({2})", "beginCaptures": { "1": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.for-loop.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)(for)\\s+(.+?)\\s+(in)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { "name": "variable.other.loop.shell", "patterns": [{ "include": "#string" }] }, "3": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.for-in-loop.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)(while|until)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.while-loop.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)(select)\\s+((?:[^\\s\\\\]|\\\\.)+)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { "name": "variable.other.loop.shell" } }, "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))", "endCaptures": { "1": { "name": "keyword.control.shell" } }, "name": "meta.scope.select-block.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)case(?=\\s|;|&|$)", "beginCaptures": { "0": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)esac(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.case-block.shell", "patterns": [{ "begin": "(?<=^|;|&|\\s)in(?=\\s|;|&|$)", "beginCaptures": { "0": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)(?=esac(\\s|;|&|$))", "name": "meta.scope.case-body.shell", "patterns": [{ "include": "#comment" }, { "include": "#case-clause" }] }, { "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)if(?=\\s|;|&|$)", "beginCaptures": { "0": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)fi(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.if-block.shell", "patterns": [{ "include": "#initial_context" }] }] }, "math": { "patterns": [{ "include": "#variable" }, { "match": "\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", "name": "keyword.operator.arithmetic.shell" }, { "match": "0[xX][0-9A-Fa-f]+", "name": "constant.numeric.hex.shell" }, { "match": "0\\d+", "name": "constant.numeric.octal.shell" }, { "match": "\\d{1,2}#[0-9a-zA-Z@_]+", "name": "constant.numeric.other.shell" }, { "match": "\\d+", "name": "constant.numeric.integer.shell" }] }, "misc_ranges": { "patterns": [{ "include": "#logical_expression_single" }, { "include": "#logical_expression_double" }, { "begin": "\\(\\(", "beginCaptures": { "0": { "name": "punctuation.section.arithmetic.shell" } }, "end": "\\)\\)", "endCaptures": { "0": { "name": "punctuation.section.arithmetic.shell" } }, "name": "meta.arithmetic.shell", "patterns": [{ "include": "#math" }] }, { "begin": "(?<!=)\\(", "beginCaptures": { "0": { "name": "punctuation.definition.subshell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.subshell" } }, "name": "meta.scope.subshell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<![^ \\t])({)", "beginCaptures": { "1": { "name": "punctuation.definition.group.shell" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.definition.group.shell" } }, "name": "meta.scope.group.shell", "patterns": [{ "include": "#initial_context" }] }] }, "modifiers": { "match": "(?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$)", "name": "storage.modifier.$0.shell" }, "normal_statement": { "begin": "(?!^[ \\t]*+$)(?:(?<=^until | until |\\tuntil |^while | while |\\twhile |^elif | elif |\\telif |^else | else |\\telse |^then | then |\\tthen |^do | do |\\tdo |^if | if |\\tif )|(?<=(?:^|;|\\||&|!|\\(|\\{|\\`)))[ \\t]*+(?!nocorrect\\W|nocorrect\\$|function\\W|function\\$|foreach\\W|foreach\\$|repeat\\W|repeat\\$|logout\\W|logout\\$|coproc\\W|coproc\\$|select\\W|select\\$|while\\W|while\\$|pushd\\W|pushd\\$|until\\W|until\\$|case\\W|case\\$|done\\W|done\\$|elif\\W|elif\\$|else\\W|else\\$|esac\\W|esac\\$|popd\\W|popd\\$|then\\W|then\\$|time\\W|time\\$|for\\W|for\\$|end\\W|end\\$|fi\\W|fi\\$|do\\W|do\\$|in\\W|in\\$|if\\W|if\\$)", "beginCaptures": {}, "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)", "endCaptures": {}, "name": "meta.statement.shell", "patterns": [{ "include": "#function_definition" }, { "include": "#assignment" }, { "begin": "[ \\t]*+(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?!\\\\\\n?$)", "beginCaptures": {}, "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)", "endCaptures": {}, "name": "meta.statement.command.shell", "patterns": [{ "begin": "\\G", "beginCaptures": {}, "end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)", "endCaptures": {}, "name": "meta.statement.command.name.shell", "patterns": [{ "include": "#modifiers" }, { "match": "(?<!\\w)(?:continue|return|break)(?!\\w)", "name": "entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell" }, { "match": "(?<!\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|:|\\.)(?!\\/)(?!\\w)", "name": "entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell" }, { "include": "#variable" }, { "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell" } }, "match": `(?<=\\G|'|"|\\}|\\))([^ \\n\\t\\r"'=;&\\|\`\\)\\{]+)` }, { "begin": `(?:\\G|(?<! |\\t|;|\\||&|\\n|\\{|#))((?:\\$)?)((?:(")|(')))`, "beginCaptures": { "1": { "name": "meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell" }, "2": {}, "3": { "name": "meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" }, "4": { "name": "meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" } }, "end": "(?<!\\G)(?<=(?:\\2))", "endCaptures": {}, "patterns": [{ "include": "#continuation_of_single_quoted_command_name" }, { "include": "#continuation_of_double_quoted_command_name" }] }, { "include": "#line_continuation" }] }, { "include": "#line_continuation" }, { "include": "#option" }, { "include": "#argument" }, { "include": "#statement_context" }, { "include": "#string" }] }, { "include": "#line_continuation" }, { "include": "#normal_statement_context" }] }, "normal_statement_context": { "patterns": [{ "include": "#comment" }, { "include": "#pipeline" }, { "include": "#normal_statement_seperator" }, { "include": "#misc_ranges" }, { "include": "#boolean" }, { "include": "#redirect_number" }, { "include": "#numeric_literal" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" }] }, "normal_statement_seperator": { "captures": { "1": { "name": "punctuation.terminator.statement.semicolon.shell" }, "2": { "name": "punctuation.separator.statement.and.shell" }, "3": { "name": "punctuation.separator.statement.or.shell" }, "4": { "name": "punctuation.separator.statement.background.shell" } }, "match": "(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n)" }, "numeric_literal": { "captures": { "1": { "name": "constant.numeric.shell constant.numeric.hex.shell" }, "2": { "name": "constant.numeric.shell constant.numeric.octal.shell" }, "3": { "name": "constant.numeric.shell constant.numeric.other.shell" }, "4": { "name": "constant.numeric.shell constant.numeric.integer.shell" }, "5": { "name": "constant.numeric.shell constant.numeric.integer.shell" } }, "match": "[ \\t]*+(?<==| |\\t|^|\\{|\\(|\\[)(?:(?:(?:(?:(0[xX][0-9A-Fa-f]+)|(0\\d+))|(\\d{1,2}#[0-9a-zA-Z@_]+))|(-?\\d+\\.\\d+))|(-?\\d+))(?!>)" }, "option": { "begin": "[ \\t]++(-)((?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t])))", "beginCaptures": { "1": { "name": "string.unquoted.argument.shell constant.other.option.dash.shell" }, "2": { "name": "string.unquoted.argument.shell constant.other.option.shell" } }, "contentName": "string.unquoted.argument constant.other.option", "end": "(?:(?=[ \\t])|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))", "endCaptures": {}, "patterns": [{ "include": "#option_context" }] }, "option_context": { "patterns": [{ "include": "#misc_ranges" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" }] }, "pathname": { "patterns": [{ "match": "(?<=\\s|:|=|^)~", "name": "keyword.operator.tilde.shell" }, { "match": "\\*|\\?", "name": "keyword.operator.glob.shell" }, { "begin": "([?*+@!])(\\()", "beginCaptures": { "1": { "name": "keyword.operator.extglob.shell" }, "2": { "name": "punctuation.definition.extglob.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.extglob.shell" } }, "name": "meta.structure.extglob.shell", "patterns": [{ "include": "#initial_context" }] }] }, "pipeline": { "patterns": [{ "match": "(?<=^|;|&|\\s)(time)(?=\\s|;|&|$)", "name": "keyword.other.shell" }, { "match": "[|!]", "name": "keyword.operator.pipe.shell" }] }, "redirect_number": { "captures": { "1": { "name": "keyword.operator.redirect.stdout.shell" }, "2": { "name": "keyword.operator.redirect.stderr.shell" }, "3": { "name": "keyword.operator.redirect.$3.shell" } }, "match": "(?<=[ \\t])(?:(1)|(2)|(\\d+))(?=>)" }, "redirection": { "patterns": [{ "begin": "[><]\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.interpolated.process-substitution.shell", "patterns": [{ "include": "#initial_context" }] }, { "match": "(?<![<>])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])", "name": "keyword.operator.redirect.shell" }] }, "regex_comparison": { "match": "\\=~", "name": "keyword.operator.logical.regex.shell" }, "regexp": { "patterns": [{ "match": ".+" }] }, "simple_options": { "captures": { "0": { "patterns": [{ "captures": { "1": { "name": "string.unquoted.argument.shell constant.other.option.dash.shell" }, "2": { "name": "string.unquoted.argument.shell constant.other.option.shell" } }, "match": "[ \\t]++(\\-)(\\w+)" }] } }, "match": "(?:[ \\t]++\\-\\w+)*" }, "start_of_command": { "match": "[ \\t]*+(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?!\\\\\\n?$)" }, "start_of_double_quoted_command_name": { "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell", "patterns": [{ "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "captures": { "1": { "name": "constant.language.$1.shell" } }, "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)" }] } }, "match": '(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:[ \\t]*+([^\n\'&;<>\\(\\)\\$`\\\\"\\|]+(?!>)))?(?:(?:\\$")|")', "name": "meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" }, "start_of_single_quoted_command_name": { "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell", "patterns": [{ "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "captures": { "1": { "name": "constant.language.$1.shell" } }, "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)" }] } }, "match": "(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:[ \\t]*+([^\n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$')|')", "name": "meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" }, "string": { "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.shell" }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.shell" }, { "begin": '\\$?"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.double.shell", "patterns": [{ "match": '\\\\[\\$\\n`"\\\\]', "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" }] }, { "begin": "\\$'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.dollar.shell", "patterns": [{ "match": "\\\\(?:a|b|e|f|n|r|t|v|\\\\|')", "name": "constant.character.escape.ansi-c.shell" }, { "match": '\\\\[0-9]{3}"', "name": "constant.character.escape.octal.shell" }, { "match": '\\\\x[0-9a-fA-F]{2}"', "name": "constant.character.escape.hex.shell" }, { "match": '\\\\c."', "name": "constant.character.escape.control-char.shell" }] }] }, "support": { "patterns": [{ "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)", "name": "support.function.builtin.shell" }] }, "variable": { "patterns": [{ "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell" }, "2": { "name": "variable.parameter.positional.all.shell" } }, "match": "(\\$)(\\@(?!\\w))" }, { "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" }, "2": { "name": "variable.parameter.positional.shell" } }, "match": "(\\$)([0-9](?!\\w))" }, { "captures": { "1": { "name": "punctuation.definition.variable.shell variable.language.special.shell" }, "2": { "name": "variable.language.special.shell" } }, "match": "(\\$)([-*#?$!0_](?!\\w))" }, { "begin": "(\\$)(\\{)[ \\t]*+(?=\\d)", "beginCaptures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" }, "2": { "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell" } }, "contentName": "meta.parameter-expansion", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell" } }, "patterns": [{ "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", "name": "keyword.operator.expansion.shell" }, { "captures": { "1": { "name": "punctuation.section.array.shell" }, "2": { "name": "punctuation.section.array.shell" } }, "match": "(\\[)[^\\]]+(\\])" }, { "match": "[0-9]+", "name": "variable.parameter.positional.shell" }, { "match": "(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)", "name": "variable.other.normal.shell" }, { "include": "#variable" }, { "include": "#string" }] }, { "begin": "(\\$)(\\{)", "beginCaptures": { "1": { "name": "punctuation.definition.variable.shell" }, "2": { "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell" } }, "contentName": "meta.parameter-expansion", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell" } }, "patterns": [{ "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", "name": "keyword.operator.expansion.shell" }, { "captures": { "1": { "name": "punctuation.section.array.shell" }, "2": { "name": "punctuation.section.array.shell" } }, "match": "(\\[)[^\\]]+(\\])" }, { "match": "(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)", "name": "variable.other.normal.shell" }, { "include": "#variable" }, { "include": "#string" }] }, { "captures": { "1": { "name": "punctuation.definition.variable.shell variable.other.normal.shell" }, "2": { "name": "variable.other.normal.shell" } }, "match": "(\\$)(\\w+(?!\\w))" }] } }, "scopeName": "source.shell", "aliases": ["bash", "sh", "shell", "zsh"] });
1
+ const lang = Object.freeze({ "displayName": "Shell", "name": "shellscript", "patterns": [{ "include": "#initial_context" }], "repository": { "alias_statement": { "begin": "(alias)[ \\t]*+[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))", "beginCaptures": { "1": { "name": "storage.type.alias.shell" }, "2": { "name": "storage.modifier.$2.shell" }, "3": { "name": "variable.other.assignment.shell" }, "4": { "name": "punctuation.definition.array.access.shell" }, "5": { "name": "variable.other.assignment.shell" }, "6": { "name": "punctuation.definition.array.access.shell" }, "7": { "name": "keyword.operator.assignment.shell" }, "8": { "name": "keyword.operator.assignment.compound.shell" }, "9": { "name": "keyword.operator.assignment.compound.shell" } }, "end": "(?:(?= |\\t|$)|(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.semicolon.shell" }, "2": { "name": "punctuation.separator.statement.and.shell" }, "3": { "name": "punctuation.separator.statement.or.shell" }, "4": { "name": "punctuation.separator.statement.background.shell" } }, "name": "meta.expression.assignment.shell", "patterns": [{ "include": "#normal_statement_context" }] }, "argument": { "begin": "[ \\t]++(?!(?:&|\\||\\(|\\[|#|\\n|$|;))", "beginCaptures": {}, "end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)", "endCaptures": {}, "name": "meta.argument.shell", "patterns": [{ "include": "#argument_context" }, { "include": "#line_continuation" }] }, "argument_context": { "patterns": [{ "captures": { "1": { "name": "string.unquoted.argument.shell", "patterns": [{ "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "captures": { "1": { "name": "constant.language.$1.shell" } }, "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)" }] } }, "match": "[ \\t]*+([^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))" }, { "include": "#normal_statement_context" }] }, "assignment": { "patterns": [{ "begin": "[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))[ \\t]*+(\\()", "beginCaptures": { "1": { "name": "storage.modifier.$1.shell" }, "2": { "name": "variable.other.assignment.shell" }, "3": { "name": "punctuation.definition.array.access.shell" }, "4": { "name": "variable.other.assignment.shell" }, "5": { "name": "punctuation.definition.array.access.shell" }, "6": { "name": "keyword.operator.assignment.shell" }, "7": { "name": "keyword.operator.assignment.compound.shell" }, "8": { "name": "keyword.operator.assignment.compound.shell" }, "9": { "name": "punctuation.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.shell" } }, "name": "meta.expression.assignment.shell", "patterns": [{ "include": "#comment" }, { "include": "#argument_context" }] }, { "begin": "[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))", "beginCaptures": { "1": { "name": "storage.modifier.$1.shell" }, "2": { "name": "variable.other.assignment.shell" }, "3": { "name": "punctuation.definition.array.access.shell" }, "4": { "name": "variable.other.assignment.shell" }, "5": { "name": "punctuation.definition.array.access.shell" }, "6": { "name": "keyword.operator.assignment.shell" }, "7": { "name": "keyword.operator.assignment.compound.shell" }, "8": { "name": "keyword.operator.assignment.compound.shell" } }, "end": "(?:(?= |\\t|$)|(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n))", "endCaptures": { "1": { "name": "punctuation.terminator.statement.semicolon.shell" }, "2": { "name": "punctuation.separator.statement.and.shell" }, "3": { "name": "punctuation.separator.statement.or.shell" }, "4": { "name": "punctuation.separator.statement.background.shell" } }, "name": "meta.expression.assignment.shell", "patterns": [{ "include": "#comment" }, { "include": "#argument_context" }] }] }, "basic_command_name": { "captures": { "1": { "name": "storage.modifier.$1.shell" }, "2": { "name": "entity.name.function.call.shell entity.name.command.shell", "patterns": [{ "match": "(?<!\\w)(?:continue|return|break)(?!\\w)", "name": "keyword.control.$0.shell" }, { "match": "(?<!\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|:|\\.)(?!\\/)(?!\\w)", "name": "support.function.builtin.shell" }, { "include": "#variable" }] } }, "match": `(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!"|'|\\\\\\n?$)[^!'" \\t\\n\\r]+?))(?:(?= |\\t)|(?=;|\\||&|\\n|\\)|\\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))`, "name": "meta.statement.command.name.basic.shell" }, "block_comment": { "begin": "\\s*+(\\/\\*)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.begin.shell" } }, "end": "\\*\\/", "endCaptures": { "0": { "name": "punctuation.definition.comment.end.shell" } }, "name": "comment.block.shell" }, "boolean": { "match": "\\b(?:true|false)\\b", "name": "constant.language.$0.shell" }, "case-clause": { "patterns": [{ "begin": "(?=\\S)", "end": ";;&?|;&", "endCaptures": { "0": { "name": "punctuation.terminator.case-clause.shell" } }, "name": "meta.scope.case-clause.shell", "patterns": [{ "begin": "\\(|(?=\\S)", "beginCaptures": { "0": { "name": "punctuation.definition.case-pattern.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.case-pattern.shell" } }, "name": "meta.scope.case-pattern.shell", "patterns": [{ "match": "\\|", "name": "punctuation.separator.pipe-sign.shell" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#pathname" }] }, { "begin": "(?<=\\))", "end": "(?=;;&?|;&)", "name": "meta.scope.case-clause-body.shell", "patterns": [{ "include": "#initial_context" }] }] }] }, "comment": { "captures": { "1": { "name": "comment.line.number-sign.shell meta.shebang.shell" }, "2": { "name": "punctuation.definition.comment.shebang.shell" }, "3": { "name": "comment.line.number-sign.shell" }, "4": { "name": "punctuation.definition.comment.shell" } }, "match": "(?:^|[ \\t]++)(?:((#!).*)|((#).*))" }, "comments": { "patterns": [{ "include": "#block_comment" }, { "include": "#line_comment" }] }, "compound-command": { "patterns": [{ "begin": "\\[{1,2}", "beginCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "end": "\\]{1,2}", "endCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "name": "meta.scope.logical-expression.shell", "patterns": [{ "include": "#logical-expression" }, { "include": "#initial_context" }] }, { "begin": "\\({2}", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "\\){2}", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.other.math.shell", "patterns": [{ "include": "#math" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.subshell.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.subshell.shell" } }, "name": "meta.scope.subshell.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=\\s|^){(?=\\s|$)", "beginCaptures": { "0": { "name": "punctuation.definition.group.shell" } }, "end": "(?<=^|;)\\s*(})", "endCaptures": { "1": { "name": "punctuation.definition.group.shell" } }, "name": "meta.scope.group.shell", "patterns": [{ "include": "#initial_context" }] }] }, "continuation_of_double_quoted_command_name": { "begin": '\\G(?<=")', "beginCaptures": {}, "contentName": "meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command", "end": '"', "endCaptures": { "0": { "name": "string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell" } }, "patterns": [{ "match": '\\\\[\\$\\n`"\\\\]', "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" }] }, "continuation_of_single_quoted_command_name": { "begin": "\\G(?<=')", "beginCaptures": {}, "contentName": "meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command", "end": "'", "endCaptures": { "0": { "name": "string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell" } } }, "custom_command_names": { "patterns": [] }, "custom_commands": { "patterns": [] }, "double_quote_context": { "patterns": [{ "match": '\\\\[\\$`"\\\\\\n]', "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" }] }, "double_quote_escape_char": { "match": '\\\\[\\$`"\\\\\\n]', "name": "constant.character.escape.shell" }, "function_definition": { "applyEndPatternLast": 1, "begin": "[ \\t]*+(?:(\\bfunction\\b)[ \\t]*+([^ \\t\\n\\r\\(\\)=]+)(?:(\\()[ \\t]*+(\\)))?|([^ \\t\\n\\r\\(\\)=]+)[ \\t]*+(\\()[ \\t]*+(\\)))", "beginCaptures": { "1": { "name": "storage.type.function.shell" }, "2": { "name": "entity.name.function.shell" }, "3": { "name": "punctuation.definition.arguments.shell" }, "4": { "name": "punctuation.definition.arguments.shell" }, "5": { "name": "entity.name.function.shell" }, "6": { "name": "punctuation.definition.arguments.shell" }, "7": { "name": "punctuation.definition.arguments.shell" } }, "end": "(?<=\\}|\\))", "endCaptures": {}, "name": "meta.function.shell", "patterns": [{ "match": "\\G(?:\\t| |\\n)" }, { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "name": "meta.function.body.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell" } }, "name": "meta.function.body.shell", "patterns": [{ "include": "#initial_context" }] }] }, "heredoc": { "patterns": [{ "begin": `((?<!<)<<-)[ \\t]*+("|')[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(?:\\2)(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": {}, "3": { "name": "punctuation.definition.string.heredoc.shell" }, "4": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.quoted.heredoc.indent", "end": "^\\t*(?:\\3)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [] }, { "begin": `((?<!<)<<(?!<))[ \\t]*+("|')[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(?:\\2)(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": {}, "3": { "name": "punctuation.definition.string.heredoc.shell" }, "4": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.quoted.heredoc.no-indent", "end": "^(?:\\3)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [] }, { "begin": `((?<!<)<<-)[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": { "name": "punctuation.definition.string.heredoc.shell" }, "3": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.unquoted.heredoc.indent", "end": "^\\t*(?:\\2)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [{ "include": "#double_quote_escape_char" }, { "include": "#variable" }, { "include": "#interpolation" }] }, { "begin": `((?<!<)<<(?!<))[ \\t]*+((?<!\\w)[a-zA-Z_0-9-]+(?!\\w))(?=\\s|;|&|<|"|')(.*)`, "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" }, "2": { "name": "punctuation.definition.string.heredoc.shell" }, "3": { "patterns": [{ "include": "#normal_statement_context" }] } }, "contentName": "string.unquoted.heredoc.no-indent", "end": "^(?:\\2)(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "punctuation.definition.string.heredoc.shell" } }, "patterns": [{ "include": "#double_quote_escape_char" }, { "include": "#variable" }, { "include": "#interpolation" }] }] }, "herestring": { "patterns": [{ "begin": "(<<<)\\s*(('))", "beginCaptures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { "name": "string.quoted.single.shell" }, "3": { "name": "punctuation.definition.string.begin.shell" } }, "contentName": "string.quoted.single.shell", "end": "(')", "endCaptures": { "0": { "name": "string.quoted.single.shell" }, "1": { "name": "punctuation.definition.string.end.shell" } }, "name": "meta.herestring.shell" }, { "begin": '(<<<)\\s*(("))', "beginCaptures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { "name": "string.quoted.double.shell" }, "3": { "name": "punctuation.definition.string.begin.shell" } }, "contentName": "string.quoted.double.shell", "end": '(")', "endCaptures": { "0": { "name": "string.quoted.double.shell" }, "1": { "name": "punctuation.definition.string.end.shell" } }, "name": "meta.herestring.shell", "patterns": [{ "include": "#double_quote_context" }] }, { "captures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { "name": "string.unquoted.herestring.shell", "patterns": [{ "include": "#initial_context" }] } }, "match": "(<<<)\\s*(([^\\s)\\\\]|\\\\.)+)", "name": "meta.herestring.shell" }] }, "initial_context": { "patterns": [{ "include": "#comment" }, { "include": "#pipeline" }, { "include": "#normal_statement_seperator" }, { "include": "#logical_expression_double" }, { "include": "#logical_expression_single" }, { "include": "#misc_ranges" }, { "include": "#loop" }, { "include": "#function_definition" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#alias_statement" }, { "include": "#normal_statement" }, { "include": "#string" }, { "include": "#support" }] }, "inline_comment": { "captures": { "1": { "name": "comment.block.shell punctuation.definition.comment.begin.shell" }, "2": { "name": "comment.block.shell" }, "3": { "patterns": [{ "match": "\\*\\/", "name": "comment.block.shell punctuation.definition.comment.end.shell" }, { "match": "\\*", "name": "comment.block.shell" }] } }, "match": "(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/))" }, "interpolation": { "patterns": [{ "begin": "\\$\\({2}", "beginCaptures": { "0": { "name": "punctuation.definition.evaluation.arithmetic.begin.shell" } }, "end": "\\)\\s*\\)", "endCaptures": { "0": { "name": "punctuation.definition.evaluation.arithmetic.end.shell" } }, "name": "string.other.math.shell", "patterns": [{ "include": "#math" }] }, { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.evaluation.backticks.shell" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.evaluation.backticks.shell" } }, "name": "string.interpolated.backtick.shell", "patterns": [{ "match": "\\\\[`\\\\$]", "name": "constant.character.escape.shell" }, { "begin": "(?<=\\W)(?=#)(?!#{)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.shell" } }, "end": "(?!\\G)", "patterns": [{ "begin": "#", "beginCaptures": { "0": { "name": "punctuation.definition.comment.shell" } }, "end": "(?=`)", "name": "comment.line.number-sign.shell" }] }, { "include": "#initial_context" }] }, { "begin": "\\$\\(", "beginCaptures": { "0": { "name": "punctuation.definition.evaluation.parens.begin.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.evaluation.parens.end.shell" } }, "name": "string.interpolated.dollar.shell", "patterns": [{ "include": "#initial_context" }] }] }, "keyword": { "patterns": [{ "match": "(?<=^|;|&| |\\t)(?:continue|foreach|return|select|repeat|break|until|while|case|done|elif|else|esac|then|for|end|do|if|fi|in)(?= |\\t|;|&|$)", "name": "keyword.control.$0.shell" }] }, "line_comment": { "begin": "\\s*+(\\/\\/)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.shell" } }, "end": "(?<=\\n)(?<!\\\\\\n)", "endCaptures": {}, "name": "comment.line.double-slash.shell", "patterns": [{ "include": "#line_continuation_character" }] }, "line_continuation": { "match": "\\\\(?=\\n)", "name": "constant.character.escape.line-continuation.shell" }, "logical-expression": { "patterns": [{ "comment": "do we want a special rule for ( expr )?", "match": "=[=~]?|!=?|<|>|&&|\\|\\|", "name": "keyword.operator.logical.shell" }, { "match": "(?<!\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])\\b", "name": "keyword.operator.logical.shell" }] }, "logical_expression_context": { "patterns": [{ "include": "#regex_comparison" }, { "include": "#logical-expression" }, { "include": "#logical_expression_single" }, { "include": "#logical_expression_double" }, { "include": "#comment" }, { "include": "#boolean" }, { "include": "#redirect_number" }, { "include": "#numeric_literal" }, { "include": "#pipeline" }, { "include": "#normal_statement_seperator" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" }] }, "logical_expression_double": { "begin": "\\[\\[", "beginCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "end": "\\]\\]", "endCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "name": "meta.scope.logical-expression.shell", "patterns": [{ "include": "#logical_expression_context" }] }, "logical_expression_single": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.logical-expression.shell" } }, "name": "meta.scope.logical-expression.shell", "patterns": [{ "include": "#logical_expression_context" }] }, "loop": { "patterns": [{ "begin": "(?<=^|;|&|\\s)(for)\\s+(?=\\({2})", "beginCaptures": { "1": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.for-loop.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)(for)\\s+(.+?)\\s+(in)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { "name": "variable.other.loop.shell", "patterns": [{ "include": "#string" }] }, "3": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.for-in-loop.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)(while|until)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.while-loop.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)(select)\\s+((?:[^\\s\\\\]|\\\\.)+)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { "name": "variable.other.loop.shell" } }, "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))", "endCaptures": { "1": { "name": "keyword.control.shell" } }, "name": "meta.scope.select-block.shell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)case(?=\\s|;|&|$)", "beginCaptures": { "0": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)esac(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.case-block.shell", "patterns": [{ "begin": "(?<=^|;|&|\\s)in(?=\\s|;|&|$)", "beginCaptures": { "0": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)(?=esac(\\s|;|&|$))", "name": "meta.scope.case-body.shell", "patterns": [{ "include": "#comment" }, { "include": "#case-clause" }] }, { "include": "#initial_context" }] }, { "begin": "(?<=^|;|&|\\s)if(?=\\s|;|&|$)", "beginCaptures": { "0": { "name": "keyword.control.shell" } }, "end": "(?<=^|;|&|\\s)fi(?=\\s|;|&|$)", "endCaptures": { "0": { "name": "keyword.control.shell" } }, "name": "meta.scope.if-block.shell", "patterns": [{ "include": "#initial_context" }] }] }, "math": { "patterns": [{ "include": "#variable" }, { "match": "\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", "name": "keyword.operator.arithmetic.shell" }, { "match": "0[xX][0-9A-Fa-f]+", "name": "constant.numeric.hex.shell" }, { "match": "0\\d+", "name": "constant.numeric.octal.shell" }, { "match": "\\d{1,2}#[0-9a-zA-Z@_]+", "name": "constant.numeric.other.shell" }, { "match": "\\d+", "name": "constant.numeric.integer.shell" }] }, "misc_ranges": { "patterns": [{ "include": "#logical_expression_single" }, { "include": "#logical_expression_double" }, { "begin": "\\(\\(", "beginCaptures": { "0": { "name": "punctuation.section.arithmetic.shell" } }, "end": "\\)\\)", "endCaptures": { "0": { "name": "punctuation.section.arithmetic.shell" } }, "name": "meta.arithmetic.shell", "patterns": [{ "include": "#math" }] }, { "begin": "(?<!=)\\(", "beginCaptures": { "0": { "name": "punctuation.definition.subshell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.subshell" } }, "name": "meta.scope.subshell", "patterns": [{ "include": "#initial_context" }] }, { "begin": "(?<![^ \\t])({)", "beginCaptures": { "1": { "name": "punctuation.definition.group.shell" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.definition.group.shell" } }, "name": "meta.scope.group.shell", "patterns": [{ "include": "#initial_context" }] }] }, "modifiers": { "match": "(?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$)", "name": "storage.modifier.$0.shell" }, "normal_statement": { "begin": "(?!^[ \\t]*+$)(?:(?<=^until | until |\\tuntil |^while | while |\\twhile |^elif | elif |\\telif |^else | else |\\telse |^then | then |\\tthen |^do | do |\\tdo |^if | if |\\tif )|(?<=(?:^|;|\\||&|!|\\(|\\{|\\`)))[ \\t]*+(?!nocorrect\\W|nocorrect\\$|function\\W|function\\$|foreach\\W|foreach\\$|repeat\\W|repeat\\$|logout\\W|logout\\$|coproc\\W|coproc\\$|select\\W|select\\$|while\\W|while\\$|pushd\\W|pushd\\$|until\\W|until\\$|case\\W|case\\$|done\\W|done\\$|elif\\W|elif\\$|else\\W|else\\$|esac\\W|esac\\$|popd\\W|popd\\$|then\\W|then\\$|time\\W|time\\$|for\\W|for\\$|end\\W|end\\$|fi\\W|fi\\$|do\\W|do\\$|in\\W|in\\$|if\\W|if\\$)", "beginCaptures": {}, "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)", "endCaptures": {}, "name": "meta.statement.shell", "patterns": [{ "include": "#function_definition" }, { "include": "#assignment" }, { "begin": "[ \\t]*+(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?!\\\\\\n?$)", "beginCaptures": {}, "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)", "endCaptures": {}, "name": "meta.statement.command.shell", "patterns": [{ "begin": "\\G", "beginCaptures": {}, "end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)", "endCaptures": {}, "name": "meta.statement.command.name.shell", "patterns": [{ "include": "#modifiers" }, { "match": "(?<!\\w)(?:continue|return|break)(?!\\w)", "name": "entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell" }, { "match": "(?<!\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|:|\\.)(?!\\/)(?!\\w)", "name": "entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell" }, { "include": "#variable" }, { "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell" } }, "match": `(?<=\\G|'|"|\\}|\\))([^ \\n\\t\\r"'=;&\\|\`\\)\\{]+)` }, { "begin": `(?:\\G|(?<! |\\t|;|\\||&|\\n|\\{|#))((?:\\$)?)((?:(")|(')))`, "beginCaptures": { "1": { "name": "meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell" }, "2": {}, "3": { "name": "meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" }, "4": { "name": "meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" } }, "end": "(?<!\\G)(?<=(?:\\2))", "endCaptures": {}, "patterns": [{ "include": "#continuation_of_single_quoted_command_name" }, { "include": "#continuation_of_double_quoted_command_name" }] }, { "include": "#line_continuation" }] }, { "include": "#line_continuation" }, { "include": "#option" }, { "include": "#argument" }, { "include": "#statement_context" }, { "include": "#string" }] }, { "include": "#line_continuation" }, { "include": "#normal_statement_context" }] }, "normal_statement_context": { "patterns": [{ "include": "#comment" }, { "include": "#pipeline" }, { "include": "#normal_statement_seperator" }, { "include": "#misc_ranges" }, { "include": "#boolean" }, { "include": "#redirect_number" }, { "include": "#numeric_literal" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" }] }, "normal_statement_seperator": { "captures": { "1": { "name": "punctuation.terminator.statement.semicolon.shell" }, "2": { "name": "punctuation.separator.statement.and.shell" }, "3": { "name": "punctuation.separator.statement.or.shell" }, "4": { "name": "punctuation.separator.statement.background.shell" } }, "match": "(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n)" }, "numeric_literal": { "captures": { "1": { "name": "constant.numeric.shell constant.numeric.hex.shell" }, "2": { "name": "constant.numeric.shell constant.numeric.octal.shell" }, "3": { "name": "constant.numeric.shell constant.numeric.other.shell" }, "4": { "name": "constant.numeric.shell constant.numeric.integer.shell" }, "5": { "name": "constant.numeric.shell constant.numeric.integer.shell" } }, "match": "[ \\t]*+(?<==| |\\t|^|\\{|\\(|\\[)(?:(?:(?:(?:(0[xX][0-9A-Fa-f]+)|(0\\d+))|(\\d{1,2}#[0-9a-zA-Z@_]+))|(-?\\d+\\.\\d+))|(-?\\d+))(?!>)" }, "option": { "begin": "[ \\t]++(-)((?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t])))", "beginCaptures": { "1": { "name": "string.unquoted.argument.shell constant.other.option.dash.shell" }, "2": { "name": "string.unquoted.argument.shell constant.other.option.shell" } }, "contentName": "string.unquoted.argument constant.other.option", "end": "(?:(?=[ \\t])|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))", "endCaptures": {}, "patterns": [{ "include": "#option_context" }] }, "option_context": { "patterns": [{ "include": "#misc_ranges" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" }] }, "pathname": { "patterns": [{ "match": "(?<=\\s|:|=|^)~", "name": "keyword.operator.tilde.shell" }, { "match": "\\*|\\?", "name": "keyword.operator.glob.shell" }, { "begin": "([?*+@!])(\\()", "beginCaptures": { "1": { "name": "keyword.operator.extglob.shell" }, "2": { "name": "punctuation.definition.extglob.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.extglob.shell" } }, "name": "meta.structure.extglob.shell", "patterns": [{ "include": "#initial_context" }] }] }, "pipeline": { "patterns": [{ "match": "(?<=^|;|&|\\s)(time)(?=\\s|;|&|$)", "name": "keyword.other.shell" }, { "match": "[|!]", "name": "keyword.operator.pipe.shell" }] }, "redirect_number": { "captures": { "1": { "name": "keyword.operator.redirect.stdout.shell" }, "2": { "name": "keyword.operator.redirect.stderr.shell" }, "3": { "name": "keyword.operator.redirect.$3.shell" } }, "match": "(?<=[ \\t])(?:(1)|(2)|(\\d+))(?=>)" }, "redirection": { "patterns": [{ "begin": "[><]\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.interpolated.process-substitution.shell", "patterns": [{ "include": "#initial_context" }] }, { "match": "(?<![<>])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])", "name": "keyword.operator.redirect.shell" }] }, "regex_comparison": { "match": "\\=~", "name": "keyword.operator.logical.regex.shell" }, "regexp": { "patterns": [{ "match": ".+" }] }, "simple_options": { "captures": { "0": { "patterns": [{ "captures": { "1": { "name": "string.unquoted.argument.shell constant.other.option.dash.shell" }, "2": { "name": "string.unquoted.argument.shell constant.other.option.shell" } }, "match": "[ \\t]++(\\-)(\\w+)" }] } }, "match": "(?:[ \\t]++\\-\\w+)*" }, "start_of_command": { "match": "[ \\t]*+(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?!\\\\\\n?$)" }, "start_of_double_quoted_command_name": { "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell", "patterns": [{ "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "captures": { "1": { "name": "constant.language.$1.shell" } }, "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)" }] } }, "match": '(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:[ \\t]*+([^ \\t\\n\'&;<>\\(\\)\\$`\\\\"\\|]+(?!>)))?(?:(?:\\$")|")', "name": "meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" }, "start_of_single_quoted_command_name": { "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell", "patterns": [{ "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "captures": { "1": { "name": "constant.language.$1.shell" } }, "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)" }] } }, "match": "(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:[ \\t]*+([^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$')|')", "name": "meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell" }, "string": { "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.shell" }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.shell" }, { "begin": '\\$?"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.double.shell", "patterns": [{ "match": '\\\\[\\$\\n`"\\\\]', "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" }] }, { "begin": "\\$'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.dollar.shell", "patterns": [{ "match": "\\\\(?:a|b|e|f|n|r|t|v|\\\\|')", "name": "constant.character.escape.ansi-c.shell" }, { "match": '\\\\[0-9]{3}"', "name": "constant.character.escape.octal.shell" }, { "match": '\\\\x[0-9a-fA-F]{2}"', "name": "constant.character.escape.hex.shell" }, { "match": '\\\\c."', "name": "constant.character.escape.control-char.shell" }] }] }, "support": { "patterns": [{ "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)", "name": "support.function.builtin.shell" }] }, "variable": { "patterns": [{ "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell" }, "2": { "name": "variable.parameter.positional.all.shell" } }, "match": "(\\$)(\\@(?!\\w))" }, { "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" }, "2": { "name": "variable.parameter.positional.shell" } }, "match": "(\\$)([0-9](?!\\w))" }, { "captures": { "1": { "name": "punctuation.definition.variable.shell variable.language.special.shell" }, "2": { "name": "variable.language.special.shell" } }, "match": "(\\$)([-*#?$!0_](?!\\w))" }, { "begin": "(\\$)(\\{)[ \\t]*+(?=\\d)", "beginCaptures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" }, "2": { "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell" } }, "contentName": "meta.parameter-expansion", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell" } }, "patterns": [{ "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", "name": "keyword.operator.expansion.shell" }, { "captures": { "1": { "name": "punctuation.section.array.shell" }, "2": { "name": "punctuation.section.array.shell" } }, "match": "(\\[)[^\\]]+(\\])" }, { "match": "[0-9]+", "name": "variable.parameter.positional.shell" }, { "match": "(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)", "name": "variable.other.normal.shell" }, { "include": "#variable" }, { "include": "#string" }] }, { "begin": "(\\$)(\\{)", "beginCaptures": { "1": { "name": "punctuation.definition.variable.shell" }, "2": { "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell" } }, "contentName": "meta.parameter-expansion", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell" } }, "patterns": [{ "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", "name": "keyword.operator.expansion.shell" }, { "captures": { "1": { "name": "punctuation.section.array.shell" }, "2": { "name": "punctuation.section.array.shell" } }, "match": "(\\[)[^\\]]+(\\])" }, { "match": "(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)", "name": "variable.other.normal.shell" }, { "include": "#variable" }, { "include": "#string" }] }, { "captures": { "1": { "name": "punctuation.definition.variable.shell variable.other.normal.shell" }, "2": { "name": "variable.other.normal.shell" } }, "match": "(\\$)(\\w+(?!\\w))" }] } }, "scopeName": "source.shell", "aliases": ["bash", "sh", "shell", "zsh"] });
2
2
  var shellscript = [
3
3
  lang
4
4
  ];
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "Terraform", "fileTypes": ["tf", "tfvars"], "name": "terraform", "patterns": [{ "include": "#comments" }, { "include": "#attribute_definition" }, { "include": "#block" }, { "include": "#expressions" }], "repository": { "attribute_access": { "begin": "\\.(?!\\*)", "beginCaptures": { "0": { "name": "keyword.operator.accessor.hcl" } }, "comment": "Matches traversal attribute access such as .attr", "end": "[[:alpha:]][\\w-]*|\\d*", "endCaptures": { "0": { "patterns": [{ "comment": "Attribute name", "match": "(?!null|false|true)[[:alpha:]][\\w-]*", "name": "variable.other.member.hcl" }, { "comment": "Optional attribute index", "match": "\\d+", "name": "constant.numeric.integer.hcl" }] } } }, "attribute_definition": { "captures": { "1": { "name": "punctuation.section.parens.begin.hcl" }, "2": { "name": "variable.other.readwrite.hcl" }, "3": { "name": "punctuation.section.parens.end.hcl" }, "4": { "name": "keyword.operator.assignment.hcl" } }, "comment": 'Identifier "=" with optional parens', "match": "(\\()?(\\b(?!null\\b|false\\b|true\\b)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=(?!\\=|\\>))\\s*", "name": "variable.declaration.hcl" }, "attribute_splat": { "begin": "\\.", "beginCaptures": { "0": { "name": "keyword.operator.accessor.hcl" } }, "comment": "Legacy attribute-only splat", "end": "\\*", "endCaptures": { "0": { "name": "keyword.operator.splat.hcl" } } }, "block": { "begin": '([\\w][\\-\\w]*)([\\s\\"\\-\\w]*)(\\{)', "beginCaptures": { "1": { "patterns": [{ "comment": "Known block type", "match": "\\bdata|check|import|locals|module|output|provider|resource|terraform|variable\\b", "name": "entity.name.type.terraform" }, { "comment": "Unknown block type", "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b", "name": "entity.name.type.hcl" }] }, "2": { "patterns": [{ "comment": "Block label", "match": '[\\"\\-\\w]+', "name": "variable.other.enummember.hcl" }] }, "3": { "name": "punctuation.section.block.begin.hcl" } }, "comment": 'This will match Terraform blocks like `resource "aws_instance" "web" {` or `module {`', "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.hcl" } }, "name": "meta.block.hcl", "patterns": [{ "include": "#comments" }, { "include": "#attribute_definition" }, { "include": "#block" }, { "include": "#expressions" }] }, "block_inline_comments": { "begin": "/\\*", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Inline comments start with the /* sequence and end with the */ sequence, and may have any characters within except the ending sequence. An inline comment is considered equivalent to a whitespace sequence", "end": "\\*/", "name": "comment.block.hcl" }, "brackets": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.section.brackets.begin.hcl" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.end.hcl" } }, "patterns": [{ "comment": "Splat operator", "match": "\\*", "name": "keyword.operator.splat.hcl" }, { "include": "#comma" }, { "include": "#comments" }, { "include": "#inline_for_expression" }, { "include": "#inline_if_expression" }, { "include": "#expressions" }, { "include": "#local_identifiers" }] }, "char_escapes": { "comment": "Character Escapes", "match": '\\\\[nrt"\\\\]|\\\\u(\\h{8}|\\h{4})', "name": "constant.character.escape.hcl" }, "comma": { "comment": "Commas - used in certain expressions", "match": "\\,", "name": "punctuation.separator.hcl" }, "comments": { "patterns": [{ "include": "#hash_line_comments" }, { "include": "#double_slash_line_comments" }, { "include": "#block_inline_comments" }] }, "double_slash_line_comments": { "begin": "//", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Line comments start with // sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence", "end": "$\\n?", "name": "comment.line.double-slash.hcl" }, "expressions": { "patterns": [{ "include": "#literal_values" }, { "include": "#operators" }, { "include": "#tuple_for_expression" }, { "include": "#object_for_expression" }, { "include": "#brackets" }, { "include": "#objects" }, { "include": "#attribute_access" }, { "include": "#attribute_splat" }, { "include": "#functions" }, { "include": "#parens" }] }, "for_expression_body": { "patterns": [{ "comment": "in keyword", "match": "\\bin\\b", "name": "keyword.operator.word.hcl" }, { "comment": "if keyword", "match": "\\bif\\b", "name": "keyword.control.conditional.hcl" }, { "match": "\\:", "name": "keyword.operator.hcl" }, { "include": "#expressions" }, { "include": "#comments" }, { "include": "#comma" }, { "include": "#local_identifiers" }] }, "functions": { "begin": "(\\w+)(\\()", "beginCaptures": { "1": { "patterns": [{ "match": "\\b(abs|abspath|alltrue|anytrue|base64decode|base64encode|base64gzip|base64sha256|base64sha512|basename|bcrypt|can|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|cidrsubnets|coalesce|coalescelist|compact|concat|contains|csvdecode|dirname|distinct|element|endswith|file|filebase64|filebase64sha256|filebase64sha512|fileexists|filemd5|fileset|filesha1|filesha256|filesha512|flatten|floor|format|formatdate|formatlist|indent|index|join|jsondecode|jsonencode|keys|length|log|lookup|lower|matchkeys|max|md5|merge|min|nonsensitive|one|parseint|pathexpand|plantimestamp|pow|range|regex|regexall|replace|reverse|rsadecrypt|sensitive|setintersection|setproduct|setsubtract|setunion|sha1|sha256|sha512|signum|slice|sort|split|startswith|strcontains|strrev|substr|sum|templatefile|textdecodebase64|textencodebase64|timeadd|timecmp|timestamp|title|tobool|tolist|tomap|tonumber|toset|tostring|transpose|trim|trimprefix|trimspace|trimsuffix|try|upper|urlencode|uuid|uuidv5|values|yamldecode|yamlencode|zipmap)\\b", "name": "support.function.builtin.terraform" }] }, "2": { "name": "punctuation.section.parens.begin.hcl" } }, "comment": "Built-in function calls", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.hcl" } }, "name": "meta.function-call.hcl", "patterns": [{ "include": "#comments" }, { "include": "#expressions" }, { "include": "#comma" }] }, "hash_line_comments": { "begin": "#", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Line comments start with # sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence", "end": "$\\n?", "name": "comment.line.number-sign.hcl" }, "hcl_type_keywords": { "comment": "Type keywords known to HCL.", "match": "\\b(any|string|number|bool|list|set|map|tuple|object)\\b", "name": "storage.type.hcl" }, "heredoc": { "begin": "(\\<\\<\\-?)\\s*(\\w+)\\s*$", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.hcl" }, "2": { "name": "keyword.control.heredoc.hcl" } }, "comment": "String Heredoc", "end": "^\\s*\\2\\s*$", "endCaptures": { "0": { "name": "keyword.control.heredoc.hcl" } }, "name": "string.unquoted.heredoc.hcl", "patterns": [{ "include": "#string_interpolation" }] }, "inline_for_expression": { "begin": "(for)\\b", "beginCaptures": { "1": { "name": "keyword.control.hcl" } }, "end": "\\n", "patterns": [{ "match": "\\=\\>", "name": "storage.type.function.hcl" }, { "include": "#for_expression_body" }] }, "inline_if_expression": { "begin": "(if)\\b", "beginCaptures": { "1": { "name": "keyword.control.conditional.hcl" } }, "end": "\\n", "patterns": [{ "include": "#expressions" }, { "include": "#comments" }, { "include": "#comma" }, { "include": "#local_identifiers" }] }, "language_constants": { "comment": "Language Constants", "match": "\\b(true|false|null)\\b", "name": "constant.language.hcl" }, "literal_values": { "patterns": [{ "include": "#numeric_literals" }, { "include": "#language_constants" }, { "include": "#string_literals" }, { "include": "#heredoc" }, { "include": "#hcl_type_keywords" }, { "include": "#named_value_references" }] }, "local_identifiers": { "comment": "Local Identifiers", "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b", "name": "variable.other.readwrite.hcl" }, "named_value_references": { "comment": "Constant values available only to Terraform.", "match": "\\b(var|local|module|data|path|terraform)\\b", "name": "variable.other.readwrite.terraform" }, "numeric_literals": { "patterns": [{ "captures": { "1": { "name": "punctuation.separator.exponent.hcl" } }, "comment": "Integer, no fraction, optional exponent", "match": "\\b\\d+([Ee][+-]?)\\d+\\b", "name": "constant.numeric.float.hcl" }, { "captures": { "1": { "name": "punctuation.separator.decimal.hcl" }, "2": { "name": "punctuation.separator.exponent.hcl" } }, "comment": "Integer, fraction, optional exponent", "match": "\\b\\d+(\\.)\\d+(?:([Ee][+-]?)\\d+)?\\b", "name": "constant.numeric.float.hcl" }, { "comment": "Integers", "match": "\\b\\d+\\b", "name": "constant.numeric.integer.hcl" }] }, "object_for_expression": { "begin": "(\\{)\\s?(for)\\b", "beginCaptures": { "1": { "name": "punctuation.section.braces.begin.hcl" }, "2": { "name": "keyword.control.hcl" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.braces.end.hcl" } }, "patterns": [{ "match": "\\=\\>", "name": "storage.type.function.hcl" }, { "include": "#for_expression_body" }] }, "object_key_values": { "patterns": [{ "include": "#comments" }, { "include": "#literal_values" }, { "include": "#operators" }, { "include": "#tuple_for_expression" }, { "include": "#object_for_expression" }, { "include": "#heredoc" }, { "include": "#functions" }] }, "objects": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.braces.begin.hcl" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.braces.end.hcl" } }, "name": "meta.braces.hcl", "patterns": [{ "include": "#comments" }, { "include": "#objects" }, { "include": "#inline_for_expression" }, { "include": "#inline_if_expression" }, { "captures": { "1": { "name": "meta.mapping.key.hcl variable.other.readwrite.hcl" }, "2": { "name": "keyword.operator.assignment.hcl", "patterns": [{ "match": "\\=\\>", "name": "storage.type.function.hcl" }] } }, "comment": "Literal, named object key", "match": "\\b((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)\\s*(\\=\\>?)\\s*" }, { "captures": { "0": { "patterns": [{ "include": "#named_value_references" }] }, "1": { "name": "meta.mapping.key.hcl string.quoted.double.hcl" }, "2": { "name": "punctuation.definition.string.begin.hcl" }, "3": { "name": "punctuation.definition.string.end.hcl" }, "4": { "name": "keyword.operator.hcl" } }, "comment": "String object key", "match": '\\b((").*("))\\s*(\\=)\\s*' }, { "begin": "^\\s*\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.hcl" } }, "comment": "Computed object key (any expression between parens)", "end": "(\\))\\s*(=|:)\\s*", "endCaptures": { "1": { "name": "punctuation.section.parens.end.hcl" }, "2": { "name": "keyword.operator.hcl" } }, "name": "meta.mapping.key.hcl", "patterns": [{ "include": "#named_value_references" }, { "include": "#attribute_access" }] }, { "include": "#object_key_values" }] }, "operators": { "patterns": [{ "match": "\\>\\=", "name": "keyword.operator.hcl" }, { "match": "\\<\\=", "name": "keyword.operator.hcl" }, { "match": "\\=\\=", "name": "keyword.operator.hcl" }, { "match": "\\!\\=", "name": "keyword.operator.hcl" }, { "match": "\\+", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\-", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\*", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\/", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\%", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\&\\&", "name": "keyword.operator.logical.hcl" }, { "match": "\\|\\|", "name": "keyword.operator.logical.hcl" }, { "match": "\\!", "name": "keyword.operator.logical.hcl" }, { "match": "\\>", "name": "keyword.operator.hcl" }, { "match": "\\<", "name": "keyword.operator.hcl" }, { "match": "\\?", "name": "keyword.operator.hcl" }, { "match": "\\.\\.\\.", "name": "keyword.operator.hcl" }, { "match": "\\:" }] }, "parens": { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.hcl" } }, "comment": "Parens - matched *after* function syntax", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.hcl" } }, "patterns": [{ "include": "#comments" }, { "include": "#expressions" }] }, "string_interpolation": { "begin": "(?<![%$])([%$]{)", "beginCaptures": { "1": { "name": "keyword.other.interpolation.begin.hcl" } }, "comment": "String interpolation", "end": "\\}", "endCaptures": { "0": { "name": "keyword.other.interpolation.end.hcl" } }, "name": "meta.interpolation.hcl", "patterns": [{ "comment": "Trim left whitespace", "match": "\\~\\s", "name": "keyword.operator.template.left.trim.hcl" }, { "comment": "Trim right whitespace", "match": "\\s\\~", "name": "keyword.operator.template.right.trim.hcl" }, { "comment": "if/else/endif and for/in/endfor directives", "match": "\\b(if|else|endif|for|in|endfor)\\b", "name": "keyword.control.hcl" }, { "include": "#expressions" }, { "include": "#local_identifiers" }] }, "string_literals": { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.hcl" } }, "comment": "Strings", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.hcl" } }, "name": "string.quoted.double.hcl", "patterns": [{ "include": "#string_interpolation" }, { "include": "#char_escapes" }] }, "tuple_for_expression": { "begin": "(\\[)\\s?(for)\\b", "beginCaptures": { "1": { "name": "punctuation.section.brackets.begin.hcl" }, "2": { "name": "keyword.control.hcl" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.end.hcl" } }, "patterns": [{ "include": "#for_expression_body" }] } }, "scopeName": "source.hcl.terraform", "aliases": ["tf", "tfvars"] });
1
+ const lang = Object.freeze({ "displayName": "Terraform", "fileTypes": ["tf", "tfvars"], "name": "terraform", "patterns": [{ "include": "#comments" }, { "include": "#attribute_definition" }, { "include": "#block" }, { "include": "#expressions" }], "repository": { "attribute_access": { "begin": "\\.(?!\\*)", "beginCaptures": { "0": { "name": "keyword.operator.accessor.hcl" } }, "comment": "Matches traversal attribute access such as .attr", "end": "[[:alpha:]][\\w-]*|\\d*", "endCaptures": { "0": { "patterns": [{ "comment": "Attribute name", "match": "(?!null|false|true)[[:alpha:]][\\w-]*", "name": "variable.other.member.hcl" }, { "comment": "Optional attribute index", "match": "\\d+", "name": "constant.numeric.integer.hcl" }] } } }, "attribute_definition": { "captures": { "1": { "name": "punctuation.section.parens.begin.hcl" }, "2": { "name": "variable.other.readwrite.hcl" }, "3": { "name": "punctuation.section.parens.end.hcl" }, "4": { "name": "keyword.operator.assignment.hcl" } }, "comment": 'Identifier "=" with optional parens', "match": "(\\()?(\\b(?!null\\b|false\\b|true\\b)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=(?!\\=|\\>))\\s*", "name": "variable.declaration.hcl" }, "attribute_splat": { "begin": "\\.", "beginCaptures": { "0": { "name": "keyword.operator.accessor.hcl" } }, "comment": "Legacy attribute-only splat", "end": "\\*", "endCaptures": { "0": { "name": "keyword.operator.splat.hcl" } } }, "block": { "begin": '([\\w][\\-\\w]*)([\\s\\"\\-\\w]*)(\\{)', "beginCaptures": { "1": { "patterns": [{ "comment": "Known block type", "match": "\\bdata|check|import|locals|module|output|provider|resource|terraform|variable\\b", "name": "entity.name.type.terraform" }, { "comment": "Unknown block type", "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b", "name": "entity.name.type.hcl" }] }, "2": { "patterns": [{ "comment": "Block label", "match": '[\\"\\-\\w]+', "name": "variable.other.enummember.hcl" }] }, "3": { "name": "punctuation.section.block.begin.hcl" } }, "comment": 'This will match Terraform blocks like `resource "aws_instance" "web" {` or `module {`', "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.block.end.hcl" } }, "name": "meta.block.hcl", "patterns": [{ "include": "#comments" }, { "include": "#attribute_definition" }, { "include": "#block" }, { "include": "#expressions" }] }, "block_inline_comments": { "begin": "/\\*", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Inline comments start with the /* sequence and end with the */ sequence, and may have any characters within except the ending sequence. An inline comment is considered equivalent to a whitespace sequence", "end": "\\*/", "name": "comment.block.hcl" }, "brackets": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.section.brackets.begin.hcl" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.end.hcl" } }, "patterns": [{ "comment": "Splat operator", "match": "\\*", "name": "keyword.operator.splat.hcl" }, { "include": "#comma" }, { "include": "#comments" }, { "include": "#inline_for_expression" }, { "include": "#inline_if_expression" }, { "include": "#expressions" }, { "include": "#local_identifiers" }] }, "char_escapes": { "comment": "Character Escapes", "match": '\\\\[nrt"\\\\]|\\\\u(\\h{8}|\\h{4})', "name": "constant.character.escape.hcl" }, "comma": { "comment": "Commas - used in certain expressions", "match": "\\,", "name": "punctuation.separator.hcl" }, "comments": { "patterns": [{ "include": "#hash_line_comments" }, { "include": "#double_slash_line_comments" }, { "include": "#block_inline_comments" }] }, "double_slash_line_comments": { "begin": "//", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Line comments start with // sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence", "end": "$\\n?", "name": "comment.line.double-slash.hcl" }, "expressions": { "patterns": [{ "include": "#literal_values" }, { "include": "#operators" }, { "include": "#tuple_for_expression" }, { "include": "#object_for_expression" }, { "include": "#brackets" }, { "include": "#objects" }, { "include": "#attribute_access" }, { "include": "#attribute_splat" }, { "include": "#functions" }, { "include": "#parens" }] }, "for_expression_body": { "patterns": [{ "comment": "in keyword", "match": "\\bin\\b", "name": "keyword.operator.word.hcl" }, { "comment": "if keyword", "match": "\\bif\\b", "name": "keyword.control.conditional.hcl" }, { "match": "\\:", "name": "keyword.operator.hcl" }, { "include": "#expressions" }, { "include": "#comments" }, { "include": "#comma" }, { "include": "#local_identifiers" }] }, "functions": { "begin": "([:\\-\\w]+)(\\()", "beginCaptures": { "1": { "patterns": [{ "match": "\\b(abs|abspath|alltrue|anytrue|base64decode|base64encode|base64gzip|base64sha256|base64sha512|basename|bcrypt|can|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|cidrsubnets|coalesce|coalescelist|compact|concat|contains|csvdecode|dirname|distinct|element|endswith|file|filebase64|filebase64sha256|filebase64sha512|fileexists|filemd5|fileset|filesha1|filesha256|filesha512|flatten|floor|format|formatdate|formatlist|indent|index|join|jsondecode|jsonencode|keys|length|log|lookup|lower|matchkeys|max|md5|merge|min|nonsensitive|one|parseint|pathexpand|plantimestamp|pow|range|regex|regexall|replace|reverse|rsadecrypt|sensitive|setintersection|setproduct|setsubtract|setunion|sha1|sha256|sha512|signum|slice|sort|split|startswith|strcontains|strrev|substr|sum|templatefile|textdecodebase64|textencodebase64|timeadd|timecmp|timestamp|title|tobool|tolist|tomap|tonumber|toset|tostring|transpose|trim|trimprefix|trimspace|trimsuffix|try|upper|urlencode|uuid|uuidv5|values|yamldecode|yamlencode|zipmap)\\b", "name": "support.function.builtin.terraform" }, { "match": "\\bprovider::[[:alpha:]][\\w_-]*::[[:alpha:]][\\w_-]*\\b", "name": "support.function.provider" }] }, "2": { "name": "punctuation.section.parens.begin.hcl" } }, "comment": "Built-in function calls", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.hcl" } }, "name": "meta.function-call.hcl", "patterns": [{ "include": "#comments" }, { "include": "#expressions" }, { "include": "#comma" }] }, "hash_line_comments": { "begin": "#", "captures": { "0": { "name": "punctuation.definition.comment.hcl" } }, "comment": "Line comments start with # sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence", "end": "$\\n?", "name": "comment.line.number-sign.hcl" }, "hcl_type_keywords": { "comment": "Type keywords known to HCL.", "match": "\\b(any|string|number|bool|list|set|map|tuple|object)\\b", "name": "storage.type.hcl" }, "heredoc": { "begin": "(\\<\\<\\-?)\\s*(\\w+)\\s*$", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.hcl" }, "2": { "name": "keyword.control.heredoc.hcl" } }, "comment": "String Heredoc", "end": "^\\s*\\2\\s*$", "endCaptures": { "0": { "name": "keyword.control.heredoc.hcl" } }, "name": "string.unquoted.heredoc.hcl", "patterns": [{ "include": "#string_interpolation" }] }, "inline_for_expression": { "begin": "(for)\\b", "beginCaptures": { "1": { "name": "keyword.control.hcl" } }, "end": "\\n", "patterns": [{ "match": "\\=\\>", "name": "storage.type.function.hcl" }, { "include": "#for_expression_body" }] }, "inline_if_expression": { "begin": "(if)\\b", "beginCaptures": { "1": { "name": "keyword.control.conditional.hcl" } }, "end": "\\n", "patterns": [{ "include": "#expressions" }, { "include": "#comments" }, { "include": "#comma" }, { "include": "#local_identifiers" }] }, "language_constants": { "comment": "Language Constants", "match": "\\b(true|false|null)\\b", "name": "constant.language.hcl" }, "literal_values": { "patterns": [{ "include": "#numeric_literals" }, { "include": "#language_constants" }, { "include": "#string_literals" }, { "include": "#heredoc" }, { "include": "#hcl_type_keywords" }, { "include": "#named_value_references" }] }, "local_identifiers": { "comment": "Local Identifiers", "match": "\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b", "name": "variable.other.readwrite.hcl" }, "named_value_references": { "comment": "Constant values available only to Terraform.", "match": "\\b(var|local|module|data|path|terraform)\\b", "name": "variable.other.readwrite.terraform" }, "numeric_literals": { "patterns": [{ "captures": { "1": { "name": "punctuation.separator.exponent.hcl" } }, "comment": "Integer, no fraction, optional exponent", "match": "\\b\\d+([Ee][+-]?)\\d+\\b", "name": "constant.numeric.float.hcl" }, { "captures": { "1": { "name": "punctuation.separator.decimal.hcl" }, "2": { "name": "punctuation.separator.exponent.hcl" } }, "comment": "Integer, fraction, optional exponent", "match": "\\b\\d+(\\.)\\d+(?:([Ee][+-]?)\\d+)?\\b", "name": "constant.numeric.float.hcl" }, { "comment": "Integers", "match": "\\b\\d+\\b", "name": "constant.numeric.integer.hcl" }] }, "object_for_expression": { "begin": "(\\{)\\s?(for)\\b", "beginCaptures": { "1": { "name": "punctuation.section.braces.begin.hcl" }, "2": { "name": "keyword.control.hcl" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.braces.end.hcl" } }, "patterns": [{ "match": "\\=\\>", "name": "storage.type.function.hcl" }, { "include": "#for_expression_body" }] }, "object_key_values": { "patterns": [{ "include": "#comments" }, { "include": "#literal_values" }, { "include": "#operators" }, { "include": "#tuple_for_expression" }, { "include": "#object_for_expression" }, { "include": "#heredoc" }, { "include": "#functions" }] }, "objects": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.section.braces.begin.hcl" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.section.braces.end.hcl" } }, "name": "meta.braces.hcl", "patterns": [{ "include": "#comments" }, { "include": "#objects" }, { "include": "#inline_for_expression" }, { "include": "#inline_if_expression" }, { "captures": { "1": { "name": "meta.mapping.key.hcl variable.other.readwrite.hcl" }, "2": { "name": "keyword.operator.assignment.hcl", "patterns": [{ "match": "\\=\\>", "name": "storage.type.function.hcl" }] } }, "comment": "Literal, named object key", "match": "\\b((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)\\s*(\\=\\>?)\\s*" }, { "captures": { "0": { "patterns": [{ "include": "#named_value_references" }] }, "1": { "name": "meta.mapping.key.hcl string.quoted.double.hcl" }, "2": { "name": "punctuation.definition.string.begin.hcl" }, "3": { "name": "punctuation.definition.string.end.hcl" }, "4": { "name": "keyword.operator.hcl" } }, "comment": "String object key", "match": '\\b((").*("))\\s*(\\=)\\s*' }, { "begin": "^\\s*\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.hcl" } }, "comment": "Computed object key (any expression between parens)", "end": "(\\))\\s*(=|:)\\s*", "endCaptures": { "1": { "name": "punctuation.section.parens.end.hcl" }, "2": { "name": "keyword.operator.hcl" } }, "name": "meta.mapping.key.hcl", "patterns": [{ "include": "#named_value_references" }, { "include": "#attribute_access" }] }, { "include": "#object_key_values" }] }, "operators": { "patterns": [{ "match": "\\>\\=", "name": "keyword.operator.hcl" }, { "match": "\\<\\=", "name": "keyword.operator.hcl" }, { "match": "\\=\\=", "name": "keyword.operator.hcl" }, { "match": "\\!\\=", "name": "keyword.operator.hcl" }, { "match": "\\+", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\-", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\*", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\/", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\%", "name": "keyword.operator.arithmetic.hcl" }, { "match": "\\&\\&", "name": "keyword.operator.logical.hcl" }, { "match": "\\|\\|", "name": "keyword.operator.logical.hcl" }, { "match": "\\!", "name": "keyword.operator.logical.hcl" }, { "match": "\\>", "name": "keyword.operator.hcl" }, { "match": "\\<", "name": "keyword.operator.hcl" }, { "match": "\\?", "name": "keyword.operator.hcl" }, { "match": "\\.\\.\\.", "name": "keyword.operator.hcl" }, { "match": "\\:" }] }, "parens": { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.parens.begin.hcl" } }, "comment": "Parens - matched *after* function syntax", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.parens.end.hcl" } }, "patterns": [{ "include": "#comments" }, { "include": "#expressions" }] }, "string_interpolation": { "begin": "(?<![%$])([%$]{)", "beginCaptures": { "1": { "name": "keyword.other.interpolation.begin.hcl" } }, "comment": "String interpolation", "end": "\\}", "endCaptures": { "0": { "name": "keyword.other.interpolation.end.hcl" } }, "name": "meta.interpolation.hcl", "patterns": [{ "comment": "Trim left whitespace", "match": "\\~\\s", "name": "keyword.operator.template.left.trim.hcl" }, { "comment": "Trim right whitespace", "match": "\\s\\~", "name": "keyword.operator.template.right.trim.hcl" }, { "comment": "if/else/endif and for/in/endfor directives", "match": "\\b(if|else|endif|for|in|endfor)\\b", "name": "keyword.control.hcl" }, { "include": "#expressions" }, { "include": "#local_identifiers" }] }, "string_literals": { "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.hcl" } }, "comment": "Strings", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.hcl" } }, "name": "string.quoted.double.hcl", "patterns": [{ "include": "#string_interpolation" }, { "include": "#char_escapes" }] }, "tuple_for_expression": { "begin": "(\\[)\\s?(for)\\b", "beginCaptures": { "1": { "name": "punctuation.section.brackets.begin.hcl" }, "2": { "name": "keyword.control.hcl" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.section.brackets.end.hcl" } }, "patterns": [{ "include": "#for_expression_body" }] } }, "scopeName": "source.hcl.terraform", "aliases": ["tf", "tfvars"] });
2
2
  var terraform = [
3
3
  lang
4
4
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shiki",
3
3
  "type": "module",
4
- "version": "1.1.6",
4
+ "version": "1.1.7",
5
5
  "description": "A beautiful Syntax Highlighter.",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -91,10 +91,10 @@
91
91
  "dist"
92
92
  ],
93
93
  "dependencies": {
94
- "@shikijs/core": "1.1.6"
94
+ "@shikijs/core": "1.1.7"
95
95
  },
96
96
  "devDependencies": {
97
- "tm-grammars": "^1.4.0",
97
+ "tm-grammars": "^1.4.4",
98
98
  "tm-themes": "^1.1.3",
99
99
  "vscode-oniguruma": "^1.7.0"
100
100
  },