[python] update grammar

This commit is contained in:
Martin Aeschlimann 2017-08-17 15:22:06 +02:00
parent 82b7f2433b
commit 64fd8f8720
3 changed files with 167 additions and 46 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/976e59dcb78cb577e79c8f2117216c06718337e0",
"version": "https://github.com/MagicStack/MagicPython/commit/b453f26ed856c9b16a053517c41207e3a72cc7d5",
"name": "MagicPython",
"scopeName": "source.python",
"fileTypes": [
@ -260,14 +260,6 @@
}
}
},
"codetags": {
"match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
"captures": {
"1": {
"name": "keyword.codetag.notation.python"
}
}
},
"statement-keyword": {
"patterns": [
{
@ -392,8 +384,13 @@
]
},
"member-access": {
"begin": "\\.\\s*(?!\\.)",
"begin": "(\\.)\\s*(?!\\.)",
"end": "(?x)\n # stop when you've just read non-whitespace followed by non-word\n # i.e. when finished reading an identifier or function call\n (?<=\\S)(?=\\W) |\n # stop when seeing the start of something that's not a word,\n # i.e. when seeing a non-identifier\n (^|(?<=\\s))(?=[^\\\\\\w\\s]) |\n $\n",
"beginCaptures": {
"1": {
"name": "punctuation.separator.period.python"
}
},
"patterns": [
{
"include": "#function-call"
@ -918,29 +915,6 @@
}
]
},
"fstring-formatting-braces": {
"patterns": [
{
"comment": "empty braces are illegal",
"match": "({)(\\s*?)(})",
"captures": {
"1": {
"name": "constant.character.format.placeholder.other.python"
},
"2": {
"name": "invalid.illegal.brace.python"
},
"3": {
"name": "constant.character.format.placeholder.other.python"
}
}
},
{
"name": "constant.character.escape.python",
"match": "({{|}})"
}
]
},
"fstring-formatting-singe-brace": {
"name": "invalid.illegal.brace.python",
"match": "(}(?!}))"
@ -949,11 +923,14 @@
"comment": "Import statements\n",
"patterns": [
{
"match": "(?x)\n \\s* \\b(from)\\b (\\s*\\.+\\s*) (import)?\n",
"match": "(?x)\n \\s* \\b(from)\\b \\s*(\\.+)\\s* (import)?\n",
"captures": {
"1": {
"name": "keyword.control.import.python"
},
"2": {
"name": "punctuation.separator.period.python"
},
"3": {
"name": "keyword.control.import.python"
}
@ -1077,8 +1054,13 @@
}
},
"member-access-class": {
"begin": "\\.\\s*(?!\\.)",
"begin": "(\\.)\\s*(?!\\.)",
"end": "(?<=\\S)(?=\\W)|$",
"beginCaptures": {
"1": {
"name": "punctuation.separator.period.python"
}
},
"patterns": [
{
"include": "#call-wrapper-inheritance"
@ -1671,7 +1653,7 @@
},
"magic-variable-names": {
"comment": "magic variables which a class/module may have.",
"match": "(?x)\n \\b(\n __(?:\n all | bases | builtins | class | code | debug | defaults | dict\n | doc | file | func | kwdefaults | members\n | metaclass | methods | module | mro | name\n | qualname | self | signature | slots | subclasses\n | version | weakref | wrapped | annotations | classcell\n | spec | path | package | future\n )__\n )\\b\n",
"match": "(?x)\n \\b(\n __(?:\n all | bases | builtins | class | code | debug | defaults | dict\n | doc | file | func | kwdefaults | members\n | metaclass | methods | module | mro | name\n | qualname | self | signature | slots | subclasses\n | version | weakref | wrapped | annotations | classcell\n | spec | path | package | future | traceback\n )__\n )\\b\n",
"captures": {
"1": {
"name": "support.variable.magic.python"
@ -1769,6 +1751,29 @@
}
]
},
"fstring-formatting-braces": {
"patterns": [
{
"comment": "empty braces are illegal",
"match": "({)(\\s*?)(})",
"captures": {
"1": {
"name": "constant.character.format.placeholder.other.python"
},
"2": {
"name": "invalid.illegal.brace.python"
},
"3": {
"name": "constant.character.format.placeholder.other.python"
}
}
},
{
"name": "constant.character.escape.python",
"match": "({{|}})"
}
]
},
"regexp-base-common": {
"patterns": [
{
@ -1891,6 +1896,14 @@
}
]
},
"codetags": {
"match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
"captures": {
"1": {
"name": "keyword.codetag.notation.python"
}
}
},
"comments-base": {
"name": "comment.line.number-sign.python",
"begin": "(\\#)",

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/df5bb18c64252f2e7b1aa87e2ed124666d314f1d",
"version": "https://github.com/MagicStack/MagicPython/commit/361a4964a559481330764a447e7bab88d4f1b01b",
"name": "MagicRegExp",
"scopeName": "source.regexp.python",
"fileTypes": [
@ -43,6 +43,29 @@
}
]
},
"fstring-formatting-braces": {
"patterns": [
{
"comment": "empty braces are illegal",
"match": "({)(\\s*?)(})",
"captures": {
"1": {
"name": "constant.character.format.placeholder.other.python"
},
"2": {
"name": "invalid.illegal.brace.python"
},
"3": {
"name": "constant.character.format.placeholder.other.python"
}
}
},
{
"name": "constant.character.escape.python",
"match": "({{|}})"
}
]
},
"regexp-base-common": {
"patterns": [
{
@ -165,6 +188,14 @@
}
]
},
"codetags": {
"match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
"captures": {
"1": {
"name": "keyword.codetag.notation.python"
}
}
},
"regexp-expression": {
"patterns": [
{

View file

@ -407,7 +407,29 @@
}
},
{
"c": "banana.size",
"c": "banana",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": ".",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "size",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
@ -2189,7 +2211,7 @@
}
},
{
"c": " g.",
"c": " g",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
@ -2199,6 +2221,17 @@
"hc_black": "default: #FFFFFF"
}
},
{
"c": ".",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "next",
"t": "source.python meta.function-call.python meta.function-call.generic.python",
@ -4499,7 +4532,18 @@
}
},
{
"c": ".fn ",
"c": ".",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "fn ",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
@ -4554,7 +4598,18 @@
}
},
{
"c": ".memo ",
"c": ".",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "memo ",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
@ -4829,7 +4884,18 @@
}
},
{
"c": ".memo",
"c": ".",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "memo",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
@ -4874,7 +4940,7 @@
},
{
"c": ".",
"t": "source.python",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -4973,7 +5039,7 @@
},
{
"c": ".",
"t": "source.python",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -5083,7 +5149,7 @@
},
{
"c": ".",
"t": "source.python",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -5159,7 +5225,7 @@
}
},
{
"c": " re.",
"c": " re",
"t": "source.python",
"r": {
"dark_plus": "default: #D4D4D4",
@ -5169,6 +5235,17 @@
"hc_black": "default: #FFFFFF"
}
},
{
"c": ".",
"t": "source.python punctuation.separator.period.python",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "search",
"t": "source.python meta.function-call.python meta.function-call.generic.python",