{ "information_for_contributors": [ "This file has been converted from https://github.com/jeff-hykin/better-shell-syntax/blob/master/autogenerated/shell.tmLanguage.json", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/jeff-hykin/better-shell-syntax/commit/35020b0bd79a90d3b262b4c13a8bb0b33adc1f45", "name": "Shell Script", "scopeName": "source.shell", "patterns": [ { "include": "#initial_context" } ], "repository": { "alias_statement": { "begin": "(?:(?:[ \\t]*+)(alias)(?:[ \\t]*+)((?:(?:((?&;<>\\(\\)\\$`\\\\\"'<\\|]+)(?!>))", "captures": { "1": { "name": "string.unquoted.argument.shell", "patterns": [ { "match": "\\*", "name": "variable.language.special.wildcard.shell" }, { "include": "#variable" }, { "include": "#numeric_literal" }, { "match": "(?|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\"<> \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?]+))", "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell" } } }, { "begin": "(?:(?:\\G|(?|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$)(?!\\\\\\n?$)))", "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?|&&|\\|\\|", "name": "keyword.operator.logical.shell" }, { "match": "(?[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", "name": "keyword.operator.arithmetic.shell" }, { "match": "0[xX][0-9A-Fa-f]+", "name": "constant.numeric.hex.shell" }, { "match": ";", "name": "punctuation.separator.semicolon.range" }, { "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" }, { "match": "(?[>=]?|==|!=|^|\\|{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" }, { "include": "#subshell_dollar" }, { "begin": "(?|#|\\n|$|;|[ \\t]))))", "end": "(?:(?=[ \\t])|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?>?)(?:[ \\t]*+)([^ \t\n>&;<>\\(\\)\\$`\\\\\"'<\\|]+))", "captures": { "1": { "name": "keyword.operator.redirect.shell" }, "2": { "name": "string.unquoted.argument.shell" } } }, "redirect_number": { "match": "(?<=[ \\t])(?:(?:(1)|(2)|(\\d+))(?=>))", "captures": { "1": { "name": "keyword.operator.redirect.stdout.shell" }, "2": { "name": "keyword.operator.redirect.stderr.shell" }, "3": { "name": "keyword.operator.redirect.$3.shell" } } }, "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": { "match": "(?:(?:[ \\t]++)\\-(?:\\w+))*", "captures": { "0": { "patterns": [ { "match": "(?:[ \\t]++)(\\-)(\\w+)", "captures": { "1": { "name": "string.unquoted.argument.shell constant.other.option.dash.shell" }, "2": { "name": "string.unquoted.argument.shell constant.other.option.shell" } } } ] } } }, "simple_unquoted": { "match": "[^ \\t\\n>&;<>\\(\\)\\$`\\\\\"'<\\|]", "name": "string.unquoted.shell" }, "special_expansion": { "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", "name": "keyword.operator.expansion.shell" }, "start_of_command": { "match": "(?:(?:[ \\t]*+)(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$)(?!\\\\\\n?$)))" }, "string": { "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.shell" }, { "begin": "'", "end": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.shell" }, { "begin": "\\$?\"", "end": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "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": "\\$'", "end": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "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" } ] } ] }, "subshell_dollar": { "patterns": [ { "begin": "(?:\\$\\()", "end": "\\)", "beginCaptures": { "0": { "name": "punctuation.definition.subshell.single.shell" } }, "endCaptures": { "0": { "name": "punctuation.definition.subshell.single.shell" } }, "name": "meta.scope.subshell", "patterns": [ { "include": "#parenthese" }, { "include": "#initial_context" } ] } ] }, "support": { "patterns": [ { "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)", "name": "support.function.builtin.shell" } ] }, "typical_statements": { "patterns": [ { "include": "#assignment_statement" }, { "include": "#case_statement" }, { "include": "#for_statement" }, { "include": "#while_statement" }, { "include": "#function_definition" }, { "include": "#command_statement" }, { "include": "#line_continuation" }, { "include": "#arithmetic_double" }, { "include": "#normal_context" } ] }, "variable": { "patterns": [ { "match": "(?:(\\$)(\\@(?!\\w)))", "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell" }, "2": { "name": "variable.parameter.positional.all.shell" } } }, { "match": "(?:(\\$)([0-9](?!\\w)))", "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" }, "2": { "name": "variable.parameter.positional.shell" } } }, { "match": "(?:(\\$)([-*#?$!0_](?!\\w)))", "captures": { "1": { "name": "punctuation.definition.variable.shell variable.language.special.shell" }, "2": { "name": "variable.language.special.shell" } } }, { "begin": "(?:(\\$)(\\{)(?:[ \\t]*+)(?=\\d))", "end": "\\}", "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" } }, "endCaptures": { "0": { "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell" } }, "contentName": "meta.parameter-expansion", "patterns": [ { "include": "#special_expansion" }, { "include": "#array_access_inline" }, { "match": "[0-9]+", "name": "variable.parameter.positional.shell" }, { "match": "(?