mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Update grammars (#209932)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"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/worlpaker/go-syntax/commit/f53c71e58787fb719399b7c38a08bceaa0c0e2d9",
|
||||
"version": "https://github.com/worlpaker/go-syntax/commit/6b7e1ad89c031a35a2bf8359538204bcef82f5be",
|
||||
"name": "Go",
|
||||
"scopeName": "source.go",
|
||||
"patterns": [
|
||||
@@ -308,7 +308,7 @@
|
||||
"name": "punctuation.definition.begin.bracket.square.go"
|
||||
}
|
||||
},
|
||||
"end": "(?:(\\])((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?\\b(?:func|struct|map)\\b)[\\w\\.\\[\\]\\*]+)?)",
|
||||
"end": "(?:(\\])((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?\\b(?:func|struct|map)\\b)(?:[\\*\\[\\]]+)?(?:[\\w\\.]+))?)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.end.bracket.square.go"
|
||||
@@ -338,7 +338,7 @@
|
||||
"include": "#type-declarations-without-brackets"
|
||||
},
|
||||
{
|
||||
"include": "#generic_types"
|
||||
"include": "#parameter-variable-types"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
@@ -1285,12 +1285,15 @@
|
||||
{
|
||||
"include": "#struct_variables_types"
|
||||
},
|
||||
{
|
||||
"include": "#interface_variables_types"
|
||||
},
|
||||
{
|
||||
"include": "#type-declarations-without-brackets"
|
||||
},
|
||||
{
|
||||
"comment": "struct type declaration",
|
||||
"match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\bstruct\\b\\s*\\{)",
|
||||
"comment": "struct/interface type declaration",
|
||||
"match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
@@ -1381,9 +1384,32 @@
|
||||
"generic_param_types": {
|
||||
"comment": "generic parameter variables and types",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#struct_variables_types"
|
||||
},
|
||||
{
|
||||
"include": "#interface_variables_types"
|
||||
},
|
||||
{
|
||||
"include": "#type-declarations-without-brackets"
|
||||
},
|
||||
{
|
||||
"comment": "struct/interface type declaration",
|
||||
"match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-declarations"
|
||||
},
|
||||
{
|
||||
"match": "\\w+",
|
||||
"name": "variable.parameter.go"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "multiple parameters one type -with multilines",
|
||||
"match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)",
|
||||
@@ -1691,34 +1717,30 @@
|
||||
}
|
||||
},
|
||||
"struct_variables_types": {
|
||||
"comment": "Struct variable type",
|
||||
"begin": "(\\bstruct\\b)\\s*(\\{)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.struct.go"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.begin.bracket.curly.go"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Struct variable type",
|
||||
"begin": "(\\bstruct\\b)\\s*(\\{)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.struct.go"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.begin.bracket.curly.go"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#struct_variables_types_fields"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
],
|
||||
"end": "\\}",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.end.bracket.curly.go"
|
||||
}
|
||||
}
|
||||
"include": "#struct_variables_types_fields"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
],
|
||||
"end": "\\}",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.end.bracket.curly.go"
|
||||
}
|
||||
}
|
||||
},
|
||||
"struct_variables_types_fields": {
|
||||
"comment": "Struct variable type fields",
|
||||
@@ -1773,12 +1795,12 @@
|
||||
},
|
||||
{
|
||||
"comment": "one line with semicolon(;) without formatting gofmt - single type | property variables and types",
|
||||
"match": "(?:(?<=\\{)((?:\\s*(?:(?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?(?:(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]\\(\\)\\{\\}]+)(?:\\;)?))+)\\s*(?=\\}))",
|
||||
"match": "(?:(?<=\\{)((?:\\s*(?:(?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?(?:(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\S]+)(?:\\;)?))+)\\s*(?=\\}))",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+)(?:\\;)?))",
|
||||
"match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\S]+)(?:\\;)?))",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
@@ -1859,10 +1881,11 @@
|
||||
]
|
||||
},
|
||||
"struct_variable_types_fields_multi": {
|
||||
"comment": "struct variable and type fields with multi lines",
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "Struct variable for struct in struct types",
|
||||
"begin": "(?:(\\w+(?:\\,\\s*\\w+)*)(?:\\s+)(?:(?:[\\[\\]\\*])+)?(\\bstruct\\b)(?:\\s*)(\\{))",
|
||||
"comment": "struct in struct types",
|
||||
"begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\bstruct\\b)(?:\\s*)(\\{))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
@@ -1896,104 +1919,185 @@
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"interface_variables_types": {
|
||||
"patterns": [
|
||||
},
|
||||
{
|
||||
"comment": "interface variable types",
|
||||
"begin": "(\\binterface\\b)\\s*(\\{)",
|
||||
"comment": "interface in struct types",
|
||||
"begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\binterface\\b)(?:\\s*)(\\{))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.interface.go"
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-declarations"
|
||||
},
|
||||
{
|
||||
"match": "\\w+",
|
||||
"name": "variable.other.property.go"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.interface.go"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.begin.bracket.curly.go"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "other types",
|
||||
"match": "([\\w\\.]+)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-declarations"
|
||||
},
|
||||
{
|
||||
"match": "\\w+",
|
||||
"name": "entity.name.type.go"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
],
|
||||
"end": "\\}",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.end.bracket.curly.go"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#interface_variables_types_field"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "function in struct types",
|
||||
"begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\bfunc\\b)(?:\\s*)(\\())",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-declarations"
|
||||
},
|
||||
{
|
||||
"match": "\\w+",
|
||||
"name": "variable.other.property.go"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.function.go"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.begin.bracket.round.go"
|
||||
}
|
||||
},
|
||||
"end": "\\)",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.end.bracket.round.go"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#function_param_types"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#parameter-variable-types"
|
||||
}
|
||||
]
|
||||
},
|
||||
"interface_variables_types": {
|
||||
"comment": "interface variable types",
|
||||
"begin": "(\\binterface\\b)\\s*(\\{)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.interface.go"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.begin.bracket.curly.go"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#interface_variables_types_field"
|
||||
},
|
||||
{
|
||||
"include": "$self"
|
||||
}
|
||||
],
|
||||
"end": "\\}",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.end.bracket.curly.go"
|
||||
}
|
||||
}
|
||||
},
|
||||
"interface_variables_types_field": {
|
||||
"comment": "interface variable type fields",
|
||||
"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"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "other types",
|
||||
"match": "([\\w\\.]+)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type-declarations"
|
||||
},
|
||||
{
|
||||
"match": "\\w+",
|
||||
"name": "entity.name.type.go"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -2002,7 +2106,7 @@
|
||||
"patterns": [
|
||||
{
|
||||
"comment": "single type declaration",
|
||||
"match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?:\\s+)(?!(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b)([\\s\\S]+))",
|
||||
"match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?:\\s+)(?!(?:\\=\\s*)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b)([\\s\\S]+))",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.type.go"
|
||||
|
||||
Reference in New Issue
Block a user