|
4 | 4 | "If you want to provide a fix or improvement, please create a pull request against the original repository.", |
5 | 5 | "Once accepted there, we are happy to receive an update request." |
6 | 6 | ], |
7 | | - "version": "https://github.com/jtbandes/swift-tmlanguage/commit/860eface4241cf9f2174d5fa690bd34389ac8d26", |
| 7 | + "version": "https://github.com/jtbandes/swift-tmlanguage/commit/b8d2889b4af1d8bad41578317a6adade642555a3", |
8 | 8 | "name": "Swift", |
9 | 9 | "scopeName": "source.swift", |
10 | 10 | "comment": "See swift.tmbundle/grammar-test.swift for test cases.", |
|
3081 | 3081 | { |
3082 | 3082 | "comment": "Single-line regular expression literals must be matched all in one go\n in order to avoid ambiguities with operators, and to adhere to certain\n parsing rules in SE-0354/SE-0355, such as:\n - A regex literal will not be parsed if it contains an unbalanced ).\n - A regex may end with a space only if it began with an escaped space", |
3083 | 3083 | "name": "string.regexp.line.swift", |
3084 | | - "match": "(?x)\n(((\\#+)?)/) # (1) for captures, (2) for matching end, (3) for conditionals\n(?(3)|(?!/)) # is not a comment\n(?(3)|(?!\\s)) # does not start with a space or tab\n(\\\\\\s)? # (4) may start with an escaped space or tab\n(?<guts>\n (?> # no backtracking, avoids issues with negative lookbehind at end\n (?:\n \\\\Q\n (?:(?!\\\\E)(?!/\\2).)*+\n (?:\\\\E\n # A quoted sequence may not have a closing E, in which case it extends to the end of the regex\n | (?(3)|(?<!\\s))(?=/\\2)\n )\n | \\\\.\n | \\(\\?\\#[^)]*\\)\n | \\(\\?\n # we only support a fixed maximum number of braces because otherwise we can't balance the number of open and close braces\n \\{(?<g1>\\{)?+(?<g2>\\{)?+(?<g3>\\{)?+(?<g4>\\{)?+(?<g5>\\{)?+\n .+?\n \\}(?(<g1>)\\})(?(<g2>)\\})(?(<g3>)\\})(?(<g4>)\\})(?(<g5>)\\})\n (?:\\[(?!\\d)\\w+\\])?\n [X<>]?\n \\)\n | (?<class>\\[ (?:\\\\. | [^\\[\\]] | \\g<class>)+ \\])\n | \\(\\g<guts>?+\\)\n | (?:(?!/\\2)[^()\\[\\\\])+ # any character (until end)\n )+\n )\n)?+\n# may end with a space only if it is an extended literal or contains only a single escaped space\n(?(3)|(?(5)(?<!\\s)))\n(/\\2) # (12)\n| \\#+/.+(\\n)", |
| 3084 | + "match": "(?x)\n(?!/\\s) # non-extended regex literals may not start with a space or tab\n(?!//) # disambiguation with line comments (redundant since comment rules occur earlier)\n(((\\#+)?)/) # (1) for captures, (2) for matching end, (3) for conditionals\n(\\\\\\s)? # (4) may start with an escaped space or tab\n(?<guts>\n (?> # no backtracking, avoids issues with negative lookbehind at end\n (?:\n \\\\Q\n (?:(?!\\\\E)(?!/\\2).)*+\n (?:\\\\E\n # A quoted sequence may not have a closing E, in which case it extends to the end of the regex\n | (?(3)|(?<!\\s))(?=/\\2)\n )\n | \\\\.\n | \\(\\?\\#[^)]*\\)\n | \\(\\?\n # InterpolatedCallout\n (?>(\\{(?:\\g<-1>|(?!{).*?)\\}))\n (?:\\[(?!\\d)\\w+\\])?\n [X<>]?\n \\)\n | (?<class>\\[ (?:\\\\. | [^\\[\\]] | \\g<class>)+ \\])\n | \\(\\g<guts>?+\\)\n | (?:(?!/\\2)[^()\\[\\\\])+ # any character (until end)\n )+\n )\n)?+\n# may end with a space only if it is an extended literal or contains only a single escaped space\n(?(3)|(?(5)(?<!\\s)))\n(/\\2) # (12)\n| \\#+/.+(\\n)", |
3085 | 3085 | "captures": { |
3086 | 3086 | "0": { |
3087 | 3087 | "patterns": [ |
|
3093 | 3093 | "1": { |
3094 | 3094 | "name": "punctuation.definition.string.begin.regexp.swift" |
3095 | 3095 | }, |
3096 | | - "12": { |
| 3096 | + "8": { |
3097 | 3097 | "name": "punctuation.definition.string.end.regexp.swift" |
3098 | 3098 | }, |
3099 | | - "13": { |
| 3099 | + "9": { |
3100 | 3100 | "name": "invalid.illegal.returns-not-allowed.regexp" |
3101 | 3101 | } |
3102 | 3102 | } |
|
3155 | 3155 | } |
3156 | 3156 | }, |
3157 | 3157 | { |
3158 | | - "comment": "'\\k<' NamedOrNumberRef '>'\n \"\\k'\" NamedOrNumberRef \"'\"\n '\\g<' NamedOrNumberRef '>'\n \"\\g'\" NamedOrNumberRef \"'\"", |
3159 | | - "match": "(?x)(\\\\[gk](<)|\\\\[gk]') (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) ((?(2)>|'))", |
| 3158 | + "comment": "'\\k<' NamedOrNumberRef '>'\n '\\g<' NamedOrNumberRef '>'", |
| 3159 | + "match": "(?x)(\\\\[gk]<) (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) (>)", |
3160 | 3160 | "captures": { |
3161 | 3161 | "1": { |
3162 | 3162 | "name": "constant.character.escape.backslash.regexp" |
3163 | 3163 | }, |
3164 | | - "3": { |
| 3164 | + "2": { |
3165 | 3165 | "name": "variable.other.group-name.regexp" |
3166 | 3166 | }, |
3167 | | - "4": { |
| 3167 | + "3": { |
3168 | 3168 | "name": "keyword.operator.recursion-level.regexp" |
3169 | 3169 | }, |
| 3170 | + "4": { |
| 3171 | + "name": "constant.numeric.integer.decimal.regexp" |
| 3172 | + }, |
3170 | 3173 | "5": { |
3171 | 3174 | "name": "constant.numeric.integer.decimal.regexp" |
3172 | 3175 | }, |
3173 | 3176 | "6": { |
3174 | | - "name": "constant.numeric.integer.decimal.regexp" |
| 3177 | + "name": "keyword.operator.recursion-level.regexp" |
3175 | 3178 | }, |
3176 | 3179 | "7": { |
3177 | | - "name": "keyword.operator.recursion-level.regexp" |
| 3180 | + "name": "constant.numeric.integer.decimal.regexp" |
3178 | 3181 | }, |
3179 | 3182 | "8": { |
| 3183 | + "name": "constant.character.escape.backslash.regexp" |
| 3184 | + } |
| 3185 | + } |
| 3186 | + }, |
| 3187 | + { |
| 3188 | + "comment": "\"\\k'\" NamedOrNumberRef \"'\"\n \"\\g'\" NamedOrNumberRef \"'\"", |
| 3189 | + "match": "(?x)(\\\\[gk]') (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) (')", |
| 3190 | + "captures": { |
| 3191 | + "1": { |
| 3192 | + "name": "constant.character.escape.backslash.regexp" |
| 3193 | + }, |
| 3194 | + "2": { |
| 3195 | + "name": "variable.other.group-name.regexp" |
| 3196 | + }, |
| 3197 | + "3": { |
| 3198 | + "name": "keyword.operator.recursion-level.regexp" |
| 3199 | + }, |
| 3200 | + "4": { |
3180 | 3201 | "name": "constant.numeric.integer.decimal.regexp" |
3181 | 3202 | }, |
3182 | | - "9": { |
| 3203 | + "5": { |
| 3204 | + "name": "constant.numeric.integer.decimal.regexp" |
| 3205 | + }, |
| 3206 | + "6": { |
| 3207 | + "name": "keyword.operator.recursion-level.regexp" |
| 3208 | + }, |
| 3209 | + "7": { |
| 3210 | + "name": "constant.numeric.integer.decimal.regexp" |
| 3211 | + }, |
| 3212 | + "8": { |
3183 | 3213 | "name": "constant.character.escape.backslash.regexp" |
3184 | 3214 | } |
3185 | 3215 | } |
|
3291 | 3321 | }, |
3292 | 3322 | "literals-regular-expression-literal-callout": { |
3293 | 3323 | "name": "meta.callout.regexp", |
3294 | | - "match": "(?x)\n# PCRECallout\n(\\()(?<keyw>\\?C)\n (?:\n (?<num>\\d+)\n | `(?<name>(?:[^`]|``)*)`\n | '(?<name>(?:[^']|'')*)'\n | \"(?<name>(?:[^\"]|\"\")*)\"\n | \\^(?<name>(?:[^\\^]|\\^\\^)*)\\^\n | %(?<name>(?:[^%]|%%)*)%\n | \\#(?<name>(?:[^#]|\\#\\#)*)\\#\n | \\$(?<name>(?:[^$]|\\$\\$)*)\\$\n | \\{(?<name>(?:[^}]|\\}\\})*)\\}\n )?\n(\\))\n# NamedCallout\n| (\\()(?<keyw>\\*)\n (?<name>(?!\\d)\\w+)\n (?:\\[(?<tag>(?!\\d)\\w+)\\])?\n (?:\\{ [^,}]+ (?:,[^,}]+)* \\})?\n (\\))\n# InterpolatedCallout\n| (\\()(?<keyw>\\?)\n # we only support a fixed maximum number of braces because otherwise we can't balance the number of open and close braces\n (\\{(?<g1>\\{)?+(?<g2>\\{)?+(?<g3>\\{)?+(?<g4>\\{)?+(?<g5>\\{)?+) .+? \\}(?(<g1>)\\})(?(<g2>)\\})(?(<g3>)\\})(?(<g4>)\\})(?(<g5>)\\})\n (?:\\[(?<tag>(?!\\d)\\w+)\\])?\n (?<keyw>[X<>]?)\n (\\))", |
| 3324 | + "match": "(?x)\n# PCRECallout\n(\\()(?<keyw>\\?C)\n (?:\n (?<num>\\d+)\n | `(?<name>(?:[^`]|``)*)`\n | '(?<name>(?:[^']|'')*)'\n | \"(?<name>(?:[^\"]|\"\")*)\"\n | \\^(?<name>(?:[^\\^]|\\^\\^)*)\\^\n | %(?<name>(?:[^%]|%%)*)%\n | \\#(?<name>(?:[^#]|\\#\\#)*)\\#\n | \\$(?<name>(?:[^$]|\\$\\$)*)\\$\n | \\{(?<name>(?:[^}]|\\}\\})*)\\}\n )?\n(\\))\n# NamedCallout\n| (\\()(?<keyw>\\*)\n (?<name>(?!\\d)\\w+)\n (?:\\[(?<tag>(?!\\d)\\w+)\\])?\n (?:\\{ [^,}]+ (?:,[^,}]+)* \\})?\n (\\))\n# InterpolatedCallout\n| (\\()(?<keyw>\\?)\n (?>(\\{(?:\\g<-1>|(?!{).*?)\\}))\n (?:\\[(?<tag>(?!\\d)\\w+)\\])?\n (?<keyw>[X<>]?)\n (\\))", |
3295 | 3325 | "captures": { |
3296 | 3326 | "1": { |
3297 | 3327 | "name": "punctuation.definition.group.regexp" |
|
3350 | 3380 | "19": { |
3351 | 3381 | "name": "keyword.control.callout.regexp" |
3352 | 3382 | }, |
3353 | | - "26": { |
| 3383 | + "21": { |
3354 | 3384 | "name": "variable.language.tag-name.regexp" |
3355 | 3385 | }, |
3356 | | - "27": { |
| 3386 | + "22": { |
3357 | 3387 | "name": "keyword.control.callout.regexp" |
3358 | 3388 | }, |
3359 | | - "28": { |
| 3389 | + "23": { |
3360 | 3390 | "name": "punctuation.definition.group.regexp" |
3361 | 3391 | } |
3362 | 3392 | } |
|
0 commit comments