Update C# TextMate grammar with latest fixes from csharp-tmLanguage (#28120)
This includes fixes for the following: * C# 7 ref locals and ref returns (https://github.com/dotnet/csharp-tmLanguage/issues/12) * C# 7 throw expressions (https://github.com/dotnet/csharp-tmLanguage/issues/69)
This commit is contained in:
parent
544d44350b
commit
a53cce90d3
1 changed files with 52 additions and 10 deletions
|
@ -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/dotnet/csharp-tmLanguage/commit/9ef19ad34df99e0e5bf3e0a8e8a1733d1f0c4aca",
|
||||
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/e7f564b60e08e6d8400d2512918c2ff5ccbf4cec",
|
||||
"name": "C#",
|
||||
"scopeName": "source.cs",
|
||||
"fileTypes": [
|
||||
|
@ -275,6 +275,9 @@
|
|||
{
|
||||
"include": "#nameof-expression"
|
||||
},
|
||||
{
|
||||
"include": "#throw-expression"
|
||||
},
|
||||
{
|
||||
"include": "#interpolated-string"
|
||||
},
|
||||
|
@ -614,7 +617,7 @@
|
|||
]
|
||||
},
|
||||
"delegate-declaration": {
|
||||
"begin": "(?x)\n(?:\\b(delegate)\\b)\\s+\n(?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+\n(\\g<identifier>)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()",
|
||||
"begin": "(?x)\n(?:\\b(delegate)\\b)\\s+\n(?<type-name>\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+\n(\\g<identifier>)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.other.delegate.cs"
|
||||
|
@ -999,7 +1002,7 @@
|
|||
]
|
||||
},
|
||||
"property-declaration": {
|
||||
"begin": "(?x)\n(?!.*\\b(?:class|interface|struct|enum|event)\\b)\\s*\n(?<return-type>\n (?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?<interface-name>\\g<type-name>\\s*\\.\\s*)?\n(?<property-name>\\g<identifier>)\\s*\n(?=\\{|=>|$)",
|
||||
"begin": "(?x)\n(?!.*\\b(?:class|interface|struct|enum|event)\\b)\\s*\n(?<return-type>\n (?<type-name>\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?<interface-name>\\g<type-name>\\s*\\.\\s*)?\n(?<property-name>\\g<identifier>)\\s*\n(?=\\{|=>|$)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
|
@ -1042,7 +1045,7 @@
|
|||
]
|
||||
},
|
||||
"indexer-declaration": {
|
||||
"begin": "(?x)\n(?<return-type>\n (?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?<interface-name>\\g<type-name>\\s*\\.\\s*)?\n(?<indexer-name>this)\\s*\n(?=\\[)",
|
||||
"begin": "(?x)\n(?<return-type>\n (?<type-name>\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?<interface-name>\\g<type-name>\\s*\\.\\s*)?\n(?<indexer-name>this)\\s*\n(?=\\[)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
|
@ -1215,7 +1218,7 @@
|
|||
]
|
||||
},
|
||||
"method-declaration": {
|
||||
"begin": "(?x)\n(?<return-type>\n (?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?<interface-name>\\g<type-name>\\s*\\.\\s*)?\n(\\g<identifier>)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()",
|
||||
"begin": "(?x)\n(?<return-type>\n (?<type-name>\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?<interface-name>\\g<type-name>\\s*\\.\\s*)?\n(\\g<identifier>)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
|
@ -1351,7 +1354,7 @@
|
|||
]
|
||||
},
|
||||
"operator-declaration": {
|
||||
"begin": "(?x)\n(?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?<operator-keyword>(?:\\b(?:operator)))\\s*\n(?<operator>(?:\\+|-|\\*|/|%|&|\\||\\^|\\<\\<|\\>\\>|==|!=|\\>|\\<|\\>=|\\<=|!|~|\\+\\+|--|true|false))\\s*\n(?=\\()",
|
||||
"begin": "(?x)\n(?<type-name>\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?<operator-keyword>(?:\\b(?:operator)))\\s*\n(?<operator>(?:\\+|-|\\*|/|%|&|\\||\\^|\\<\\<|\\>\\>|==|!=|\\>|\\<|\\>=|\\<=|!|~|\\+\\+|--|true|false))\\s*\n(?=\\()",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
|
@ -1384,7 +1387,7 @@
|
|||
]
|
||||
},
|
||||
"conversion-operator-declaration": {
|
||||
"begin": "(?x)\n(?<explicit-or-implicit-keyword>(?:\\b(?:explicit|implicit)))\\s*\n(?<operator-keyword>(?:\\b(?:operator)))\\s*\n(?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?=\\()",
|
||||
"begin": "(?x)\n(?<explicit-or-implicit-keyword>(?:\\b(?:explicit|implicit)))\\s*\n(?<operator-keyword>(?:\\b(?:operator)))\\s*\n(?<type-name>\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?=\\()",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"patterns": [
|
||||
|
@ -1461,6 +1464,9 @@
|
|||
},
|
||||
"end": "(?=[,\\)\\];}])",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#ref-modifier"
|
||||
},
|
||||
{
|
||||
"include": "#expression"
|
||||
}
|
||||
|
@ -1475,6 +1481,9 @@
|
|||
},
|
||||
"end": "(?=[,\\);}])",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#ref-modifier"
|
||||
},
|
||||
{
|
||||
"include": "#expression"
|
||||
}
|
||||
|
@ -1526,6 +1535,9 @@
|
|||
},
|
||||
"end": "(?=;)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#ref-modifier"
|
||||
},
|
||||
{
|
||||
"include": "#expression"
|
||||
}
|
||||
|
@ -2122,19 +2134,22 @@
|
|||
]
|
||||
},
|
||||
"local-variable-declaration": {
|
||||
"begin": "(?x)\n(?:\n (\\bvar\\b)|\n (?<type-name>\n (?:\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\n)\\s+\n(\\g<identifier>)\\s*\n(?=,|;|=|\\))",
|
||||
"begin": "(?x)\n(?:\n (?:(\\bref)\\s+)?(\\bvar\\b)| # ref local\n (?<type-name>\n (?:\n (?:ref\\s+)? # ref local\n (?:\n (?:(?<identifier>[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\*\\s*)* # pointer suffix?\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\n)\\s+\n(\\g<identifier>)\\s*\n(?=,|;|=|\\))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.other.var.cs"
|
||||
"name": "storage.modifier.cs"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.var.cs"
|
||||
},
|
||||
"3": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#type"
|
||||
}
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"8": {
|
||||
"name": "entity.name.variable.local.cs"
|
||||
}
|
||||
},
|
||||
|
@ -2405,6 +2420,20 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"throw-expression": {
|
||||
"begin": "(?<!\\.)\\b(throw)\\b",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.control.flow.throw.cs"
|
||||
}
|
||||
},
|
||||
"end": "(?=;)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
"interpolated-string": {
|
||||
"name": "string.quoted.double.cs",
|
||||
"begin": "\\$\"",
|
||||
|
@ -3460,6 +3489,9 @@
|
|||
{
|
||||
"include": "#block"
|
||||
},
|
||||
{
|
||||
"include": "#ref-modifier"
|
||||
},
|
||||
{
|
||||
"include": "#expression"
|
||||
}
|
||||
|
@ -3487,6 +3519,9 @@
|
|||
{
|
||||
"include": "#block"
|
||||
},
|
||||
{
|
||||
"include": "#ref-modifier"
|
||||
},
|
||||
{
|
||||
"include": "#expression"
|
||||
}
|
||||
|
@ -3569,6 +3604,9 @@
|
|||
{
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"include": "#ref-modifier"
|
||||
},
|
||||
{
|
||||
"include": "#tuple-type"
|
||||
},
|
||||
|
@ -3589,6 +3627,10 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"ref-modifier": {
|
||||
"name": "storage.modifier.cs",
|
||||
"match": "ref"
|
||||
},
|
||||
"tuple-type": {
|
||||
"begin": "\\(",
|
||||
"beginCaptures": {
|
||||
|
|
Loading…
Reference in a new issue