tm-grammars
Version:
Collecton of TextMate grammars in JSON
1,715 lines (1,714 loc) • 89.6 kB
JSON
{
"displayName": "Go",
"name": "go",
"patterns": [
{
"include": "#statements"
}
],
"repository": {
"after_control_variables": {
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\w+",
"name": "variable.other.go"
}
]
}
},
"match": "(?<=\\brange\\b|;|\\bif\\b|\\bfor\\b|[<>]|<=|>=|==|!=|\\w[-%*+/]|\\w[-%*+/]=|\\|\\||&&)\\s*((?![]\\[]+)[-\\]!%*+./:<=>\\[_[:alnum:]]+)\\s*(?=\\{)"
},
"brackets": {
"patterns": [
{
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.curly.go"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.curly.go"
}
},
"patterns": [
{
"include": "$self"
}
]
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "$self"
}
]
},
{
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.square.go"
}
},
"end": "]",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.square.go"
}
},
"patterns": [
{
"include": "$self"
}
]
}
]
},
"built_in_functions": {
"patterns": [
{
"match": "\\b(append|cap|close|complex|copy|delete|imag|len|panic|print|println|real|recover|min|max|clear)\\b(?=\\()",
"name": "entity.name.function.support.builtin.go"
},
{
"begin": "\\b(new)\\b(\\()",
"beginCaptures": {
"1": {
"name": "entity.name.function.support.builtin.go"
},
"2": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#functions"
},
{
"include": "#struct_variables_types"
},
{
"include": "#support_functions"
},
{
"include": "#type-declarations"
},
{
"include": "#generic_types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
},
{
"include": "$self"
}
]
},
{
"begin": "\\b(make)\\b(\\()((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?[]*\\[]+{0,1}(?:(?!\\bmap\\b)[.\\w]+)?(\\[(?:\\S+(?:,\\s*\\S+)*)?])?,?)?",
"beginCaptures": {
"1": {
"name": "entity.name.function.support.builtin.go"
},
"2": {
"name": "punctuation.definition.begin.bracket.round.go"
},
"3": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "$self"
}
]
}
]
},
"comments": {
"patterns": [
{
"begin": "(/\\*)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.go"
}
},
"end": "(\\*/)",
"endCaptures": {
"1": {
"name": "punctuation.definition.comment.go"
}
},
"name": "comment.block.go"
},
{
"begin": "(//)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.go"
}
},
"end": "\\n|$",
"name": "comment.line.double-slash.go"
}
]
},
"const_assignment": {
"patterns": [
{
"captures": {
"1": {
"patterns": [
{
"include": "#delimiters"
},
{
"match": "\\w+",
"name": "variable.other.constant.go"
}
]
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#generic_types"
},
{
"match": "\\(",
"name": "punctuation.definition.begin.bracket.round.go"
},
{
"match": "\\)",
"name": "punctuation.definition.end.bracket.round.go"
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "(?<=\\bconst\\b)\\s*\\b([.\\w]+(?:,\\s*[.\\w]+)*)\\s*((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?(?![]*\\[]+{0,1}\\b(?:struct|func|map)\\b)(?:[]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?\\s*=?)?"
},
{
"begin": "(?<=\\bconst\\b)\\s*(\\()",
"beginCaptures": {
"1": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"captures": {
"1": {
"patterns": [
{
"include": "#delimiters"
},
{
"match": "\\w+",
"name": "variable.other.constant.go"
}
]
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#generic_types"
},
{
"match": "\\(",
"name": "punctuation.definition.begin.bracket.round.go"
},
{
"match": "\\)",
"name": "punctuation.definition.end.bracket.round.go"
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "^\\s*\\b([.\\w]+(?:,\\s*[.\\w]+)*)\\s*((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?(?![]*\\[]+{0,1}\\b(?:struct|func|map)\\b)(?:[]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?\\s*=?)?"
},
{
"include": "$self"
}
]
}
]
},
"delimiters": {
"patterns": [
{
"match": ",",
"name": "punctuation.other.comma.go"
},
{
"match": "\\.(?!\\.\\.)",
"name": "punctuation.other.period.go"
},
{
"match": ":(?!=)",
"name": "punctuation.other.colon.go"
}
]
},
"double_parentheses_types": {
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"match": "\\(",
"name": "punctuation.definition.begin.bracket.round.go"
},
{
"match": "\\)",
"name": "punctuation.definition.end.bracket.round.go"
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\{",
"name": "punctuation.definition.begin.bracket.curly.go"
},
{
"match": "}",
"name": "punctuation.definition.end.bracket.curly.go"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "(?<!\\w)(\\([]*\\[]+{0,1}[.\\w]+(?:\\[(?:[]*.\\[{}\\w]+(?:,\\s*[]*.\\[{}\\w]+)*)?])?\\))(?=\\()"
},
"function_declaration": {
"begin": "^\\b(func)\\b\\s*(\\([^)]+\\)\\s*)?(?:(\\w+)(?=[(\\[]))?",
"beginCaptures": {
"1": {
"name": "keyword.function.go"
},
"2": {
"patterns": [
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"captures": {
"1": {
"name": "variable.parameter.go"
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "(\\w+\\s+)?([*.\\w]+(?:\\[(?:[*.\\w]+(?:,\\s+)?)+{0,1}])?)"
},
{
"include": "$self"
}
]
}
]
},
"3": {
"patterns": [
{
"match": "\\d\\w*",
"name": "invalid.illegal.identifier.go"
},
{
"match": "\\w+",
"name": "entity.name.function.go"
}
]
}
},
"end": "(?<=\\))\\s*((?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?![]*\\[]+{0,1}\\b(?:struct|interface)\\b)[-\\]*.\\[\\w]+)?\\s*(?=\\{)",
"endCaptures": {
"1": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"patterns": [
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#function_param_types"
}
]
},
{
"begin": "([*.\\w]+)?(\\[)",
"beginCaptures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"2": {
"name": "punctuation.definition.begin.bracket.square.go"
}
},
"end": "]",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.square.go"
}
},
"patterns": [
{
"include": "#generic_param_types"
}
]
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "(?<=\\))\\s*((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[-\\]*.<>\\[\\w]+\\s*(?:/[*/].*)?)$"
},
{
"include": "$self"
}
]
},
"function_param_types": {
"patterns": [
{
"include": "#struct_variables_types"
},
{
"include": "#interface_variables_types"
},
{
"include": "#type-declarations-without-brackets"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "variable.parameter.go"
}
]
}
},
"match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+(?=(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*\\[]+{0,1}\\b(?:struct|interface)\\b\\s*\\{)"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "variable.parameter.go"
}
]
}
},
"match": "(?:(?<=\\()|^\\s*)((?:\\b\\w+,\\s*)+(?:/[*/].*)?)$"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#delimiters"
},
{
"match": "\\w+",
"name": "variable.parameter.go"
}
]
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?:[]*.\\[\\w]+{0,1}(?:\\bfunc\\b\\([^)]+{0,1}\\)(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*)+(?:[]*.\\[\\w]+|\\([^)]+{0,1}\\))?|(?:[]*\\[]+{0,1}[*.\\w]+(?:\\[[^]]+])?[*.\\w]+{0,1})+))"
},
{
"begin": "([*.\\w]+)?(\\[)",
"beginCaptures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"2": {
"name": "punctuation.definition.begin.bracket.square.go"
}
},
"end": "]",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.square.go"
}
},
"patterns": [
{
"include": "#generic_param_types"
}
]
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#function_param_types"
}
]
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "([.\\w]+)"
},
{
"include": "$self"
}
]
},
"functions": {
"begin": "\\b(func)\\b(?=\\()",
"beginCaptures": {
"1": {
"name": "keyword.function.go"
}
},
"end": "(?<=\\))(\\s*(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+)?(\\s*(?:[]*\\[]+{0,1}[*.\\w]+)?(?:\\[(?:[*.\\w]+{0,1}(?:\\[[^]]+{0,1}])?(?:,\\s+)?)+]|\\([^)]+{0,1}\\))?[*.\\w]+{0,1}\\s*(?=\\{)|\\s*(?:[]*\\[]+{0,1}(?!\\bfunc\\b)[*.\\w]+(?:\\[(?:[*.\\w]+{0,1}(?:\\[[^]]+{0,1}])?(?:,\\s+)?)+])?[*.\\w]+{0,1}|\\([^)]+{0,1}\\)))?",
"endCaptures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
}
]
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"patterns": [
{
"include": "#parameter-variable-types"
}
]
},
"functions_inline": {
"captures": {
"1": {
"name": "keyword.function.go"
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#function_param_types"
},
{
"include": "$self"
}
]
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\{",
"name": "punctuation.definition.begin.bracket.curly.go"
},
{
"match": "}",
"name": "punctuation.definition.end.bracket.curly.go"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "\\b(func)\\b(\\([^/]*?\\)\\s+\\([^/]*?\\))\\s+(?=\\{)"
},
"generic_param_types": {
"patterns": [
{
"include": "#struct_variables_types"
},
{
"include": "#interface_variables_types"
},
{
"include": "#type-declarations-without-brackets"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "variable.parameter.go"
}
]
}
},
"match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+(?=(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*\\[]+{0,1}\\b(?:struct|interface)\\b\\s*\\{)"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "variable.parameter.go"
}
]
}
},
"match": "(?:(?<=\\()|^\\s*)((?:\\b\\w+,\\s*)+(?:/[*/].*)?)$"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#delimiters"
},
{
"match": "\\w+",
"name": "variable.parameter.go"
}
]
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"3": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?:[]*.\\[\\w]+{0,1}(?:\\bfunc\\b\\([^)]+{0,1}\\)(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*)+(?:[*.\\w]+|\\([^)]+{0,1}\\))?|(?:(?:[*.~\\w]+|\\[(?:[*.\\w]+{0,1}(?:\\[[^]]+{0,1}])?(?:,\\s+)?)+])[*.\\w]+{0,1})+))"
},
{
"begin": "([*.\\w]+)?(\\[)",
"beginCaptures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"2": {
"name": "punctuation.definition.begin.bracket.square.go"
}
},
"end": "]",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.square.go"
}
},
"patterns": [
{
"include": "#generic_param_types"
}
]
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#function_param_types"
}
]
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "\\b([.\\w]+)"
},
{
"include": "$self"
}
]
},
"generic_types": {
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"2": {
"patterns": [
{
"include": "#parameter-variable-types"
}
]
}
},
"match": "([*.\\w]+)(\\[[^]]+{0,1}])"
},
"group-functions": {
"patterns": [
{
"include": "#function_declaration"
},
{
"include": "#functions_inline"
},
{
"include": "#functions"
},
{
"include": "#built_in_functions"
},
{
"include": "#support_functions"
}
]
},
"group-types": {
"patterns": [
{
"include": "#other_struct_interface_expressions"
},
{
"include": "#type_assertion_inline"
},
{
"include": "#struct_variables_types"
},
{
"include": "#interface_variables_types"
},
{
"include": "#single_type"
},
{
"include": "#multi_types"
},
{
"include": "#struct_interface_declaration"
},
{
"include": "#double_parentheses_types"
},
{
"include": "#switch_types"
},
{
"include": "#type-declarations"
}
]
},
"group-variables": {
"patterns": [
{
"include": "#const_assignment"
},
{
"include": "#var_assignment"
},
{
"include": "#variable_assignment"
},
{
"include": "#label_loop_variables"
},
{
"include": "#slice_index_variables"
},
{
"include": "#property_variables"
},
{
"include": "#switch_variables"
},
{
"include": "#other_variables"
}
]
},
"hover": {
"patterns": [
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "variable.other.property.go"
}
]
},
"2": {
"patterns": [
{
"match": "\\binvalid\\b\\s+\\btype\\b",
"name": "invalid.field.go"
},
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "(?<=^\\bfield\\b)\\s+([*.\\w]+)\\s+([\\s\\S]+)"
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "(?<=^\\breturns\\b)\\s+([\\s\\S]+)"
}
]
},
"import": {
"patterns": [
{
"begin": "\\b(import)\\s+",
"beginCaptures": {
"1": {
"name": "keyword.control.import.go"
}
},
"end": "(?!\\G)",
"patterns": [
{
"include": "#imports"
}
]
}
]
},
"imports": {
"patterns": [
{
"captures": {
"1": {
"patterns": [
{
"include": "#delimiters"
},
{
"match": "\\w+",
"name": "variable.other.import.go"
}
]
},
"2": {
"name": "string.quoted.double.go"
},
"3": {
"name": "punctuation.definition.string.begin.go"
},
"4": {
"name": "entity.name.import.go"
},
"5": {
"name": "punctuation.definition.string.end.go"
}
},
"match": "(\\s*[.\\w]+)?\\s*((\")([^\"]*)(\"))"
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.imports.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.imports.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#comments"
},
{
"include": "#imports"
}
]
},
{
"include": "$self"
}
]
},
"interface_variables_types": {
"begin": "\\b(interface)\\b\\s*(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.interface.go"
},
"2": {
"name": "punctuation.definition.begin.bracket.curly.go"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.curly.go"
}
},
"patterns": [
{
"include": "#interface_variables_types_field"
},
{
"include": "$self"
}
]
},
"interface_variables_types_field": {
"patterns": [
{
"include": "#support_functions"
},
{
"include": "#type-declarations-without-brackets"
},
{
"begin": "([*.\\w]+)?(\\[)",
"beginCaptures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"2": {
"name": "punctuation.definition.begin.bracket.square.go"
}
},
"end": "]",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.square.go"
}
},
"patterns": [
{
"include": "#generic_param_types"
}
]
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#function_param_types"
}
]
},
{
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"match": "([.\\w]+)"
}
]
},
"keywords": {
"patterns": [
{
"match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b",
"name": "keyword.control.go"
},
{
"match": "\\bchan\\b",
"name": "keyword.channel.go"
},
{
"match": "\\bconst\\b",
"name": "keyword.const.go"
},
{
"match": "\\bvar\\b",
"name": "keyword.var.go"
},
{
"match": "\\bfunc\\b",
"name": "keyword.function.go"
},
{
"match": "\\binterface\\b",
"name": "keyword.interface.go"
},
{
"match": "\\bmap\\b",
"name": "keyword.map.go"
},
{
"match": "\\bstruct\\b",
"name": "keyword.struct.go"
},
{
"match": "\\bimport\\b",
"name": "keyword.control.import.go"
},
{
"match": "\\btype\\b",
"name": "keyword.type.go"
}
]
},
"label_loop_variables": {
"captures": {
"1": {
"patterns": [
{
"include": "#type-declarations"
},
{
"match": "\\w+",
"name": "variable.other.label.go"
}
]
}
},
"match": "^(\\s*\\w+:\\s*|\\s*\\b(?:break|goto|continue)\\b\\s+\\w+(?:\\s*/[*/]\\s*.*)?)$"
},
"language_constants": {
"captures": {
"1": {
"name": "constant.language.boolean.go"
},
"2": {
"name": "constant.language.null.go"
},
"3": {
"name": "constant.language.iota.go"
}
},
"match": "\\b(?:(true|false)|(nil)|(iota))\\b"
},
"map_types": {
"begin": "\\b(map)\\b(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.map.go"
},
"2": {
"name": "punctuation.definition.begin.bracket.square.go"
}
},
"end": "(])((?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?![]*\\[]+{0,1}\\b(?:func|struct|map)\\b)[]*\\[]+{0,1}[.\\w]+(?:\\[(?:[]*.\\[{}\\w]+(?:,\\s*[]*.\\[{}\\w]+)*)?])?)?",
"endCaptures": {
"1": {
"name": "punctuation.definition.end.bracket.square.go"
},
"2": {
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
}
},
"patterns": [
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"include": "#functions"
},
{
"match": "\\[",
"name": "punctuation.definition.begin.bracket.square.go"
},
{
"match": "]",
"name": "punctuation.definition.end.bracket.square.go"
},
{
"match": "\\{",
"name": "punctuation.definition.begin.bracket.curly.go"
},
{
"match": "}",
"name": "punctuation.definition.end.bracket.curly.go"
},
{
"match": "\\(",
"name": "punctuation.definition.begin.bracket.round.go"
},
{
"match": "\\)",
"name": "punctuation.definition.end.bracket.round.go"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"multi_types": {
"begin": "\\b(type)\\b\\s*(\\()",
"beginCaptures": {
"1": {
"name": "keyword.type.go"
},
"2": {
"name": "punctuation.definition.begin.bracket.round.go"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.end.bracket.round.go"
}
},
"patterns": [
{
"include": "#struct_variables_types"
},
{
"include": "#interface_variables_types"
},
{
"include": "#type-declarations-without-brackets"
},
{
"include": "#parameter-variable-types"
},
{
"match": "\\w+",
"name": "entity.name.type.go"
}
]
},
"numeric_literals": {
"captures": {
"0": {
"patterns": [
{
"begin": "(?=.)",
"end": "\\n|$",
"patterns": [
{
"captures": {
"1": {
"name": "constant.numeric.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"10": {
"name": "keyword.other.unit.imaginary.go"
},
"11": {
"name": "constant.numeric.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"12": {
"name": "punctuation.separator.constant.numeric.go"
},
"13": {
"name": "keyword.other.unit.exponent.decimal.go"
},
"14": {
"name": "keyword.operator.plus.exponent.decimal.go"
},
"15": {
"name": "keyword.operator.minus.exponent.decimal.go"
},
"16": {
"name": "constant.numeric.exponent.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"17": {
"name": "keyword.other.unit.imaginary.go"
},
"18": {
"name": "constant.numeric.decimal.point.go"
},
"19": {
"name": "constant.numeric.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"2": {
"name": "punctuation.separator.constant.numeric.go"
},
"20": {
"name": "punctuation.separator.constant.numeric.go"
},
"21": {
"name": "keyword.other.unit.exponent.decimal.go"
},
"22": {
"name": "keyword.operator.plus.exponent.decimal.go"
},
"23": {
"name": "keyword.operator.minus.exponent.decimal.go"
},
"24": {
"name": "constant.numeric.exponent.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"25": {
"name": "keyword.other.unit.imaginary.go"
},
"26": {
"name": "keyword.other.unit.hexadecimal.go"
},
"27": {
"name": "constant.numeric.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"28": {
"name": "punctuation.separator.constant.numeric.go"
},
"29": {
"name": "constant.numeric.hexadecimal.go"
},
"3": {
"name": "constant.numeric.decimal.point.go"
},
"30": {
"name": "constant.numeric.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"31": {
"name": "punctuation.separator.constant.numeric.go"
},
"32": {
"name": "keyword.other.unit.exponent.hexadecimal.go"
},
"33": {
"name": "keyword.operator.plus.exponent.hexadecimal.go"
},
"34": {
"name": "keyword.operator.minus.exponent.hexadecimal.go"
},
"35": {
"name": "constant.numeric.exponent.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"36": {
"name": "keyword.other.unit.imaginary.go"
},
"37": {
"name": "keyword.other.unit.hexadecimal.go"
},
"38": {
"name": "constant.numeric.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"39": {
"name": "punctuation.separator.constant.numeric.go"
},
"4": {
"name": "constant.numeric.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"40": {
"name": "keyword.other.unit.exponent.hexadecimal.go"
},
"41": {
"name": "keyword.operator.plus.exponent.hexadecimal.go"
},
"42": {
"name": "keyword.operator.minus.exponent.hexadecimal.go"
},
"43": {
"name": "constant.numeric.exponent.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"44": {
"name": "keyword.other.unit.imaginary.go"
},
"45": {
"name": "keyword.other.unit.hexadecimal.go"
},
"46": {
"name": "constant.numeric.hexadecimal.go"
},
"47": {
"name": "constant.numeric.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"48": {
"name": "punctuation.separator.constant.numeric.go"
},
"49": {
"name": "keyword.other.unit.exponent.hexadecimal.go"
},
"5": {
"name": "punctuation.separator.constant.numeric.go"
},
"50": {
"name": "keyword.operator.plus.exponent.hexadecimal.go"
},
"51": {
"name": "keyword.operator.minus.exponent.hexadecimal.go"
},
"52": {
"name": "constant.numeric.exponent.hexadecimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"53": {
"name": "keyword.other.unit.imaginary.go"
},
"6": {
"name": "keyword.other.unit.exponent.decimal.go"
},
"7": {
"name": "keyword.operator.plus.exponent.decimal.go"
},
"8": {
"name": "keyword.operator.minus.exponent.decimal.go"
},
"9": {
"name": "constant.numeric.exponent.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
}
},
"match": "\\G(?:(?:(?:(?:(?:(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)((?<=[0-9])\\.|\\.(?=[0-9]))([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)?(?:(?<!_)([Ee])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*))?(i(?!\\w))?(?:\\n|$)|(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)(?<!_)([Ee])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))|((?<=[0-9])\\.|\\.(?=[0-9]))([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)(?:(?<!_)([Ee])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*))?(i(?!\\w))?(?:\\n|$))|(0[Xx])_?(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)((?<=\\h)\\.|\\.(?=\\h))(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)?(?<!_)([Pp])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))|(0[Xx])_?(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)(?<!_)([Pp])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))|(0[Xx])((?<=\\h)\\.|\\.(?=\\h))(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)(?<!_)([Pp])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))"
},
{
"captures": {
"1": {
"name": "constant.numeric.decimal.go",
"patterns": [
{
"match": "(?<=\\h)_(?=\\h)",
"name": "punctuation.separator.constant.numeric.go"
}
]
},
"10": {
"name": "punctuation.separator.constant.numeric.go"