Update grammars

This commit is contained in:
Alex Ross
2020-05-11 14:03:35 +02:00
parent 71bb111a06
commit 884fcedf97
9 changed files with 89 additions and 43 deletions

View File

@@ -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/MagicStack/MagicPython/commit/0b09c1fca238d22e15ac5712d03f9bf6da626f9c",
"version": "https://github.com/MagicStack/MagicPython/commit/2ca894f270f92e2bc8f09a2ebdcd482fbb3b1074",
"name": "MagicPython",
"scopeName": "source.python",
"patterns": [
@@ -31,6 +31,9 @@
{
"include": "#function-declaration"
},
{
"include": "#generator"
},
{
"include": "#statement-keyword"
},
@@ -291,6 +294,9 @@
{
"include": "#lambda"
},
{
"include": "#generator"
},
{
"include": "#illegal-operator"
},
@@ -306,6 +312,9 @@
{
"include": "#list"
},
{
"include": "#odd-function-call"
},
{
"include": "#round-braces"
},
@@ -388,6 +397,9 @@
},
{
"include": "#member-access-base"
},
{
"include": "#member-access-attribute"
}
]
},
@@ -413,6 +425,11 @@
}
]
},
"member-access-attribute": {
"comment": "Highlight attribute access in otherwise non-specialized cases.",
"name": "meta.attribute.python",
"match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
},
"special-names": {
"name": "constant.other.caps.python",
"match": "(?x)\n \\b\n # we want to see \"enough\", meaning 2 or more upper-case\n # letters in the beginning of the constant\n #\n # for more details refer to:\n # https://github.com/MagicStack/MagicPython/issues/42\n (\n _* [[:upper:]] [_\\d]* [[:upper:]]\n )\n [[:upper:]\\d]* (_\\w*)?\n \\b\n"
@@ -459,6 +476,21 @@
}
]
},
"odd-function-call": {
"comment": "A bit obscured function call where there may have been an\narbitrary number of other operations to get the function.\nE.g. \"arr[idx](args)\"\n",
"begin": "(?x)\n (?<= \\] | \\) ) \\s*\n (?=\\()\n",
"end": "(\\))",
"endCaptures": {
"1": {
"name": "punctuation.definition.arguments.end.python"
}
},
"patterns": [
{
"include": "#function-arguments"
}
]
},
"round-braces": {
"begin": "\\(",
"end": "\\)",
@@ -1195,6 +1227,26 @@
}
]
},
"generator": {
"comment": "Match \"for ... in\" construct used in generators and for loops to\ncorrectly identify the \"in\" as a control flow keyword.\n",
"begin": "for",
"beginCaptures": {
"0": {
"name": "keyword.control.flow.python"
}
},
"end": "in",
"endCaptures": {
"0": {
"name": "keyword.control.flow.python"
}
},
"patterns": [
{
"include": "#expression"
}
]
},
"function-declaration": {
"name": "meta.function.python",
"begin": "(?x)\n \\s*\n (?:\\b(async) \\s+)? \\b(def)\\s+\n (?=\n [[:alpha:]_][[:word:]]* \\s* \\(\n )\n",
@@ -1407,6 +1459,7 @@
"include": "#special-names"
},
{
"name": "meta.indexed-name.python",
"match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
}
]
@@ -1524,6 +1577,7 @@
},
"function-call": {
"name": "meta.function-call.python",
"comment": "Regular function call of the type \"name(args)\"",
"begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n",
"end": "(\\))",
"endCaptures": {