From b8998dc63df4c145d7b5e7e46e33efd872fb0b6c Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Tue, 25 Apr 2017 11:06:12 -0700 Subject: [PATCH 01/49] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 79a03ca5..e6b42c6f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2015 MagicStack Inc. http://magic.io +Copyright (c) 2015-present MagicStack Inc. http://magic.io Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 65a7b4cc0fc4b4fa08806d6d6adfd93b707f54b0 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 27 Apr 2017 15:40:24 -0400 Subject: [PATCH 02/49] travis: Use recent nodejs to run tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 100771e4..bc26510f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - - 0.10 + - "7" install: - make From a7d329dc4a860e589083c3b354bd8b9b51b8afbd Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 27 Apr 2017 15:59:24 -0400 Subject: [PATCH 03/49] build: Bump syntaxdev dep to 0.0.16 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3a581363..2d09f37c 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ test: ci-test atom -t . devenv: - npm install syntaxdev@0.0.15 + npm install syntaxdev@0.0.16 release: ./node_modules/.bin/syntaxdev build-plist --in grammars/src/MagicPython.syntax.yaml --out grammars/MagicPython.tmLanguage From ed68ac42c5cadb9b56902f03310d8d4afcdb012f Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 27 Apr 2017 16:01:59 -0400 Subject: [PATCH 04/49] travis: Fix build env --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc26510f..05da1abe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,17 @@ language: node_js node_js: - - "7" + - "6" + +env: + - CXX=g++-4.8 + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 install: - make From 34427bcba880c804484dce4d5da2431a64c73e2b Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Wed, 3 May 2017 15:12:36 -0400 Subject: [PATCH 05/49] Fix double quote autoclosing issue with docstring quotes. --- settings/sublime/Default.sublime-keymap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/sublime/Default.sublime-keymap b/settings/sublime/Default.sublime-keymap index 50c1b423..3a0ae806 100644 --- a/settings/sublime/Default.sublime-keymap +++ b/settings/sublime/Default.sublime-keymap @@ -5,7 +5,7 @@ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, - { "key": "preceding_text", "operator": "regex_contains", "operand": "(?:[bfruBFRU]|[^'[:alnum:]_])$", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "(?:[bfruBFRU]|[^\"[:alnum:]_])$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, { "key": "eol_selector", "operator": "equal", "operand": "source.python", "match_all": true } ] From cba112e1620dc50f7ed458497ecab925d1501f6c Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 3 May 2017 15:39:13 -0400 Subject: [PATCH 06/49] Prepare 1.0.10 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efb9d141..432eb0b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MagicPython", - "version": "1.0.9", + "version": "1.0.10", "engines": { "atom": "*", "node": "*", From 68c88ccfc21bc720e8e17137672d4c29b716cbd3 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Fri, 5 May 2017 19:32:04 -0400 Subject: [PATCH 07/49] Tweak symbol list. Elide arguments for extra long function definitions. --- settings/sublime/Symbol List.tmPreferences | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/settings/sublime/Symbol List.tmPreferences b/settings/sublime/Symbol List.tmPreferences index e832b863..987e0f72 100644 --- a/settings/sublime/Symbol List.tmPreferences +++ b/settings/sublime/Symbol List.tmPreferences @@ -15,7 +15,7 @@ # transform into 'class Classname' form s/(class)\s+([[:alpha:]_]\w*)\s*.*/$1 $2/g; - # transform into '[async] funciton_name(args,...)' form + # transform into '[async] funciton_name(args,...)' long form s/(?x) def \s+ ([[:alpha:]_]\w*) \s* \( @@ -24,6 +24,13 @@ # remove extra whitespace in arg list (except leading) s/(\S)\s{2,}/$1 /g; + + # transform into short form + s/(?x) + (class\s|async\s)? (\w+\() + (.{80})(.+) + (\))$ + /$1$2$3\.\.\.$5/g; uuid From 7cb46598c38a0823f3ff04b30dd5ee32a905347e Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 19 Jul 2017 16:22:19 -0400 Subject: [PATCH 08/49] Fix travis-ci build. Fixes #93. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 05da1abe..bf2912a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ node_js: env: - CXX=g++-4.8 +dist: trusty + addons: apt: sources: From ffab3f1ec0272e6ae6546ffd21eb84a49328930d Mon Sep 17 00:00:00 2001 From: tennyson-mccalla Date: Wed, 19 Jul 2017 18:12:22 -0400 Subject: [PATCH 09/49] Sync Atom snippets with language-python (#94) --- snippets/atom.cson | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/snippets/atom.cson b/snippets/atom.cson index 41827a5e..0f03f31b 100644 --- a/snippets/atom.cson +++ b/snippets/atom.cson @@ -34,9 +34,18 @@ '#!/usr/bin/env python': 'prefix': 'env' 'body': '#!/usr/bin/env python\n' + '#!/usr/bin/env python3': + 'prefix': 'env3' + 'body': '#!/usr/bin/env python3\n' '# coding=utf-8': 'prefix': 'enc' - 'body': '# coding=utf-8\n' + 'body': '# -*- coding: utf-8 -*-\n' + 'Import': + 'prefix': 'im' + 'body': 'import ${1:package/module}' + 'From/Import': + 'prefix': 'fim' + 'body': 'from ${1:package/module} import ${2:names}' 'Assert Equal': 'prefix': 'ase' 'body': 'self.assertEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0' @@ -97,6 +106,9 @@ 'while': 'prefix': 'while' 'body': 'while ${1:condition}:\n\t${2:pass}' + 'with statement': + 'prefix': 'with' + 'body': 'with ${1:expression} as ${2:target}:\n\t${3:pass}' 'Try/Except/Else/Finally': 'prefix': 'tryef' 'body': 'try:\n\t${1:pass}\nexcept${2: ${3:Exception} as ${4:e}}:\n\t${5:raise}\nelse:\n\t${6:pass}\nfinally:\n\t${7:pass}' @@ -118,12 +130,21 @@ 'Dictionary Comprehension': 'prefix': 'dc' 'body': '{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:variable}}' + 'Set Comprehension': + 'prefix': 'sc' + 'body': '{${1:value} for ${2:value} in ${3:variable}}' 'PDB set trace': 'prefix': 'pdb' 'body': 'import pdb; pdb.set_trace()\n' 'iPDB set trace': 'prefix': 'ipdb' 'body': 'import ipdb; ipdb.set_trace()\n' + 'rPDB set trace': + 'prefix': 'rpdb' + 'body': 'import rpdb2; rpdb2.start_embedded_debugger(\'${1:debug_password}\')$0' + 'PuDB set trace': + 'prefix': 'pudb' + 'body': 'import pudb; pudb.set_trace()' '__magic__': 'prefix': '__' 'body': '__${1:init}__' From 7fb0aa5b2e0ec906863d0b358c5a5648e28822b3 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 21 Jul 2017 13:04:09 -0400 Subject: [PATCH 10/49] Highlight __traceback__ --- grammars/MagicPython.cson | 2 +- grammars/MagicPython.tmLanguage | 2 +- grammars/src/MagicPython.syntax.yaml | 2 +- test/atom-spec/python-spec.js | 12 +++++++++--- test/builtins/builtins3.py | 4 ++++ 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 65b36733..efdd9583 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1829,7 +1829,7 @@ repository: | metaclass | methods | module | mro | name | qualname | self | signature | slots | subclasses | version | weakref | wrapped | annotations | classcell - | spec | path | package | future + | spec | path | package | future | traceback )__ )\\b diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 784b4894..7291caf0 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -2813,7 +2813,7 @@ indirectly through syntactic constructs | metaclass | methods | module | mro | name | qualname | self | signature | slots | subclasses | version | weakref | wrapped | annotations | classcell - | spec | path | package | future + | spec | path | package | future | traceback )__ )\b diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index b43b8f84..f39918b8 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -1370,7 +1370,7 @@ repository: | metaclass | methods | module | mro | name | qualname | self | signature | slots | subclasses | version | weakref | wrapped | annotations | classcell - | spec | path | package | future + | spec | path | package | future | traceback )__ )\b captures: diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 38958186..0359e613 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -130,7 +130,7 @@ describe("Grammar Tests", function() { it("test/builtins/builtins3.py", function() { - tokens = grammar.tokenizeLines("__all__ = ['bar', 'baz']\nsome.__bases__\nsome.__class__\nassert __debug__\n__builtins__\n__builtins__.len\nprint(__builtins__)\nsome.__dict__\nsome.__doc__\nsome.__file__\nsome.__members__\nsome.__metaclass__\nsome.__methods__\nsome.__module__\nsome.__mro__\nsome.__name__\nsome.__slots__\nsome.__subclasses__\nsome.__version__\nsome.__weakref__\nsome.__qualname__\nsome.__code__\nsome.__wrapped__\nsome.__signature__\nsome.__defaults__\nsome.__func__\nsome.__self__\nsome.__kwdefaults__\nsome.__matmul__\nsome.__imatmul__\nsome.__rmatmul__\nsome.__annotations__\nsome.__init_subclass__\nsome.__set_name__\nsome.__fspath__\nsome.__classcell__\nsome.__bytes__\nsome.__spec__\nsome.__path__\nsome.__prepare__\nsome.__package__\nsome.__notspecial__") + tokens = grammar.tokenizeLines("__all__ = ['bar', 'baz']\nsome.__bases__\nsome.__class__\nassert __debug__\n__builtins__\n__builtins__.len\nprint(__builtins__)\nsome.__dict__\nsome.__doc__\nsome.__file__\nsome.__members__\nsome.__metaclass__\nsome.__methods__\nsome.__module__\nsome.__mro__\nsome.__name__\nsome.__slots__\nsome.__subclasses__\nsome.__version__\nsome.__weakref__\nsome.__qualname__\nsome.__code__\nsome.__wrapped__\nsome.__signature__\nsome.__defaults__\nsome.__func__\nsome.__self__\nsome.__kwdefaults__\nsome.__matmul__\nsome.__imatmul__\nsome.__rmatmul__\nsome.__annotations__\nsome.__init_subclass__\nsome.__set_name__\nsome.__fspath__\nsome.__classcell__\nsome.__bytes__\nsome.__spec__\nsome.__path__\nsome.__prepare__\nsome.__package__\nsome.__traceback__\nsome.__notspecial__") expect(tokens[0][0].value).toBe("__all__"); expect(tokens[0][0].scopes).toEqual(["source.python","support.variable.magic.python"]); expect(tokens[0][1].value).toBe(" "); @@ -401,8 +401,14 @@ describe("Grammar Tests", function() { expect(tokens[41][0].scopes).toEqual(["source.python"]); expect(tokens[41][1].value).toBe("."); expect(tokens[41][1].scopes).toEqual(["source.python"]); - expect(tokens[41][2].value).toBe("__notspecial__"); - expect(tokens[41][2].scopes).toEqual(["source.python"]); + expect(tokens[41][2].value).toBe("__traceback__"); + expect(tokens[41][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[42][0].value).toBe("some"); + expect(tokens[42][0].scopes).toEqual(["source.python"]); + expect(tokens[42][1].value).toBe("."); + expect(tokens[42][1].scopes).toEqual(["source.python"]); + expect(tokens[42][2].value).toBe("__notspecial__"); + expect(tokens[42][2].scopes).toEqual(["source.python"]); }); it("test/builtins/builtins4.py", diff --git a/test/builtins/builtins3.py b/test/builtins/builtins3.py index 68036b64..fd3db478 100644 --- a/test/builtins/builtins3.py +++ b/test/builtins/builtins3.py @@ -39,6 +39,7 @@ some.__path__ some.__prepare__ some.__package__ +some.__traceback__ some.__notspecial__ @@ -179,4 +180,7 @@ __package__ : source.python, support.variable.magic.python some : source.python . : source.python +__traceback__ : source.python, support.variable.magic.python +some : source.python +. : source.python __notspecial__ : source.python From da1a537acab2cde0748d47418f2d13b5d5352f48 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 21 Jul 2017 13:05:08 -0400 Subject: [PATCH 11/49] Prepare 1.0.11 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 432eb0b8..b7b86461 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MagicPython", - "version": "1.0.10", + "version": "1.0.11", "engines": { "atom": "*", "node": "*", From d39070f6212b43803c67d61110dfd243b4a21923 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 21 Jul 2017 14:01:13 -0400 Subject: [PATCH 12/49] Use a PNG icon for vscode extensions gallery --- icon.png | Bin 0 -> 5228 bytes icon.svg | 23 ----------------------- package.json | 2 +- 3 files changed, 1 insertion(+), 24 deletions(-) create mode 100644 icon.png delete mode 100644 icon.svg diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c49edec988b74670e30890b71c97e7ff7d9be412 GIT binary patch literal 5228 zcmZ`-c{r5q+kVErWGAvsQbx!Kp|VU_Ls>GEWt50g5n-6YBoUP*TfJf|WqncEB4$Lg zl~J-}V$g^b!;CS8!T0EWzwh||`2GI4pXE57=eh6uy3Xr7&+AEYJYy{)BrgO2fXFEu z3uo|*+Zh6U;IYH>Vjp;dggRTF1giTLe}XqW{wGeK0DzaN!kmk|;Jsk5&G}FO5bf9* zkglLIUjUGXoU%CKf<`Um{S1}qYD#4As|1>jr5dCG2d@eF95(Q&N9^5wN-ntV{VAMW zT*d|dOZSnGOKqd0Zw>gQJi_2v(lhsL?^S*4Hb}`EMY3GIMm8^0*knzRgGej(q^FBd z7ESve-0Dx974AH$=buj@57O*ObNqUjKj667b}B&Rng1~Q>%1{qpT`FhI8=GR;aZ|D!BQ_^^UZ2 zY%LcpW!yB?c#2?uq{J6^p&O_?&U=WvM*LF{qAS$!qBfnOpu>N3jZng&oSISnh@rd~ z4dwkS4N4S!7{6X9QRcp(C~X)f$O_fadCui%8X;4+OH`_fc4D?rtbkjh2R7H&$W@?0 zTrTfRvk3Pt`mzd5^a*K}ScrJ~L=vJNxDfZmAwLePOyJGChcFcZ;1p2+j^}HG;i2mu z_?KL5)JC4}Qpk%L!{5y|XpyUlsJqF2Z|)LRs^6Ic=a`{lD8olI9)ul12{^=-EsU8B zG>|R0+TnzL)_i&mGi~)Zx8pG3+oSFKlv40BOFd%7v|ru+=EU2aW>~sgVbr9Sv>|-= zR<)4?8JM&PS|w;!W8+?8VL%AGh+&%Hz`Zv;)tu-Zvyj5b{HqF9SVk~k+n7FijeFq5 zBBBCouo6o5H`zS)fwRoZ%l>=)2(@;8=*DN6$y4#&?6EhEcAwTxMzk zmmru_dqY?JhWwG2y8zToMm+{;*C1@xadw!{uIg?4y^)$*kCFWipl50s1Z#p4jxIwI zVja2avj^9lAAOQ-^i%T+N}aPytY0KWc zLdO?*d#oir9E8DHr}yBl*BF_b!J(MV^O&0WiP9i><0lGi9whrN5HJuAL9n%e25fj? z=@s$|eV(viqDR5_`8JI-a<}#EB-Y`YAPrTtw*+FO9OX?6V+A_aV_|vAISpC~7A!!2 z!6>lLe+Zw8q6i{zoZgebmqN&k#2BVs%ady?Pqr(df0@(3(ZF+hw=&u(@<*0;wGHQZ zvbO;7WqrVwz5oRD7}A(|3<4s?QU#bF0DNst71ryiwS^P}co9w4G{B2*4VNYP0}U1e?xzS+fH`|67bS7S?5YrCG^SS+ z_x=GT8y?7715xfh>?VNFdJFE+A2N`MkASo>IcRU?o2RsXJfnZDP*!D^FQ8m8(Qyq}*G(=qXCRe6D26)_OD97fb1onETY2c0 zPt#Xf09?YWxjfrH)=bG(&FW%~}BqYjS1~Q15Bv7T@cAYr=mA)Wi{otQrMeTE*;4Y-`ehHGBTMGKp1L zqy%^-4>imd9RTN$r{@8WyZwi14&afoH=?3Vffj5%utdL8Igv$7e{nk`5?$@Dpb@~2 zGpYO84bx%k1Ey>z=KAy=V!|KRx&k;;OB*oz*l!_e$X0s-l39(VdwH8cD6tKE?iro= z3-N_Az~5Ub+_Y!C;5@1nL0kfsD+^?S9kNwo$J_Vh@VC{?x6)xmcZYNQrLji`Yx8vK zxF%zLkB2Vg-v&YMP8S@be;t6Qfk3mMOKhEU2bsLoiD}QFnx)kT(@G}n4%TsruXcxP zQwBQwNW;1}wj<4y*aERyRlr&zR@x!>os@Kia;L}Nw-fO-pO1;C^Y8tgzA!g2@Ei^< zCGwz)&*r=(-Z(-_^xo2 zn_5|iu>}Kw*JNLt8+k*}|?5j=*Ny6UQ$?&q#)ZuoaIgj&G%P{kU06I6P zrxY@f4vL!gA3$6I_R~A{Vz}8nYIwfAmITxrSW(%h=)B+TOAPEZyCSDYtQv$QRW`MK z8DHro?<$1w`DE3&9ttAk|CmOYn)_ib($-apu1H#T+V`<+-jD9JoZ+nn)4KC%WXyz| zStyNLXObclVoboLMu0Kx4tZ0mZliLuRVCrrr8L87bQp?%cHLRfVn#Dp~ znlmsKOV4&QRcWN3CAS)_t{?n67IHb5wrla{nYIqNQ}cXU>a<`AI<9Wsi@kK-(9&;T znKZB+iSPYi!j~nj9b%uQ4Ob&x@w6j-cQt=M^bZET?I zwzzrc{2j;7Y#!;XWHIcQm8$9l5E3GZSZiYy?gg)N;G45jKi+PNb!=ZvatG=_OJjJ2 zMWqMwkv=D4bnaW(T#uxn(oDKdG=jl07EVwadn z^{*Ze1)+qNk^CiU?zC&0Pi*4LQTi=SPZJX;p~+6;NiwU4bP@woraKvDP)@NIzkhAt z{NePNXEh4c%^g-OIAB&k0;f%=e1l_cB%#?Yj4j*d<{!D3+%_-YD?&t5cxYdp?)XI0 zv>>6Pks9H+82kA4QGoFD>$yMr>;WlLGUk6CI{fUn17$wywV|zOnd60HOY|_;`EKej zx7Mo|m;&949ePm8@UOEec>Dk`83y>zHO|Zyjdz?B zd18nm)rteBBSGZw+?U)GOu8IFl!$A9>Anq$Q!-uC^*7@hG!a8Pwr>B{%>)kZlu}%d z_jGCX!N~4l<-Nbu*u|B`J+Gx76kMYX(0W1VMp^8kx&^IP=UcL$93^fnyS4sX11D3+ zZwhuQZ_wa%So3hGmZdsx!AuY1DMvpl8V2})R*kX!(h_?-;atH%6%fA>?!90x280!h^|Nq+>PvoSodA(B#(*R+RtWvCBKL39cE zcq9nAsf^un#NDP4i%c$DZ2Tz=Q01&ZIh=f$mz=+ue|?KaNs=pcM1tzAA4qeihE7k_ ze2iB^Z&=pb{jh}~_PKm0h%Au;_s~fU!e{4+vVq<+DNT|TnnO9HD8C9 zeEdAf)=MK+AzSd}wTvBEnDFKU?P1LUifG%wQMB){uD?f)!>yaTVgD}+_T=Mk1aIRh zl&bOC+14&E@m@&TW8w*QZ=>&xGr#_(9;yhJg-_Z^bcWm!C$q_Gq7MT=;{ery%7)O%0-}JFLwCpO85ib*SW4BM ze9KgHil5vV#Kw44KWnG`fqq%+ai!DAY5Y6Z$21vcG%Yw-*D96d|G@h!o^!a48y85I zZ@_=a4B|)ZgXY|1kj44iyqOi||2*rypdno6etqLaleu{>97vlk(GD1mbaF5~ zp#~jUVo+!z2%8}Wy)+VhjPh(?4I0*XLEG%VW*e*i5`ZbCMO>}KT-X=5Xp>#8YOO<+nd zW~aKp-^t~$+#v&1QBSa&6{(jnu$R`P%673@HU!Q3 zt+>zKuiJXr9)z%Oc`IgfL9)N25ln7X`$p(BQ%LS zc-!jX(zZ3&84nD4E#6DD!$i#btO@6cE6!U&+IW?UwxK(%c*wTd?lF2;g{g11*ps>E zy%8HxS6stx%3q>i@7{lva{-y!J86g25NkhUy# z?}I=kis#IaU?o!pk)@kjiW8RGvTq$98^6lZ^ijg)FY2x>YD;KUtnaFi$VSJtKlhZn z1s&->@=_G|+$d>|u<$Q$Ww=IPp6Lpk?vmO7_8LjrV-fL}3tRgV&`)(rHr}17ek=*O z;E5(ED|2}L`Vz2z@)P&N0`8?YQFS=RQBSDE1xU-cJg}0g5}5%009dhqY>Oo6&2Y8J zxx4X2RPUd9i%+^m^vWvoy60@DCwy%JPgw^~noy F{{wM8NgDtF literal 0 HcmV?d00001 diff --git a/icon.svg b/icon.svg deleted file mode 100644 index e80d60cd..00000000 --- a/icon.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/package.json b/package.json index b7b86461..759d184b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "syntax", "python3" ], - "icon": "icon.svg", + "icon": "icon.png", "galleryBanner": { "color": "#2c2c2c", "theme": "dark" From 361a4964a559481330764a447e7bab88d4f1b01b Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 10 Aug 2017 20:04:22 -0400 Subject: [PATCH 13/49] Clean-up the grammar so that MagicRegExp does not have missing rules. (#100) Thanks to @stoivo for noticing this issue. --- grammars/MagicPython.cson | 46 +++++----- grammars/MagicPython.tmLanguage | 98 +++++++++++----------- grammars/MagicRegExp.cson | 23 +++++ grammars/MagicRegExp.tmLanguage | 49 +++++++++++ grammars/src/MagicPython.syntax.yaml | 16 ---- grammars/src/regexp-common.inc.syntax.yaml | 16 ++++ test/atom-spec/python-re-spec.js | 17 ++++ test/regexp/comments3.re | 10 +++ 8 files changed, 187 insertions(+), 88 deletions(-) create mode 100644 test/regexp/comments3.re diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index efdd9583..568d9944 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -252,11 +252,6 @@ repository: captures: "1": name: "keyword.control.flow.python" - codetags: - match: "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)" - captures: - "1": - name: "keyword.codetag.notation.python" "statement-keyword": patterns: [ { @@ -988,24 +983,6 @@ repository: include: "#fstring-formatting-singe-brace" } ] - "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: "(}(?!}))" @@ -1931,6 +1908,24 @@ repository: include: "#regexp-base-common" } ] + "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: [ { @@ -2066,6 +2061,11 @@ repository: include: "#regexp-escape-catchall" } ] + 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: "(\\#)" diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 7291caf0..6545fbab 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -404,19 +404,6 @@ - codetags - - match - (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) - captures - - 1 - - name - keyword.codetag.notation.python - - - statement-keyword patterns @@ -1509,42 +1496,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 @@ -2978,6 +2929,42 @@ indirectly through syntactic constructs + 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 @@ -3188,6 +3175,19 @@ indirectly through syntactic constructs + codetags + + match + (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) + captures + + 1 + + name + keyword.codetag.notation.python + + + comments-base name diff --git a/grammars/MagicRegExp.cson b/grammars/MagicRegExp.cson index 69e0c300..175b80f6 100644 --- a/grammars/MagicRegExp.cson +++ b/grammars/MagicRegExp.cson @@ -35,6 +35,24 @@ repository: include: "#regexp-base-common" } ] + "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: [ { @@ -170,6 +188,11 @@ repository: include: "#regexp-escape-catchall" } ] + codetags: + match: "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)" + captures: + "1": + name: "keyword.codetag.notation.python" "regexp-expression": patterns: [ { diff --git a/grammars/MagicRegExp.tmLanguage b/grammars/MagicRegExp.tmLanguage index 3bc9d48e..3d19e058 100644 --- a/grammars/MagicRegExp.tmLanguage +++ b/grammars/MagicRegExp.tmLanguage @@ -58,6 +58,42 @@ + 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 @@ -268,6 +304,19 @@ + codetags + + match + (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) + captures + + 1 + + name + keyword.codetag.notation.python + + + regexp-expression patterns diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index f39918b8..2c31e243 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -351,11 +351,6 @@ repository: captures: '1': {name: keyword.control.flow.python} - codetags: - match: (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) - captures: - '1': {name: keyword.codetag.notation.python} - statement-keyword: patterns: - name: storage.type.function.python @@ -824,17 +819,6 @@ repository: - include: '#fstring-formatting-braces' - include: '#fstring-formatting-singe-brace' - 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: (}(?!})) diff --git a/grammars/src/regexp-common.inc.syntax.yaml b/grammars/src/regexp-common.inc.syntax.yaml index d7b02061..e367af87 100644 --- a/grammars/src/regexp-common.inc.syntax.yaml +++ b/grammars/src/regexp-common.inc.syntax.yaml @@ -12,6 +12,17 @@ repository: - match: \{.*?\} - include: '#regexp-base-common' + 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: - name: support.other.match.any.regexp @@ -109,4 +120,9 @@ repository: - include: '#regexp-escape-character' - include: '#regexp-escape-unicode' - include: '#regexp-escape-catchall' + + codetags: + match: (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) + captures: + '1': {name: keyword.codetag.notation.python} ... diff --git a/test/atom-spec/python-re-spec.js b/test/atom-spec/python-re-spec.js index 5a5557c5..2874e777 100644 --- a/test/atom-spec/python-re-spec.js +++ b/test/atom-spec/python-re-spec.js @@ -56,6 +56,23 @@ describe("Grammar Tests", function() { expect(tokens[4][3].scopes).toEqual(["source.regexp.python","comment.regexp","punctuation.comment.end.regexp"]); }); + it("test/regexp/comments3.re", + function() { + tokens = grammar.tokenizeLines("foo(?#NOTE:comment)bar") + expect(tokens[0][0].value).toBe("foo"); + expect(tokens[0][0].scopes).toEqual(["source.regexp.python"]); + expect(tokens[0][1].value).toBe("(?#"); + expect(tokens[0][1].scopes).toEqual(["source.regexp.python","comment.regexp","punctuation.comment.begin.regexp"]); + expect(tokens[0][2].value).toBe("NOTE"); + expect(tokens[0][2].scopes).toEqual(["source.regexp.python","comment.regexp","keyword.codetag.notation.python"]); + expect(tokens[0][3].value).toBe(":comment"); + expect(tokens[0][3].scopes).toEqual(["source.regexp.python","comment.regexp"]); + expect(tokens[0][4].value).toBe(")"); + expect(tokens[0][4].scopes).toEqual(["source.regexp.python","comment.regexp","punctuation.comment.end.regexp"]); + expect(tokens[0][5].value).toBe("bar"); + expect(tokens[0][5].scopes).toEqual(["source.regexp.python"]); + }); + it("test/regexp/conditional1.re", function() { tokens = grammar.tokenizeLines("(<)?(\\w+@\\w+(?:\\.\\w+)+)(?(1)>|$)") diff --git a/test/regexp/comments3.re b/test/regexp/comments3.re new file mode 100644 index 00000000..8f1cb962 --- /dev/null +++ b/test/regexp/comments3.re @@ -0,0 +1,10 @@ +foo(?#NOTE:comment)bar + + + +foo : source.regexp.python +(?# : comment.regexp, punctuation.comment.begin.regexp, source.regexp.python +NOTE : comment.regexp, keyword.codetag.notation.python, source.regexp.python +:comment : comment.regexp, source.regexp.python +) : comment.regexp, punctuation.comment.end.regexp, source.regexp.python +bar : source.regexp.python From dcb1a380a0a73e5905ae090696bc40fe1d8595ca Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 10 Aug 2017 20:04:38 -0400 Subject: [PATCH 14/49] Update README.md. (#99) --- README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index dd281085..41a48420 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,26 @@ This is a package with preferences and syntax highlighter for cutting edge Python 3, although Python 2 is well supported, too. The syntax is compatible with [Sublime Text](http://www.sublimetext.com), [Atom](http://atom.io) and -[Visual Studio Code](http://code.visualstudio.com). -It is meant to be a drop-in replacement for the default Python package. +[Visual Studio Code](http://code.visualstudio.com). It is meant to be a drop-in +replacement for the default Python package. -MagicPython correctly highlights all Python 3.5 and 3.6 syntax features, -including type annotations, f-strings and regular expressions. It is built -from scratch for robustness with an extensive test suite. +We are proud to say that MagicPython is used by GitHub to highlight Python. -We are proud to say that MagicPython has been included into the -[github/linguist](https://github.com/github/linguist), a library used -by GitHub.com to process languages. +**Attention VSCode users**: MagicPython is used as the _default_ +Python highlighter in Visual Studio Code. Don't install it unless you +want or need the cutting edge version of it. You will likely see no +difference because you're already using MagicPython. +MagicPython correctly highlights all Python 3 syntax features, +including type annotations, f-strings and regular expressions. It is +built from scratch for robustness with an extensive test suite. -![](https://magicstack.github.io/MagicPython/example.png) - -Type hints in comments require support by the color scheme. The one +Type hints in comments require support by the color scheme. The one used in the screenshot is [Chromodynamics](https://github.com/MagicStack/Chromodynamics). +![](https://magicstack.github.io/MagicPython/example.png) + ## Installation Instructions From b453f26ed856c9b16a053517c41207e3a72cc7d5 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 10 Aug 2017 22:35:17 -0400 Subject: [PATCH 15/49] Highlight `.` in its own scope. (#101) The scope for `.` is `punctuation.separator.period.python`. --- grammars/MagicPython.cson | 14 +- grammars/MagicPython.tmLanguage | 27 +- grammars/src/MagicPython.syntax.yaml | 11 +- misc/scopes | 1 + test/atom-spec/python-spec.js | 562 +++++++++++++++------------ test/builtins/builtins3.py | 78 ++-- test/builtins/builtins4.py | 12 +- test/builtins/builtins5.py | 9 +- test/calls/call3.py | 6 +- test/calls/call4.py | 8 +- test/calls/call7.py | 10 +- test/calls/call8.py | 12 +- test/calls/print1.py | 4 +- test/classes/class11.py | 10 +- test/classes/class12.py | 10 +- test/classes/class14.py | 6 +- test/classes/class2.py | 4 +- test/classes/super1.py | 10 +- test/expressions/const1.py | 8 +- test/expressions/expr10.py | 2 +- test/expressions/expr11.py | 2 +- test/expressions/expr15.py | 2 +- test/expressions/expr18.py | 4 +- test/expressions/expr19.py | 18 +- test/expressions/expr7.py | 6 +- test/fstrings/comment4.py | 2 +- test/fstrings/simple2.py | 2 +- test/illegals/illegal1.py | 2 +- test/regexp/python8.py | 4 +- test/statements/import1.py | 3 +- test/statements/import2.py | 12 +- test/statements/import3.py | 8 +- test/statements/import4.py | 8 +- test/statements/import5.py | 6 +- test/strings/format2.py | 2 +- 35 files changed, 493 insertions(+), 392 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 568d9944..526b2873 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -386,7 +386,7 @@ repository: } ] "member-access": - begin: "\\.\\s*(?!\\.)" + begin: "(\\.)\\s*(?!\\.)" end: ''' (?x) # stop when you've just read non-whitespace followed by non-word @@ -398,6 +398,9 @@ repository: $ ''' + beginCaptures: + "1": + name: "punctuation.separator.period.python" patterns: [ { include: "#function-call" @@ -995,12 +998,14 @@ repository: { match: ''' (?x) - \\s* \\b(from)\\b (\\s*\\.+\\s*) (import)? + \\s* \\b(from)\\b \\s*(\\.+)\\s* (import)? ''' captures: "1": name: "keyword.control.import.python" + "2": + name: "punctuation.separator.period.python" "3": name: "keyword.control.import.python" } @@ -1122,8 +1127,11 @@ repository: "1": name: "entity.other.inherited-class.python" "member-access-class": - begin: "\\.\\s*(?!\\.)" + begin: "(\\.)\\s*(?!\\.)" end: "(?<=\\S)(?=\\W)|$" + beginCaptures: + "1": + name: "punctuation.separator.period.python" patterns: [ { include: "#call-wrapper-inheritance" diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 6545fbab..ae03ed0e 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -589,7 +589,7 @@ member-access begin - \.\s*(?!\.) + (\.)\s*(?!\.) end (?x) # stop when you've just read non-whitespace followed by non-word @@ -600,6 +600,14 @@ (^|(?<=\s))(?=[^\\\w\s]) | $ + beginCaptures + + 1 + + name + punctuation.separator.period.python + + patterns @@ -1513,7 +1521,7 @@ match (?x) - \s* \b(from)\b (\s*\.+\s*) (import)? + \s* \b(from)\b \s*(\.+)\s* (import)? captures @@ -1522,6 +1530,11 @@ name keyword.control.import.python + 2 + + name + punctuation.separator.period.python + 3 name @@ -1719,9 +1732,17 @@ member-access-class begin - \.\s*(?!\.) + (\.)\s*(?!\.) end (?<=\S)(?=\W)|$ + beginCaptures + + 1 + + name + punctuation.separator.period.python + + patterns diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 2c31e243..43009579 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -415,7 +415,7 @@ repository: match: (?x) \b ([[:alpha:]_]\w*) \b member-access: - begin: \.\s*(?!\.) + begin: (\.)\s*(?!\.) end: | (?x) # stop when you've just read non-whitespace followed by non-word @@ -425,6 +425,8 @@ repository: # i.e. when seeing a non-identifier (^|(?<=\s))(?=[^\\\w\s]) | $ + beginCaptures: + '1': {name: punctuation.separator.period.python} patterns: - include: '#function-call' - include: '#member-access-base' @@ -829,9 +831,10 @@ repository: patterns: - match: | (?x) - \s* \b(from)\b (\s*\.+\s*) (import)? + \s* \b(from)\b \s*(\.+)\s* (import)? captures: '1': {name: keyword.control.import.python} + '2': {name: punctuation.separator.period.python} '3': {name: keyword.control.import.python} - name: keyword.control.import.python match: \b(?> : keyword.operator.bitwise.python, source.python sys : source.python -. : source.python +. : punctuation.separator.period.python, source.python stderr : source.python , : punctuation.separator.element.python, source.python : source.python @@ -72,7 +72,7 @@ file : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python = : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python sys : meta.function-call.arguments.python, meta.function-call.python, source.python -. : meta.function-call.arguments.python, meta.function-call.python, source.python +. : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.period.python, source.python stderr : meta.function-call.arguments.python, meta.function-call.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python print : meta.function-call.python, source.python, support.function.builtin.python diff --git a/test/classes/class11.py b/test/classes/class11.py index 6083dc95..bad00706 100644 --- a/test/classes/class11.py +++ b/test/classes/class11.py @@ -32,7 +32,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : : meta.function.python, punctuation.section.function.begin.python, source.python : source.python self : source.python, variable.language.special.self.python -. : source.python +. : punctuation.separator.period.python, source.python a : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -40,7 +40,7 @@ def : meta.function.python, source.python, storage.type.function.pytho a : source.python : source.python self : source.python, variable.language.special.self.python -. : source.python +. : punctuation.separator.period.python, source.python b : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -57,7 +57,7 @@ def : meta.function.python, source.python, storage.type.function.pytho ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python : source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python self : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -65,9 +65,9 @@ def : meta.function.python, source.python, storage.type.function.pytho 1 : constant.numeric.dec.python, source.python : source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python self : source.python -. : source.python +. : punctuation.separator.period.python, source.python bar : source.python : source.python = : keyword.operator.assignment.python, source.python diff --git a/test/classes/class12.py b/test/classes/class12.py index 90e656bf..e8b69161 100644 --- a/test/classes/class12.py +++ b/test/classes/class12.py @@ -37,7 +37,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : : meta.function.python, punctuation.section.function.begin.python, source.python : source.python cls : source.python, variable.language.special.cls.python -. : source.python +. : punctuation.separator.period.python, source.python a : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -45,7 +45,7 @@ def : meta.function.python, source.python, storage.type.function.pytho a : source.python : source.python cls : source.python, variable.language.special.cls.python -. : source.python +. : punctuation.separator.period.python, source.python b : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -68,7 +68,7 @@ def : meta.function.python, source.python, storage.type.function.pytho 1 : constant.numeric.dec.python, source.python : source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python cls : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -76,9 +76,9 @@ def : meta.function.python, source.python, storage.type.function.pytho 1 : constant.numeric.dec.python, source.python : source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python cls : source.python -. : source.python +. : punctuation.separator.period.python, source.python __name__ : source.python, support.variable.magic.python : source.python cls : meta.item-access.python, source.python, variable.language.special.cls.python diff --git a/test/classes/class14.py b/test/classes/class14.py index 036543ed..706969f9 100644 --- a/test/classes/class14.py +++ b/test/classes/class14.py @@ -8,12 +8,12 @@ class : meta.class.python, source.python, storage.type.class.python F : entity.name.type.class.python, meta.class.python, source.python ( : meta.class.inheritance.python, meta.class.python, punctuation.definition.inheritance.begin.python, source.python f : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python Exception : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python f : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python type : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python @@ -21,7 +21,7 @@ class : meta.class.python, source.python, storage.type.class.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python Exception : meta.class.inheritance.python, meta.class.python, source.python, support.type.exception.python -. : meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python a : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python diff --git a/test/classes/class2.py b/test/classes/class2.py index bba5e52d..536f9258 100644 --- a/test/classes/class2.py +++ b/test/classes/class2.py @@ -14,12 +14,12 @@ class : meta.class.python, source.python, storage.type.class.python Spam : entity.name.type.class.python, meta.class.python, source.python ( : meta.class.inheritance.python, meta.class.python, punctuation.definition.inheritance.begin.python, source.python Foo : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python Bar : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python Bar : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python name : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python = : keyword.operator.assignment.python, meta.class.inheritance.python, meta.class.python, source.python { : meta.class.inheritance.python, meta.class.python, punctuation.definition.dict.begin.python, source.python diff --git a/test/classes/super1.py b/test/classes/super1.py index 5172f365..1840ed9b 100644 --- a/test/classes/super1.py +++ b/test/classes/super1.py @@ -30,7 +30,7 @@ def : meta.function.python, source.python, storage.type.function.pytho super : meta.function-call.python, source.python, support.type.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python __init__ : meta.function-call.python, source.python, support.function.magic.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python @@ -41,7 +41,8 @@ def : meta.function.python, source.python, storage.type.function.pytho super : meta.function-call.python, source.python, support.type.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python __init__ : meta.function-call.python, source.python, support.function.magic.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python @@ -52,7 +53,8 @@ def : meta.function.python, source.python, storage.type.function.pytho super : meta.function-call.python, source.python, support.type.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python \ : punctuation.separator.continuation.line.python, source.python : source.python __init__ : meta.function-call.python, source.python, support.function.magic.python @@ -71,7 +73,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python : source.python foo : source.python -. : source.python +. : punctuation.separator.period.python, source.python __init__ : meta.function-call.python, source.python, support.function.magic.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python bar : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python diff --git a/test/expressions/const1.py b/test/expressions/const1.py index 8e19a502..e59a19be 100644 --- a/test/expressions/const1.py +++ b/test/expressions/const1.py @@ -12,24 +12,24 @@ PROTOCOL_v2 : constant.other.caps.python, source.python : source.python QQQ : constant.other.caps.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python bar : source.python : source.python baz : source.python -. : source.python +. : punctuation.separator.period.python, source.python AA_a : constant.other.caps.python, source.python : source.python _AAA : constant.other.caps.python, source.python : source.python foo : source.python -. : source.python +. : punctuation.separator.period.python, source.python _AAA : constant.other.caps.python, source.python QQQq : source.python : source.python QQQq123 : source.python : source.python self : source.python, variable.language.special.self.python -. : source.python +. : punctuation.separator.period.python, source.python FOOO : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/expressions/expr10.py b/test/expressions/expr10.py index 0a14b7df..501fb475 100644 --- a/test/expressions/expr10.py +++ b/test/expressions/expr10.py @@ -32,5 +32,5 @@ ... : constant.other.ellipsis.python, source.python ) : punctuation.parenthesis.end.python, source.python ... : constant.other.ellipsis.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python __class__ : source.python, support.variable.magic.python diff --git a/test/expressions/expr11.py b/test/expressions/expr11.py index 584174eb..142ff621 100644 --- a/test/expressions/expr11.py +++ b/test/expressions/expr11.py @@ -7,7 +7,7 @@ = : keyword.operator.assignment.python, source.python : source.python self : source.python, variable.language.special.self.python -. : source.python +. : punctuation.separator.period.python, source.python some_list : meta.item-access.python, source.python [ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python 1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python diff --git a/test/expressions/expr15.py b/test/expressions/expr15.py index 80558f9d..2815cdae 100644 --- a/test/expressions/expr15.py +++ b/test/expressions/expr15.py @@ -3,5 +3,5 @@ foofrom : source.python -. : source.python +. : punctuation.separator.period.python, source.python something : source.python diff --git a/test/expressions/expr18.py b/test/expressions/expr18.py index 41ed45db..8326520f 100644 --- a/test/expressions/expr18.py +++ b/test/expressions/expr18.py @@ -4,8 +4,8 @@ a : source.python -. : source.python +. : punctuation.separator.period.python, source.python Exception : source.python Exception : source.python, support.type.exception.python -. : source.python +. : punctuation.separator.period.python, source.python a : source.python diff --git a/test/expressions/expr19.py b/test/expressions/expr19.py index 604b9b84..45dd0e8e 100644 --- a/test/expressions/expr19.py +++ b/test/expressions/expr19.py @@ -12,31 +12,37 @@ a : source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python foo : comment.line.number-sign.python, source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python foo : comment.line.number-sign.python, source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python \ : punctuation.separator.continuation.line.python, source.python : source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python foo : comment.line.number-sign.python, source.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python bar : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.docstring.single.python bar : source.python, string.quoted.docstring.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.docstring.single.python a : source.python -. : source.python +. : punctuation.separator.period.python, source.python + : source.python \ : punctuation.separator.continuation.line.python, source.python : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python diff --git a/test/expressions/expr7.py b/test/expressions/expr7.py index eef5c56e..936af9e8 100644 --- a/test/expressions/expr7.py +++ b/test/expressions/expr7.py @@ -3,17 +3,17 @@ a : source.python -. : source.python +. : punctuation.separator.period.python, source.python True : keyword.illegal.name.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python b : source.python -. : source.python +. : punctuation.separator.period.python, source.python False : keyword.illegal.name.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python d : source.python -. : source.python +. : punctuation.separator.period.python, source.python None : keyword.illegal.name.python, source.python diff --git a/test/fstrings/comment4.py b/test/fstrings/comment4.py index 793efc35..f070cdd0 100644 --- a/test/fstrings/comment4.py +++ b/test/fstrings/comment4.py @@ -4,7 +4,7 @@ self : source.python, variable.language.special.self.python -. : source.python +. : punctuation.separator.period.python, source.python assertEqual : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python f : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.single.python diff --git a/test/fstrings/simple2.py b/test/fstrings/simple2.py index 967bb1f3..48ce0dcd 100644 --- a/test/fstrings/simple2.py +++ b/test/fstrings/simple2.py @@ -22,7 +22,7 @@ normal : meta.fstring.python, source.python, string.interpolated.python, string.quoted.single.python { : constant.character.format.placeholder.other.python, meta.fstring.python, source.python fo : meta.fstring.python, source.python -. : meta.fstring.python, source.python +. : meta.fstring.python, punctuation.separator.period.python, source.python __add__ : meta.fstring.python, source.python, support.function.magic.python !s : meta.fstring.python, source.python, storage.type.format.python } : constant.character.format.placeholder.other.python, meta.fstring.python, source.python diff --git a/test/illegals/illegal1.py b/test/illegals/illegal1.py index 61c22dce..6010bc4f 100644 --- a/test/illegals/illegal1.py +++ b/test/illegals/illegal1.py @@ -28,7 +28,7 @@ def : meta.function.python, source.python, storage.type.function.pytho .class : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python ) : punctuation.parenthesis.end.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python fuuuu : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python baz : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python diff --git a/test/regexp/python8.py b/test/regexp/python8.py index b0080e77..f0babc73 100644 --- a/test/regexp/python8.py +++ b/test/regexp/python8.py @@ -30,7 +30,7 @@ = : keyword.operator.assignment.python, source.python : source.python re : source.python -. : source.python +. : punctuation.separator.period.python, source.python compile : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python r : meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python @@ -187,7 +187,7 @@ , : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python : meta.function-call.arguments.python, meta.function-call.python, source.python re : meta.function-call.arguments.python, meta.function-call.python, source.python -. : meta.function-call.arguments.python, meta.function-call.python, source.python +. : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.period.python, source.python ASCII : constant.other.caps.python, meta.function-call.arguments.python, meta.function-call.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python : source.python diff --git a/test/statements/import1.py b/test/statements/import1.py index 1e322e8f..f41b72c5 100644 --- a/test/statements/import1.py +++ b/test/statements/import1.py @@ -4,7 +4,8 @@ from : keyword.control.import.python, source.python - ... : source.python + : source.python +... : punctuation.separator.period.python, source.python foo : source.python : source.python import : keyword.control.import.python, source.python diff --git a/test/statements/import2.py b/test/statements/import2.py index 18a8049e..842f68d2 100644 --- a/test/statements/import2.py +++ b/test/statements/import2.py @@ -5,17 +5,23 @@ from : keyword.control.import.python, source.python - .... : source.python + : source.python +.... : punctuation.separator.period.python, source.python + : source.python import : keyword.control.import.python, source.python : source.python a : source.python from : keyword.control.import.python, source.python - ... : source.python + : source.python +... : punctuation.separator.period.python, source.python + : source.python import : keyword.control.import.python, source.python : source.python b : source.python from : keyword.control.import.python, source.python - .. : source.python + : source.python +.. : punctuation.separator.period.python, source.python + : source.python import : keyword.control.import.python, source.python : source.python c : source.python diff --git a/test/statements/import3.py b/test/statements/import3.py index 79f06128..1952bf59 100644 --- a/test/statements/import3.py +++ b/test/statements/import3.py @@ -6,22 +6,22 @@ from : keyword.control.import.python, source.python -.... : source.python +.... : punctuation.separator.period.python, source.python import : keyword.control.import.python, source.python : source.python a : source.python from : keyword.control.import.python, source.python -... : source.python +... : punctuation.separator.period.python, source.python import : keyword.control.import.python, source.python : source.python b : source.python from : keyword.control.import.python, source.python -.. : source.python +.. : punctuation.separator.period.python, source.python import : keyword.control.import.python, source.python : source.python c : source.python from : keyword.control.import.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python import : keyword.control.import.python, source.python : source.python d : source.python diff --git a/test/statements/import4.py b/test/statements/import4.py index c45b328d..b2cee743 100644 --- a/test/statements/import4.py +++ b/test/statements/import4.py @@ -6,28 +6,28 @@ from : keyword.control.import.python, source.python -.... : source.python +.... : punctuation.separator.period.python, source.python foo : source.python : source.python import : keyword.control.import.python, source.python : source.python a : source.python from : keyword.control.import.python, source.python -... : source.python +... : punctuation.separator.period.python, source.python foo : source.python : source.python import : keyword.control.import.python, source.python : source.python b : source.python from : keyword.control.import.python, source.python -.. : source.python +.. : punctuation.separator.period.python, source.python foo : source.python : source.python import : keyword.control.import.python, source.python : source.python c : source.python from : keyword.control.import.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python foo : source.python : source.python import : keyword.control.import.python, source.python diff --git a/test/statements/import5.py b/test/statements/import5.py index a805e4d3..2df920d6 100644 --- a/test/statements/import5.py +++ b/test/statements/import5.py @@ -11,20 +11,20 @@ def bar(): from : keyword.control.import.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python foo : source.python : source.python import : keyword.control.import.python, source.python : source.python d : source.python from : keyword.control.import.python, source.python -. : source.python +. : punctuation.separator.period.python, source.python import : keyword.control.import.python, source.python : source.python a : source.python : source.python foo : source.python -. : source.python +. : punctuation.separator.period.python, source.python import : keyword.control.flow.python, source.python : source.python raise : keyword.control.flow.python, source.python diff --git a/test/strings/format2.py b/test/strings/format2.py index e9b0c240..41c1baed 100644 --- a/test/strings/format2.py +++ b/test/strings/format2.py @@ -20,7 +20,7 @@ !s : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python } : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python -. : source.python +. : punctuation.separator.period.python, source.python format : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python fo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python From 935abefebfd4a75fe5741a99de0b51a7542efb5b Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 10 Aug 2017 22:49:29 -0400 Subject: [PATCH 16/49] Prepare 1.0.12 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 759d184b..7673f4fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MagicPython", - "version": "1.0.11", + "version": "1.0.12", "engines": { "atom": "*", "node": "*", From f340032d0ed35f0b94323537f95cb256ea82ebb5 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Tue, 10 Jul 2018 14:33:43 -0400 Subject: [PATCH 17/49] Fix a docstring highlighter bug. --- Makefile | 2 +- grammars/MagicPython.cson | 11 ++-- grammars/MagicPython.tmLanguage | 12 ++-- grammars/src/MagicPython.syntax.yaml | 10 ++- grammars/src/pystring.inc.syntax.yaml | 2 +- package.json | 4 ++ test/atom-spec/python-spec.js | 91 +++++++++++++++++++++++++-- test/docstrings/continuation2.py | 3 + test/docstrings/continuation5.py | 47 ++++++++++++++ test/fstrings/nested3.py | 4 +- test/illegals/backticks3.py | 3 + test/regexp/python2.py | 3 + 12 files changed, 172 insertions(+), 20 deletions(-) create mode 100644 test/docstrings/continuation5.py diff --git a/Makefile b/Makefile index 2d09f37c..f690dbd9 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ ci-test: release then echo "Error: package.version != git.tag" && exit 1 ; fi test: ci-test - atom -t . + atom -t test/atom-spec devenv: npm install syntaxdev@0.0.16 diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 526b2873..8dff74fb 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -129,7 +129,8 @@ repository: ] "docstring-statement": begin: "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))" - end: "(?<=\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\")" + comment: "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring" + end: "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))" patterns: [ { include: "#docstring" @@ -186,7 +187,7 @@ repository: { name: "string.quoted.docstring.single.python" begin: "(\\'|\\\")" - end: "(\\1)|((? begin ^(?=\s*[rR]?(\'\'\'|\"\"\"|\'|\")) + comment + the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring end - (?<=\'\'\'|\"\"\"|\'|\") + ((?<=\1)|^)(?!\s*[rR]?(\'\'\'|\"\"\"|\'|\")) patterns @@ -287,7 +289,7 @@ begin (\'|\") end - (\1)|((?<!\\)\n) + (\1)|(\n) beginCaptures 1 @@ -327,7 +329,7 @@ begin ([rR])(\'|\") end - (\2)|((?<!\\)\n) + (\2)|(\n) beginCaptures 1 @@ -7365,7 +7367,7 @@ indirectly through syntactic constructs name string.quoted.single.python begin - (\b[rR](?=[uU]))?([uU])?((['"])) + (?:\b([rR])(?=[uU]))?([uU])?((['"])) end (\3)|((?<!\\)\n) beginCaptures @@ -7665,7 +7667,7 @@ indirectly through syntactic constructs name string.quoted.multi.python begin - (\b[rR](?=[uU]))?([uU])?('''|""") + (?:\b([rR])(?=[uU]))?([uU])?('''|""") end (\3) beginCaptures diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 43009579..334e439e 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -279,7 +279,11 @@ repository: docstring-statement: begin: ^(?=\s*[rR]?(\'\'\'|\"\"\"|\'|\")) - end: (?<=\'\'\'|\"\"\"|\'|\") + comment: the string either terminates correctly or by the + beginning of a new line (this is for single line + docstrings that aren't terminated) AND it's not followed + by another docstring + end: ((?<=\1)|^)(?!\s*[rR]?(\'\'\'|\"\"\"|\'|\")) patterns: - include: '#docstring' @@ -312,7 +316,7 @@ repository: - name: string.quoted.docstring.single.python begin: (\'|\") - end: (\1)|((? Date: Thu, 19 Jul 2018 15:09:02 -0400 Subject: [PATCH 18/49] Update string formatting scopes. Add two scopes for finer control of format highlighting: - meta.format.percent.python - meta.format.brace.python Issue #106. --- grammars/MagicPython.cson | 59 +++++---- grammars/MagicPython.tmLanguage | 69 ++++++---- grammars/src/MagicPython.syntax.yaml | 53 +++++--- misc/scopes | 2 + test/atom-spec/python-spec.js | 186 ++++++++++++--------------- test/strings/format1.py | 21 ++- test/strings/format10.py | 8 +- test/strings/format11.py | 4 +- test/strings/format12.py | 4 +- test/strings/format15.py | 4 +- test/strings/format2.py | 16 +-- test/strings/format3.py | 14 +- test/strings/format4.py | 16 +-- test/strings/format5.py | 17 +-- test/strings/format6.py | 2 +- test/strings/format7.py | 4 +- test/strings/format9.py | 10 +- 17 files changed, 252 insertions(+), 237 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 8dff74fb..54ef1a3f 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -917,23 +917,28 @@ repository: name: "constant.language.python" match: "\\\\$" "string-formatting": - name: "constant.character.format.placeholder.other.python" + name: "meta.format.percent.python" match: ''' (?x) - % (\\([\\w\\s]*\\))? - [-+#0 ]* - (\\d+|\\*)? (\\.(\\d+|\\*))? - ([hlL])? - [diouxXeEfFgGcrsa%] + ( + % (\\([\\w\\s]*\\))? + [-+#0 ]* + (\\d+|\\*)? (\\.(\\d+|\\*))? + ([hlL])? + [diouxXeEfFgGcrsa%] + ) ''' + captures: + "1": + name: "constant.character.format.placeholder.other.python" "string-brace-formatting": patterns: [ { - name: "constant.character.format.placeholder.other.python" + name: "meta.format.brace.python" match: ''' (?x) - (?: + ( {{ | }} | (?: { @@ -946,36 +951,38 @@ repository: ''' captures: - "2": - name: "storage.type.format.python" + "1": + name: "constant.character.format.placeholder.other.python" "3": name: "storage.type.format.python" + "4": + name: "storage.type.format.python" } { - name: "constant.character.format.placeholder.other.python" - begin: ''' + name: "meta.format.brace.python" + match: ''' (?x) - \\{ + ( + { \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'"]+\\])*? (![rsa])? (:) - (?=[^'"}\\n]*\\}) + ( + [^'"{}\\n]+? + | + \\{ [^'"}\\n]*? \\} + )* + } + ) ''' - end: "\\}" - beginCaptures: - "2": - name: "storage.type.format.python" + captures: + "1": + name: "constant.character.format.placeholder.other.python" "3": name: "storage.type.format.python" - patterns: [ - { - match: ''' - (?x) \\{ [^'"}\\n]*? \\} (?=.*?\\}) - - ''' - } - ] + "4": + name: "storage.type.format.python" } ] "fstring-formatting": diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index de83a6bc..35d7b049 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1411,15 +1411,25 @@ string-formatting name - constant.character.format.placeholder.other.python + meta.format.percent.python match (?x) - % (\([\w\s]*\))? - [-+#0 ]* - (\d+|\*)? (\.(\d+|\*))? - ([hlL])? - [diouxXeEfFgGcrsa%] + ( + % (\([\w\s]*\))? + [-+#0 ]* + (\d+|\*)? (\.(\d+|\*))? + ([hlL])? + [diouxXeEfFgGcrsa%] + ) + captures + + 1 + + name + constant.character.format.placeholder.other.python + + string-brace-formatting @@ -1427,10 +1437,10 @@ name - constant.character.format.placeholder.other.python + meta.format.brace.python match (?x) - (?: + ( {{ | }} | (?: { @@ -1443,52 +1453,59 @@ captures - 2 + 1 name - storage.type.format.python + constant.character.format.placeholder.other.python 3 name storage.type.format.python + 4 + + name + storage.type.format.python + name - constant.character.format.placeholder.other.python - begin + meta.format.brace.python + match (?x) - \{ + ( + { \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*? (![rsa])? (:) - (?=[^'"}\n]*\}) + ( + [^'"{}\n]+? + | + \{ [^'"}\n]*? \} + )* + } + ) - end - \} - beginCaptures + captures - 2 + 1 name - storage.type.format.python + constant.character.format.placeholder.other.python 3 name storage.type.format.python - - patterns - + 4 - match - (?x) \{ [^'"}\n]*? \} (?=.*?\}) - + name + storage.type.format.python - + diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 334e439e..cd585f2f 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -769,21 +769,25 @@ repository: match: \\$ string-formatting: - name: constant.character.format.placeholder.other.python + name: meta.format.percent.python match: | (?x) - % (\([\w\s]*\))? - [-+#0 ]* - (\d+|\*)? (\.(\d+|\*))? - ([hlL])? - [diouxXeEfFgGcrsa%] + ( + % (\([\w\s]*\))? + [-+#0 ]* + (\d+|\*)? (\.(\d+|\*))? + ([hlL])? + [diouxXeEfFgGcrsa%] + ) + captures: + '1': {name: constant.character.format.placeholder.other.python} string-brace-formatting: patterns: - - name: constant.character.format.placeholder.other.python + - name: meta.format.brace.python match: | (?x) - (?: + ( {{ | }} | (?: { @@ -801,24 +805,33 @@ repository: # "storage.type..." is more likely to have special # highlighting in any given color scheme than # "support.other..." - # - '2': {name: storage.type.format.python} + '1': {name: constant.character.format.placeholder.other.python} '3': {name: storage.type.format.python} - - name: constant.character.format.placeholder.other.python - begin: | + '4': {name: storage.type.format.python} + + # The reason for 2 separate rules is to establish which one + # should be matched with a higher priority. The rule below is + # more generic, so it should be matched only if the specific one + # didn't. + - name: meta.format.brace.python + match: | (?x) - \{ + ( + { \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*? (![rsa])? (:) - (?=[^'"}\n]*\}) - end: \} - beginCaptures: - '2': {name: storage.type.format.python} + ( + [^'"{}\n]+? + | + \{ [^'"}\n]*? \} + )* + } + ) + captures: + '1': {name: constant.character.format.placeholder.other.python} '3': {name: storage.type.format.python} - patterns: - - match: | - (?x) \{ [^'"}\n]*? \} (?=.*?\}) + '4': {name: storage.type.format.python} fstring-formatting: patterns: diff --git a/misc/scopes b/misc/scopes index 128a673c..fb8522c3 100644 --- a/misc/scopes +++ b/misc/scopes @@ -65,6 +65,8 @@ meta.backreference.regexp meta.character.set.regexp meta.class.inheritance.python meta.class.python +meta.format.brace.python +meta.format.percent.python meta.fstring.python meta.function-call.generic.python meta.function-call.python diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 56462323..52ccbf80 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -12998,11 +12998,11 @@ describe("Grammar Tests", function() { expect(tokens[0][4].value).toBe("\""); expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[0][5].value).toBe("{0[ ]"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][6].value).toBe(":X>+10d"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); expect(tokens[0][7].value).toBe("}"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][8].value).toBe("\""); expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("a"); @@ -13016,13 +13016,13 @@ describe("Grammar Tests", function() { expect(tokens[1][4].value).toBe("\""); expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[1][5].value).toBe("{0[ ]"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][6].value).toBe("!s"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); expect(tokens[1][7].value).toBe(":X>+10d"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); expect(tokens[1][8].value).toBe("}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][9].value).toBe("\""); expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[2][0].value).toBe("a"); @@ -13036,21 +13036,19 @@ describe("Grammar Tests", function() { expect(tokens[2][4].value).toBe("\""); expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[2][5].value).toBe("{0[ ]"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][6].value).toBe(":"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); - expect(tokens[2][7].value).toBe("Xd>+10d"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[2][8].value).toBe("}"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[2][9].value).toBe("\""); - expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); - expect(tokens[2][10].value).toBe(" "); - expect(tokens[2][10].scopes).toEqual(["source.python"]); - expect(tokens[2][11].value).toBe("#"); - expect(tokens[2][11].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); - expect(tokens[2][12].value).toBe("invalid"); - expect(tokens[2][12].scopes).toEqual(["source.python","comment.line.number-sign.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[2][7].value).toBe("Xd>+10d}"); + expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][8].value).toBe("\""); + expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[2][9].value).toBe(" "); + expect(tokens[2][9].scopes).toEqual(["source.python"]); + expect(tokens[2][10].value).toBe("#"); + expect(tokens[2][10].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[2][11].value).toBe("invalid"); + expect(tokens[2][11].scopes).toEqual(["source.python","comment.line.number-sign.python"]); }); it("test/strings/format10.py", @@ -13069,25 +13067,25 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe("blah {foo-bar "); expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[0][6].value).toBe("%d"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][0].value).toBe(" blah "); expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[1][1].value).toBe("{foo-bar "); expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[1][2].value).toBe("%d"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][3].value).toBe("}"); expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[2][0].value).toBe(" blah {foo-bar "); expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[2][1].value).toBe("%d"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][2].value).toBe(" //insane {}}"); expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[3][0].value).toBe(" {}blah {foo-bar "); expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[3][1].value).toBe("%d"); - expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][2].value).toBe(" //insane {}}"); expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[3][3].value).toBe("'''"); @@ -13112,7 +13110,7 @@ describe("Grammar Tests", function() { expect(tokens[0][6].value).toBe("\\fr"); expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]); expect(tokens[0][7].value).toBe("{still_ok}"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.raw.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.raw.multi.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][8].value).toBe("ac"); expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]); expect(tokens[0][9].value).toBe("{m_{j \\rightarrow i}(\\mathrm{good})}"); @@ -13120,7 +13118,7 @@ describe("Grammar Tests", function() { expect(tokens[1][0].value).toBe(" {not_ok} "); expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]); expect(tokens[1][1].value).toBe("%d"); - expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.raw.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.raw.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][0].value).toBe("'''"); expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.end.python"]); }); @@ -13145,11 +13143,11 @@ describe("Grammar Tests", function() { expect(tokens[0][7].value).toBe("{m_{j \\"); expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.raw.single.python"]); expect(tokens[0][8].value).toBe("%s"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][9].value).toBe("rightarrow i}(\\mathrm{"); expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.raw.single.python"]); expect(tokens[0][10].value).toBe("%s"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.raw.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][11].value).toBe("good})}{\\su%m{m_{j \\rightarrow i}}}$"); expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.raw.single.python"]); expect(tokens[0][12].value).toBe("'"); @@ -13232,11 +13230,11 @@ describe("Grammar Tests", function() { expect(tokens[0][4].value).toBe("'''"); expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]); expect(tokens[1][0].value).toBe("{{"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][1].value).toBe(" before detection "); expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[1][2].value).toBe("}}"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][0].value).toBe("{# jinja comment #}"); expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.multi.python"]); expect(tokens[3][0].value).toBe("{{ after detection }}"); @@ -13261,27 +13259,27 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe("normal "); expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][6].value).toBe("{{"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][7].value).toBe(" normal "); expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][8].value).toBe("}}"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][9].value).toBe(" normal "); expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][10].value).toBe("{10"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][11].value).toBe("!r"); - expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); expect(tokens[0][12].value).toBe("}"); - expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][13].value).toBe(" normal "); expect(tokens[0][13].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][14].value).toBe("{fo.__add__"); - expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][15].value).toBe("!s"); - expect(tokens[0][15].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[0][15].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); expect(tokens[0][16].value).toBe("}"); - expect(tokens[0][16].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][16].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][17].value).toBe("\""); expect(tokens[0][17].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[0][18].value).toBe("."); @@ -13314,7 +13312,7 @@ describe("Grammar Tests", function() { expect(tokens[0][4].value).toBe("'"); expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[0][5].value).toBe("%i"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][6].value).toBe("'"); expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[0][7].value).toBe(" "); @@ -13336,11 +13334,11 @@ describe("Grammar Tests", function() { expect(tokens[1][4].value).toBe("\""); expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[1][5].value).toBe("%(language)s"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][6].value).toBe(" has "); expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[1][7].value).toBe("%(number)03d"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][8].value).toBe(" quote types."); expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[1][9].value).toBe("\""); @@ -13358,11 +13356,11 @@ describe("Grammar Tests", function() { expect(tokens[2][5].value).toBe("\""); expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]); expect(tokens[2][6].value).toBe("%(language)s"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.binary.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][7].value).toBe(" has "); expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.binary.single.python"]); expect(tokens[2][8].value).toBe("%(number)03d"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.binary.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][9].value).toBe(" quote types."); expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.binary.single.python"]); expect(tokens[2][10].value).toBe("\""); @@ -13380,11 +13378,11 @@ describe("Grammar Tests", function() { expect(tokens[3][5].value).toBe("\""); expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]); expect(tokens[3][6].value).toBe("%(language)s"); - expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.raw.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][7].value).toBe(" has "); expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.raw.single.python"]); expect(tokens[3][8].value).toBe("%(number)03d"); - expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][9].value).toBe(" quote types."); expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.raw.single.python"]); expect(tokens[3][10].value).toBe("\""); @@ -13407,17 +13405,15 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe("qqq"); expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][6].value).toBe("{"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][7].value).toBe(":"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); - expect(tokens[0][8].value).toBe("%Y-%m-%d %H:%M:%S"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[0][9].value).toBe("}"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[0][10].value).toBe("www"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python"]); - expect(tokens[0][11].value).toBe("'"); - expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[0][8].value).toBe("%Y-%m-%d %H:%M:%S}"); + expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][9].value).toBe("www"); + expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[0][10].value).toBe("'"); + expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("a"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe(" "); @@ -13431,21 +13427,15 @@ describe("Grammar Tests", function() { expect(tokens[1][5].value).toBe("qqq"); expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[1][6].value).toBe("{0"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][7].value).toBe(":"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); - expect(tokens[1][8].value).toBe("{fill}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[1][9].value).toBe("{align}"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[1][10].value).toBe("16"); - expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[1][11].value).toBe("}"); - expect(tokens[1][11].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[1][12].value).toBe("www"); - expect(tokens[1][12].scopes).toEqual(["source.python","string.quoted.single.python"]); - expect(tokens[1][13].value).toBe("'"); - expect(tokens[1][13].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[1][8].value).toBe("{fill}{align}16}"); + expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][9].value).toBe("www"); + expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[1][10].value).toBe("'"); + expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); }); it("test/strings/format5.py", @@ -13464,19 +13454,15 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe("qqq"); expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][6].value).toBe("{0"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][7].value).toBe(":"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); - expect(tokens[0][8].value).toBe("{width}"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[0][9].value).toBe("{base}"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[0][10].value).toBe("}"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[0][11].value).toBe("www"); - expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python"]); - expect(tokens[0][12].value).toBe("'"); - expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[0][8].value).toBe("{width}{base}}"); + expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][9].value).toBe("www"); + expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[0][10].value).toBe("'"); + expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("a"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe(" "); @@ -13490,17 +13476,15 @@ describe("Grammar Tests", function() { expect(tokens[1][5].value).toBe("qqq"); expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[1][6].value).toBe("{0"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][7].value).toBe(":"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); - expect(tokens[1][8].value).toBe("$20"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[1][9].value).toBe("}"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); - expect(tokens[1][10].value).toBe("www"); - expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python"]); - expect(tokens[1][11].value).toBe("'"); - expect(tokens[1][11].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]); + expect(tokens[1][8].value).toBe("$20}"); + expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][9].value).toBe("www"); + expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[1][10].value).toBe("'"); + expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[2][0].value).toBe("a"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe(" "); @@ -13514,7 +13498,7 @@ describe("Grammar Tests", function() { expect(tokens[2][5].value).toBe("qqq"); expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[2][6].value).toBe("{0}"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][7].value).toBe("www"); expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[2][8].value).toBe("'"); @@ -13577,7 +13561,7 @@ describe("Grammar Tests", function() { expect(tokens[2][11].value).toBe("h}"); expect(tokens[2][11].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[2][12].value).toBe("{base}"); - expect(tokens[2][12].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][12].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][13].value).toBe("}www"); expect(tokens[2][13].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[2][14].value).toBe("'"); @@ -13616,11 +13600,11 @@ describe("Grammar Tests", function() { expect(tokens[3][5].value).toBe("12"); expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[3][6].value).toBe("% o"); - expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][7].value).toBe("f "); expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[3][8].value).toBe("%s"); - expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][9].value).toBe("'"); expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[3][10].value).toBe(" "); @@ -13682,7 +13666,7 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe("blah {foo-bar "); expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[0][6].value).toBe("%d"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][7].value).toBe("'"); expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("a"); @@ -13700,7 +13684,7 @@ describe("Grammar Tests", function() { expect(tokens[1][6].value).toBe("{foo-bar "); expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[1][7].value).toBe("%d"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][8].value).toBe("}"); expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[1][9].value).toBe("'"); @@ -13720,7 +13704,7 @@ describe("Grammar Tests", function() { expect(tokens[2][6].value).toBe("{foo-bar "); expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[2][7].value).toBe("%d"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][8].value).toBe(" //insane {}}"); expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[2][9].value).toBe("'"); @@ -13736,13 +13720,13 @@ describe("Grammar Tests", function() { expect(tokens[3][4].value).toBe("'"); expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[3][5].value).toBe("{}"); - expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][6].value).toBe("blah "); expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[3][7].value).toBe("{foo-bar "); expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[3][8].value).toBe("%d"); - expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); expect(tokens[3][9].value).toBe(" //insane {}}"); expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.single.python"]); expect(tokens[3][10].value).toBe("'"); diff --git a/test/strings/format1.py b/test/strings/format1.py index b9b8e6e0..55327cae 100644 --- a/test/strings/format1.py +++ b/test/strings/format1.py @@ -9,29 +9,28 @@ = : keyword.operator.assignment.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -{0[ ] : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -:X>+10d : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0[ ] : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +:X>+10d : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python : source.python = : keyword.operator.assignment.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -{0[ ] : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -!s : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -:X>+10d : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0[ ] : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +!s : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +:X>+10d : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python : source.python = : keyword.operator.assignment.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -{0[ ] : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -: : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -Xd>+10d : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0[ ] : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +: : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +Xd>+10d} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python : source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python diff --git a/test/strings/format10.py b/test/strings/format10.py index 01f848f6..3cd456f7 100644 --- a/test/strings/format10.py +++ b/test/strings/format10.py @@ -11,15 +11,15 @@ : source.python ''' : punctuation.definition.string.begin.python, source.python, string.quoted.multi.python blah {foo-bar : source.python, string.quoted.multi.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.multi.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.multi.python blah : source.python, string.quoted.multi.python {foo-bar : source.python, string.quoted.multi.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.multi.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.multi.python } : source.python, string.quoted.multi.python blah {foo-bar : source.python, string.quoted.multi.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.multi.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.multi.python //insane {}} : source.python, string.quoted.multi.python {}blah {foo-bar : source.python, string.quoted.multi.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.multi.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.multi.python //insane {}} : source.python, string.quoted.multi.python ''' : punctuation.definition.string.end.python, source.python, string.quoted.multi.python diff --git a/test/strings/format11.py b/test/strings/format11.py index c16d3fbf..358bb9f7 100644 --- a/test/strings/format11.py +++ b/test/strings/format11.py @@ -11,9 +11,9 @@ R : source.python, storage.type.string.python, string.quoted.raw.multi.python ''' : punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python \fr : source.python, string.quoted.raw.multi.python -{still_ok} : constant.character.format.placeholder.other.python, source.python, string.quoted.raw.multi.python +{still_ok} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.raw.multi.python ac : source.python, string.quoted.raw.multi.python {m_{j \rightarrow i}(\mathrm{good})} : source.python, string.quoted.raw.multi.python {not_ok} : source.python, string.quoted.raw.multi.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.raw.multi.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.raw.multi.python ''' : punctuation.definition.string.end.python, source.python, string.quoted.raw.multi.python diff --git a/test/strings/format12.py b/test/strings/format12.py index 6b9fd6fc..e370a39d 100644 --- a/test/strings/format12.py +++ b/test/strings/format12.py @@ -10,8 +10,8 @@ ' : punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python $\frac : source.python, string.quoted.raw.single.python {m_{j \ : source.python, string.quoted.raw.single.python -%s : constant.character.format.placeholder.other.python, source.python, string.quoted.raw.single.python +%s : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.raw.single.python rightarrow i}(\mathrm{ : source.python, string.quoted.raw.single.python -%s : constant.character.format.placeholder.other.python, source.python, string.quoted.raw.single.python +%s : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.raw.single.python good})}{\su%m{m_{j \rightarrow i}}}$ : source.python, string.quoted.raw.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.raw.single.python diff --git a/test/strings/format15.py b/test/strings/format15.py index b1f7ddfe..68743f4d 100644 --- a/test/strings/format15.py +++ b/test/strings/format15.py @@ -11,9 +11,9 @@ = : keyword.operator.assignment.python, source.python : source.python ''' : punctuation.definition.string.begin.python, source.python, string.quoted.multi.python -{{ : constant.character.format.placeholder.other.python, source.python, string.quoted.multi.python +{{ : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.multi.python before detection : source.python, string.quoted.multi.python -}} : constant.character.format.placeholder.other.python, source.python, string.quoted.multi.python +}} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.multi.python {# jinja comment #} : source.python, string.quoted.multi.python {{ after detection }} : source.python, string.quoted.multi.python ''' : punctuation.definition.string.end.python, source.python, string.quoted.multi.python diff --git a/test/strings/format2.py b/test/strings/format2.py index 41c1baed..86227776 100644 --- a/test/strings/format2.py +++ b/test/strings/format2.py @@ -8,17 +8,17 @@ : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python normal : source.python, string.quoted.single.python -{{ : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{{ : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python normal : source.python, string.quoted.single.python -}} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +}} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python normal : source.python, string.quoted.single.python -{10 : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -!r : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{10 : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +!r : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python normal : source.python, string.quoted.single.python -{fo.__add__ : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -!s : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{fo.__add__ : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +!s : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python . : punctuation.separator.period.python, source.python format : meta.function-call.generic.python, meta.function-call.python, source.python diff --git a/test/strings/format3.py b/test/strings/format3.py index b699bdff..2a63d31a 100644 --- a/test/strings/format3.py +++ b/test/strings/format3.py @@ -10,7 +10,7 @@ = : keyword.operator.assignment.python, source.python : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -%i : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%i : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python : source.python % : keyword.operator.arithmetic.python, source.python @@ -21,9 +21,9 @@ = : keyword.operator.assignment.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -%(language)s : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%(language)s : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python has : source.python, string.quoted.single.python -%(number)03d : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%(number)03d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python quote types. : source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python @@ -32,9 +32,9 @@ : source.python b : source.python, storage.type.string.python, string.quoted.binary.single.python " : punctuation.definition.string.begin.python, source.python, string.quoted.binary.single.python -%(language)s : constant.character.format.placeholder.other.python, source.python, string.quoted.binary.single.python +%(language)s : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.binary.single.python has : source.python, string.quoted.binary.single.python -%(number)03d : constant.character.format.placeholder.other.python, source.python, string.quoted.binary.single.python +%(number)03d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.binary.single.python quote types. : source.python, string.quoted.binary.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.binary.single.python a : source.python @@ -43,8 +43,8 @@ : source.python R : source.python, storage.type.string.python, string.quoted.raw.single.python " : punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python -%(language)s : constant.character.format.placeholder.other.python, source.python, string.quoted.raw.single.python +%(language)s : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.raw.single.python has : source.python, string.quoted.raw.single.python -%(number)03d : constant.character.format.placeholder.other.python, source.python, string.quoted.raw.single.python +%(number)03d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.raw.single.python quote types. : source.python, string.quoted.raw.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.raw.single.python diff --git a/test/strings/format4.py b/test/strings/format4.py index e135cf03..4f21cd9c 100644 --- a/test/strings/format4.py +++ b/test/strings/format4.py @@ -10,10 +10,9 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python qqq : source.python, string.quoted.single.python -{ : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -: : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -%Y-%m-%d %H:%M:%S : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{ : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +: : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +%Y-%m-%d %H:%M:%S} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python www : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python @@ -22,11 +21,8 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python qqq : source.python, string.quoted.single.python -{0 : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -: : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -{fill} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -{align} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -16 : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0 : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +: : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +{fill}{align}16} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python www : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python diff --git a/test/strings/format5.py b/test/strings/format5.py index 0c3f6bb4..230253a3 100644 --- a/test/strings/format5.py +++ b/test/strings/format5.py @@ -11,11 +11,9 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python qqq : source.python, string.quoted.single.python -{0 : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -: : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -{width} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -{base} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0 : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +: : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +{width}{base}} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python www : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python @@ -24,10 +22,9 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python qqq : source.python, string.quoted.single.python -{0 : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -: : constant.character.format.placeholder.other.python, source.python, storage.type.format.python, string.quoted.single.python -$20 : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0 : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +: : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python +$20} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python www : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python @@ -36,6 +33,6 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python qqq : source.python, string.quoted.single.python -{0} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{0} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python www : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python diff --git a/test/strings/format6.py b/test/strings/format6.py index cf0ea3c7..aff1a320 100644 --- a/test/strings/format6.py +++ b/test/strings/format6.py @@ -31,6 +31,6 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python h} : source.python, string.quoted.single.python -{base} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{base} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python }www : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python diff --git a/test/strings/format7.py b/test/strings/format7.py index e80e3d27..cafb5dcd 100644 --- a/test/strings/format7.py +++ b/test/strings/format7.py @@ -19,9 +19,9 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python 12 : source.python, string.quoted.single.python -% o : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +% o : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python f : source.python, string.quoted.single.python -%s : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%s : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python : source.python % : keyword.operator.arithmetic.python, source.python diff --git a/test/strings/format9.py b/test/strings/format9.py index 26e5d643..1b493484 100644 --- a/test/strings/format9.py +++ b/test/strings/format9.py @@ -11,7 +11,7 @@ : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python blah {foo-bar : source.python, string.quoted.single.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python : source.python @@ -20,7 +20,7 @@ ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python blah : source.python, string.quoted.single.python {foo-bar : source.python, string.quoted.single.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python } : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python @@ -30,7 +30,7 @@ ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python blah : source.python, string.quoted.single.python {foo-bar : source.python, string.quoted.single.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python //insane {}} : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python @@ -38,9 +38,9 @@ = : keyword.operator.assignment.python, source.python : source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -{} : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +{} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python blah : source.python, string.quoted.single.python {foo-bar : source.python, string.quoted.single.python -%d : constant.character.format.placeholder.other.python, source.python, string.quoted.single.python +%d : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.single.python //insane {}} : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python From 2780782a60733a07cae933a9c70eb276751ae5fb Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 19 Jul 2018 16:32:17 -0400 Subject: [PATCH 19/49] Add '%b' as a valid percent-format (PEP 461). Issue #125. --- grammars/MagicPython.cson | 2 +- grammars/MagicPython.tmLanguage | 2 +- grammars/src/MagicPython.syntax.yaml | 2 +- test/strings/format16.py | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 test/strings/format16.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 54ef1a3f..e8d15954 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -925,7 +925,7 @@ repository: [-+#0 ]* (\\d+|\\*)? (\\.(\\d+|\\*))? ([hlL])? - [diouxXeEfFgGcrsa%] + [diouxXeEfFgGcrsab%] ) ''' diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 35d7b049..78f208b6 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1419,7 +1419,7 @@ [-+#0 ]* (\d+|\*)? (\.(\d+|\*))? ([hlL])? - [diouxXeEfFgGcrsa%] + [diouxXeEfFgGcrsab%] ) captures diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index cd585f2f..2cd94a29 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -777,7 +777,7 @@ repository: [-+#0 ]* (\d+|\*)? (\.(\d+|\*))? ([hlL])? - [diouxXeEfFgGcrsa%] + [diouxXeEfFgGcrsab%] ) captures: '1': {name: constant.character.format.placeholder.other.python} diff --git a/test/strings/format16.py b/test/strings/format16.py new file mode 100644 index 00000000..9b81ed31 --- /dev/null +++ b/test/strings/format16.py @@ -0,0 +1,19 @@ +a = b'%b' % b'foo' + + + +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +b : source.python, storage.type.string.python, string.quoted.binary.single.python +' : punctuation.definition.string.begin.python, source.python, string.quoted.binary.single.python +%b : constant.character.format.placeholder.other.python, meta.format.percent.python, source.python, string.quoted.binary.single.python +' : punctuation.definition.string.end.python, source.python, string.quoted.binary.single.python + : source.python +% : keyword.operator.arithmetic.python, source.python + : source.python +b : source.python, storage.type.string.python, string.quoted.binary.single.python +' : punctuation.definition.string.begin.python, source.python, string.quoted.binary.single.python +foo : source.python, string.quoted.binary.single.python +' : punctuation.definition.string.end.python, source.python, string.quoted.binary.single.python From 9c874c6e4f6457ff87a18ad2a48c0f5e6c31c2d0 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 19 Jul 2018 18:14:26 -0400 Subject: [PATCH 20/49] Stop interpreting `exec` as a keyword. Issue #134. --- grammars/MagicPython.cson | 2 +- grammars/MagicPython.tmLanguage | 2 +- grammars/src/MagicPython.syntax.yaml | 2 +- test/atom-spec/python-spec.js | 60 +++++++++++++++++++++++++++- test/builtins/builtins1.py | 4 +- test/builtins/builtins6.py | 13 ++++++ 6 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 test/builtins/builtins6.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index e8d15954..6bddf756 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1845,7 +1845,7 @@ repository: (?x) \\b( and | as | assert | async | await | break | class | continue | def - | del | elif | else | except | exec | finally | for | from | global + | del | elif | else | except | finally | for | from | global | if | import | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=]) | nonlocal | not | or | pass | raise | return | try | while | with | yield diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 78f208b6..a068b281 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -2839,7 +2839,7 @@ indirectly through syntactic constructs (?x) \b( and | as | assert | async | await | break | class | continue | def - | del | elif | else | except | exec | finally | for | from | global + | del | elif | else | except | finally | for | from | global | if | import | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) | nonlocal | not | or | pass | raise | return | try | while | with | yield diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 2cd94a29..c7b27645 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -1393,7 +1393,7 @@ repository: (?x) \b( and | as | assert | async | await | break | class | continue | def - | del | elif | else | except | exec | finally | for | from | global + | del | elif | else | except | finally | for | from | global | if | import | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) | nonlocal | not | or | pass | raise | return | try | while | with | yield diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 52ccbf80..3baf4825 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -16,7 +16,7 @@ describe("Grammar Tests", function() { it("test/builtins/builtins1.py", function() { - tokens = grammar.tokenizeLines("AttributeError ConnectionAbortedError\nPendingDeprecationWarning\nModuleNotFoundError\nSystemExit\nNotImplemented True None False Ellipsis\nWarning\nException BaseException\nsum oct abs type object print") + tokens = grammar.tokenizeLines("AttributeError ConnectionAbortedError\nPendingDeprecationWarning\nModuleNotFoundError\nSystemExit\nNotImplemented True None False Ellipsis\nWarning\nException BaseException\nsum oct abs type object print exec") expect(tokens[0][0].value).toBe("AttributeError"); expect(tokens[0][0].scopes).toEqual(["source.python","support.type.exception.python"]); expect(tokens[0][1].value).toBe(" "); @@ -77,6 +77,10 @@ describe("Grammar Tests", function() { expect(tokens[7][9].scopes).toEqual(["source.python"]); expect(tokens[7][10].value).toBe("print"); expect(tokens[7][10].scopes).toEqual(["source.python","support.function.builtin.python"]); + expect(tokens[7][11].value).toBe(" "); + expect(tokens[7][11].scopes).toEqual(["source.python"]); + expect(tokens[7][12].value).toBe("exec"); + expect(tokens[7][12].scopes).toEqual(["source.python","support.function.builtin.python"]); }); it("test/builtins/builtins2.py", @@ -491,6 +495,25 @@ describe("Grammar Tests", function() { expect(tokens[5][1].scopes).toEqual(["source.python","keyword.illegal.name.python"]); }); + it("test/builtins/builtins6.py", + function() { + tokens = grammar.tokenizeLines("exec()\nexec(code_obj)") + expect(tokens[0][0].value).toBe("exec"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]); + expect(tokens[0][1].value).toBe("("); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][2].value).toBe(")"); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[1][0].value).toBe("exec"); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]); + expect(tokens[1][1].value).toBe("("); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][2].value).toBe("code_obj"); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][3].value).toBe(")"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + }); + it("test/calls/call1.py", function() { tokens = grammar.tokenizeLines("some_call(A, b, c[1], *args, FOO=lambda:{'q': 42}, **kwargs)") @@ -13243,6 +13266,41 @@ describe("Grammar Tests", function() { expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]); }); + it("test/strings/format16.py", + function() { + tokens = grammar.tokenizeLines("a = b'%b' % b'foo'") + expect(tokens[0][0].value).toBe("a"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("b"); + expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]); + expect(tokens[0][5].value).toBe("'"); + expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][6].value).toBe("%b"); + expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][7].value).toBe("'"); + expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]); + expect(tokens[0][8].value).toBe(" "); + expect(tokens[0][8].scopes).toEqual(["source.python"]); + expect(tokens[0][9].value).toBe("%"); + expect(tokens[0][9].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]); + expect(tokens[0][10].value).toBe(" "); + expect(tokens[0][10].scopes).toEqual(["source.python"]); + expect(tokens[0][11].value).toBe("b"); + expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]); + expect(tokens[0][12].value).toBe("'"); + expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][13].value).toBe("foo"); + expect(tokens[0][13].scopes).toEqual(["source.python","string.quoted.binary.single.python"]); + expect(tokens[0][14].value).toBe("'"); + expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]); + }); + it("test/strings/format2.py", function() { tokens = grammar.tokenizeLines("a = \"normal {{ normal }} normal {10!r} normal {fo.__add__!s}\".format(fo=1)") diff --git a/test/builtins/builtins1.py b/test/builtins/builtins1.py index 03c18cd6..36866c2a 100644 --- a/test/builtins/builtins1.py +++ b/test/builtins/builtins1.py @@ -5,7 +5,7 @@ NotImplemented True None False Ellipsis Warning Exception BaseException -sum oct abs type object print +sum oct abs type object print exec @@ -39,3 +39,5 @@ object : source.python, support.type.python : source.python print : source.python, support.function.builtin.python + : source.python +exec : source.python, support.function.builtin.python diff --git a/test/builtins/builtins6.py b/test/builtins/builtins6.py new file mode 100644 index 00000000..c110fa4a --- /dev/null +++ b/test/builtins/builtins6.py @@ -0,0 +1,13 @@ +exec() +exec(code_obj) + + + + +exec : meta.function-call.python, source.python, support.function.builtin.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +exec : meta.function-call.python, source.python, support.function.builtin.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +code_obj : meta.function-call.arguments.python, meta.function-call.python, source.python +) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python From 7c43d1cb668f349b292356433272b42dab5de69d Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 19 Jul 2018 18:23:52 -0400 Subject: [PATCH 21/49] Fix an issue with `import` highlighting. Issue #133. --- grammars/MagicPython.cson | 24 +++++++++++------ grammars/MagicPython.tmLanguage | 33 ++++++++++++++++------- grammars/src/MagicPython.syntax.yaml | 23 ++++++++++------ test/atom-spec/python-spec.js | 39 ++++++++++++++++++++++++++-- test/expressions/expr5.py | 2 +- test/statements/import5.py | 2 +- test/statements/import7.py | 20 ++++++++++++++ 7 files changed, 114 insertions(+), 29 deletions(-) create mode 100644 test/statements/import7.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 6bddf756..879da336 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1006,7 +1006,7 @@ repository: { match: ''' (?x) - \\s* \\b(from)\\b \\s*(\\.+)\\s* (import)? + \\s* \\b(from) \\s*(\\.+)\\s* (import\\b)? ''' captures: @@ -1840,18 +1840,26 @@ repository: } ] "illegal-names": - name: "keyword.control.flow.python" match: ''' (?x) - \\b( - and | as | assert | async | await | break | class | continue | def - | del | elif | else | except | finally | for | from | global - | if | import | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=]) - | nonlocal | not | or | pass | raise | return | try | while | with - | yield + \\b(?: + ( + and | as | assert | async | await | break | class | continue | def + | del | elif | else | except | finally | for | from | global + | if | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=]) + | nonlocal | not | or | pass | raise | return | try | while | with + | yield + ) | ( + import + ) )\\b ''' + captures: + "1": + name: "keyword.control.flow.python" + "2": + name: "keyword.control.import.python" "special-variables": match: ''' (?x) diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index a068b281..90d27a30 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1540,7 +1540,7 @@ match (?x) - \s* \b(from)\b \s*(\.+)\s* (import)? + \s* \b(from) \s*(\.+)\s* (import\b)? captures @@ -2833,18 +2833,33 @@ indirectly through syntactic constructs illegal-names - name - keyword.control.flow.python match (?x) - \b( - and | as | assert | async | await | break | class | continue | def - | del | elif | else | except | finally | for | from | global - | if | import | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) - | nonlocal | not | or | pass | raise | return | try | while | with - | yield + \b(?: + ( + and | as | assert | async | await | break | class | continue | def + | del | elif | else | except | finally | for | from | global + | if | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) + | nonlocal | not | or | pass | raise | return | try | while | with + | yield + ) | ( + import + ) )\b + captures + + 1 + + name + keyword.control.flow.python + + 2 + + name + keyword.control.import.python + + special-variables diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index c7b27645..1d6ea54d 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -848,7 +848,7 @@ repository: patterns: - match: | (?x) - \s* \b(from)\b \s*(\.+)\s* (import)? + \s* \b(from) \s*(\.+)\s* (import\b)? captures: '1': {name: keyword.control.import.python} '2': {name: punctuation.separator.period.python} @@ -1388,16 +1388,23 @@ repository: - include: '#magic-variable-names' illegal-names: - name: keyword.control.flow.python match: | (?x) - \b( - and | as | assert | async | await | break | class | continue | def - | del | elif | else | except | finally | for | from | global - | if | import | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) - | nonlocal | not | or | pass | raise | return | try | while | with - | yield + \b(?: + ( + and | as | assert | async | await | break | class | continue | def + | del | elif | else | except | finally | for | from | global + | if | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) + | nonlocal | not | or | pass | raise | return | try | while | with + | yield + ) | ( + import + ) )\b + captures: + '1': {name: keyword.control.flow.python} + '2': {name: keyword.control.import.python} + special-variables: match: | diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 3baf4825..a14fc173 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -5825,7 +5825,7 @@ describe("Grammar Tests", function() { expect(tokens[2][8].value).toBe("{"); expect(tokens[2][8].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]); expect(tokens[2][9].value).toBe("import"); - expect(tokens[2][9].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[2][9].scopes).toEqual(["source.python","keyword.control.import.python"]); expect(tokens[2][10].value).toBe(":"); expect(tokens[2][10].scopes).toEqual(["source.python","punctuation.separator.dict.python"]); expect(tokens[2][11].value).toBe(" "); @@ -12370,7 +12370,7 @@ describe("Grammar Tests", function() { expect(tokens[3][1].value).toBe("."); expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe("import"); - expect(tokens[3][2].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","keyword.control.import.python"]); expect(tokens[4][0].value).toBe(""); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[5][0].value).toBe("raise"); @@ -12430,6 +12430,41 @@ describe("Grammar Tests", function() { expect(tokens[0][6].scopes).toEqual(["source.python"]); }); + it("test/statements/import7.py", + function() { + tokens = grammar.tokenizeLines("from .importing import *\nfrom importing import *") + expect(tokens[0][0].value).toBe("from"); + expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("."); + expect(tokens[0][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][3].value).toBe("importing"); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe(" "); + expect(tokens[0][4].scopes).toEqual(["source.python"]); + expect(tokens[0][5].value).toBe("import"); + expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.import.python"]); + expect(tokens[0][6].value).toBe(" "); + expect(tokens[0][6].scopes).toEqual(["source.python"]); + expect(tokens[0][7].value).toBe("*"); + expect(tokens[0][7].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]); + expect(tokens[1][0].value).toBe("from"); + expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("importing"); + expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("import"); + expect(tokens[1][4].scopes).toEqual(["source.python","keyword.control.import.python"]); + expect(tokens[1][5].value).toBe(" "); + expect(tokens[1][5].scopes).toEqual(["source.python"]); + expect(tokens[1][6].value).toBe("*"); + expect(tokens[1][6].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]); + }); + it("test/statements/nonlocal1.py", function() { tokens = grammar.tokenizeLines("nonlocal a, b, c") diff --git a/test/expressions/expr5.py b/test/expressions/expr5.py index 0e19a719..9c734c46 100644 --- a/test/expressions/expr5.py +++ b/test/expressions/expr5.py @@ -33,7 +33,7 @@ : : punctuation.separator.dict.python, source.python : source.python { : punctuation.definition.dict.begin.python, source.python -import : keyword.control.flow.python, source.python +import : keyword.control.import.python, source.python : : punctuation.separator.dict.python, source.python : source.python a : source.python diff --git a/test/statements/import5.py b/test/statements/import5.py index 2df920d6..01c57822 100644 --- a/test/statements/import5.py +++ b/test/statements/import5.py @@ -25,7 +25,7 @@ def bar(): : source.python foo : source.python . : punctuation.separator.period.python, source.python -import : keyword.control.flow.python, source.python +import : keyword.control.import.python, source.python : source.python raise : keyword.control.flow.python, source.python : source.python diff --git a/test/statements/import7.py b/test/statements/import7.py new file mode 100644 index 00000000..7c0fd75f --- /dev/null +++ b/test/statements/import7.py @@ -0,0 +1,20 @@ +from .importing import * +from importing import * + + + +from : keyword.control.import.python, source.python + : source.python +. : punctuation.separator.period.python, source.python +importing : source.python + : source.python +import : keyword.control.import.python, source.python + : source.python +* : keyword.operator.arithmetic.python, source.python +from : keyword.control.flow.python, source.python + : source.python +importing : source.python + : source.python +import : keyword.control.import.python, source.python + : source.python +* : keyword.operator.arithmetic.python, source.python From ad6bd6211944a1b24c6594fa75ee3b15f60d7559 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 19 Jul 2018 19:59:08 -0400 Subject: [PATCH 22/49] Update the `*` and `**` in funciton call scopes. Use `keyword.operator.unpacking.arguments.python` more consistently. Issue #132. --- grammars/MagicPython.cson | 22 +++------- grammars/MagicPython.tmLanguage | 28 ++++--------- grammars/src/MagicPython.syntax.yaml | 18 +++----- test/atom-spec/python-spec.js | 63 +++++++++++++++++++++++++--- test/calls/call10.py | 32 ++++++++++++++ test/calls/call5.py | 4 +- test/calls/call6.py | 8 ++-- 7 files changed, 114 insertions(+), 61 deletions(-) create mode 100644 test/calls/call10.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 879da336..fbcc389f 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1613,35 +1613,25 @@ repository: } ] "function-arguments": - begin: ''' - (?x) - (?: - (\\() - (?:\\s*(\\*\\*|\\*))? - ) - - ''' + begin: "(\\()" end: "(?=\\))(?!\\)\\s*\\()" beginCaptures: "1": name: "punctuation.definition.arguments.begin.python" - "2": - name: "keyword.operator.unpacking.arguments.python" contentName: "meta.function-call.arguments.python" patterns: [ + { + name: "punctuation.separator.arguments.python" + match: "(,)" + } { match: ''' (?x) - (?: - (,) - (?:\\s*(\\*\\*|\\*))? - ) + (?:(?<=[,(])|^) \\s* (\\*{1,2}) ''' captures: "1": - name: "punctuation.separator.arguments.python" - "2": name: "keyword.operator.unpacking.arguments.python" } { diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 90d27a30..6f1edd62 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -2528,12 +2528,7 @@ function-arguments begin - (?x) - (?: - (\() - (?:\s*(\*\*|\*))? - ) - + (\() end (?=\))(?!\)\s*\() beginCaptures @@ -2543,32 +2538,25 @@ name punctuation.definition.arguments.begin.python - 2 - - name - keyword.operator.unpacking.arguments.python - contentName meta.function-call.arguments.python patterns + + name + punctuation.separator.arguments.python + match + (,) + match (?x) - (?: - (,) - (?:\s*(\*\*|\*))? - ) + (?:(?<=[,(])|^) \s* (\*{1,2}) captures 1 - - name - punctuation.separator.arguments.python - - 2 name keyword.operator.unpacking.arguments.python diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 1d6ea54d..556d0213 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -1219,27 +1219,19 @@ repository: \b ([[:alpha:]_]\w*) \b function-arguments: - begin: | - (?x) - (?: - (\() - (?:\s*(\*\*|\*))? - ) + begin: (\() end: (?=\))(?!\)\s*\() beginCaptures: '1': {name: punctuation.definition.arguments.begin.python} - '2': {name: keyword.operator.unpacking.arguments.python} contentName: meta.function-call.arguments.python patterns: + - name: punctuation.separator.arguments.python + match: (,) - match: | (?x) - (?: - (,) - (?:\s*(\*\*|\*))? - ) + (?:(?<=[,(])|^) \s* (\*{1,2}) captures: - '1': {name: punctuation.separator.arguments.python} - '2': {name: keyword.operator.unpacking.arguments.python} + '1': {name: keyword.operator.unpacking.arguments.python} - include: '#lambda-incomplete' - include: '#illegal-names' - match: '\b([[:alpha:]_]\w*)\s*(=)(?!=)' diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index a14fc173..64447b31 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -589,6 +589,57 @@ describe("Grammar Tests", function() { expect(tokens[0][34].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); }); + it("test/calls/call10.py", + function() { + tokens = grammar.tokenizeLines("x = foo(True,\n 3 * 4,\n *a,\n **bar)") + expect(tokens[0][0].value).toBe("x"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("foo"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[0][5].value).toBe("("); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][6].value).toBe("True"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.language.python"]); + expect(tokens[0][7].value).toBe(","); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[1][0].value).toBe(" "); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][1].value).toBe("3"); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[1][2].value).toBe(" "); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][3].value).toBe("*"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); + expect(tokens[1][4].value).toBe(" "); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][5].value).toBe("4"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[1][6].value).toBe(","); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[2][0].value).toBe(" "); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[2][1].value).toBe("*"); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]); + expect(tokens[2][2].value).toBe("a"); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[2][3].value).toBe(","); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[3][0].value).toBe(" "); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[3][1].value).toBe("**"); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]); + expect(tokens[3][2].value).toBe("bar"); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[3][3].value).toBe(")"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + }); + it("test/calls/call2.py", function() { tokens = grammar.tokenizeLines("foo(from=1)") @@ -702,7 +753,7 @@ describe("Grammar Tests", function() { expect(tokens[0][1].value).toBe("("); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][2].value).toBe("*"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","keyword.operator.unpacking.arguments.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]); expect(tokens[0][3].value).toBe("a"); expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][4].value).toBe(")"); @@ -712,7 +763,7 @@ describe("Grammar Tests", function() { expect(tokens[1][1].value).toBe("("); expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][2].value).toBe("**"); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","keyword.operator.unpacking.arguments.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]); expect(tokens[1][3].value).toBe("a"); expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[1][4].value).toBe(")"); @@ -727,9 +778,9 @@ describe("Grammar Tests", function() { expect(tokens[0][1].value).toBe("("); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][2].value).toBe(" "); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][3].value).toBe("*"); - expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","keyword.operator.unpacking.arguments.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]); expect(tokens[0][4].value).toBe("a"); expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][5].value).toBe(" "); @@ -751,9 +802,9 @@ describe("Grammar Tests", function() { expect(tokens[1][1].value).toBe("("); expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][2].value).toBe(" "); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[1][3].value).toBe("**"); - expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","keyword.operator.unpacking.arguments.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]); expect(tokens[1][4].value).toBe("a"); expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[1][5].value).toBe(" "); diff --git a/test/calls/call10.py b/test/calls/call10.py new file mode 100644 index 00000000..98b52f2d --- /dev/null +++ b/test/calls/call10.py @@ -0,0 +1,32 @@ +x = foo(True, + 3 * 4, + *a, + **bar) + + + + + +x : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +foo : meta.function-call.generic.python, meta.function-call.python, source.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +True : constant.language.python, meta.function-call.arguments.python, meta.function-call.python, source.python +, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +3 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +* : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +4 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python +, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +* : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function-call.python, source.python +a : meta.function-call.arguments.python, meta.function-call.python, source.python +, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +** : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function-call.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, source.python +) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/calls/call5.py b/test/calls/call5.py index f18470c4..4ea20afa 100644 --- a/test/calls/call5.py +++ b/test/calls/call5.py @@ -5,11 +5,11 @@ f : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -* : keyword.operator.unpacking.arguments.python, meta.function-call.python, source.python +* : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function-call.python, source.python a : meta.function-call.arguments.python, meta.function-call.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python f : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -** : keyword.operator.unpacking.arguments.python, meta.function-call.python, source.python +** : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function-call.python, source.python a : meta.function-call.arguments.python, meta.function-call.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/calls/call6.py b/test/calls/call6.py index 8cdcd6d4..afc87850 100644 --- a/test/calls/call6.py +++ b/test/calls/call6.py @@ -5,8 +5,8 @@ f : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python - : meta.function-call.python, source.python -* : keyword.operator.unpacking.arguments.python, meta.function-call.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +* : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function-call.python, source.python a : meta.function-call.arguments.python, meta.function-call.python, source.python : meta.function-call.arguments.python, meta.function-call.python, source.python , : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python @@ -17,8 +17,8 @@ ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python f : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python - : meta.function-call.python, source.python -** : keyword.operator.unpacking.arguments.python, meta.function-call.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, source.python +** : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function-call.python, source.python a : meta.function-call.arguments.python, meta.function-call.python, source.python : meta.function-call.arguments.python, meta.function-call.python, source.python , : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python From cc2b832e81fc62f2d92e2f55448c5faf21a7fe0a Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Tue, 11 Sep 2018 19:54:51 -0400 Subject: [PATCH 23/49] Modify foldEndPattern --- settings/atom.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/atom.cson b/settings/atom.cson index ef9a58d1..e66d6044 100644 --- a/settings/atom.cson +++ b/settings/atom.cson @@ -35,7 +35,7 @@ 'autoIndentOnPaste': false 'softTabs': true 'tabLength': 4 - 'foldEndPattern': '^\\s*"""\\s*$' + 'foldEndPattern': '^\\s*\\}|^\\s*\\]|^\\s*\\)' 'commentStart': '# ' 'increaseIndentPattern': '^\\s*(class|((async\\s+)?(def|with|for))|elif|else|except|finally|if|try|while)\\b.*:\\s*$' 'decreaseIndentPattern': '^\\s*(elif|else|except|finally)\\b.*:' From 1b72e04ac7fe2425e5325ddf0dfd97f73c83ea03 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 4 Oct 2018 15:56:26 -0400 Subject: [PATCH 24/49] Bugfix for an apparent infinite loop in grammar. (#163) This is a case of semantically equivalent regex not being computationally equivalent. The issue also relates to how negative character classes (e.g. `[^abc]`) are treated. In the end I had to replace something of the form `(A | B)*` with `A* (BA*)*` to avoid grinding the regex engine to a halt. Issue #150. --- grammars/MagicPython.cson | 10 +- grammars/MagicPython.tmLanguage | 10 +- grammars/src/MagicPython.syntax.yaml | 10 +- test/atom-spec/python-spec.js | 144 +++++++++++++++++++++++++++ test/strings/bug1.py | 47 +++++++++ test/strings/bug2.py | 35 +++++++ 6 files changed, 238 insertions(+), 18 deletions(-) create mode 100644 test/strings/bug1.py create mode 100644 test/strings/bug2.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index fbcc389f..bb53f04c 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -942,7 +942,7 @@ repository: {{ | }} | (?: { - \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'"]+\\])*? + \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])* (![rsa])? ( : \\w? [<>=^]? [-+ ]? \\#? \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )? @@ -964,13 +964,11 @@ repository: (?x) ( { - \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'"]+\\])*? + \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])* (![rsa])? (:) - ( - [^'"{}\\n]+? - | - \\{ [^'"}\\n]*? \\} + [^'"{}\\n]* (?: + \\{ [^'"}\\n]*? \\} [^'"{}\\n]* )* } ) diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 6f1edd62..90e33014 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1444,7 +1444,7 @@ {{ | }} | (?: { - \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*? + \w* (\.[[:alpha:]_]\w* | \[[^\]'"]+\])* (![rsa])? ( : \w? [<>=^]? [-+ ]? \#? \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )? @@ -1477,13 +1477,11 @@ (?x) ( { - \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*? + \w* (\.[[:alpha:]_]\w* | \[[^\]'"]+\])* (![rsa])? (:) - ( - [^'"{}\n]+? - | - \{ [^'"}\n]*? \} + [^'"{}\n]* (?: + \{ [^'"}\n]*? \} [^'"{}\n]* )* } ) diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 556d0213..b2dc33f9 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -791,7 +791,7 @@ repository: {{ | }} | (?: { - \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*? + \w* (\.[[:alpha:]_]\w* | \[[^\]'"]+\])* (![rsa])? ( : \w? [<>=^]? [-+ ]? \#? \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )? @@ -818,13 +818,11 @@ repository: (?x) ( { - \w*? (\.[[:alpha:]_]\w*? | \[[^\]'"]+\])*? + \w* (\.[[:alpha:]_]\w* | \[[^\]'"]+\])* (![rsa])? (:) - ( - [^'"{}\n]+? - | - \{ [^'"}\n]*? \} + [^'"{}\n]* (?: + \{ [^'"}\n]*? \} [^'"{}\n]* )* } ) diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 64447b31..ebf9ccd7 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -12853,6 +12853,150 @@ describe("Grammar Tests", function() { expect(tokens[3][13].scopes).toEqual(["source.python","comment.line.number-sign.python"]); }); + it("test/strings/bug1.py", + function() { + tokens = grammar.tokenizeLines("# issue 150\nrecord = {\n \"a\": {k: str(v) for k, v in foo if \"\"}\n}") + expect(tokens[0][0].value).toBe("#"); + expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[0][1].value).toBe(" issue 150"); + expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]); + expect(tokens[1][0].value).toBe("record"); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("="); + expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("{"); + expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]); + expect(tokens[2][0].value).toBe(" "); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe("\""); + expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[2][2].value).toBe("a"); + expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[2][3].value).toBe("\""); + expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[2][4].value).toBe(":"); + expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.separator.dict.python"]); + expect(tokens[2][5].value).toBe(" "); + expect(tokens[2][5].scopes).toEqual(["source.python"]); + expect(tokens[2][6].value).toBe("{"); + expect(tokens[2][6].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]); + expect(tokens[2][7].value).toBe("k"); + expect(tokens[2][7].scopes).toEqual(["source.python"]); + expect(tokens[2][8].value).toBe(":"); + expect(tokens[2][8].scopes).toEqual(["source.python","punctuation.separator.dict.python"]); + expect(tokens[2][9].value).toBe(" "); + expect(tokens[2][9].scopes).toEqual(["source.python"]); + expect(tokens[2][10].value).toBe("str"); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.function-call.python","support.type.python"]); + expect(tokens[2][11].value).toBe("("); + expect(tokens[2][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][12].value).toBe("v"); + expect(tokens[2][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[2][13].value).toBe(")"); + expect(tokens[2][13].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[2][14].value).toBe(" "); + expect(tokens[2][14].scopes).toEqual(["source.python"]); + expect(tokens[2][15].value).toBe("for"); + expect(tokens[2][15].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[2][16].value).toBe(" "); + expect(tokens[2][16].scopes).toEqual(["source.python"]); + expect(tokens[2][17].value).toBe("k"); + expect(tokens[2][17].scopes).toEqual(["source.python"]); + expect(tokens[2][18].value).toBe(","); + expect(tokens[2][18].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[2][19].value).toBe(" "); + expect(tokens[2][19].scopes).toEqual(["source.python"]); + expect(tokens[2][20].value).toBe("v"); + expect(tokens[2][20].scopes).toEqual(["source.python"]); + expect(tokens[2][21].value).toBe(" "); + expect(tokens[2][21].scopes).toEqual(["source.python"]); + expect(tokens[2][22].value).toBe("in"); + expect(tokens[2][22].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[2][23].value).toBe(" "); + expect(tokens[2][23].scopes).toEqual(["source.python"]); + expect(tokens[2][24].value).toBe("foo"); + expect(tokens[2][24].scopes).toEqual(["source.python"]); + expect(tokens[2][25].value).toBe(" "); + expect(tokens[2][25].scopes).toEqual(["source.python"]); + expect(tokens[2][26].value).toBe("if"); + expect(tokens[2][26].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[2][27].value).toBe(" "); + expect(tokens[2][27].scopes).toEqual(["source.python"]); + expect(tokens[2][28].value).toBe("\""); + expect(tokens[2][28].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[2][29].value).toBe("\""); + expect(tokens[2][29].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[2][30].value).toBe("}"); + expect(tokens[2][30].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]); + expect(tokens[3][0].value).toBe("}"); + expect(tokens[3][0].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]); + }); + + it("test/strings/bug2.py", + function() { + tokens = grammar.tokenizeLines("# issue 150\ncmd = \"git-clang-format --style=\\\"{{BasedOnStyle: Google, ColumnLimit: 100, IndentWidth: 2, \" \\\n \"AlignConsecutiveAssignments: true}}\\\" {COMMIT_SHA} -- ./**/*.proto > {OUTPUT}\".format(") + expect(tokens[0][0].value).toBe("#"); + expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[0][1].value).toBe(" issue 150"); + expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]); + expect(tokens[1][0].value).toBe("cmd"); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("="); + expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("\""); + expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[1][5].value).toBe("git-clang-format --style="); + expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[1][6].value).toBe("\\\""); + expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]); + expect(tokens[1][7].value).toBe("{{"); + expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][8].value).toBe("BasedOnStyle: Google, ColumnLimit: 100, IndentWidth: 2, "); + expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[1][9].value).toBe("\""); + expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[1][10].value).toBe(" "); + expect(tokens[1][10].scopes).toEqual(["source.python"]); + expect(tokens[1][11].value).toBe("\\"); + expect(tokens[1][11].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]); + expect(tokens[1][12].value).toBe(""); + expect(tokens[1][12].scopes).toEqual(["source.python"]); + expect(tokens[2][0].value).toBe(" "); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe("\""); + expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[2][2].value).toBe("AlignConsecutiveAssignments: true"); + expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[2][3].value).toBe("}}"); + expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][4].value).toBe("\\\""); + expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]); + expect(tokens[2][5].value).toBe(" "); + expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[2][6].value).toBe("{COMMIT_SHA}"); + expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][7].value).toBe(" -- ./**/*.proto > "); + expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[2][8].value).toBe("{OUTPUT}"); + expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][9].value).toBe("\""); + expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[2][10].value).toBe("."); + expect(tokens[2][10].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][11].value).toBe("format"); + expect(tokens[2][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[2][12].value).toBe("("); + expect(tokens[2][12].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + }); + it("test/strings/bytes1.py", function() { tokens = grammar.tokenizeLines("a = b\"\"\"\nmultiline \"binary\" string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n\"\"\"") diff --git a/test/strings/bug1.py b/test/strings/bug1.py new file mode 100644 index 00000000..9b43c6de --- /dev/null +++ b/test/strings/bug1.py @@ -0,0 +1,47 @@ +# issue 150 +record = { + "a": {k: str(v) for k, v in foo if ""} +} + + + + +# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python + issue 150 : comment.line.number-sign.python, source.python +record : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +{ : punctuation.definition.dict.begin.python, source.python + : source.python +" : punctuation.definition.string.begin.python, source.python, string.quoted.single.python +a : source.python, string.quoted.single.python +" : punctuation.definition.string.end.python, source.python, string.quoted.single.python +: : punctuation.separator.dict.python, source.python + : source.python +{ : punctuation.definition.dict.begin.python, source.python +k : source.python +: : punctuation.separator.dict.python, source.python + : source.python +str : meta.function-call.python, source.python, support.type.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +v : meta.function-call.arguments.python, meta.function-call.python, source.python +) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python + : source.python +for : keyword.control.flow.python, source.python + : source.python +k : source.python +, : punctuation.separator.element.python, source.python + : source.python +v : source.python + : source.python +in : keyword.operator.logical.python, source.python + : source.python +foo : source.python + : source.python +if : keyword.control.flow.python, source.python + : source.python +" : punctuation.definition.string.begin.python, source.python, string.quoted.single.python +" : punctuation.definition.string.end.python, source.python, string.quoted.single.python +} : punctuation.definition.dict.end.python, source.python +} : punctuation.definition.dict.end.python, source.python diff --git a/test/strings/bug2.py b/test/strings/bug2.py new file mode 100644 index 00000000..0ba2bf8f --- /dev/null +++ b/test/strings/bug2.py @@ -0,0 +1,35 @@ +# issue 150 +cmd = "git-clang-format --style=\"{{BasedOnStyle: Google, ColumnLimit: 100, IndentWidth: 2, " \ + "AlignConsecutiveAssignments: true}}\" {COMMIT_SHA} -- ./**/*.proto > {OUTPUT}".format( + + + + +# : comment.line.number-sign.python, punctuation.definition.comment.python, source.python + issue 150 : comment.line.number-sign.python, source.python +cmd : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +" : punctuation.definition.string.begin.python, source.python, string.quoted.single.python +git-clang-format --style= : source.python, string.quoted.single.python +\" : constant.character.escape.python, source.python, string.quoted.single.python +{{ : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +BasedOnStyle: Google, ColumnLimit: 100, IndentWidth: 2, : source.python, string.quoted.single.python +" : punctuation.definition.string.end.python, source.python, string.quoted.single.python + : source.python +\ : punctuation.separator.continuation.line.python, source.python + : source.python + : source.python +" : punctuation.definition.string.begin.python, source.python, string.quoted.single.python +AlignConsecutiveAssignments: true : source.python, string.quoted.single.python +}} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +\" : constant.character.escape.python, source.python, string.quoted.single.python + : source.python, string.quoted.single.python +{COMMIT_SHA} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python + -- ./**/*.proto > : source.python, string.quoted.single.python +{OUTPUT} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python +" : punctuation.definition.string.end.python, source.python, string.quoted.single.python +. : punctuation.separator.period.python, source.python +format : meta.function-call.generic.python, meta.function-call.python, source.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python From a891320d09aace152b05e8cce5cb4792f0194563 Mon Sep 17 00:00:00 2001 From: therumbler Date: Thu, 4 Oct 2018 15:57:00 -0400 Subject: [PATCH 25/49] Changing Try-Except... snippets to be Python 3 style (as instead of ,) (#154) --- snippets/sublime/Try-Except-Else-Finally.sublime-snippet | 2 +- snippets/sublime/Try-Except-Else.sublime-snippet | 2 +- snippets/sublime/Try-Except-Finally.sublime-snippet | 2 +- snippets/sublime/Try-Except.sublime-snippet | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/sublime/Try-Except-Else-Finally.sublime-snippet b/snippets/sublime/Try-Except-Else-Finally.sublime-snippet index 00c41fb9..ff120922 100644 --- a/snippets/sublime/Try-Except-Else-Finally.sublime-snippet +++ b/snippets/sublime/Try-Except-Else-Finally.sublime-snippet @@ -1,7 +1,7 @@ diff --git a/snippets/sublime/Try-Except-Finally.sublime-snippet b/snippets/sublime/Try-Except-Finally.sublime-snippet index 0ee74a40..b088cbe6 100644 --- a/snippets/sublime/Try-Except-Finally.sublime-snippet +++ b/snippets/sublime/Try-Except-Finally.sublime-snippet @@ -1,7 +1,7 @@ diff --git a/snippets/sublime/Try-Except.sublime-snippet b/snippets/sublime/Try-Except.sublime-snippet index bdf36a88..58f38d1b 100644 --- a/snippets/sublime/Try-Except.sublime-snippet +++ b/snippets/sublime/Try-Except.sublime-snippet @@ -1,7 +1,7 @@ try source.python From 4030374b5245d2db6a338ba48d520aad481d74ee Mon Sep 17 00:00:00 2001 From: chbk Date: Thu, 4 Oct 2018 22:02:19 +0200 Subject: [PATCH 26/49] Tokenize `@` and `.` in decorators (#110) * Tokenize `@` in decorators * Tokenize periods in decorators --- grammars/MagicPython.cson | 9 ++- grammars/MagicPython.tmLanguage | 17 ++++- grammars/src/MagicPython.syntax.yaml | 7 +- misc/scopes | 1 + test/atom-spec/python-spec.js | 98 ++++++++++++++-------------- test/classes/class12.py | 2 +- test/classes/class2.py | 2 +- test/docstrings/regr1.py | 2 +- test/functions/async1.py | 2 +- test/functions/decorators1.py | 18 ++--- test/functions/decorators2.py | 8 +-- test/functions/decorators3.py | 4 +- test/functions/decorators4.py | 10 +-- test/functions/decorators5.py | 14 ++-- test/functions/decorators6.py | 20 +++--- test/functions/decorators7.py | 12 ++-- test/functions/decorators8.py | 2 +- test/unicode/unicode1.py | 2 +- 18 files changed, 126 insertions(+), 104 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index bb53f04c..71050143 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1479,7 +1479,7 @@ repository: begin: ''' (?x) ^\\s* - (@) \\s* (?=[[:alpha:]_]\\w*) + ((@)) \\s* (?=[[:alpha:]_]\\w*) ''' end: ''' @@ -1493,6 +1493,8 @@ repository: beginCaptures: "1": name: "entity.name.function.decorator.python" + "2": + name: "punctuation.definition.decorator.python" endCaptures: "1": name: "punctuation.definition.arguments.end.python" @@ -1518,9 +1520,12 @@ repository: name: "entity.name.function.decorator.python" match: ''' (?x) - ([[:alpha:]_]\\w*) | \\. + ([[:alpha:]_]\\w*) | (\\.) ''' + captures: + "2": + name: "punctuation.separator.period.python" } { include: "#line-continuation" diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 90e33014..c2990dae 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -2331,7 +2331,7 @@ begin (?x) ^\s* - (@) \s* (?=[[:alpha:]_]\w*) + ((@)) \s* (?=[[:alpha:]_]\w*) end (?x) @@ -2347,6 +2347,11 @@ name entity.name.function.decorator.python + 2 + + name + punctuation.definition.decorator.python + endCaptures @@ -2390,8 +2395,16 @@ entity.name.function.decorator.python match (?x) - ([[:alpha:]_]\w*) | \. + ([[:alpha:]_]\w*) | (\.) + captures + + 2 + + name + punctuation.separator.period.python + + include diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index b2dc33f9..536bd32e 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -1138,7 +1138,7 @@ repository: begin: | (?x) ^\s* - (@) \s* (?=[[:alpha:]_]\w*) + ((@)) \s* (?=[[:alpha:]_]\w*) end: | (?x) ( \) ) @@ -1147,6 +1147,7 @@ repository: | (?=\n|\#) beginCaptures: '1': {name: entity.name.function.decorator.python} + '2': {name: punctuation.definition.decorator.python} endCaptures: '1': {name: punctuation.definition.arguments.end.python} '2': {name: invalid.illegal.decorator.python} @@ -1162,7 +1163,9 @@ repository: - name: entity.name.function.decorator.python match: | (?x) - ([[:alpha:]_]\w*) | \. + ([[:alpha:]_]\w*) | (\.) + captures: + '2': {name: punctuation.separator.period.python} - include: '#line-continuation' - name: invalid.illegal.decorator.python match: | diff --git a/misc/scopes b/misc/scopes index fb8522c3..a49a024d 100644 --- a/misc/scopes +++ b/misc/scopes @@ -84,6 +84,7 @@ punctuation.comment.end.regexp punctuation.definition.arguments.begin.python punctuation.definition.arguments.end.python punctuation.definition.comment.python +punctuation.definition.decorator.python punctuation.definition.dict.begin.python punctuation.definition.dict.end.python punctuation.definition.inheritance.begin.python diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index ebf9ccd7..9660b781 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -1410,7 +1410,7 @@ describe("Grammar Tests", function() { expect(tokens[1][0].value).toBe(" "); expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[1][1].value).toBe("@"); - expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[1][2].value).toBe("classmethod"); expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","support.type.python"]); expect(tokens[2][0].value).toBe(" "); @@ -1729,7 +1729,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@dec\n# Bar.name=... is not legal, but the test is for highlighter not breaking badly\nclass Spam(Foo.Bar, Bar.name={'very': 'odd'}):\n pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("dec"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[1][0].value).toBe("#"); @@ -5013,7 +5013,7 @@ describe("Grammar Tests", function() { expect(tokens[1][0].value).toBe(" "); expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[1][1].value).toBe("@"); - expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[1][2].value).toBe("asd"); expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[2][0].value).toBe(" "); @@ -7823,7 +7823,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@foo\nasync def foo():\n a = 1\n async for a, b, c in b:\n async with b as d, c:\n await func(a, b=1)") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("foo"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[1][0].value).toBe("async"); @@ -8924,7 +8924,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@some_decorator # with comment\n@some.class.decorator\n@some_decorator(1)\n@some.decorator (1, 3)\n@some_decorator(a=2, b={'q': 42}, **kwargs)\n@classmethod\ndef decorated(a): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("some_decorator"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][2].value).toBe(" "); @@ -8934,19 +8934,19 @@ describe("Grammar Tests", function() { expect(tokens[0][4].value).toBe(" with comment"); expect(tokens[0][4].scopes).toEqual(["source.python","comment.line.number-sign.python"]); expect(tokens[1][0].value).toBe("@"); - expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[1][1].value).toBe("some"); expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[1][2].value).toBe("."); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[1][3].value).toBe("class"); expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.control.flow.python"]); expect(tokens[1][4].value).toBe("."); - expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[1][5].value).toBe("decorator"); expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[2][0].value).toBe("@"); - expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[2][1].value).toBe("some_decorator"); expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[2][2].value).toBe("("); @@ -8956,11 +8956,11 @@ describe("Grammar Tests", function() { expect(tokens[2][4].value).toBe(")"); expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]); expect(tokens[3][0].value).toBe("@"); - expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[3][1].value).toBe("some"); expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[3][2].value).toBe("."); - expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[3][3].value).toBe("decorator"); expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[3][4].value).toBe(" "); @@ -8978,7 +8978,7 @@ describe("Grammar Tests", function() { expect(tokens[3][10].value).toBe(")"); expect(tokens[3][10].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]); expect(tokens[4][0].value).toBe("@"); - expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[4][1].value).toBe("some_decorator"); expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[4][2].value).toBe("("); @@ -9024,7 +9024,7 @@ describe("Grammar Tests", function() { expect(tokens[4][22].value).toBe(")"); expect(tokens[4][22].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]); expect(tokens[5][0].value).toBe("@"); - expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[5][1].value).toBe("classmethod"); expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.decorator.python","support.type.python"]); expect(tokens[6][0].value).toBe("def"); @@ -9051,7 +9051,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@ f . bar . a . b\ndef foo(): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe(" "); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][2].value).toBe("f"); @@ -9059,7 +9059,7 @@ describe("Grammar Tests", function() { expect(tokens[0][3].value).toBe(" "); expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][4].value).toBe("."); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][5].value).toBe(" "); expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][6].value).toBe("bar"); @@ -9067,7 +9067,7 @@ describe("Grammar Tests", function() { expect(tokens[0][7].value).toBe(" "); expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][8].value).toBe("."); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][9].value).toBe(" "); expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][10].value).toBe("a"); @@ -9075,7 +9075,7 @@ describe("Grammar Tests", function() { expect(tokens[0][11].value).toBe(" "); expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][12].value).toBe("."); - expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][13].value).toBe(" "); expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][14].value).toBe("b"); @@ -9102,7 +9102,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@ f . bar (baz = 1)\ndef foo(): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe(" "); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][2].value).toBe("f"); @@ -9110,7 +9110,7 @@ describe("Grammar Tests", function() { expect(tokens[0][3].value).toBe(" "); expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][4].value).toBe("."); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][5].value).toBe(" "); expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][6].value).toBe("bar"); @@ -9153,23 +9153,23 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@a.b.c.None.z\ndef foo(): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("a"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][2].value).toBe("."); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][3].value).toBe("b"); expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][4].value).toBe("."); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][5].value).toBe("c"); expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][6].value).toBe("."); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][7].value).toBe("None"); expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.illegal.name.python"]); expect(tokens[0][8].value).toBe("."); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][9].value).toBe("z"); expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[1][0].value).toBe("def"); @@ -9194,11 +9194,11 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@a. \\\n b . \\\n c.None.z \\\n baz(q=1)\n@foo.ok\ndef foo(): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("a"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][2].value).toBe("."); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][3].value).toBe(" "); expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][4].value).toBe("\\"); @@ -9212,7 +9212,7 @@ describe("Grammar Tests", function() { expect(tokens[1][2].value).toBe(" "); expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[1][3].value).toBe("."); - expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[1][4].value).toBe(" "); expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[1][5].value).toBe("\\"); @@ -9224,11 +9224,11 @@ describe("Grammar Tests", function() { expect(tokens[2][1].value).toBe("c"); expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[2][2].value).toBe("."); - expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[2][3].value).toBe("None"); expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.illegal.name.python"]); expect(tokens[2][4].value).toBe("."); - expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[2][5].value).toBe("z"); expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[2][6].value).toBe(" "); @@ -9252,11 +9252,11 @@ describe("Grammar Tests", function() { expect(tokens[3][6].value).toBe(")"); expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]); expect(tokens[4][0].value).toBe("@"); - expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[4][1].value).toBe("foo"); expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[4][2].value).toBe("."); - expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[4][3].value).toBe("ok"); expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[5][0].value).toBe("def"); @@ -9281,11 +9281,11 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@a. b . \\\n c.None.z(foo=BAR). \\\n baz[1:2]\n@foo.class.bar[]\n@foo.ok '''\ndef foo(): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("a"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][2].value).toBe("."); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][3].value).toBe(" "); expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][4].value).toBe("b"); @@ -9293,7 +9293,7 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe(" "); expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][6].value).toBe("."); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[0][7].value).toBe(" "); expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[0][8].value).toBe("\\"); @@ -9305,11 +9305,11 @@ describe("Grammar Tests", function() { expect(tokens[1][1].value).toBe("c"); expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[1][2].value).toBe("."); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[1][3].value).toBe("None"); expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.illegal.name.python"]); expect(tokens[1][4].value).toBe("."); - expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[1][5].value).toBe("z"); expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[1][6].value).toBe("("); @@ -9339,25 +9339,25 @@ describe("Grammar Tests", function() { expect(tokens[2][6].value).toBe("]"); expect(tokens[2][6].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]); expect(tokens[3][0].value).toBe("@"); - expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[3][1].value).toBe("foo"); expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[3][2].value).toBe("."); - expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[3][3].value).toBe("class"); expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.control.flow.python"]); expect(tokens[3][4].value).toBe("."); - expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[3][5].value).toBe("bar"); expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[3][6].value).toBe("[]"); expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python","invalid.illegal.decorator.python"]); expect(tokens[4][0].value).toBe("@"); - expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[4][1].value).toBe("foo"); expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[4][2].value).toBe("."); - expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]); expect(tokens[4][3].value).toBe("ok"); expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[4][4].value).toBe(" "); @@ -9394,13 +9394,13 @@ describe("Grammar Tests", function() { expect(tokens[1][1].value).toBe(" DO NOT DELETE TRAILING WHITESTAPCE IN THIS FILE"); expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]); expect(tokens[2][0].value).toBe("@"); - expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[2][1].value).toBe("foo"); expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[2][2].value).toBe(" "); expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[3][0].value).toBe("@"); - expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[3][1].value).toBe("foo"); expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[3][2].value).toBe("("); @@ -9410,13 +9410,13 @@ describe("Grammar Tests", function() { expect(tokens[3][4].value).toBe(" "); expect(tokens[3][4].scopes).toEqual(["source.python"]); expect(tokens[4][0].value).toBe("@"); - expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[4][1].value).toBe("bar"); expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[4][2].value).toBe("\t"); expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[5][0].value).toBe("@"); - expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[5][1].value).toBe("bar"); expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[5][2].value).toBe("("); @@ -9426,7 +9426,7 @@ describe("Grammar Tests", function() { expect(tokens[5][4].value).toBe("\t"); expect(tokens[5][4].scopes).toEqual(["source.python"]); expect(tokens[6][0].value).toBe("@"); - expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[6][1].value).toBe("bar"); expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[6][2].value).toBe("("); @@ -9442,7 +9442,7 @@ describe("Grammar Tests", function() { expect(tokens[6][7].value).toBe(" legal"); expect(tokens[6][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]); expect(tokens[7][0].value).toBe("@"); - expect(tokens[7][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[7][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[7][1].value).toBe("bar"); expect(tokens[7][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[7][2].value).toBe("("); @@ -9475,7 +9475,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("@deco().abc # SyntaxError: invalid syntax\ndef foo(): pass") expect(tokens[0][0].value).toBe("@"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[0][1].value).toBe("deco"); expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[0][2].value).toBe("("); @@ -14483,7 +14483,7 @@ describe("Grammar Tests", function() { expect(tokens[2][0].value).toBe(" "); expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python"]); expect(tokens[2][1].value).toBe("@"); - expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]); expect(tokens[2][2].value).toBe("æaœ"); expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]); expect(tokens[3][0].value).toBe(" "); diff --git a/test/classes/class12.py b/test/classes/class12.py index e8b69161..e0e7fb7d 100644 --- a/test/classes/class12.py +++ b/test/classes/class12.py @@ -17,7 +17,7 @@ class : meta.class.python, source.python, storage.type.class.python F : entity.name.type.class.python, meta.class.python, source.python : : meta.class.python, punctuation.section.class.begin.python, source.python : meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python classmethod : meta.function.decorator.python, source.python, support.type.python : meta.function.python, source.python def : meta.function.python, source.python, storage.type.function.python diff --git a/test/classes/class2.py b/test/classes/class2.py index 536f9258..32b5a2dc 100644 --- a/test/classes/class2.py +++ b/test/classes/class2.py @@ -5,7 +5,7 @@ class Spam(Foo.Bar, Bar.name={'very': 'odd'}): -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python dec : entity.name.function.decorator.python, meta.function.decorator.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python Bar.name=... is not legal, but the test is for highlighter not breaking badly : comment.line.number-sign.python, source.python diff --git a/test/docstrings/regr1.py b/test/docstrings/regr1.py index 7d3d5dcc..8b5a65e9 100644 --- a/test/docstrings/regr1.py +++ b/test/docstrings/regr1.py @@ -8,7 +8,7 @@ def foo(): # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python : : comment.line.number-sign.python, source.python : meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python asd : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.python, source.python def : meta.function.python, source.python, storage.type.function.python diff --git a/test/functions/async1.py b/test/functions/async1.py index cb6fd70e..d6a5546b 100644 --- a/test/functions/async1.py +++ b/test/functions/async1.py @@ -7,7 +7,7 @@ async def foo(): -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python foo : entity.name.function.decorator.python, meta.function.decorator.python, source.python async : meta.function.python, source.python, storage.type.function.async.python : meta.function.python, source.python diff --git a/test/functions/decorators1.py b/test/functions/decorators1.py index 6fc61aea..bf03fad0 100644 --- a/test/functions/decorators1.py +++ b/test/functions/decorators1.py @@ -8,25 +8,25 @@ def decorated(a): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python some_decorator : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python with comment : comment.line.number-sign.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python some : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python class : keyword.control.flow.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python decorator : entity.name.function.decorator.python, meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python some_decorator : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python 1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function.decorator.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python some : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python decorator : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python @@ -35,7 +35,7 @@ class : keyword.control.flow.python, meta.function.decorator.python, sou : meta.function-call.arguments.python, meta.function.decorator.python, source.python 3 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function.decorator.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python some_decorator : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python a : meta.function-call.arguments.python, meta.function.decorator.python, source.python, variable.parameter.function-call.python @@ -58,7 +58,7 @@ class : keyword.control.flow.python, meta.function.decorator.python, sou ** : keyword.operator.unpacking.arguments.python, meta.function-call.arguments.python, meta.function.decorator.python, source.python kwargs : meta.function-call.arguments.python, meta.function.decorator.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python classmethod : meta.function.decorator.python, source.python, support.type.python def : meta.function.python, source.python, storage.type.function.python : meta.function.python, source.python diff --git a/test/functions/decorators2.py b/test/functions/decorators2.py index af5d7170..0b129649 100644 --- a/test/functions/decorators2.py +++ b/test/functions/decorators2.py @@ -3,19 +3,19 @@ def foo(): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python : meta.function.decorator.python, source.python f : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python a : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python b : entity.name.function.decorator.python, meta.function.decorator.python, source.python def : meta.function.python, source.python, storage.type.function.python diff --git a/test/functions/decorators3.py b/test/functions/decorators3.py index 0cfe7a4f..24e7a58f 100644 --- a/test/functions/decorators3.py +++ b/test/functions/decorators3.py @@ -3,11 +3,11 @@ def foo(): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python : meta.function.decorator.python, source.python f : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python diff --git a/test/functions/decorators4.py b/test/functions/decorators4.py index f2aab448..ba7df7bd 100644 --- a/test/functions/decorators4.py +++ b/test/functions/decorators4.py @@ -3,15 +3,15 @@ def foo(): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python a : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python b : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python c : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python None : keyword.illegal.name.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python z : entity.name.function.decorator.python, meta.function.decorator.python, source.python def : meta.function.python, source.python, storage.type.function.python : meta.function.python, source.python diff --git a/test/functions/decorators5.py b/test/functions/decorators5.py index 412747ae..436d1a4b 100644 --- a/test/functions/decorators5.py +++ b/test/functions/decorators5.py @@ -7,24 +7,24 @@ def foo(): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python a : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python \ : meta.function.decorator.python, punctuation.separator.continuation.line.python, source.python : meta.function.decorator.python, source.python : meta.function.decorator.python, source.python b : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python \ : meta.function.decorator.python, punctuation.separator.continuation.line.python, source.python : meta.function.decorator.python, source.python : meta.function.decorator.python, source.python c : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python None : keyword.illegal.name.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python z : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python \ : meta.function.decorator.python, punctuation.separator.continuation.line.python, source.python @@ -36,9 +36,9 @@ def foo(): pass = : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function.decorator.python, source.python 1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function.decorator.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python foo : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python ok : entity.name.function.decorator.python, meta.function.decorator.python, source.python def : meta.function.python, source.python, storage.type.function.python : meta.function.python, source.python diff --git a/test/functions/decorators6.py b/test/functions/decorators6.py index 53264a2e..8a167cad 100644 --- a/test/functions/decorators6.py +++ b/test/functions/decorators6.py @@ -6,21 +6,21 @@ def foo(): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python a : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python b : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python : meta.function.decorator.python, source.python \ : meta.function.decorator.python, punctuation.separator.continuation.line.python, source.python : meta.function.decorator.python, source.python : meta.function.decorator.python, source.python c : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python None : keyword.illegal.name.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python z : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python foo : meta.function-call.arguments.python, meta.function.decorator.python, source.python, variable.parameter.function-call.python @@ -35,16 +35,16 @@ def foo(): pass : : meta.item-access.arguments.python, meta.item-access.python, punctuation.separator.slice.python, source.python 2 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python ] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python foo : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python class : keyword.control.flow.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python [] : invalid.illegal.decorator.python, meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python foo : entity.name.function.decorator.python, meta.function.decorator.python, source.python -. : entity.name.function.decorator.python, meta.function.decorator.python, source.python +. : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python ok : entity.name.function.decorator.python, meta.function.decorator.python, source.python : invalid.illegal.decorator.python, meta.function.decorator.python, source.python ''' : invalid.illegal.decorator.python, meta.function.decorator.python, source.python diff --git a/test/functions/decorators7.py b/test/functions/decorators7.py index 19d3f3bd..c604f818 100644 --- a/test/functions/decorators7.py +++ b/test/functions/decorators7.py @@ -16,23 +16,23 @@ def baz(): pass this is testing trailing whitespace after the decorator : comment.line.number-sign.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python DO NOT DELETE TRAILING WHITESTAPCE IN THIS FILE : comment.line.number-sign.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python foo : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python foo : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python : source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python : source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python @@ -40,7 +40,7 @@ def baz(): pass : source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python legal : comment.line.number-sign.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python bar : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/functions/decorators8.py b/test/functions/decorators8.py index f3898789..aeb2454e 100644 --- a/test/functions/decorators8.py +++ b/test/functions/decorators8.py @@ -3,7 +3,7 @@ def foo(): pass -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python deco : entity.name.function.decorator.python, meta.function.decorator.python, source.python ( : meta.function.decorator.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/unicode/unicode1.py b/test/unicode/unicode1.py index 9d853df6..795a2645 100644 --- a/test/unicode/unicode1.py +++ b/test/unicode/unicode1.py @@ -24,7 +24,7 @@ class : meta.class.python, source.python, storage.type.class.python Ń : source.python, string.quoted.docstring.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.docstring.single.python : meta.function.decorator.python, source.python -@ : entity.name.function.decorator.python, meta.function.decorator.python, source.python +@ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python æaœ : entity.name.function.decorator.python, meta.function.decorator.python, source.python : meta.function.python, source.python def : meta.function.python, source.python, storage.type.function.python From 954029739a65d662b6381dae731bea5668907c59 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 4 Oct 2018 17:09:28 -0400 Subject: [PATCH 27/49] Add support for new Python 3.7 attrs/builtins Fixes #151 and #126 --- .gitignore | 2 +- grammars/MagicPython.cson | 10 ++++---- grammars/MagicPython.tmLanguage | 10 ++++---- grammars/src/MagicPython.syntax.yaml | 10 ++++---- test/atom-spec/python-spec.js | 36 ++++++++++++++++++++++++++++ test/builtins/builtins7.py | 8 +++++++ test/expressions/special2.py | 16 +++++++++++++ 7 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 test/builtins/builtins7.py create mode 100644 test/expressions/special2.py diff --git a/.gitignore b/.gitignore index 4377bfda..e17b261b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ node_modules .DS_Store *.cache *.pyc - +package-lock.json diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 71050143..c3f182d4 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1729,7 +1729,7 @@ repository: match: ''' (?x) (?match (?x) (?<!\.) \b( - __import__ | abs | all | any | ascii | bin | callable + __import__ | abs | all | any | ascii | bin | breakpoint | callable | chr | compile | copyright | credits | delattr | dir | divmod | enumerate | eval | exec | exit | filter | format | getattr | globals | hasattr | hash | help | hex | id | input @@ -2798,10 +2798,10 @@ indirectly through syntactic constructs (?x) \b( __(?: - all | bases | builtins | class | code | debug | defaults | dict - | doc | file | func | kwdefaults | members - | metaclass | methods | module | mro | name - | qualname | self | signature | slots | subclasses + all | bases | builtins | class | class_getitem | code | debug + | defaults | dict | doc | file | func | kwdefaults | members + | metaclass | methods | module | mro | mro_entries | name + | qualname | post_init | self | signature | slots | subclasses | version | weakref | wrapped | annotations | classcell | spec | path | package | future | traceback )__ diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 536bd32e..2be48ca1 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -1294,7 +1294,7 @@ repository: match: | (?x) (? Date: Thu, 4 Oct 2018 17:59:09 -0400 Subject: [PATCH 28/49] Prepare 1.1.0 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fea33e6..c4f12063 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MagicPython", - "version": "1.0.12", + "version": "1.1.0", "engines": { "atom": "*", "node": "*", From da6fa0793e2c85d3bf7709ff1d4f65ccf468db11 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 4 Oct 2018 18:11:18 -0400 Subject: [PATCH 29/49] package.json: deps -> dev-deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c4f12063..8c2b61e8 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ } ] }, - "dependencies": { + "devDependencies": { "oniguruma": "^7.0.0", "syntaxdev": "0.0.16" } From 1417e0873fafdaa3d6b1d40ec8ad863bfc23661e Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 5 Oct 2018 10:21:23 -0400 Subject: [PATCH 30/49] Prepare 1.1.1 release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c2b61e8..f872035a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MagicPython", - "version": "1.1.0", + "version": "1.1.1", "engines": { "atom": "*", "node": "*", From ea55e27ee3813c146cfeffc05a1617ffffc7bf05 Mon Sep 17 00:00:00 2001 From: fjeicam Date: Sun, 21 Oct 2018 18:14:48 +0200 Subject: [PATCH 31/49] Fix comment (#167) This PR adds missing part of a word in the comment. --- grammars/src/MagicPython.syntax.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 2be48ca1..be23b90a 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -736,7 +736,7 @@ repository: - include: '#impossible' f-expression: - comment: All valid Python expressions, except comments and line cont + comment: All valid Python expressions, except comments and line continuation patterns: - include: '#expression-bare' - include: '#member-access' From 8ff35b3e5fcde471fae62a57ea1ae1c7cd34c9fc Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Sun, 21 Oct 2018 12:16:47 -0400 Subject: [PATCH 32/49] Scope `from`, `import`, and `as` the same way in imports. (#165) Use `keyword.control.import.python` scope for `from`, `import`, and `as` keywords when they appear as part of an import statement. Use `keyword.control.flow.python` scope for `from` and `as` if they appear elsewhere. Issue: #123. --- grammars/MagicPython.cson | 64 +++++-- grammars/MagicPython.tmLanguage | 82 +++++++-- grammars/src/MagicPython.syntax.yaml | 46 +++-- test/atom-spec/python-spec.js | 261 ++++++++++++++++++++++++++- test/expressions/keywords.py | 4 +- test/statements/from1.py | 33 ++++ test/statements/import1.py | 4 +- test/statements/import6.py | 2 +- test/statements/import7.py | 2 +- test/statements/import8.py | 48 +++++ test/statements/import9.py | 67 +++++++ 11 files changed, 557 insertions(+), 56 deletions(-) create mode 100644 test/statements/from1.py create mode 100644 test/statements/import8.py create mode 100644 test/statements/import9.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index c3f182d4..d04da619 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -259,12 +259,32 @@ repository: name: "storage.type.function.python" match: "\\b((async\\s+)?\\s*def)\\b" } + { + name: "keyword.control.flow.python" + comment: ''' + if `as` is eventually followed by `:` or line continuation + it's probably control flow like: + with foo as bar, \\ + Foo as Bar: + try: + do_stuff() + except Exception as e: + pass + + ''' + match: "\\b(?match \b((async\s+)?\s*def)\b + + name + keyword.control.flow.python + comment + if `as` is eventually followed by `:` or line continuation +it's probably control flow like: + with foo as bar, \ + Foo as Bar: + try: + do_stuff() + except Exception as e: + pass + + match + \b(?<!\.)as\b(?=.*[:\\]) + + + name + keyword.control.import.python + comment + other legal use of `as` is in an import + match + \b(?<!\.)as\b + name keyword.control.flow.python match (?x) \b(?<!\.)( - as | async | continue | del | assert | break | finally | for + async | continue | del | assert | break | finally | for | from | elif | else | if | except | pass | raise | return | try | while | with )\b @@ -1531,39 +1555,63 @@ import comment - Import statements + Import statements used to correctly mark `from`, `import`, and `as` patterns - match - (?x) - \s* \b(from) \s*(\.+)\s* (import\b)? - - captures + begin + \b(?<!\.)(from)\b(?=.+import) + end + $|(?=import) + beginCaptures 1 name keyword.control.import.python - 2 + + patterns + name punctuation.separator.period.python + match + \.+ - 3 + + include + #expression + + + + + begin + \b(?<!\.)(import)\b + end + $ + beginCaptures + + 1 name keyword.control.import.python - - - name - keyword.control.import.python - match - \b(?<!\.)import\b + patterns + + + name + keyword.control.import.python + match + \b(?<!\.)as\b + + + include + #expression + + @@ -2836,13 +2884,13 @@ indirectly through syntactic constructs (?x) \b(?: ( - and | as | assert | async | await | break | class | continue | def + and | assert | async | await | break | class | continue | def | del | elif | else | except | finally | for | from | global | if | in | is | (?<=\.)lambda | lambda(?=\s*[\.=]) | nonlocal | not | or | pass | raise | return | try | while | with | yield ) | ( - import + as | import ) )\b diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index be23b90a..baf73a1c 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -359,11 +359,25 @@ repository: patterns: - name: storage.type.function.python match: \b((async\s+)?\s*def)\b + - name: keyword.control.flow.python + comment: | + if `as` is eventually followed by `:` or line continuation + it's probably control flow like: + with foo as bar, \ + Foo as Bar: + try: + do_stuff() + except Exception as e: + pass + match: \b(? Date: Fri, 15 Mar 2019 00:05:00 -0400 Subject: [PATCH 33/49] Upgrade syntaxdev to 0.1.0 --- grammars/MagicPython.cson | 2 +- grammars/MagicPython.tmLanguage | 2 +- grammars/src/comment.inc.syntax.yaml | 17 +- grammars/src/pyfstring.inc.syntax.yaml | 327 ++++++++++----------- grammars/src/pystring.inc.syntax.yaml | 217 +++++++------- grammars/src/regexp-common.inc.syntax.yaml | 221 +++++++------- grammars/src/regexp.inc.syntax.yaml | 313 ++++++++++---------- grammars/src/regexp.wrapper.syntax.yaml | 29 +- package.json | 5 +- 9 files changed, 564 insertions(+), 569 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index d04da619..8fe447f9 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -894,7 +894,7 @@ repository: } ] "f-expression": - comment: "All valid Python expressions, except comments and line cont" + comment: "All valid Python expressions, except comments and line continuation" patterns: [ { include: "#expression-bare" diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 7a833786..4fa597d1 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1375,7 +1375,7 @@ it's probably control flow like: f-expression comment - All valid Python expressions, except comments and line cont + All valid Python expressions, except comments and line continuation patterns diff --git a/grammars/src/comment.inc.syntax.yaml b/grammars/src/comment.inc.syntax.yaml index 8555e562..d6a791f2 100644 --- a/grammars/src/comment.inc.syntax.yaml +++ b/grammars/src/comment.inc.syntax.yaml @@ -1,11 +1,10 @@ --- -repository: - comments${suffix}: - name: comment.line.number-sign.python - begin: (\#) - beginCaptures: - '1': {name: punctuation.definition.comment.python} - end: ($${marker}) - patterns: - - include: '#codetags' +comments${suffix}: + name: comment.line.number-sign.python + begin: (\#) + beginCaptures: + '1': {name: punctuation.definition.comment.python} + end: ($${marker}) + patterns: + - include: '#codetags' ... diff --git a/grammars/src/pyfstring.inc.syntax.yaml b/grammars/src/pyfstring.inc.syntax.yaml index 4daed8b4..993707cf 100644 --- a/grammars/src/pyfstring.inc.syntax.yaml +++ b/grammars/src/pyfstring.inc.syntax.yaml @@ -1,177 +1,176 @@ --- -repository: - fstring-fnorm-quoted-${line}-line: - name: meta.fstring.python - begin: (\b[fF])([bBuU])?(${marker}) - end: (\3)${guard} - beginCaptures: - # "storage.type.string.python" class should be the first one, - # because Atom, VSCode and GitHub don't understand scopes - # separated by whitespace, and simply use the first one - # of them. Highlighting 'f' as 'storage.type' is more - # important for us than having other scopes. - '1': {name: storage.type.string.python - string.quoted.${line}.python - string.interpolated.python} - '2': {name: invalid.illegal.prefix.python} - '3': {name: string.quoted.${line}.python - string.interpolated.python - punctuation.definition.string.begin.python} - endCaptures: - '1': {name: string.quoted.${line}.python - string.interpolated.python - punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#fstring-guts' - - include: '#fstring-illegal-${line}-brace' - - include: '#fstring-${line}-brace' - - include: '#fstring-${line}-core' +fstring-fnorm-quoted-${line}-line: + name: meta.fstring.python + begin: (\b[fF])([bBuU])?(${marker}) + end: (\3)${guard} + beginCaptures: + # "storage.type.string.python" class should be the first one, + # because Atom, VSCode and GitHub don't understand scopes + # separated by whitespace, and simply use the first one + # of them. Highlighting 'f' as 'storage.type' is more + # important for us than having other scopes. + '1': {name: storage.type.string.python + string.quoted.${line}.python + string.interpolated.python} + '2': {name: invalid.illegal.prefix.python} + '3': {name: string.quoted.${line}.python + string.interpolated.python + punctuation.definition.string.begin.python} + endCaptures: + '1': {name: string.quoted.${line}.python + string.interpolated.python + punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#fstring-guts' + - include: '#fstring-illegal-${line}-brace' + - include: '#fstring-${line}-brace' + - include: '#fstring-${line}-core' - fstring-normf-quoted-${line}-line: - name: meta.fstring.python - begin: (\b[bBuU])([fF])(${marker}) - end: (\3)${guard} - beginCaptures: - '1': {name: invalid.illegal.prefix.python} - '2': {name: storage.type.string.python - string.quoted.${line}.python - string.interpolated.python} - '3': {name: string.quoted.${line}.python - punctuation.definition.string.begin.python} - endCaptures: - '1': {name: string.quoted.${line}.python - string.interpolated.python - punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#fstring-guts' - - include: '#fstring-illegal-${line}-brace' - - include: '#fstring-${line}-brace' - - include: '#fstring-${line}-core' +fstring-normf-quoted-${line}-line: + name: meta.fstring.python + begin: (\b[bBuU])([fF])(${marker}) + end: (\3)${guard} + beginCaptures: + '1': {name: invalid.illegal.prefix.python} + '2': {name: storage.type.string.python + string.quoted.${line}.python + string.interpolated.python} + '3': {name: string.quoted.${line}.python + punctuation.definition.string.begin.python} + endCaptures: + '1': {name: string.quoted.${line}.python + string.interpolated.python + punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#fstring-guts' + - include: '#fstring-illegal-${line}-brace' + - include: '#fstring-${line}-brace' + - include: '#fstring-${line}-core' - fstring-raw-quoted-${line}-line: - name: meta.fstring.python - begin: (\b(?:[R][fF]|[fF][R]))(${marker}) - end: (\2)${guard} - beginCaptures: - '1': {name: storage.type.string.python - string.quoted.raw.${line}.python - string.interpolated.python} - '2': {name: string.quoted.raw.${line}.python - punctuation.definition.string.begin.python} - endCaptures: - '1': {name: string.quoted.raw.${line}.python - string.interpolated.python - punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#fstring-raw-guts' - - include: '#fstring-illegal-${line}-brace' - - include: '#fstring-${line}-brace' - - include: '#fstring-raw-${line}-core' +fstring-raw-quoted-${line}-line: + name: meta.fstring.python + begin: (\b(?:[R][fF]|[fF][R]))(${marker}) + end: (\2)${guard} + beginCaptures: + '1': {name: storage.type.string.python + string.quoted.raw.${line}.python + string.interpolated.python} + '2': {name: string.quoted.raw.${line}.python + punctuation.definition.string.begin.python} + endCaptures: + '1': {name: string.quoted.raw.${line}.python + string.interpolated.python + punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#fstring-raw-guts' + - include: '#fstring-illegal-${line}-brace' + - include: '#fstring-${line}-brace' + - include: '#fstring-raw-${line}-core' - fstring-${line}-core: - name: string.quoted.${line}.python string.interpolated.python - match: | - (?x) - (.+?) - ( - (?# .* and .*? in multi-line match need special handling of - newlines otherwise SublimeText and Atom will match slightly - differently. +fstring-${line}-core: + name: string.quoted.${line}.python string.interpolated.python + match: | + (?x) + (.+?) + ( + (?# .* and .*? in multi-line match need special handling of + newlines otherwise SublimeText and Atom will match slightly + differently. - The guard for newlines has to be separate from the - lookahead because of special $ matching rule.) - ($\n?) - | - (?=[\\\}\{]|${marker}${guard}) - ) - (?# due to how multiline regexps are matched we need a special case - for matching a newline character) - | \n + The guard for newlines has to be separate from the + lookahead because of special $ matching rule.) + ($\n?) + | + (?=[\\\}\{]|${marker}${guard}) + ) + (?# due to how multiline regexps are matched we need a special case + for matching a newline character) + | \n - fstring-raw-${line}-core: - name: string.quoted.raw.${line}.python string.interpolated.python - match: | - (?x) - (.+?) - ( - (?# .* and .*? in multi-line match need special handling of - newlines otherwise SublimeText and Atom will match slightly - differently. +fstring-raw-${line}-core: + name: string.quoted.raw.${line}.python string.interpolated.python + match: | + (?x) + (.+?) + ( + (?# .* and .*? in multi-line match need special handling of + newlines otherwise SublimeText and Atom will match slightly + differently. - The guard for newlines has to be separate from the - lookahead because of special $ matching rule.) - ($\n?) - | - (?=[\\\}\{]|${marker}${guard}) - ) - (?# due to how multiline regexps are matched we need a special case - for matching a newline character) - | \n + The guard for newlines has to be separate from the + lookahead because of special $ matching rule.) + ($\n?) + | + (?=[\\\}\{]|${marker}${guard}) + ) + (?# due to how multiline regexps are matched we need a special case + for matching a newline character) + | \n - fstring-${line}-brace: - comment: value interpolation using { ... } - begin: (\{) - end: | - (?x) - (\})${fguard} - beginCaptures: - '1': {name: constant.character.format.placeholder.other.python} - endCaptures: - '1': {name: constant.character.format.placeholder.other.python} - patterns: - - include: '#fstring-terminator-${line}' - - include: '#f-expression' +fstring-${line}-brace: + comment: value interpolation using { ... } + begin: (\{) + end: | + (?x) + (\})${fguard} + beginCaptures: + '1': {name: constant.character.format.placeholder.other.python} + endCaptures: + '1': {name: constant.character.format.placeholder.other.python} + patterns: + - include: '#fstring-terminator-${line}' + - include: '#f-expression' - fstring-terminator-${line}: - patterns: - - name: storage.type.format.python - match: (![rsa])(?=}) - - match: | - (?x) - (![rsa])? - ( : \w? [<>=^]? [-+ ]? \#? - \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )(?=}) - captures: - # We use this awkward scope name instead of perhaps more - # elegant "support.other.format.python" because it appears - # that by default it gives a better visual result in various - # systems (e.g. GitHub). This is due to the fact that - # "storage.type..." is more likely to have special - # highlighting in any given color scheme than - # "support.other..." - # - '1': {name: storage.type.format.python} - '2': {name: storage.type.format.python} +fstring-terminator-${line}: + patterns: + - name: storage.type.format.python + match: (![rsa])(?=}) + - match: | + (?x) + (![rsa])? + ( : \w? [<>=^]? [-+ ]? \#? + \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )(?=}) + captures: + # We use this awkward scope name instead of perhaps more + # elegant "support.other.format.python" because it appears + # that by default it gives a better visual result in various + # systems (e.g. GitHub). This is due to the fact that + # "storage.type..." is more likely to have special + # highlighting in any given color scheme than + # "support.other..." + # + '1': {name: storage.type.format.python} + '2': {name: storage.type.format.python} - - include: '#fstring-terminator-${line}-tail' + - include: '#fstring-terminator-${line}-tail' - fstring-terminator-${line}-tail: - begin: (![rsa])?(:)(?=.*?{) - end: (?=})${fguard} - beginCaptures: - '1': {name: storage.type.format.python} - '2': {name: storage.type.format.python} +fstring-terminator-${line}-tail: + begin: (![rsa])?(:)(?=.*?{) + end: (?=})${fguard} + beginCaptures: + '1': {name: storage.type.format.python} + '2': {name: storage.type.format.python} - patterns: - - include: '#fstring-illegal-${line}-brace' - - include: '#fstring-${line}-brace' - - name: storage.type.format.python - match: ([bcdeEfFgGnosxX%])(?=}) - - name: storage.type.format.python - match: (\.\d+) - - name: storage.type.format.python - match: (,) - - name: storage.type.format.python - match: (\d+) - - name: storage.type.format.python - match: (\#) - - name: storage.type.format.python - match: ([-+ ]) - - name: storage.type.format.python - match: ([<>=^]) - - name: storage.type.format.python - match: (\w) + patterns: + - include: '#fstring-illegal-${line}-brace' + - include: '#fstring-${line}-brace' + - name: storage.type.format.python + match: ([bcdeEfFgGnosxX%])(?=}) + - name: storage.type.format.python + match: (\.\d+) + - name: storage.type.format.python + match: (,) + - name: storage.type.format.python + match: (\d+) + - name: storage.type.format.python + match: (\#) + - name: storage.type.format.python + match: ([-+ ]) + - name: storage.type.format.python + match: ([<>=^]) + - name: storage.type.format.python + match: (\w) ... diff --git a/grammars/src/pystring.inc.syntax.yaml b/grammars/src/pystring.inc.syntax.yaml index 8bd53282..5127ae72 100644 --- a/grammars/src/pystring.inc.syntax.yaml +++ b/grammars/src/pystring.inc.syntax.yaml @@ -1,118 +1,117 @@ --- -repository: - string-raw-quoted-${line}-line: - name: string.quoted.raw.${line}.python - begin: \b(([uU]R)|(R))(${marker}) - end: (\4)${guard} - beginCaptures: - '2': {name: invalid.deprecated.prefix.python} - '3': {name: storage.type.string.python} - '4': {name: punctuation.definition.string.begin.python} - endCaptures: - '1': {name: punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#string-${line}-bad-brace1-formatting-raw' - - include: '#string-${line}-bad-brace2-formatting-raw' - - include: '#string-raw-guts' +string-raw-quoted-${line}-line: + name: string.quoted.raw.${line}.python + begin: \b(([uU]R)|(R))(${marker}) + end: (\4)${guard} + beginCaptures: + '2': {name: invalid.deprecated.prefix.python} + '3': {name: storage.type.string.python} + '4': {name: punctuation.definition.string.begin.python} + endCaptures: + '1': {name: punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#string-${line}-bad-brace1-formatting-raw' + - include: '#string-${line}-bad-brace2-formatting-raw' + - include: '#string-raw-guts' - string-bin-quoted-${line}-line: - name: string.quoted.binary.${line}.python - begin: (\b[bB])(${marker}) - end: (\2)${guard} - beginCaptures: - '1': {name: storage.type.string.python} - '2': {name: punctuation.definition.string.begin.python} - endCaptures: - '1': {name: punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#string-entity' +string-bin-quoted-${line}-line: + name: string.quoted.binary.${line}.python + begin: (\b[bB])(${marker}) + end: (\2)${guard} + beginCaptures: + '1': {name: storage.type.string.python} + '2': {name: punctuation.definition.string.begin.python} + endCaptures: + '1': {name: punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#string-entity' - string-raw-bin-quoted-${line}-line: - name: string.quoted.raw.binary.${line}.python - begin: (\b(?:R[bB]|[bB]R))(${marker}) - end: (\2)${guard} - beginCaptures: - '1': {name: storage.type.string.python} - '2': {name: punctuation.definition.string.begin.python} - endCaptures: - '1': {name: punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#string-raw-bin-guts' +string-raw-bin-quoted-${line}-line: + name: string.quoted.raw.binary.${line}.python + begin: (\b(?:R[bB]|[bB]R))(${marker}) + end: (\2)${guard} + beginCaptures: + '1': {name: storage.type.string.python} + '2': {name: punctuation.definition.string.begin.python} + endCaptures: + '1': {name: punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#string-raw-bin-guts' - string-quoted-${line}-line: - name: string.quoted.${line}.python - begin: (?:\b([rR])(?=[uU]))?([uU])?(${marker}) - end: (\3)${guard} - beginCaptures: - '1': {name: invalid.illegal.prefix.python} - '2': {name: storage.type.string.python} - '3': {name: punctuation.definition.string.begin.python} - endCaptures: - '1': {name: punctuation.definition.string.end.python} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#string-${line}-bad-brace1-formatting-unicode' - - include: '#string-${line}-bad-brace2-formatting-unicode' - - include: '#string-unicode-guts' +string-quoted-${line}-line: + name: string.quoted.${line}.python + begin: (?:\b([rR])(?=[uU]))?([uU])?(${marker}) + end: (\3)${guard} + beginCaptures: + '1': {name: invalid.illegal.prefix.python} + '2': {name: storage.type.string.python} + '3': {name: punctuation.definition.string.begin.python} + endCaptures: + '1': {name: punctuation.definition.string.end.python} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#string-${line}-bad-brace1-formatting-unicode' + - include: '#string-${line}-bad-brace2-formatting-unicode' + - include: '#string-unicode-guts' - string-${line}-bad-brace1-formatting-unicode: - comment: template using {% ... %} - begin: | - (?x) - (?= \{% - ( .*? (?!${marker}${guard}) ) - %\} - ) - end: (?=${marker}${guard}) - patterns: - - include: '#escape-sequence-unicode' - - include: '#escape-sequence' - - include: '#string-line-continuation' +string-${line}-bad-brace1-formatting-unicode: + comment: template using {% ... %} + begin: | + (?x) + (?= \{% + ( .*? (?!${marker}${guard}) ) + %\} + ) + end: (?=${marker}${guard}) + patterns: + - include: '#escape-sequence-unicode' + - include: '#escape-sequence' + - include: '#string-line-continuation' - string-${line}-bad-brace1-formatting-raw: - comment: template using {% ... %} - begin: | - (?x) - (?= \{% - ( .*? (?!${marker}${guard}) ) - %\} - ) - end: (?=${marker}${guard}) - patterns: - - include: '#string-consume-escape' +string-${line}-bad-brace1-formatting-raw: + comment: template using {% ... %} + begin: | + (?x) + (?= \{% + ( .*? (?!${marker}${guard}) ) + %\} + ) + end: (?=${marker}${guard}) + patterns: + - include: '#string-consume-escape' - string-${line}-bad-brace2-formatting-unicode: - comment: odd format or format-like syntax - begin: | - (?x) - (?!\{\{) - (?= \{ ( - \w*? (?!${marker}${guard}) [^!:\.\[}\w] - ) - .*?(?!${marker}${guard}) - \} - ) - end: (?=${marker}${guard}) - patterns: - - include: '#escape-sequence-unicode' - - include: '#string-entity' +string-${line}-bad-brace2-formatting-unicode: + comment: odd format or format-like syntax + begin: | + (?x) + (?!\{\{) + (?= \{ ( + \w*? (?!${marker}${guard}) [^!:\.\[}\w] + ) + .*?(?!${marker}${guard}) + \} + ) + end: (?=${marker}${guard}) + patterns: + - include: '#escape-sequence-unicode' + - include: '#string-entity' - string-${line}-bad-brace2-formatting-raw: - comment: odd format or format-like syntax - begin: | - (?x) - (?!\{\{) - (?= \{ ( - \w*? (?!${marker}${guard}) [^!:\.\[}\w] - ) - .*?(?!${marker}${guard}) - \} - ) - end: (?=${marker}${guard}) - patterns: - - include: '#string-consume-escape' - - include: '#string-formatting' +string-${line}-bad-brace2-formatting-raw: + comment: odd format or format-like syntax + begin: | + (?x) + (?!\{\{) + (?= \{ ( + \w*? (?!${marker}${guard}) [^!:\.\[}\w] + ) + .*?(?!${marker}${guard}) + \} + ) + end: (?=${marker}${guard}) + patterns: + - include: '#string-consume-escape' + - include: '#string-formatting' ... diff --git a/grammars/src/regexp-common.inc.syntax.yaml b/grammars/src/regexp-common.inc.syntax.yaml index e367af87..828a630b 100644 --- a/grammars/src/regexp-common.inc.syntax.yaml +++ b/grammars/src/regexp-common.inc.syntax.yaml @@ -1,128 +1,127 @@ --- -repository: - regexp-base-expression: - patterns: - - include: '#regexp-quantifier' - - include: '#regexp-base-common' +regexp-base-expression: + patterns: + - include: '#regexp-quantifier' + - include: '#regexp-base-common' - fregexp-base-expression: - patterns: - - include: '#fregexp-quantifier' - - include: '#fstring-formatting-braces' - - match: \{.*?\} - - include: '#regexp-base-common' +fregexp-base-expression: + patterns: + - include: '#fregexp-quantifier' + - include: '#fstring-formatting-braces' + - match: \{.*?\} + - include: '#regexp-base-common' - 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-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: - - name: support.other.match.any.regexp - match: \. - - name: support.other.match.begin.regexp - match: \^ - - name: support.other.match.end.regexp - match: \$ - - name: keyword.operator.quantifier.regexp - match: '[+*?]\??' - - name: keyword.operator.disjunction.regexp - match: \| - - include: '#regexp-escape-sequence' +regexp-base-common: + patterns: + - name: support.other.match.any.regexp + match: \. + - name: support.other.match.begin.regexp + match: \^ + - name: support.other.match.end.regexp + match: \$ + - name: keyword.operator.quantifier.regexp + match: '[+*?]\??' + - name: keyword.operator.disjunction.regexp + match: \| + - include: '#regexp-escape-sequence' - regexp-quantifier: - name: keyword.operator.quantifier.regexp - match: | - (?x) - \{( - \d+ | \d+,(\d+)? | ,\d+ - )\} +regexp-quantifier: + name: keyword.operator.quantifier.regexp + match: | + (?x) + \{( + \d+ | \d+,(\d+)? | ,\d+ + )\} - fregexp-quantifier: - name: keyword.operator.quantifier.regexp - match: | - (?x) - \{\{( - \d+ | \d+,(\d+)? | ,\d+ - )\}\} +fregexp-quantifier: + name: keyword.operator.quantifier.regexp + match: | + (?x) + \{\{( + \d+ | \d+,(\d+)? | ,\d+ + )\}\} - regexp-backreference-number: - name: meta.backreference.regexp - match: (\\[1-9]\d?) - captures: - '1': {name: entity.name.tag.backreference.regexp} +regexp-backreference-number: + name: meta.backreference.regexp + match: (\\[1-9]\d?) + captures: + '1': {name: entity.name.tag.backreference.regexp} - regexp-backreference: - name: meta.backreference.named.regexp - match: | - (?x) - (\() (\?P= \w+(?:\s+[[:alnum:]]+)?) (\)) - captures: - '1': {name: punctuation.parenthesis.backreference.named.begin.regexp - support.other.parenthesis.regexp} - '2': {name: entity.name.tag.named.backreference.regexp} - '3': {name: punctuation.parenthesis.backreference.named.end.regexp - support.other.parenthesis.regexp} +regexp-backreference: + name: meta.backreference.named.regexp + match: | + (?x) + (\() (\?P= \w+(?:\s+[[:alnum:]]+)?) (\)) + captures: + '1': {name: punctuation.parenthesis.backreference.named.begin.regexp + support.other.parenthesis.regexp} + '2': {name: entity.name.tag.named.backreference.regexp} + '3': {name: punctuation.parenthesis.backreference.named.end.regexp + support.other.parenthesis.regexp} - regexp-flags: - name: storage.modifier.flag.regexp - match: \(\?[aiLmsux]+\) +regexp-flags: + name: storage.modifier.flag.regexp + match: \(\?[aiLmsux]+\) - regexp-escape-special: - name: support.other.escape.special.regexp - match: \\([AbBdDsSwWZ]) +regexp-escape-special: + name: support.other.escape.special.regexp + match: \\([AbBdDsSwWZ]) - regexp-escape-character: - name: constant.character.escape.regexp - match: | - (?x) - \\ ( - x[0-9A-Fa-f]{2} - | 0[0-7]{1,2} - | [0-7]{3} - ) +regexp-escape-character: + name: constant.character.escape.regexp + match: | + (?x) + \\ ( + x[0-9A-Fa-f]{2} + | 0[0-7]{1,2} + | [0-7]{3} + ) - regexp-escape-unicode: - name: constant.character.unicode.regexp - match: | - (?x) - \\ ( - u[0-9A-Fa-f]{4} - | U[0-9A-Fa-f]{8} - ) +regexp-escape-unicode: + name: constant.character.unicode.regexp + match: | + (?x) + \\ ( + u[0-9A-Fa-f]{4} + | U[0-9A-Fa-f]{8} + ) - regexp-escape-catchall: - name: constant.character.escape.regexp - match: \\(.|\n) +regexp-escape-catchall: + name: constant.character.escape.regexp + match: \\(.|\n) - regexp-escape-sequence: - patterns: - - include: '#regexp-escape-special' - - include: '#regexp-escape-character' - - include: '#regexp-escape-unicode' - - include: '#regexp-backreference-number' - - include: '#regexp-escape-catchall' +regexp-escape-sequence: + patterns: + - include: '#regexp-escape-special' + - include: '#regexp-escape-character' + - include: '#regexp-escape-unicode' + - include: '#regexp-backreference-number' + - include: '#regexp-escape-catchall' - regexp-charecter-set-escapes: - patterns: - - name: constant.character.escape.regexp - match: \\[abfnrtv\\] - - include: '#regexp-escape-special' - - name: constant.character.escape.regexp - match: \\([0-7]{1,3}) - - include: '#regexp-escape-character' - - include: '#regexp-escape-unicode' - - include: '#regexp-escape-catchall' +regexp-charecter-set-escapes: + patterns: + - name: constant.character.escape.regexp + match: \\[abfnrtv\\] + - include: '#regexp-escape-special' + - name: constant.character.escape.regexp + match: \\([0-7]{1,3}) + - include: '#regexp-escape-character' + - include: '#regexp-escape-unicode' + - include: '#regexp-escape-catchall' - codetags: - match: (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) - captures: - '1': {name: keyword.codetag.notation.python} +codetags: + match: (?:\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\b) + captures: + '1': {name: keyword.codetag.notation.python} ... diff --git a/grammars/src/regexp.inc.syntax.yaml b/grammars/src/regexp.inc.syntax.yaml index ea55ff55..aac9e286 100644 --- a/grammars/src/regexp.inc.syntax.yaml +++ b/grammars/src/regexp.inc.syntax.yaml @@ -1,170 +1,169 @@ --- -repository: - ${prefix}${basename}-expression: - patterns: - - include: '#${basename}-base-expression' - - include: '#${prefix}regexp-character-set' - - include: '#${prefix}regexp-comments' - - include: '#regexp-flags' - - include: '#${prefix}regexp-named-group' - - include: '#regexp-backreference' - - include: '#${prefix}${basename}-lookahead' - - include: '#${prefix}${basename}-lookahead-negative' - - include: '#${prefix}${basename}-lookbehind' - - include: '#${prefix}${basename}-lookbehind-negative' - - include: '#${prefix}${basename}-conditional' - - include: '#${prefix}${basename}-parentheses-non-capturing' - - include: '#${prefix}${basename}-parentheses' - ${nested} +${prefix}${basename}-expression: + patterns: + - include: '#${basename}-base-expression' + - include: '#${prefix}regexp-character-set' + - include: '#${prefix}regexp-comments' + - include: '#regexp-flags' + - include: '#${prefix}regexp-named-group' + - include: '#regexp-backreference' + - include: '#${prefix}${basename}-lookahead' + - include: '#${prefix}${basename}-lookahead-negative' + - include: '#${prefix}${basename}-lookbehind' + - include: '#${prefix}${basename}-lookbehind-negative' + - include: '#${prefix}${basename}-conditional' + - include: '#${prefix}${basename}-parentheses-non-capturing' + - include: '#${prefix}${basename}-parentheses' + ${nested} - ${prefix}regexp-character-set: - patterns: - - match: | - (?x) - \[ \^? \] (?! .*?\]) - - name: meta.character.set.regexp - begin: (\[)(\^)?(\])? - end: (\]${marker})${guard} - beginCaptures: - '1': {name: constant.other.set.regexp - punctuation.character.set.begin.regexp} - '2': {name: keyword.operator.negation.regexp} - '3': {name: constant.character.set.regexp} - endCaptures: - '1': {name: constant.other.set.regexp - punctuation.character.set.end.regexp} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#regexp-charecter-set-escapes' - - name: constant.character.set.regexp - match: '[^\n]' +${prefix}regexp-character-set: + patterns: + - match: | + (?x) + \[ \^? \] (?! .*?\]) + - name: meta.character.set.regexp + begin: (\[)(\^)?(\])? + end: (\]${marker})${guard} + beginCaptures: + '1': {name: constant.other.set.regexp + punctuation.character.set.begin.regexp} + '2': {name: keyword.operator.negation.regexp} + '3': {name: constant.character.set.regexp} + endCaptures: + '1': {name: constant.other.set.regexp + punctuation.character.set.end.regexp} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#regexp-charecter-set-escapes' + - name: constant.character.set.regexp + match: '[^\n]' - ${prefix}${basename}-named-group: - name: meta.named.regexp - begin: | - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - end: (\)${marker})${guard} - beginCaptures: - '1': {name: punctuation.parenthesis.named.begin.regexp - support.other.parenthesis.regexp} - '2': {name: entity.name.tag.named.group.regexp} - endCaptures: - '1': {name: punctuation.parenthesis.named.end.regexp - support.other.parenthesis.regexp} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#${prefix}${basename}-expression' - ${nested} +${prefix}${basename}-named-group: + name: meta.named.regexp + begin: | + (?x) + (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) + end: (\)${marker})${guard} + beginCaptures: + '1': {name: punctuation.parenthesis.named.begin.regexp + support.other.parenthesis.regexp} + '2': {name: entity.name.tag.named.group.regexp} + endCaptures: + '1': {name: punctuation.parenthesis.named.end.regexp + support.other.parenthesis.regexp} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#${prefix}${basename}-expression' + ${nested} - ${prefix}regexp-comments: - name: comment.regexp - begin: \(\?# - end: (\)${marker})${guard} - beginCaptures: - '0': {name: punctuation.comment.begin.regexp} - endCaptures: - '1': {name: punctuation.comment.end.regexp} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#codetags' +${prefix}regexp-comments: + name: comment.regexp + begin: \(\?# + end: (\)${marker})${guard} + beginCaptures: + '0': {name: punctuation.comment.begin.regexp} + endCaptures: + '1': {name: punctuation.comment.end.regexp} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#codetags' - ${prefix}${basename}-lookahead: - begin: '(\()\?=' - end: (\)${marker})${guard} - beginCaptures: - '0': {name: keyword.operator.lookahead.regexp} - '1': {name: punctuation.parenthesis.lookahead.begin.regexp} - endCaptures: - '1': {name: punctuation.parenthesis.lookahead.end.regexp - keyword.operator.lookahead.regexp} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#${prefix}${basename}-expression' - ${nested} +${prefix}${basename}-lookahead: + begin: '(\()\?=' + end: (\)${marker})${guard} + beginCaptures: + '0': {name: keyword.operator.lookahead.regexp} + '1': {name: punctuation.parenthesis.lookahead.begin.regexp} + endCaptures: + '1': {name: punctuation.parenthesis.lookahead.end.regexp + keyword.operator.lookahead.regexp} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#${prefix}${basename}-expression' + ${nested} - ${prefix}${basename}-lookahead-negative: - begin: '(\()\?!' - end: (\)${marker})${guard} - beginCaptures: - '0': {name: keyword.operator.lookahead.negative.regexp} - '1': {name: punctuation.parenthesis.lookahead.begin.regexp} - endCaptures: - '1': {name: punctuation.parenthesis.lookahead.end.regexp - keyword.operator.lookahead.negative.regexp} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#${prefix}${basename}-expression' - ${nested} +${prefix}${basename}-lookahead-negative: + begin: '(\()\?!' + end: (\)${marker})${guard} + beginCaptures: + '0': {name: keyword.operator.lookahead.negative.regexp} + '1': {name: punctuation.parenthesis.lookahead.begin.regexp} + endCaptures: + '1': {name: punctuation.parenthesis.lookahead.end.regexp + keyword.operator.lookahead.negative.regexp} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#${prefix}${basename}-expression' + ${nested} - ${prefix}${basename}-lookbehind: - begin: '(\()\?<=' - end: (\)${marker})${guard} - beginCaptures: - '0': {name: keyword.operator.lookbehind.regexp} - '1': {name: punctuation.parenthesis.lookbehind.begin.regexp} - endCaptures: - '1': {name: punctuation.parenthesis.lookbehind.end.regexp - keyword.operator.lookbehind.regexp} - '2': {name: invalid.illegal.newline.python} - patterns: - - include: '#${prefix}${basename}-expression' - ${nested} +${prefix}${basename}-lookbehind: + begin: '(\()\?<=' + end: (\)${marker})${guard} + beginCaptures: + '0': {name: keyword.operator.lookbehind.regexp} + '1': {name: punctuation.parenthesis.lookbehind.begin.regexp} + endCaptures: + '1': {name: punctuation.parenthesis.lookbehind.end.regexp + keyword.operator.lookbehind.regexp} + '2': {name: invalid.illegal.newline.python} + patterns: + - include: '#${prefix}${basename}-expression' + ${nested} - ${prefix}${basename}-lookbehind-negative: - begin: '(\()\? Date: Fri, 15 Mar 2019 00:39:40 -0400 Subject: [PATCH 34/49] Fix the 'make devenv' target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f690dbd9..85c19a17 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ test: ci-test atom -t test/atom-spec devenv: - npm install syntaxdev@0.0.16 + npm install --dev release: ./node_modules/.bin/syntaxdev build-plist --in grammars/src/MagicPython.syntax.yaml --out grammars/MagicPython.tmLanguage From c0f8d514bbe6e9d3899f2b002bcd6971aef5e34b Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 17 Oct 2019 17:03:25 -0400 Subject: [PATCH 35/49] Add a `meta.member.access.python` scope. Add a `meta.member.access.python` scope wrapping around any attribute access or method call. Fixes #188. --- grammars/MagicPython.cson | 2 + grammars/MagicPython.tmLanguage | 4 + grammars/src/MagicPython.syntax.yaml | 2 + misc/scopes | 1 + test/atom-spec/python-spec.js | 1036 +++++++++++++------------- test/builtins/builtins3.py | 156 ++-- test/builtins/builtins4.py | 25 +- test/builtins/builtins5.py | 27 +- test/calls/call3.py | 23 +- test/calls/call4.py | 17 +- test/calls/call7.py | 65 +- test/calls/call8.py | 69 +- test/calls/print1.py | 9 +- test/classes/class11.py | 21 +- test/classes/class12.py | 21 +- test/classes/class14.py | 13 +- test/classes/class2.py | 9 +- test/classes/super1.py | 64 +- test/expressions/const1.py | 21 +- test/expressions/expr10.py | 5 +- test/expressions/expr11.py | 15 +- test/expressions/expr15.py | 5 +- test/expressions/expr18.py | 9 +- test/expressions/expr19.py | 39 +- test/expressions/expr7.py | 13 +- test/fstrings/comment4.py | 66 +- test/fstrings/simple2.py | 5 +- test/illegals/illegal1.py | 15 +- test/regexp/python8.py | 321 ++++---- test/statements/import5.py | 5 +- test/strings/bug2.py | 6 +- test/strings/format2.py | 15 +- 32 files changed, 1068 insertions(+), 1036 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 8fe447f9..33f23dad 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -407,6 +407,7 @@ repository: } ] "member-access": + name: "meta.member.access.python" begin: "(\\.)\\s*(?!\\.)" end: ''' (?x) @@ -1167,6 +1168,7 @@ repository: "1": name: "entity.other.inherited-class.python" "member-access-class": + name: "meta.member.access.python" begin: "(\\.)\\s*(?!\\.)" end: "(?<=\\S)(?=\\W)|$" beginCaptures: diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 4fa597d1..ba24d9d1 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -614,6 +614,8 @@ it's probably control flow like: member-access + name + meta.member.access.python begin (\.)\s*(?!\.) end @@ -1796,6 +1798,8 @@ it's probably control flow like: member-access-class + name + meta.member.access.python begin (\.)\s*(?!\.) end diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index baf73a1c..7dbec777 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -433,6 +433,7 @@ repository: match: (?x) \b ([[:alpha:]_]\w*) \b member-access: + name: meta.member.access.python begin: (\.)\s*(?!\.) end: | (?x) @@ -947,6 +948,7 @@ repository: '1': {name: entity.other.inherited-class.python} member-access-class: + name: meta.member.access.python begin: (\.)\s*(?!\.) end: (?<=\S)(?=\W)|$ beginCaptures: diff --git a/misc/scopes b/misc/scopes index a49a024d..17a74a4a 100644 --- a/misc/scopes +++ b/misc/scopes @@ -75,6 +75,7 @@ meta.function.parameters.python meta.function.python meta.item-access.python meta.lambda-function.python +meta.member.access.python meta.named.regexp meta.typehint.comment.python punctuation.character.set.begin.regexp diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 37e92940..d1c7466b 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -166,15 +166,15 @@ describe("Grammar Tests", function() { expect(tokens[1][0].value).toBe("some"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("__bases__"); - expect(tokens[1][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[2][0].value).toBe("some"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); - expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe("__class__"); - expect(tokens[2][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[3][0].value).toBe("assert"); expect(tokens[3][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); expect(tokens[3][1].value).toBe(" "); @@ -186,9 +186,9 @@ describe("Grammar Tests", function() { expect(tokens[5][0].value).toBe("__builtins__"); expect(tokens[5][0].scopes).toEqual(["source.python","support.variable.magic.python"]); expect(tokens[5][1].value).toBe("."); - expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[5][2].value).toBe("len"); - expect(tokens[5][2].scopes).toEqual(["source.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[6][0].value).toBe("print"); expect(tokens[6][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]); expect(tokens[6][1].value).toBe("("); @@ -200,219 +200,219 @@ describe("Grammar Tests", function() { expect(tokens[7][0].value).toBe("some"); expect(tokens[7][0].scopes).toEqual(["source.python"]); expect(tokens[7][1].value).toBe("."); - expect(tokens[7][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[7][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][2].value).toBe("__dict__"); - expect(tokens[7][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[7][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[8][0].value).toBe("some"); expect(tokens[8][0].scopes).toEqual(["source.python"]); expect(tokens[8][1].value).toBe("."); - expect(tokens[8][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[8][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[8][2].value).toBe("__doc__"); - expect(tokens[8][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[8][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[9][0].value).toBe("some"); expect(tokens[9][0].scopes).toEqual(["source.python"]); expect(tokens[9][1].value).toBe("."); - expect(tokens[9][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[9][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[9][2].value).toBe("__file__"); - expect(tokens[9][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[9][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[10][0].value).toBe("some"); expect(tokens[10][0].scopes).toEqual(["source.python"]); expect(tokens[10][1].value).toBe("."); - expect(tokens[10][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[10][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[10][2].value).toBe("__members__"); - expect(tokens[10][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[10][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[11][0].value).toBe("some"); expect(tokens[11][0].scopes).toEqual(["source.python"]); expect(tokens[11][1].value).toBe("."); - expect(tokens[11][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[11][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[11][2].value).toBe("__metaclass__"); - expect(tokens[11][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[11][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[12][0].value).toBe("some"); expect(tokens[12][0].scopes).toEqual(["source.python"]); expect(tokens[12][1].value).toBe("."); - expect(tokens[12][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[12][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[12][2].value).toBe("__methods__"); - expect(tokens[12][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[12][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[13][0].value).toBe("some"); expect(tokens[13][0].scopes).toEqual(["source.python"]); expect(tokens[13][1].value).toBe("."); - expect(tokens[13][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[13][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[13][2].value).toBe("__module__"); - expect(tokens[13][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[13][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[14][0].value).toBe("some"); expect(tokens[14][0].scopes).toEqual(["source.python"]); expect(tokens[14][1].value).toBe("."); - expect(tokens[14][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[14][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[14][2].value).toBe("__mro__"); - expect(tokens[14][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[14][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[15][0].value).toBe("some"); expect(tokens[15][0].scopes).toEqual(["source.python"]); expect(tokens[15][1].value).toBe("."); - expect(tokens[15][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[15][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[15][2].value).toBe("__name__"); - expect(tokens[15][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[15][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[16][0].value).toBe("some"); expect(tokens[16][0].scopes).toEqual(["source.python"]); expect(tokens[16][1].value).toBe("."); - expect(tokens[16][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[16][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[16][2].value).toBe("__slots__"); - expect(tokens[16][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[16][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[17][0].value).toBe("some"); expect(tokens[17][0].scopes).toEqual(["source.python"]); expect(tokens[17][1].value).toBe("."); - expect(tokens[17][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[17][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[17][2].value).toBe("__subclasses__"); - expect(tokens[17][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[17][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[18][0].value).toBe("some"); expect(tokens[18][0].scopes).toEqual(["source.python"]); expect(tokens[18][1].value).toBe("."); - expect(tokens[18][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[18][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[18][2].value).toBe("__version__"); - expect(tokens[18][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[18][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[19][0].value).toBe("some"); expect(tokens[19][0].scopes).toEqual(["source.python"]); expect(tokens[19][1].value).toBe("."); - expect(tokens[19][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[19][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[19][2].value).toBe("__weakref__"); - expect(tokens[19][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[19][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[20][0].value).toBe("some"); expect(tokens[20][0].scopes).toEqual(["source.python"]); expect(tokens[20][1].value).toBe("."); - expect(tokens[20][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[20][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[20][2].value).toBe("__qualname__"); - expect(tokens[20][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[20][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[21][0].value).toBe("some"); expect(tokens[21][0].scopes).toEqual(["source.python"]); expect(tokens[21][1].value).toBe("."); - expect(tokens[21][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[21][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[21][2].value).toBe("__code__"); - expect(tokens[21][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[21][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[22][0].value).toBe("some"); expect(tokens[22][0].scopes).toEqual(["source.python"]); expect(tokens[22][1].value).toBe("."); - expect(tokens[22][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[22][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[22][2].value).toBe("__wrapped__"); - expect(tokens[22][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[22][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[23][0].value).toBe("some"); expect(tokens[23][0].scopes).toEqual(["source.python"]); expect(tokens[23][1].value).toBe("."); - expect(tokens[23][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[23][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[23][2].value).toBe("__signature__"); - expect(tokens[23][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[23][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[24][0].value).toBe("some"); expect(tokens[24][0].scopes).toEqual(["source.python"]); expect(tokens[24][1].value).toBe("."); - expect(tokens[24][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[24][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[24][2].value).toBe("__defaults__"); - expect(tokens[24][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[24][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[25][0].value).toBe("some"); expect(tokens[25][0].scopes).toEqual(["source.python"]); expect(tokens[25][1].value).toBe("."); - expect(tokens[25][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[25][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[25][2].value).toBe("__func__"); - expect(tokens[25][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[25][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[26][0].value).toBe("some"); expect(tokens[26][0].scopes).toEqual(["source.python"]); expect(tokens[26][1].value).toBe("."); - expect(tokens[26][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[26][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[26][2].value).toBe("__self__"); - expect(tokens[26][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[26][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[27][0].value).toBe("some"); expect(tokens[27][0].scopes).toEqual(["source.python"]); expect(tokens[27][1].value).toBe("."); - expect(tokens[27][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[27][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[27][2].value).toBe("__kwdefaults__"); - expect(tokens[27][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[27][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[28][0].value).toBe("some"); expect(tokens[28][0].scopes).toEqual(["source.python"]); expect(tokens[28][1].value).toBe("."); - expect(tokens[28][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[28][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[28][2].value).toBe("__matmul__"); - expect(tokens[28][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[28][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[29][0].value).toBe("some"); expect(tokens[29][0].scopes).toEqual(["source.python"]); expect(tokens[29][1].value).toBe("."); - expect(tokens[29][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[29][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[29][2].value).toBe("__imatmul__"); - expect(tokens[29][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[29][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[30][0].value).toBe("some"); expect(tokens[30][0].scopes).toEqual(["source.python"]); expect(tokens[30][1].value).toBe("."); - expect(tokens[30][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[30][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[30][2].value).toBe("__rmatmul__"); - expect(tokens[30][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[30][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[31][0].value).toBe("some"); expect(tokens[31][0].scopes).toEqual(["source.python"]); expect(tokens[31][1].value).toBe("."); - expect(tokens[31][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[31][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[31][2].value).toBe("__annotations__"); - expect(tokens[31][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[31][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[32][0].value).toBe("some"); expect(tokens[32][0].scopes).toEqual(["source.python"]); expect(tokens[32][1].value).toBe("."); - expect(tokens[32][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[32][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[32][2].value).toBe("__init_subclass__"); - expect(tokens[32][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[32][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[33][0].value).toBe("some"); expect(tokens[33][0].scopes).toEqual(["source.python"]); expect(tokens[33][1].value).toBe("."); - expect(tokens[33][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[33][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[33][2].value).toBe("__set_name__"); - expect(tokens[33][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[33][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[34][0].value).toBe("some"); expect(tokens[34][0].scopes).toEqual(["source.python"]); expect(tokens[34][1].value).toBe("."); - expect(tokens[34][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[34][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[34][2].value).toBe("__fspath__"); - expect(tokens[34][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[34][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[35][0].value).toBe("some"); expect(tokens[35][0].scopes).toEqual(["source.python"]); expect(tokens[35][1].value).toBe("."); - expect(tokens[35][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[35][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[35][2].value).toBe("__classcell__"); - expect(tokens[35][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[35][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[36][0].value).toBe("some"); expect(tokens[36][0].scopes).toEqual(["source.python"]); expect(tokens[36][1].value).toBe("."); - expect(tokens[36][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[36][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[36][2].value).toBe("__bytes__"); - expect(tokens[36][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[36][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[37][0].value).toBe("some"); expect(tokens[37][0].scopes).toEqual(["source.python"]); expect(tokens[37][1].value).toBe("."); - expect(tokens[37][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[37][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[37][2].value).toBe("__spec__"); - expect(tokens[37][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[37][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[38][0].value).toBe("some"); expect(tokens[38][0].scopes).toEqual(["source.python"]); expect(tokens[38][1].value).toBe("."); - expect(tokens[38][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[38][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[38][2].value).toBe("__path__"); - expect(tokens[38][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[38][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[39][0].value).toBe("some"); expect(tokens[39][0].scopes).toEqual(["source.python"]); expect(tokens[39][1].value).toBe("."); - expect(tokens[39][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[39][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[39][2].value).toBe("__prepare__"); - expect(tokens[39][2].scopes).toEqual(["source.python","support.function.magic.python"]); + expect(tokens[39][2].scopes).toEqual(["source.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[40][0].value).toBe("some"); expect(tokens[40][0].scopes).toEqual(["source.python"]); expect(tokens[40][1].value).toBe("."); - expect(tokens[40][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[40][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[40][2].value).toBe("__package__"); - expect(tokens[40][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[40][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[41][0].value).toBe("some"); expect(tokens[41][0].scopes).toEqual(["source.python"]); expect(tokens[41][1].value).toBe("."); - expect(tokens[41][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[41][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[41][2].value).toBe("__traceback__"); - expect(tokens[41][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[41][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[42][0].value).toBe("some"); expect(tokens[42][0].scopes).toEqual(["source.python"]); expect(tokens[42][1].value).toBe("."); - expect(tokens[42][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[42][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[42][2].value).toBe("__notspecial__"); - expect(tokens[42][2].scopes).toEqual(["source.python"]); + expect(tokens[42][2].scopes).toEqual(["source.python","meta.member.access.python"]); }); it("test/builtins/builtins4.py", @@ -421,39 +421,39 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("some"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("int"); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[1][0].value).toBe("some"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("sum"); - expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[2][0].value).toBe("some"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); - expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe("super"); - expect(tokens[2][2].scopes).toEqual(["source.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[3][0].value).toBe("some"); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("."); - expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe("unicode"); - expect(tokens[3][2].scopes).toEqual(["source.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[4][0].value).toBe("some"); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[4][1].value).toBe("."); - expect(tokens[4][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[4][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][2].value).toBe("foo"); - expect(tokens[4][2].scopes).toEqual(["source.python"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[5][0].value).toBe("some"); expect(tokens[5][0].scopes).toEqual(["source.python"]); expect(tokens[5][1].value).toBe("."); - expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[5][2].value).toBe("Exception"); - expect(tokens[5][2].scopes).toEqual(["source.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python"]); }); it("test/builtins/builtins5.py", @@ -462,37 +462,37 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("some"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe(" "); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[0][3].value).toBe("True"); - expect(tokens[0][3].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); expect(tokens[1][0].value).toBe("some"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe(" "); - expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[1][3].value).toBe("\\"); - expect(tokens[1][3].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.continuation.line.python"]); expect(tokens[1][4].value).toBe(""); - expect(tokens[1][4].scopes).toEqual(["source.python"]); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[2][0].value).toBe(" "); - expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[2][1].value).toBe("True"); - expect(tokens[2][1].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); expect(tokens[3][0].value).toBe("True"); expect(tokens[3][0].scopes).toEqual(["source.python","constant.language.python"]); expect(tokens[4][0].value).toBe("some"); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[4][1].value).toBe("."); - expect(tokens[4][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[4][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][2].value).toBe(""); - expect(tokens[4][2].scopes).toEqual(["source.python"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[5][0].value).toBe(" "); - expect(tokens[5][0].scopes).toEqual(["source.python"]); + expect(tokens[5][0].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[5][1].value).toBe("True"); - expect(tokens[5][1].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); }); it("test/builtins/builtins6.py", @@ -674,31 +674,31 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("foo"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("class"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","keyword.control.flow.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","keyword.control.flow.python"]); expect(tokens[0][3].value).toBe("("); - expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][4].value).toBe("a"); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][5].value).toBe(")"); - expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[1][0].value).toBe("foo"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("and"); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","keyword.control.flow.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","keyword.control.flow.python"]); expect(tokens[1][3].value).toBe("("); - expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][4].value).toBe(")"); - expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[2][0].value).toBe("foo"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); - expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe("if"); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","keyword.control.flow.python"]); }); it("test/calls/call4.py", @@ -707,9 +707,9 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("foo"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("1"); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[1][0].value).toBe("foo"); expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[1][1].value).toBe("("); @@ -735,9 +735,9 @@ describe("Grammar Tests", function() { expect(tokens[2][0].value).toBe("foo"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); - expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe("None"); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); expect(tokens[2][3].value).toBe(" "); expect(tokens[2][3].scopes).toEqual(["source.python"]); expect(tokens[2][4].value).toBe("and"); @@ -747,13 +747,13 @@ describe("Grammar Tests", function() { expect(tokens[2][6].value).toBe("foo"); expect(tokens[2][6].scopes).toEqual(["source.python"]); expect(tokens[2][7].value).toBe("."); - expect(tokens[2][7].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][8].value).toBe("None"); - expect(tokens[2][8].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); expect(tokens[2][9].value).toBe("."); - expect(tokens[2][9].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][9].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][10].value).toBe("baz"); - expect(tokens[2][10].scopes).toEqual(["source.python"]); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.member.access.python"]); }); it("test/calls/call5.py", @@ -840,79 +840,79 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("foo"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("__class__"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.variable.magic.python"]); expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python"]); expect(tokens[0][4].value).toBe("("); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][5].value).toBe("foo"); - expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[0][6].value).toBe("="); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[0][7].value).toBe("bar"); - expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][8].value).toBe(")"); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[1][0].value).toBe("foo"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("__class__"); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.variable.magic.python"]); expect(tokens[1][3].value).toBe("("); - expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][4].value).toBe("foo"); - expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[1][5].value).toBe("="); - expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[1][6].value).toBe("bar"); - expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[1][7].value).toBe(")"); - expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[2][0].value).toBe("foo"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); - expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe("__add__"); - expect(tokens[2][2].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python"]); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python"]); expect(tokens[2][4].value).toBe("("); - expect(tokens[2][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[2][5].value).toBe("foo"); - expect(tokens[2][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[2][6].value).toBe("="); - expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[2][7].value).toBe("bar"); - expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[2][8].value).toBe(")"); - expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[3][0].value).toBe("foo"); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("."); - expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe("__add__"); - expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[3][3].value).toBe("("); - expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[3][4].value).toBe("foo"); - expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[3][5].value).toBe("="); - expect(tokens[3][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[3][6].value).toBe("bar"); - expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[3][7].value).toBe(")"); - expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[3][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[4][0].value).toBe(""); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[5][0].value).toBe("foo"); expect(tokens[5][0].scopes).toEqual(["source.python"]); expect(tokens[5][1].value).toBe("."); - expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[5][2].value).toBe("__class__"); - expect(tokens[5][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[5][3].value).toBe(" "); expect(tokens[5][3].scopes).toEqual(["source.python"]); expect(tokens[5][4].value).toBe("1"); @@ -925,79 +925,79 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("foo"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe(" "); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[0][3].value).toBe("__class__"); - expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.variable.magic.python"]); expect(tokens[0][4].value).toBe("("); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][5].value).toBe("foo"); - expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[0][6].value).toBe("="); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[0][7].value).toBe("bar"); - expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][8].value).toBe(")"); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[1][0].value).toBe("foo"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe(" "); - expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[1][3].value).toBe("__class__"); - expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.variable.magic.python"]); expect(tokens[1][4].value).toBe(" "); - expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python"]); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python"]); expect(tokens[1][5].value).toBe("("); - expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][6].value).toBe("foo"); - expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[1][7].value).toBe("="); - expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[1][8].value).toBe("bar"); - expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[1][9].value).toBe(")"); - expect(tokens[1][9].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[1][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[2][0].value).toBe("foo"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); - expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe(" "); - expect(tokens[2][2].scopes).toEqual(["source.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[2][3].value).toBe("__add__"); - expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[2][4].value).toBe(" "); - expect(tokens[2][4].scopes).toEqual(["source.python","meta.function-call.python"]); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python"]); expect(tokens[2][5].value).toBe("("); - expect(tokens[2][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[2][6].value).toBe("foo"); - expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[2][7].value).toBe("="); - expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[2][8].value).toBe("bar"); - expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[2][9].value).toBe(")"); - expect(tokens[2][9].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[2][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[3][0].value).toBe("foo"); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("."); - expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe(" "); - expect(tokens[3][2].scopes).toEqual(["source.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[3][3].value).toBe("__add__"); - expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[3][4].value).toBe("("); - expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[3][5].value).toBe("foo"); - expect(tokens[3][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[3][6].value).toBe("="); - expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[3][7].value).toBe("bar"); - expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[3][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[3][8].value).toBe(")"); - expect(tokens[3][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[3][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); }); it("test/calls/call9.py", @@ -1109,9 +1109,9 @@ describe("Grammar Tests", function() { expect(tokens[6][3].value).toBe("sys"); expect(tokens[6][3].scopes).toEqual(["source.python"]); expect(tokens[6][4].value).toBe("."); - expect(tokens[6][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[6][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[6][5].value).toBe("stderr"); - expect(tokens[6][5].scopes).toEqual(["source.python"]); + expect(tokens[6][5].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[6][6].value).toBe(","); expect(tokens[6][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]); expect(tokens[6][7].value).toBe(" "); @@ -1143,9 +1143,9 @@ describe("Grammar Tests", function() { expect(tokens[7][9].value).toBe("sys"); expect(tokens[7][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[7][10].value).toBe("."); - expect(tokens[7][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.period.python"]); + expect(tokens[7][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][11].value).toBe("stderr"); - expect(tokens[7][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[7][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python"]); expect(tokens[7][12].value).toBe(")"); expect(tokens[7][12].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[8][0].value).toBe("print"); @@ -1314,9 +1314,9 @@ describe("Grammar Tests", function() { expect(tokens[2][1].value).toBe("self"); expect(tokens[2][1].scopes).toEqual(["source.python","variable.language.special.self.python"]); expect(tokens[2][2].value).toBe("."); - expect(tokens[2][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][3].value).toBe("a"); - expect(tokens[2][3].scopes).toEqual(["source.python"]); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[2][4].value).toBe(" "); expect(tokens[2][4].scopes).toEqual(["source.python"]); expect(tokens[2][5].value).toBe("="); @@ -1330,9 +1330,9 @@ describe("Grammar Tests", function() { expect(tokens[3][1].value).toBe("self"); expect(tokens[3][1].scopes).toEqual(["source.python","variable.language.special.self.python"]); expect(tokens[3][2].value).toBe("."); - expect(tokens[3][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][3].value).toBe("b"); - expect(tokens[3][3].scopes).toEqual(["source.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[3][4].value).toBe(" "); expect(tokens[3][4].scopes).toEqual(["source.python"]); expect(tokens[3][5].value).toBe("="); @@ -1364,9 +1364,9 @@ describe("Grammar Tests", function() { expect(tokens[6][1].value).toBe("a"); expect(tokens[6][1].scopes).toEqual(["source.python"]); expect(tokens[6][2].value).toBe("."); - expect(tokens[6][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[6][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[6][3].value).toBe("self"); - expect(tokens[6][3].scopes).toEqual(["source.python"]); + expect(tokens[6][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[6][4].value).toBe(" "); expect(tokens[6][4].scopes).toEqual(["source.python"]); expect(tokens[6][5].value).toBe("="); @@ -1380,13 +1380,13 @@ describe("Grammar Tests", function() { expect(tokens[7][1].value).toBe("a"); expect(tokens[7][1].scopes).toEqual(["source.python"]); expect(tokens[7][2].value).toBe("."); - expect(tokens[7][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[7][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][3].value).toBe("self"); - expect(tokens[7][3].scopes).toEqual(["source.python"]); + expect(tokens[7][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[7][4].value).toBe("."); - expect(tokens[7][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[7][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][5].value).toBe("bar"); - expect(tokens[7][5].scopes).toEqual(["source.python"]); + expect(tokens[7][5].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[7][6].value).toBe(" "); expect(tokens[7][6].scopes).toEqual(["source.python"]); expect(tokens[7][7].value).toBe("="); @@ -1461,9 +1461,9 @@ describe("Grammar Tests", function() { expect(tokens[3][1].value).toBe("cls"); expect(tokens[3][1].scopes).toEqual(["source.python","variable.language.special.cls.python"]); expect(tokens[3][2].value).toBe("."); - expect(tokens[3][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][3].value).toBe("a"); - expect(tokens[3][3].scopes).toEqual(["source.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[3][4].value).toBe(" "); expect(tokens[3][4].scopes).toEqual(["source.python"]); expect(tokens[3][5].value).toBe("="); @@ -1477,9 +1477,9 @@ describe("Grammar Tests", function() { expect(tokens[4][1].value).toBe("cls"); expect(tokens[4][1].scopes).toEqual(["source.python","variable.language.special.cls.python"]); expect(tokens[4][2].value).toBe("."); - expect(tokens[4][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][3].value).toBe("b"); - expect(tokens[4][3].scopes).toEqual(["source.python"]); + expect(tokens[4][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[4][4].value).toBe(" "); expect(tokens[4][4].scopes).toEqual(["source.python"]); expect(tokens[4][5].value).toBe("="); @@ -1523,9 +1523,9 @@ describe("Grammar Tests", function() { expect(tokens[8][1].value).toBe("a"); expect(tokens[8][1].scopes).toEqual(["source.python"]); expect(tokens[8][2].value).toBe("."); - expect(tokens[8][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[8][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[8][3].value).toBe("cls"); - expect(tokens[8][3].scopes).toEqual(["source.python"]); + expect(tokens[8][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[8][4].value).toBe(" "); expect(tokens[8][4].scopes).toEqual(["source.python"]); expect(tokens[8][5].value).toBe("="); @@ -1539,13 +1539,13 @@ describe("Grammar Tests", function() { expect(tokens[9][1].value).toBe("a"); expect(tokens[9][1].scopes).toEqual(["source.python"]); expect(tokens[9][2].value).toBe("."); - expect(tokens[9][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[9][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[9][3].value).toBe("cls"); - expect(tokens[9][3].scopes).toEqual(["source.python"]); + expect(tokens[9][3].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[9][4].value).toBe("."); - expect(tokens[9][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[9][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[9][5].value).toBe("__name__"); - expect(tokens[9][5].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[9][5].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); expect(tokens[10][0].value).toBe(" "); expect(tokens[10][0].scopes).toEqual(["source.python"]); expect(tokens[10][1].value).toBe("cls"); @@ -1605,9 +1605,9 @@ describe("Grammar Tests", function() { expect(tokens[0][4].value).toBe("f"); expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); expect(tokens[0][5].value).toBe("."); - expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][6].value).toBe("Exception"); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","entity.other.inherited-class.python"]); expect(tokens[0][7].value).toBe(","); expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]); expect(tokens[0][8].value).toBe(" "); @@ -1615,9 +1615,9 @@ describe("Grammar Tests", function() { expect(tokens[0][9].value).toBe("f"); expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); expect(tokens[0][10].value).toBe("."); - expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][11].value).toBe("type"); - expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","entity.other.inherited-class.python"]); expect(tokens[0][12].value).toBe(","); expect(tokens[0][12].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]); expect(tokens[0][13].value).toBe(" "); @@ -1631,9 +1631,9 @@ describe("Grammar Tests", function() { expect(tokens[0][17].value).toBe("Exception"); expect(tokens[0][17].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.exception.python"]); expect(tokens[0][18].value).toBe("."); - expect(tokens[0][18].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]); + expect(tokens[0][18].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][19].value).toBe("a"); - expect(tokens[0][19].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); + expect(tokens[0][19].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","entity.other.inherited-class.python"]); expect(tokens[0][20].value).toBe(","); expect(tokens[0][20].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]); expect(tokens[0][21].value).toBe(" "); @@ -1758,9 +1758,9 @@ describe("Grammar Tests", function() { expect(tokens[2][4].value).toBe("Foo"); expect(tokens[2][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); expect(tokens[2][5].value).toBe("."); - expect(tokens[2][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][6].value).toBe("Bar"); - expect(tokens[2][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","entity.other.inherited-class.python"]); expect(tokens[2][7].value).toBe(","); expect(tokens[2][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]); expect(tokens[2][8].value).toBe(" "); @@ -1768,9 +1768,9 @@ describe("Grammar Tests", function() { expect(tokens[2][9].value).toBe("Bar"); expect(tokens[2][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); expect(tokens[2][10].value).toBe("."); - expect(tokens[2][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][11].value).toBe("name"); - expect(tokens[2][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]); + expect(tokens[2][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.member.access.python","entity.other.inherited-class.python"]); expect(tokens[2][12].value).toBe("="); expect(tokens[2][12].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]); expect(tokens[2][13].value).toBe("{"); @@ -2046,19 +2046,19 @@ describe("Grammar Tests", function() { expect(tokens[2][3].value).toBe(")"); expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[2][4].value).toBe("."); - expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][5].value).toBe("__init__"); - expect(tokens[2][5].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[2][6].value).toBe("("); - expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[2][7].value).toBe("foo"); - expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[2][8].value).toBe("="); - expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[2][9].value).toBe("1"); - expect(tokens[2][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[2][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); expect(tokens[2][10].value).toBe(")"); - expect(tokens[2][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[3][0].value).toBe(" "); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("super"); @@ -2068,21 +2068,21 @@ describe("Grammar Tests", function() { expect(tokens[3][3].value).toBe(")"); expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[3][4].value).toBe("."); - expect(tokens[3][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][5].value).toBe(" "); - expect(tokens[3][5].scopes).toEqual(["source.python"]); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[3][6].value).toBe("__init__"); - expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[3][7].value).toBe("("); - expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[3][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[3][8].value).toBe("foo"); - expect(tokens[3][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[3][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[3][9].value).toBe("="); - expect(tokens[3][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[3][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[3][10].value).toBe("1"); - expect(tokens[3][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[3][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); expect(tokens[3][11].value).toBe(")"); - expect(tokens[3][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[3][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[4][0].value).toBe(" "); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[4][1].value).toBe("super"); @@ -2092,25 +2092,25 @@ describe("Grammar Tests", function() { expect(tokens[4][3].value).toBe(")"); expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[4][4].value).toBe("."); - expect(tokens[4][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[4][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][5].value).toBe(" "); - expect(tokens[4][5].scopes).toEqual(["source.python"]); + expect(tokens[4][5].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[4][6].value).toBe("\\"); - expect(tokens[4][6].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]); + expect(tokens[4][6].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.continuation.line.python"]); expect(tokens[4][7].value).toBe(""); - expect(tokens[4][7].scopes).toEqual(["source.python"]); + expect(tokens[4][7].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[5][0].value).toBe("__init__"); - expect(tokens[5][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[5][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[5][1].value).toBe("("); - expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[5][2].value).toBe("foo"); - expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[5][3].value).toBe("="); - expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[5][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[5][4].value).toBe("1"); - expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[5][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); expect(tokens[5][5].value).toBe(")"); - expect(tokens[5][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[5][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[6][0].value).toBe(" "); expect(tokens[6][0].scopes).toEqual(["source.python"]); expect(tokens[6][1].value).toBe("__init__"); @@ -2132,19 +2132,19 @@ describe("Grammar Tests", function() { expect(tokens[8][1].value).toBe("foo"); expect(tokens[8][1].scopes).toEqual(["source.python"]); expect(tokens[8][2].value).toBe("."); - expect(tokens[8][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[8][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[8][3].value).toBe("__init__"); - expect(tokens[8][3].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]); + expect(tokens[8][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","support.function.magic.python"]); expect(tokens[8][4].value).toBe("("); - expect(tokens[8][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[8][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[8][5].value).toBe("bar"); - expect(tokens[8][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[8][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[8][6].value).toBe("="); - expect(tokens[8][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[8][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[8][7].value).toBe("1"); - expect(tokens[8][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[8][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); expect(tokens[8][8].value).toBe(")"); - expect(tokens[8][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[8][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[9][0].value).toBe(" "); expect(tokens[9][0].scopes).toEqual(["source.python"]); expect(tokens[9][1].value).toBe("__init__"); @@ -5069,17 +5069,17 @@ describe("Grammar Tests", function() { expect(tokens[0][8].value).toBe("QQQ"); expect(tokens[0][8].scopes).toEqual(["source.python","constant.other.caps.python"]); expect(tokens[0][9].value).toBe("."); - expect(tokens[0][9].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][10].value).toBe("bar"); - expect(tokens[0][10].scopes).toEqual(["source.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[0][11].value).toBe(" "); expect(tokens[0][11].scopes).toEqual(["source.python"]); expect(tokens[0][12].value).toBe("baz"); expect(tokens[0][12].scopes).toEqual(["source.python"]); expect(tokens[0][13].value).toBe("."); - expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][13].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][14].value).toBe("AA_a"); - expect(tokens[0][14].scopes).toEqual(["source.python","constant.other.caps.python"]); + expect(tokens[0][14].scopes).toEqual(["source.python","meta.member.access.python","constant.other.caps.python"]); expect(tokens[0][15].value).toBe(" "); expect(tokens[0][15].scopes).toEqual(["source.python"]); expect(tokens[0][16].value).toBe("_AAA"); @@ -5089,9 +5089,9 @@ describe("Grammar Tests", function() { expect(tokens[0][18].value).toBe("foo"); expect(tokens[0][18].scopes).toEqual(["source.python"]); expect(tokens[0][19].value).toBe("."); - expect(tokens[0][19].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][19].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][20].value).toBe("_AAA"); - expect(tokens[0][20].scopes).toEqual(["source.python","constant.other.caps.python"]); + expect(tokens[0][20].scopes).toEqual(["source.python","meta.member.access.python","constant.other.caps.python"]); expect(tokens[1][0].value).toBe("QQQq"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe(" "); @@ -5103,13 +5103,13 @@ describe("Grammar Tests", function() { expect(tokens[1][4].value).toBe("self"); expect(tokens[1][4].scopes).toEqual(["source.python","variable.language.special.self.python"]); expect(tokens[1][5].value).toBe("."); - expect(tokens[1][5].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][6].value).toBe("FOOO"); - expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[1][7].value).toBe("("); - expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][8].value).toBe(")"); - expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[1][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[1][9].value).toBe(" "); expect(tokens[1][9].scopes).toEqual(["source.python"]); expect(tokens[1][10].value).toBe("_"); @@ -5373,9 +5373,9 @@ describe("Grammar Tests", function() { expect(tokens[3][0].value).toBe("..."); expect(tokens[3][0].scopes).toEqual(["source.python","constant.other.ellipsis.python"]); expect(tokens[3][1].value).toBe("."); - expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe("__class__"); - expect(tokens[3][2].scopes).toEqual(["source.python","support.variable.magic.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","support.variable.magic.python"]); }); it("test/expressions/expr11.py", @@ -5392,19 +5392,19 @@ describe("Grammar Tests", function() { expect(tokens[0][4].value).toBe("self"); expect(tokens[0][4].scopes).toEqual(["source.python","variable.language.special.self.python"]); expect(tokens[0][5].value).toBe("."); - expect(tokens[0][5].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][6].value).toBe("some_list"); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.item-access.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python"]); expect(tokens[0][7].value).toBe("["); - expect(tokens[0][7].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][8].value).toBe("1"); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]); expect(tokens[0][9].value).toBe(":"); - expect(tokens[0][9].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","punctuation.separator.slice.python"]); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","meta.item-access.arguments.python","punctuation.separator.slice.python"]); expect(tokens[0][10].value).toBe("2"); - expect(tokens[0][10].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]); expect(tokens[0][11].value).toBe("]"); - expect(tokens[0][11].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","punctuation.definition.arguments.end.python"]); }); it("test/expressions/expr12.py", @@ -5468,9 +5468,9 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("foofrom"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("something"); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); }); it("test/expressions/expr16.py", @@ -5539,15 +5539,15 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("a"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("Exception"); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[1][0].value).toBe("Exception"); expect(tokens[1][0].scopes).toEqual(["source.python","support.type.exception.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("a"); - expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); }); it("test/expressions/expr19.py", @@ -5556,9 +5556,9 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("a"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe(" "); - expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[0][3].value).toBe("#"); expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[0][4].value).toBe("foo"); @@ -5566,9 +5566,9 @@ describe("Grammar Tests", function() { expect(tokens[1][0].value).toBe("a"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); - expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe(""); - expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[2][0].value).toBe("#"); expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[2][1].value).toBe("foo"); @@ -5576,13 +5576,13 @@ describe("Grammar Tests", function() { expect(tokens[3][0].value).toBe("a"); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("."); - expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe(" "); - expect(tokens[3][2].scopes).toEqual(["source.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[3][3].value).toBe("\\"); - expect(tokens[3][3].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.continuation.line.python"]); expect(tokens[3][4].value).toBe(""); - expect(tokens[3][4].scopes).toEqual(["source.python"]); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[4][0].value).toBe("#"); expect(tokens[4][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[4][1].value).toBe("foo"); @@ -5590,9 +5590,9 @@ describe("Grammar Tests", function() { expect(tokens[5][0].value).toBe("a"); expect(tokens[5][0].scopes).toEqual(["source.python"]); expect(tokens[5][1].value).toBe("."); - expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[5][2].value).toBe(" "); - expect(tokens[5][2].scopes).toEqual(["source.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[5][3].value).toBe("'"); expect(tokens[5][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[5][4].value).toBe("bar"); @@ -5602,9 +5602,9 @@ describe("Grammar Tests", function() { expect(tokens[6][0].value).toBe("a"); expect(tokens[6][0].scopes).toEqual(["source.python"]); expect(tokens[6][1].value).toBe("."); - expect(tokens[6][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[6][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[6][2].value).toBe(""); - expect(tokens[6][2].scopes).toEqual(["source.python"]); + expect(tokens[6][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[7][0].value).toBe("'"); expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]); expect(tokens[7][1].value).toBe("bar"); @@ -5614,19 +5614,19 @@ describe("Grammar Tests", function() { expect(tokens[8][0].value).toBe("a"); expect(tokens[8][0].scopes).toEqual(["source.python"]); expect(tokens[8][1].value).toBe("."); - expect(tokens[8][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[8][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[8][2].value).toBe(" "); - expect(tokens[8][2].scopes).toEqual(["source.python"]); + expect(tokens[8][2].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[8][3].value).toBe("\\"); - expect(tokens[8][3].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]); + expect(tokens[8][3].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.continuation.line.python"]); expect(tokens[8][4].value).toBe(""); - expect(tokens[8][4].scopes).toEqual(["source.python"]); + expect(tokens[8][4].scopes).toEqual(["source.python","meta.member.access.python"]); expect(tokens[9][0].value).toBe("'"); - expect(tokens[9][0].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[9][0].scopes).toEqual(["source.python","meta.member.access.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[9][1].value).toBe("bar"); - expect(tokens[9][1].scopes).toEqual(["source.python","string.quoted.single.python"]); + expect(tokens[9][1].scopes).toEqual(["source.python","meta.member.access.python","string.quoted.single.python"]); expect(tokens[9][2].value).toBe("'"); - expect(tokens[9][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[9][2].scopes).toEqual(["source.python","meta.member.access.python","string.quoted.single.python","punctuation.definition.string.end.python"]); }); it("test/expressions/expr2.py", @@ -5999,9 +5999,9 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("a"); expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("True"); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); expect(tokens[0][3].value).toBe(" "); expect(tokens[0][3].scopes).toEqual(["source.python"]); expect(tokens[0][4].value).toBe("="); @@ -6011,9 +6011,9 @@ describe("Grammar Tests", function() { expect(tokens[0][6].value).toBe("b"); expect(tokens[0][6].scopes).toEqual(["source.python"]); expect(tokens[0][7].value).toBe("."); - expect(tokens[0][7].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][8].value).toBe("False"); - expect(tokens[0][8].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); expect(tokens[0][9].value).toBe(" "); expect(tokens[0][9].scopes).toEqual(["source.python"]); expect(tokens[0][10].value).toBe("="); @@ -6023,9 +6023,9 @@ describe("Grammar Tests", function() { expect(tokens[0][12].value).toBe("d"); expect(tokens[0][12].scopes).toEqual(["source.python"]); expect(tokens[0][13].value).toBe("."); - expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][13].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][14].value).toBe("None"); - expect(tokens[0][14].scopes).toEqual(["source.python","keyword.illegal.name.python"]); + expect(tokens[0][14].scopes).toEqual(["source.python","meta.member.access.python","keyword.illegal.name.python"]); }); it("test/expressions/expr8.py", @@ -6354,71 +6354,71 @@ describe("Grammar Tests", function() { expect(tokens[0][0].value).toBe("self"); expect(tokens[0][0].scopes).toEqual(["source.python","variable.language.special.self.python"]); expect(tokens[0][1].value).toBe("."); - expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("assertEqual"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[0][3].value).toBe("("); - expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][4].value).toBe("f"); - expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]); expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]); expect(tokens[0][6].value).toBe("{"); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][7].value).toBe("10"); - expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); expect(tokens[0][8].value).toBe(":"); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]); expect(tokens[0][9].value).toBe("#"); - expect(tokens[0][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]); expect(tokens[0][10].value).toBe("{"); - expect(tokens[0][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][11].value).toBe("3"); - expect(tokens[0][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); expect(tokens[0][12].value).toBe(" "); - expect(tokens[0][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); expect(tokens[0][13].value).toBe("!="); - expect(tokens[0][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.comparison.python"]); + expect(tokens[0][13].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.comparison.python"]); expect(tokens[0][14].value).toBe(" "); - expect(tokens[0][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); + expect(tokens[0][14].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); expect(tokens[0][15].value).toBe("{"); - expect(tokens[0][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.definition.dict.begin.python"]); + expect(tokens[0][15].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.definition.dict.begin.python"]); expect(tokens[0][16].value).toBe("4"); - expect(tokens[0][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][16].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); expect(tokens[0][17].value).toBe(":"); - expect(tokens[0][17].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.separator.dict.python"]); + expect(tokens[0][17].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.separator.dict.python"]); expect(tokens[0][18].value).toBe("5"); - expect(tokens[0][18].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][18].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]); expect(tokens[0][19].value).toBe("}"); - expect(tokens[0][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.definition.dict.end.python"]); + expect(tokens[0][19].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.definition.dict.end.python"]); expect(tokens[0][20].value).toBe(" "); - expect(tokens[0][20].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); + expect(tokens[0][20].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); expect(tokens[0][21].value).toBe("and"); - expect(tokens[0][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.logical.python"]); + expect(tokens[0][21].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.logical.python"]); expect(tokens[0][22].value).toBe(" "); - expect(tokens[0][22].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); + expect(tokens[0][22].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); expect(tokens[0][23].value).toBe("width"); - expect(tokens[0][23].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); + expect(tokens[0][23].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); expect(tokens[0][24].value).toBe("}"); - expect(tokens[0][24].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][24].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][25].value).toBe("x"); - expect(tokens[0][25].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]); + expect(tokens[0][25].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]); expect(tokens[0][26].value).toBe("}"); - expect(tokens[0][26].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][26].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][27].value).toBe("'"); - expect(tokens[0][27].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[0][27].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[0][28].value).toBe(","); - expect(tokens[0][28].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[0][28].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); expect(tokens[0][29].value).toBe(" "); - expect(tokens[0][29].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[0][29].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][30].value).toBe("'"); - expect(tokens[0][30].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][30].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]); expect(tokens[0][31].value).toBe(" 0xa"); - expect(tokens[0][31].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]); + expect(tokens[0][31].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]); expect(tokens[0][32].value).toBe("'"); - expect(tokens[0][32].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]); + expect(tokens[0][32].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[0][33].value).toBe(")"); - expect(tokens[0][33].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][33].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); }); it("test/fstrings/empty1.py", @@ -7463,9 +7463,9 @@ describe("Grammar Tests", function() { expect(tokens[0][19].value).toBe("fo"); expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python"]); expect(tokens[0][20].value).toBe("."); - expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","punctuation.separator.period.python"]); + expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][21].value).toBe("__add__"); - expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","support.function.magic.python"]); + expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","meta.member.access.python","support.function.magic.python"]); expect(tokens[0][22].value).toBe("!s"); expect(tokens[0][22].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]); expect(tokens[0][23].value).toBe("}"); @@ -10044,19 +10044,19 @@ describe("Grammar Tests", function() { expect(tokens[4][7].value).toBe(")"); expect(tokens[4][7].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]); expect(tokens[4][8].value).toBe("."); - expect(tokens[4][8].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[4][8].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][9].value).toBe("fuuuu"); - expect(tokens[4][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[4][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[4][10].value).toBe("("); - expect(tokens[4][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[4][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[4][11].value).toBe("baz"); - expect(tokens[4][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[4][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[4][12].value).toBe("="); - expect(tokens[4][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[4][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[4][13].value).toBe("1"); - expect(tokens[4][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[4][13].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); expect(tokens[4][14].value).toBe(")"); - expect(tokens[4][14].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[4][14].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[5][0].value).toBe("#"); expect(tokens[5][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[5][1].value).toBe(" we recover just fine"); @@ -11632,325 +11632,325 @@ describe("Grammar Tests", function() { expect(tokens[2][4].value).toBe("re"); expect(tokens[2][4].scopes).toEqual(["source.python"]); expect(tokens[2][5].value).toBe("."); - expect(tokens[2][5].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][6].value).toBe("compile"); - expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[2][7].value).toBe("("); - expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[2][8].value).toBe("r"); - expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]); expect(tokens[2][9].value).toBe("\"\"\""); - expect(tokens[2][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]); + expect(tokens[2][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]); expect(tokens[3][0].value).toBe(" "); - expect(tokens[3][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[3][1].value).toBe("(?x)"); - expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]); expect(tokens[3][2].value).toBe(" "); - expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[3][3].value).toBe("#"); - expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[3][4].value).toBe(" This is a verbose pattern"); - expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[4][0].value).toBe(" "); - expect(tokens[4][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[4][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[4][1].value).toBe("\\s"); - expect(tokens[4][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); + expect(tokens[4][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); expect(tokens[4][2].value).toBe("*"); - expect(tokens[4][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[4][3].value).toBe(" "); - expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[4][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[4][4].value).toBe("#"); - expect(tokens[4][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[4][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[4][5].value).toBe(" Optional whitespace at start of cookie"); - expect(tokens[4][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[4][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[5][0].value).toBe(" "); - expect(tokens[5][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[5][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[5][1].value).toBe("("); - expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]); + expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]); expect(tokens[5][2].value).toBe("?P"); - expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","entity.name.tag.named.group.regexp"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","entity.name.tag.named.group.regexp"]); expect(tokens[5][3].value).toBe(" "); - expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[5][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[5][4].value).toBe("#"); - expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[5][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[5][5].value).toBe(" Start of group 'key'"); - expect(tokens[5][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); + expect(tokens[5][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); expect(tokens[6][0].value).toBe(" "); - expect(tokens[6][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[6][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[6][1].value).toBe("["); - expect(tokens[6][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); + expect(tokens[6][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); expect(tokens[6][2].value).toBe("\"\"\""); - expect(tokens[6][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); + expect(tokens[6][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); expect(tokens[6][3].value).toBe(" "); - expect(tokens[6][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[6][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[6][4].value).toBe("+"); - expect(tokens[6][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); + expect(tokens[6][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); expect(tokens[6][5].value).toBe(" "); - expect(tokens[6][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[6][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[6][6].value).toBe("_LegalKeyChars"); - expect(tokens[6][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[6][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[6][7].value).toBe(" "); - expect(tokens[6][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[6][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[6][8].value).toBe("+"); - expect(tokens[6][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); + expect(tokens[6][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); expect(tokens[6][9].value).toBe(" "); - expect(tokens[6][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[6][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[6][10].value).toBe("r"); - expect(tokens[6][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]); + expect(tokens[6][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]); expect(tokens[6][11].value).toBe("\"\"\""); - expect(tokens[6][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]); + expect(tokens[6][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]); expect(tokens[6][12].value).toBe("]"); - expect(tokens[6][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[6][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[6][13].value).toBe("+?"); - expect(tokens[6][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[6][13].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[6][14].value).toBe(" "); - expect(tokens[6][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[6][14].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[6][15].value).toBe("#"); - expect(tokens[6][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[6][15].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[6][16].value).toBe(" Any word of at least one letter"); - expect(tokens[6][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[6][16].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[7][0].value).toBe(" ) "); - expect(tokens[7][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[7][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[7][1].value).toBe("#"); - expect(tokens[7][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[7][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[7][2].value).toBe(" End of group 'key'"); - expect(tokens[7][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[7][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[8][0].value).toBe(" "); - expect(tokens[8][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[8][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[8][1].value).toBe("("); - expect(tokens[8][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]); + expect(tokens[8][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]); expect(tokens[8][2].value).toBe(" "); - expect(tokens[8][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[8][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[8][3].value).toBe("#"); - expect(tokens[8][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[8][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[8][4].value).toBe(" Optional group: there may not be a value."); - expect(tokens[8][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[8][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[9][0].value).toBe(" "); - expect(tokens[9][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[9][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[9][1].value).toBe("\\s"); - expect(tokens[9][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); + expect(tokens[9][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); expect(tokens[9][2].value).toBe("*"); - expect(tokens[9][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[9][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[9][3].value).toBe("="); - expect(tokens[9][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[9][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[9][4].value).toBe("\\s"); - expect(tokens[9][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); + expect(tokens[9][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); expect(tokens[9][5].value).toBe("*"); - expect(tokens[9][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[9][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[9][6].value).toBe(" "); - expect(tokens[9][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[9][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[9][7].value).toBe("#"); - expect(tokens[9][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[9][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[9][8].value).toBe(" Equal Sign"); - expect(tokens[9][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[9][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[10][0].value).toBe(" "); - expect(tokens[10][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[10][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[10][1].value).toBe("("); - expect(tokens[10][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]); + expect(tokens[10][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]); expect(tokens[10][2].value).toBe("?P"); - expect(tokens[10][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","entity.name.tag.named.group.regexp"]); + expect(tokens[10][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","entity.name.tag.named.group.regexp"]); expect(tokens[10][3].value).toBe(" "); - expect(tokens[10][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[10][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[10][4].value).toBe("#"); - expect(tokens[10][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[10][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[10][5].value).toBe(" Start of group 'val'"); - expect(tokens[10][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); + expect(tokens[10][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); expect(tokens[11][0].value).toBe(" \""); - expect(tokens[11][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[11][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[11][1].value).toBe("(?:"); - expect(tokens[11][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.non-capturing.begin.regexp support.other.parenthesis.regexp"]); + expect(tokens[11][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.non-capturing.begin.regexp support.other.parenthesis.regexp"]); expect(tokens[11][2].value).toBe("["); - expect(tokens[11][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); + expect(tokens[11][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); expect(tokens[11][3].value).toBe("^"); - expect(tokens[11][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","keyword.operator.negation.regexp"]); + expect(tokens[11][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","keyword.operator.negation.regexp"]); expect(tokens[11][4].value).toBe("\\\\"); - expect(tokens[11][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.escape.regexp"]); + expect(tokens[11][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.escape.regexp"]); expect(tokens[11][5].value).toBe("\""); - expect(tokens[11][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]); + expect(tokens[11][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]); expect(tokens[11][6].value).toBe("]"); - expect(tokens[11][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); + expect(tokens[11][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); expect(tokens[11][7].value).toBe("|"); - expect(tokens[11][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]); + expect(tokens[11][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]); expect(tokens[11][8].value).toBe("\\\\"); - expect(tokens[11][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","constant.character.escape.regexp"]); + expect(tokens[11][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","constant.character.escape.regexp"]); expect(tokens[11][9].value).toBe("."); - expect(tokens[11][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.match.any.regexp"]); + expect(tokens[11][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.match.any.regexp"]); expect(tokens[11][10].value).toBe(")"); - expect(tokens[11][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.non-capturing.end.regexp support.other.parenthesis.regexp"]); + expect(tokens[11][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.non-capturing.end.regexp support.other.parenthesis.regexp"]); expect(tokens[11][11].value).toBe("*"); - expect(tokens[11][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); + expect(tokens[11][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); expect(tokens[11][12].value).toBe("\" "); - expect(tokens[11][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[11][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[11][13].value).toBe("#"); - expect(tokens[11][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[11][13].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[11][14].value).toBe(" Any doublequoted string"); - expect(tokens[11][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); + expect(tokens[11][14].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); expect(tokens[12][0].value).toBe(" "); - expect(tokens[12][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[12][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[12][1].value).toBe("|"); - expect(tokens[12][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]); + expect(tokens[12][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]); expect(tokens[12][2].value).toBe(" "); - expect(tokens[12][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[12][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[12][3].value).toBe("#"); - expect(tokens[12][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[12][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[12][4].value).toBe(" or"); - expect(tokens[12][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); + expect(tokens[12][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); expect(tokens[13][0].value).toBe(" "); - expect(tokens[13][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[13][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[13][1].value).toBe("\\w"); - expect(tokens[13][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); expect(tokens[13][2].value).toBe("{3}"); - expect(tokens[13][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); + expect(tokens[13][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); expect(tokens[13][3].value).toBe(","); - expect(tokens[13][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[13][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[13][4].value).toBe("\\s"); - expect(tokens[13][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); expect(tokens[13][5].value).toBe("["); - expect(tokens[13][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); + expect(tokens[13][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); expect(tokens[13][6].value).toBe("\\w"); - expect(tokens[13][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); expect(tokens[13][7].value).toBe("\\d"); - expect(tokens[13][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); expect(tokens[13][8].value).toBe("\\s"); - expect(tokens[13][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); expect(tokens[13][9].value).toBe("-"); - expect(tokens[13][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]); + expect(tokens[13][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]); expect(tokens[13][10].value).toBe("]"); - expect(tokens[13][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); + expect(tokens[13][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); expect(tokens[13][11].value).toBe("{9,11}"); - expect(tokens[13][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); + expect(tokens[13][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); expect(tokens[13][12].value).toBe("\\s"); - expect(tokens[13][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); expect(tokens[13][13].value).toBe("["); - expect(tokens[13][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); + expect(tokens[13][13].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); expect(tokens[13][14].value).toBe("\\d"); - expect(tokens[13][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][14].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]); expect(tokens[13][15].value).toBe(":"); - expect(tokens[13][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]); + expect(tokens[13][15].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]); expect(tokens[13][16].value).toBe("]"); - expect(tokens[13][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); + expect(tokens[13][16].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); expect(tokens[13][17].value).toBe("{8}"); - expect(tokens[13][17].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); + expect(tokens[13][17].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]); expect(tokens[13][18].value).toBe("\\s"); - expect(tokens[13][18].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); + expect(tokens[13][18].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]); expect(tokens[13][19].value).toBe("GMT "); - expect(tokens[13][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[13][19].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[13][20].value).toBe("#"); - expect(tokens[13][20].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[13][20].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[13][21].value).toBe(" Special case for \"expires\" attr"); - expect(tokens[13][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); + expect(tokens[13][21].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); expect(tokens[14][0].value).toBe(" "); - expect(tokens[14][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[14][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[14][1].value).toBe("|"); - expect(tokens[14][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]); + expect(tokens[14][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]); expect(tokens[14][2].value).toBe(" "); - expect(tokens[14][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[14][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[14][3].value).toBe("#"); - expect(tokens[14][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[14][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[14][4].value).toBe(" or"); - expect(tokens[14][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); + expect(tokens[14][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]); expect(tokens[15][0].value).toBe(" "); - expect(tokens[15][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); + expect(tokens[15][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]); expect(tokens[15][1].value).toBe("["); - expect(tokens[15][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); + expect(tokens[15][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); expect(tokens[15][2].value).toBe("\"\"\""); - expect(tokens[15][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); + expect(tokens[15][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); expect(tokens[15][3].value).toBe(" "); - expect(tokens[15][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[15][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[15][4].value).toBe("+"); - expect(tokens[15][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); + expect(tokens[15][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); expect(tokens[15][5].value).toBe(" "); - expect(tokens[15][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[15][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[15][6].value).toBe("_LegalValueChars"); - expect(tokens[15][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[15][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[15][7].value).toBe(" "); - expect(tokens[15][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[15][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[15][8].value).toBe("+"); - expect(tokens[15][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); + expect(tokens[15][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]); expect(tokens[15][9].value).toBe(" "); - expect(tokens[15][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[15][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[15][10].value).toBe("r"); - expect(tokens[15][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]); + expect(tokens[15][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]); expect(tokens[15][11].value).toBe("\"\"\""); - expect(tokens[15][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]); + expect(tokens[15][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]); expect(tokens[15][12].value).toBe("]"); - expect(tokens[15][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[15][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[15][13].value).toBe("*"); - expect(tokens[15][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[15][13].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[15][14].value).toBe(" "); - expect(tokens[15][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[15][14].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[15][15].value).toBe("#"); - expect(tokens[15][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[15][15].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[15][16].value).toBe(" Any word or empty string"); - expect(tokens[15][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[15][16].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[16][0].value).toBe(" ) "); - expect(tokens[16][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[16][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[16][1].value).toBe("#"); - expect(tokens[16][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[16][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[16][2].value).toBe(" End of group 'val'"); - expect(tokens[16][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[16][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[17][0].value).toBe(" )"); - expect(tokens[17][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[17][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[17][1].value).toBe("?"); - expect(tokens[17][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[17][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[17][2].value).toBe(" "); - expect(tokens[17][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[17][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[17][3].value).toBe("#"); - expect(tokens[17][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[17][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[17][4].value).toBe(" End of optional value group"); - expect(tokens[17][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[17][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[18][0].value).toBe(" "); - expect(tokens[18][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[18][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[18][1].value).toBe("\\s"); - expect(tokens[18][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); + expect(tokens[18][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); expect(tokens[18][2].value).toBe("*"); - expect(tokens[18][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[18][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[18][3].value).toBe(" "); - expect(tokens[18][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[18][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[18][4].value).toBe("#"); - expect(tokens[18][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[18][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[18][5].value).toBe(" Any number of spaces."); - expect(tokens[18][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[18][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[19][0].value).toBe(" "); - expect(tokens[19][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[19][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[19][1].value).toBe("("); - expect(tokens[19][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]); + expect(tokens[19][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]); expect(tokens[19][2].value).toBe("\\s"); - expect(tokens[19][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); + expect(tokens[19][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]); expect(tokens[19][3].value).toBe("+"); - expect(tokens[19][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); + expect(tokens[19][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]); expect(tokens[19][4].value).toBe("|"); - expect(tokens[19][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.disjunction.regexp"]); + expect(tokens[19][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.disjunction.regexp"]); expect(tokens[19][5].value).toBe(";"); - expect(tokens[19][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[19][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[19][6].value).toBe("|"); - expect(tokens[19][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.disjunction.regexp"]); + expect(tokens[19][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.disjunction.regexp"]); expect(tokens[19][7].value).toBe("$"); - expect(tokens[19][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.match.end.regexp"]); + expect(tokens[19][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.match.end.regexp"]); expect(tokens[19][8].value).toBe(")"); - expect(tokens[19][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"]); + expect(tokens[19][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"]); expect(tokens[19][9].value).toBe(" "); - expect(tokens[19][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[19][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[19][10].value).toBe("#"); - expect(tokens[19][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); + expect(tokens[19][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]); expect(tokens[19][11].value).toBe(" Ending either at space, semicolon, or EOS."); - expect(tokens[19][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); + expect(tokens[19][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]); expect(tokens[20][0].value).toBe(" "); - expect(tokens[20][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); + expect(tokens[20][0].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]); expect(tokens[20][1].value).toBe("\"\"\""); - expect(tokens[20][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); + expect(tokens[20][1].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); expect(tokens[20][2].value).toBe(","); - expect(tokens[20][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[20][2].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); expect(tokens[20][3].value).toBe(" "); - expect(tokens[20][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[20][3].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[20][4].value).toBe("re"); - expect(tokens[20][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[20][4].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[20][5].value).toBe("."); - expect(tokens[20][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.period.python"]); + expect(tokens[20][5].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[20][6].value).toBe("ASCII"); - expect(tokens[20][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.other.caps.python"]); + expect(tokens[20][6].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python","constant.other.caps.python"]); expect(tokens[20][7].value).toBe(")"); - expect(tokens[20][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[20][7].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[20][8].value).toBe(" "); expect(tokens[20][8].scopes).toEqual(["source.python"]); expect(tokens[20][9].value).toBe("#"); @@ -12512,9 +12512,9 @@ describe("Grammar Tests", function() { expect(tokens[3][0].value).toBe("foo"); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("."); - expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe("import"); - expect(tokens[3][2].scopes).toEqual(["source.python","keyword.control.import.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","keyword.control.import.python"]); expect(tokens[4][0].value).toBe(""); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[5][0].value).toBe("raise"); @@ -13275,11 +13275,11 @@ describe("Grammar Tests", function() { expect(tokens[2][9].value).toBe("\""); expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[2][10].value).toBe("."); - expect(tokens[2][10].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][11].value).toBe("format"); - expect(tokens[2][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[2][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[2][12].value).toBe("("); - expect(tokens[2][12].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][12].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); }); it("test/strings/bytes1.py", @@ -13856,19 +13856,19 @@ describe("Grammar Tests", function() { expect(tokens[0][17].value).toBe("\""); expect(tokens[0][17].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]); expect(tokens[0][18].value).toBe("."); - expect(tokens[0][18].scopes).toEqual(["source.python","punctuation.separator.period.python"]); + expect(tokens[0][18].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][19].value).toBe("format"); - expect(tokens[0][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[0][19].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); expect(tokens[0][20].value).toBe("("); - expect(tokens[0][20].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][20].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][21].value).toBe("fo"); - expect(tokens[0][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[0][21].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); expect(tokens[0][22].value).toBe("="); - expect(tokens[0][22].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[0][22].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); expect(tokens[0][23].value).toBe("1"); - expect(tokens[0][23].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[0][23].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); expect(tokens[0][24].value).toBe(")"); - expect(tokens[0][24].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][24].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); }); it("test/strings/format3.py", diff --git a/test/builtins/builtins3.py b/test/builtins/builtins3.py index 02ccb5af..17972344 100644 --- a/test/builtins/builtins3.py +++ b/test/builtins/builtins3.py @@ -60,127 +60,127 @@ ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python ] : punctuation.definition.list.end.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -__bases__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__bases__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__class__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__class__ : meta.member.access.python, source.python, support.variable.magic.python assert : keyword.control.flow.python, source.python : source.python __debug__ : source.python, support.variable.magic.python __builtins__ : source.python, support.variable.magic.python __builtins__ : source.python, support.variable.magic.python -. : punctuation.separator.period.python, source.python -len : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +len : meta.member.access.python, source.python print : meta.function-call.python, source.python, support.function.builtin.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python __builtins__ : meta.function-call.arguments.python, meta.function-call.python, source.python, support.variable.magic.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -__dict__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__dict__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__doc__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__doc__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__file__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__file__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__members__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__members__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__metaclass__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__metaclass__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__methods__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__methods__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__module__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__module__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__mro__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__mro__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__name__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__name__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__slots__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__slots__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__subclasses__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__subclasses__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__version__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__version__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__weakref__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__weakref__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__qualname__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__qualname__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__code__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__code__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__wrapped__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__wrapped__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__signature__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__signature__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__defaults__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__defaults__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__func__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__func__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__self__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__self__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__kwdefaults__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__kwdefaults__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__matmul__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__matmul__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__imatmul__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__imatmul__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__rmatmul__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__rmatmul__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__annotations__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__annotations__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__init_subclass__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__init_subclass__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__set_name__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__set_name__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__fspath__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__fspath__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__classcell__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__classcell__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__bytes__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__bytes__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__spec__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__spec__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__path__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__path__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__prepare__ : source.python, support.function.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__prepare__ : meta.member.access.python, source.python, support.function.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__package__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__package__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__traceback__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__traceback__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python -. : punctuation.separator.period.python, source.python -__notspecial__ : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__notspecial__ : meta.member.access.python, source.python diff --git a/test/builtins/builtins4.py b/test/builtins/builtins4.py index b8f3401b..ac82589a 100644 --- a/test/builtins/builtins4.py +++ b/test/builtins/builtins4.py @@ -7,21 +7,22 @@ + some : source.python -. : punctuation.separator.period.python, source.python -int : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +int : meta.member.access.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -sum : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +sum : meta.member.access.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -super : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +super : meta.member.access.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -unicode : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +unicode : meta.member.access.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -foo : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +foo : meta.member.access.python, source.python some : source.python -. : punctuation.separator.period.python, source.python -Exception : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +Exception : meta.member.access.python, source.python diff --git a/test/builtins/builtins5.py b/test/builtins/builtins5.py index 674df37f..af3db3e5 100644 --- a/test/builtins/builtins5.py +++ b/test/builtins/builtins5.py @@ -7,20 +7,21 @@ + some : source.python -. : punctuation.separator.period.python, source.python - : source.python -True : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +True : keyword.illegal.name.python, meta.member.access.python, source.python some : source.python -. : punctuation.separator.period.python, source.python - : source.python -\ : punctuation.separator.continuation.line.python, source.python - : source.python - : source.python -True : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +\ : meta.member.access.python, punctuation.separator.continuation.line.python, source.python + : meta.member.access.python, source.python + : meta.member.access.python, source.python +True : keyword.illegal.name.python, meta.member.access.python, source.python True : constant.language.python, source.python some : source.python -. : punctuation.separator.period.python, source.python - : source.python - : source.python -True : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python + : meta.member.access.python, source.python +True : keyword.illegal.name.python, meta.member.access.python, source.python diff --git a/test/calls/call3.py b/test/calls/call3.py index 3e5bca3d..3eb5ff59 100644 --- a/test/calls/call3.py +++ b/test/calls/call3.py @@ -4,17 +4,18 @@ + foo : source.python -. : punctuation.separator.period.python, source.python -class : keyword.control.flow.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -a : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +class : keyword.control.flow.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +a : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python -and : keyword.control.flow.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +and : keyword.control.flow.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python -if : keyword.control.flow.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +if : keyword.control.flow.python, meta.member.access.python, source.python diff --git a/test/calls/call4.py b/test/calls/call4.py index a2976601..9cfce7af 100644 --- a/test/calls/call4.py +++ b/test/calls/call4.py @@ -4,9 +4,10 @@ + foo : source.python -. : punctuation.separator.period.python, source.python -1 : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +1 : meta.member.access.python, source.python foo : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python bar : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python @@ -19,13 +20,13 @@ sam : meta.function-call.arguments.python, meta.function-call.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python -None : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +None : keyword.illegal.name.python, meta.member.access.python, source.python : source.python and : keyword.operator.logical.python, source.python : source.python foo : source.python -. : punctuation.separator.period.python, source.python -None : keyword.illegal.name.python, source.python -. : punctuation.separator.period.python, source.python -baz : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +None : keyword.illegal.name.python, meta.member.access.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +baz : meta.member.access.python, source.python diff --git a/test/calls/call7.py b/test/calls/call7.py index b0b00f05..97cf7ee9 100644 --- a/test/calls/call7.py +++ b/test/calls/call7.py @@ -7,43 +7,44 @@ + foo : source.python -. : punctuation.separator.period.python, source.python -__class__ : meta.function-call.python, source.python, support.variable.magic.python - : meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__class__ : meta.function-call.python, meta.member.access.python, source.python, support.variable.magic.python + : meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python -__class__ : meta.function-call.python, source.python, support.variable.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__class__ : meta.function-call.python, meta.member.access.python, source.python, support.variable.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python -__add__ : meta.function-call.python, source.python, support.function.magic.python - : meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__add__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python + : meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python -__add__ : meta.function-call.python, source.python, support.function.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__add__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python foo : source.python -. : punctuation.separator.period.python, source.python -__class__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__class__ : meta.member.access.python, source.python, support.variable.magic.python : source.python 1 : constant.numeric.dec.python, source.python diff --git a/test/calls/call8.py b/test/calls/call8.py index 471a64d3..0b78f3d3 100644 --- a/test/calls/call8.py +++ b/test/calls/call8.py @@ -5,41 +5,42 @@ + foo : source.python -. : punctuation.separator.period.python, source.python - : source.python -__class__ : meta.function-call.python, source.python, support.variable.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +__class__ : meta.function-call.python, meta.member.access.python, source.python, support.variable.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python - : source.python -__class__ : meta.function-call.python, source.python, support.variable.magic.python - : meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +__class__ : meta.function-call.python, meta.member.access.python, source.python, support.variable.magic.python + : meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python - : source.python -__add__ : meta.function-call.python, source.python, support.function.magic.python - : meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +__add__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python + : meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python foo : source.python -. : punctuation.separator.period.python, source.python - : source.python -__add__ : meta.function-call.python, source.python, support.function.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +__add__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/calls/print1.py b/test/calls/print1.py index c5f3e7f7..8ce2b03f 100644 --- a/test/calls/print1.py +++ b/test/calls/print1.py @@ -11,6 +11,7 @@ + print : source.python, support.function.builtin.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python @@ -55,8 +56,8 @@ : source.python >> : keyword.operator.bitwise.python, source.python sys : source.python -. : punctuation.separator.period.python, source.python -stderr : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +stderr : meta.member.access.python, source.python , : punctuation.separator.element.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python @@ -72,8 +73,8 @@ file : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python = : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python sys : meta.function-call.arguments.python, meta.function-call.python, source.python -. : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.period.python, source.python -stderr : meta.function-call.arguments.python, meta.function-call.python, source.python +. : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.separator.period.python, source.python +stderr : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python print : meta.function-call.python, source.python, support.function.builtin.python : meta.function-call.python, source.python diff --git a/test/classes/class11.py b/test/classes/class11.py index bad00706..4995c536 100644 --- a/test/classes/class11.py +++ b/test/classes/class11.py @@ -10,6 +10,7 @@ def __init__(self, a, b=1): + class : meta.class.python, source.python, storage.type.class.python : meta.class.python, source.python F : entity.name.type.class.python, meta.class.python, source.python @@ -32,16 +33,16 @@ def : meta.function.python, source.python, storage.type.function.pytho : : meta.function.python, punctuation.section.function.begin.python, source.python : source.python self : source.python, variable.language.special.self.python -. : punctuation.separator.period.python, source.python -a : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +a : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python a : source.python : source.python self : source.python, variable.language.special.self.python -. : punctuation.separator.period.python, source.python -b : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +b : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -57,18 +58,18 @@ def : meta.function.python, source.python, storage.type.function.pytho ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python : source.python a : source.python -. : punctuation.separator.period.python, source.python -self : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +self : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python 1 : constant.numeric.dec.python, source.python : source.python a : source.python -. : punctuation.separator.period.python, source.python -self : source.python -. : punctuation.separator.period.python, source.python -bar : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +self : meta.member.access.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +bar : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python diff --git a/test/classes/class12.py b/test/classes/class12.py index e0e7fb7d..2d34fc81 100644 --- a/test/classes/class12.py +++ b/test/classes/class12.py @@ -12,6 +12,7 @@ def meth(cls, a, b=1): + class : meta.class.python, source.python, storage.type.class.python : meta.class.python, source.python F : entity.name.type.class.python, meta.class.python, source.python @@ -37,16 +38,16 @@ def : meta.function.python, source.python, storage.type.function.pytho : : meta.function.python, punctuation.section.function.begin.python, source.python : source.python cls : source.python, variable.language.special.cls.python -. : punctuation.separator.period.python, source.python -a : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +a : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python a : source.python : source.python cls : source.python, variable.language.special.cls.python -. : punctuation.separator.period.python, source.python -b : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +b : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -68,18 +69,18 @@ def : meta.function.python, source.python, storage.type.function.pytho 1 : constant.numeric.dec.python, source.python : source.python a : source.python -. : punctuation.separator.period.python, source.python -cls : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +cls : meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python 1 : constant.numeric.dec.python, source.python : source.python a : source.python -. : punctuation.separator.period.python, source.python -cls : source.python -. : punctuation.separator.period.python, source.python -__name__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +cls : meta.member.access.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__name__ : meta.member.access.python, source.python, support.variable.magic.python : source.python cls : meta.item-access.python, source.python, variable.language.special.cls.python [ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python diff --git a/test/classes/class14.py b/test/classes/class14.py index 706969f9..45455895 100644 --- a/test/classes/class14.py +++ b/test/classes/class14.py @@ -3,26 +3,27 @@ class F(f.Exception, f.type, Exception, Exception.a, b=Exception): + class : meta.class.python, source.python, storage.type.class.python : meta.class.python, source.python F : entity.name.type.class.python, meta.class.python, source.python ( : meta.class.inheritance.python, meta.class.python, punctuation.definition.inheritance.begin.python, source.python f : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python -Exception : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, meta.member.access.python, punctuation.separator.period.python, source.python +Exception : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, meta.member.access.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python f : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python -type : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, meta.member.access.python, punctuation.separator.period.python, source.python +type : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, meta.member.access.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python Exception : meta.class.inheritance.python, meta.class.python, source.python, support.type.exception.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python Exception : meta.class.inheritance.python, meta.class.python, source.python, support.type.exception.python -. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python -a : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, meta.member.access.python, punctuation.separator.period.python, source.python +a : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, meta.member.access.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python b : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python, variable.parameter.class.python diff --git a/test/classes/class2.py b/test/classes/class2.py index 32b5a2dc..1f15e252 100644 --- a/test/classes/class2.py +++ b/test/classes/class2.py @@ -5,6 +5,7 @@ class Spam(Foo.Bar, Bar.name={'very': 'odd'}): + @ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python dec : entity.name.function.decorator.python, meta.function.decorator.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python @@ -14,13 +15,13 @@ class : meta.class.python, source.python, storage.type.class.python Spam : entity.name.type.class.python, meta.class.python, source.python ( : meta.class.inheritance.python, meta.class.python, punctuation.definition.inheritance.begin.python, source.python Foo : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python -Bar : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, meta.member.access.python, punctuation.separator.period.python, source.python +Bar : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, meta.member.access.python, source.python , : meta.class.inheritance.python, meta.class.python, punctuation.separator.inheritance.python, source.python : meta.class.inheritance.python, meta.class.python, source.python Bar : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python -. : meta.class.inheritance.python, meta.class.python, punctuation.separator.period.python, source.python -name : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, source.python +. : meta.class.inheritance.python, meta.class.python, meta.member.access.python, punctuation.separator.period.python, source.python +name : entity.other.inherited-class.python, meta.class.inheritance.python, meta.class.python, meta.member.access.python, source.python = : keyword.operator.assignment.python, meta.class.inheritance.python, meta.class.python, source.python { : meta.class.inheritance.python, meta.class.python, punctuation.definition.dict.begin.python, source.python ' : meta.class.inheritance.python, meta.class.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python diff --git a/test/classes/super1.py b/test/classes/super1.py index 1840ed9b..709205c4 100644 --- a/test/classes/super1.py +++ b/test/classes/super1.py @@ -30,39 +30,39 @@ def : meta.function.python, source.python, storage.type.function.pytho super : meta.function-call.python, source.python, support.type.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python -. : punctuation.separator.period.python, source.python -__init__ : meta.function-call.python, source.python, support.function.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__init__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python super : meta.function-call.python, source.python, support.type.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python -. : punctuation.separator.period.python, source.python - : source.python -__init__ : meta.function-call.python, source.python, support.function.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +__init__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python super : meta.function-call.python, source.python, support.type.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python -. : punctuation.separator.period.python, source.python - : source.python -\ : punctuation.separator.continuation.line.python, source.python - : source.python -__init__ : meta.function-call.python, source.python, support.function.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -foo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +\ : meta.member.access.python, punctuation.separator.continuation.line.python, source.python + : meta.member.access.python, source.python +__init__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +foo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python __init__ : meta.function-call.python, source.python, support.function.magic.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python @@ -73,13 +73,13 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python : source.python foo : source.python -. : punctuation.separator.period.python, source.python -__init__ : meta.function-call.python, source.python, support.function.magic.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -bar : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__init__ : meta.function-call.python, meta.member.access.python, source.python, support.function.magic.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +bar : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python __init__ : meta.function-call.python, source.python, support.function.magic.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python diff --git a/test/expressions/const1.py b/test/expressions/const1.py index e59a19be..384f93be 100644 --- a/test/expressions/const1.py +++ b/test/expressions/const1.py @@ -3,6 +3,7 @@ + QQQQ : constant.other.caps.python, source.python : source.python QQQQ_123 : constant.other.caps.python, source.python @@ -12,27 +13,27 @@ PROTOCOL_v2 : constant.other.caps.python, source.python : source.python QQQ : constant.other.caps.python, source.python -. : punctuation.separator.period.python, source.python -bar : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +bar : meta.member.access.python, source.python : source.python baz : source.python -. : punctuation.separator.period.python, source.python -AA_a : constant.other.caps.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +AA_a : constant.other.caps.python, meta.member.access.python, source.python : source.python _AAA : constant.other.caps.python, source.python : source.python foo : source.python -. : punctuation.separator.period.python, source.python -_AAA : constant.other.caps.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +_AAA : constant.other.caps.python, meta.member.access.python, source.python QQQq : source.python : source.python QQQq123 : source.python : source.python self : source.python, variable.language.special.self.python -. : punctuation.separator.period.python, source.python -FOOO : meta.function-call.generic.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +FOOO : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python _ : source.python : source.python diff --git a/test/expressions/expr10.py b/test/expressions/expr10.py index 501fb475..df5f1165 100644 --- a/test/expressions/expr10.py +++ b/test/expressions/expr10.py @@ -5,6 +5,7 @@ + a : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -32,5 +33,5 @@ ... : constant.other.ellipsis.python, source.python ) : punctuation.parenthesis.end.python, source.python ... : constant.other.ellipsis.python, source.python -. : punctuation.separator.period.python, source.python -__class__ : source.python, support.variable.magic.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +__class__ : meta.member.access.python, source.python, support.variable.magic.python diff --git a/test/expressions/expr11.py b/test/expressions/expr11.py index 142ff621..754112c8 100644 --- a/test/expressions/expr11.py +++ b/test/expressions/expr11.py @@ -2,15 +2,16 @@ + a : source.python : source.python = : keyword.operator.assignment.python, source.python : source.python self : source.python, variable.language.special.self.python -. : punctuation.separator.period.python, source.python -some_list : meta.item-access.python, source.python -[ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python -1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python -: : meta.item-access.arguments.python, meta.item-access.python, punctuation.separator.slice.python, source.python -2 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python -] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +some_list : meta.item-access.python, meta.member.access.python, source.python +[ : meta.item-access.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, source.python +: : meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, punctuation.separator.slice.python, source.python +2 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, source.python +] : meta.item-access.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/expressions/expr15.py b/test/expressions/expr15.py index 2815cdae..0685ff23 100644 --- a/test/expressions/expr15.py +++ b/test/expressions/expr15.py @@ -2,6 +2,7 @@ + foofrom : source.python -. : punctuation.separator.period.python, source.python -something : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +something : meta.member.access.python, source.python diff --git a/test/expressions/expr18.py b/test/expressions/expr18.py index 8326520f..3ef0ad22 100644 --- a/test/expressions/expr18.py +++ b/test/expressions/expr18.py @@ -3,9 +3,10 @@ + a : source.python -. : punctuation.separator.period.python, source.python -Exception : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +Exception : meta.member.access.python, source.python Exception : source.python, support.type.exception.python -. : punctuation.separator.period.python, source.python -a : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +a : meta.member.access.python, source.python diff --git a/test/expressions/expr19.py b/test/expressions/expr19.py index 45dd0e8e..4a4a3a5b 100644 --- a/test/expressions/expr19.py +++ b/test/expressions/expr19.py @@ -11,40 +11,41 @@ + a : source.python -. : punctuation.separator.period.python, source.python - : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python foo : comment.line.number-sign.python, source.python a : source.python -. : punctuation.separator.period.python, source.python - : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python foo : comment.line.number-sign.python, source.python a : source.python -. : punctuation.separator.period.python, source.python - : source.python -\ : punctuation.separator.continuation.line.python, source.python - : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +\ : meta.member.access.python, punctuation.separator.continuation.line.python, source.python + : meta.member.access.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python foo : comment.line.number-sign.python, source.python a : source.python -. : punctuation.separator.period.python, source.python - : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python bar : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python a : source.python -. : punctuation.separator.period.python, source.python - : source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python ' : punctuation.definition.string.begin.python, source.python, string.quoted.docstring.single.python bar : source.python, string.quoted.docstring.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.docstring.single.python a : source.python -. : punctuation.separator.period.python, source.python - : source.python -\ : punctuation.separator.continuation.line.python, source.python - : source.python -' : punctuation.definition.string.begin.python, source.python, string.quoted.single.python -bar : source.python, string.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.quoted.single.python +. : meta.member.access.python, punctuation.separator.period.python, source.python + : meta.member.access.python, source.python +\ : meta.member.access.python, punctuation.separator.continuation.line.python, source.python + : meta.member.access.python, source.python +' : meta.member.access.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python +bar : meta.member.access.python, source.python, string.quoted.single.python +' : meta.member.access.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python diff --git a/test/expressions/expr7.py b/test/expressions/expr7.py index 936af9e8..8bfa1704 100644 --- a/test/expressions/expr7.py +++ b/test/expressions/expr7.py @@ -2,18 +2,19 @@ + a : source.python -. : punctuation.separator.period.python, source.python -True : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +True : keyword.illegal.name.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python b : source.python -. : punctuation.separator.period.python, source.python -False : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +False : keyword.illegal.name.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python d : source.python -. : punctuation.separator.period.python, source.python -None : keyword.illegal.name.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +None : keyword.illegal.name.python, meta.member.access.python, source.python diff --git a/test/fstrings/comment4.py b/test/fstrings/comment4.py index f070cdd0..66943523 100644 --- a/test/fstrings/comment4.py +++ b/test/fstrings/comment4.py @@ -4,36 +4,36 @@ self : source.python, variable.language.special.self.python -. : punctuation.separator.period.python, source.python -assertEqual : meta.function-call.generic.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -f : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.single.python -' : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.quoted.single.python -{ : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -10 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.format.python -# : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.format.python -{ : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -3 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -!= : keyword.operator.comparison.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -{ : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.dict.begin.python, source.python -4 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.dict.python, source.python -5 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -} : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.dict.end.python, source.python - : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -and : keyword.operator.logical.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -width : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -} : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -x : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.format.python -} : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -' : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python -, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -' : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python - 0xa : meta.function-call.arguments.python, meta.function-call.python, source.python, string.quoted.single.python -' : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +assertEqual : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +f : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.single.python +' : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.quoted.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +10 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.format.python +# : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.format.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +3 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +!= : keyword.operator.comparison.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +{ : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.dict.begin.python, source.python +4 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +: : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.separator.dict.python, source.python +5 : constant.numeric.dec.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +} : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.dict.end.python, source.python + : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +and : keyword.operator.logical.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +width : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +x : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.format.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +' : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python +, : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +' : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python + 0xa : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.quoted.single.python +' : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.end.python, source.python, string.quoted.single.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/fstrings/simple2.py b/test/fstrings/simple2.py index 48ce0dcd..e4e1ff37 100644 --- a/test/fstrings/simple2.py +++ b/test/fstrings/simple2.py @@ -2,6 +2,7 @@ + a : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -22,8 +23,8 @@ normal : meta.fstring.python, source.python, string.interpolated.python, string.quoted.single.python { : constant.character.format.placeholder.other.python, meta.fstring.python, source.python fo : meta.fstring.python, source.python -. : meta.fstring.python, punctuation.separator.period.python, source.python -__add__ : meta.fstring.python, source.python, support.function.magic.python +. : meta.fstring.python, meta.member.access.python, punctuation.separator.period.python, source.python +__add__ : meta.fstring.python, meta.member.access.python, source.python, support.function.magic.python !s : meta.fstring.python, source.python, storage.type.format.python } : constant.character.format.placeholder.other.python, meta.fstring.python, source.python " : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python diff --git a/test/illegals/illegal1.py b/test/illegals/illegal1.py index 6010bc4f..5ee9654d 100644 --- a/test/illegals/illegal1.py +++ b/test/illegals/illegal1.py @@ -9,6 +9,7 @@ def f(): pass + -> : invalid.illegal.annotation.python, source.python def : meta.function.python, source.python, storage.type.function.python : meta.function.python, source.python @@ -28,13 +29,13 @@ def : meta.function.python, source.python, storage.type.function.pytho .class : source.python, string.quoted.single.python ' : punctuation.definition.string.end.python, source.python, string.quoted.single.python ) : punctuation.parenthesis.end.python, source.python -. : punctuation.separator.period.python, source.python -fuuuu : meta.function-call.generic.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -baz : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +fuuuu : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +baz : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python we recover just fine : comment.line.number-sign.python, source.python b : source.python diff --git a/test/regexp/python8.py b/test/regexp/python8.py index f0babc73..ba72a7be 100644 --- a/test/regexp/python8.py +++ b/test/regexp/python8.py @@ -22,6 +22,7 @@ + # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python And now something fun! : comment.line.number-sign.python, source.python : source.python @@ -30,166 +31,166 @@ = : keyword.operator.assignment.python, source.python : source.python re : source.python -. : punctuation.separator.period.python, source.python -compile : meta.function-call.generic.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -r : meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python -""" : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.begin.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -(?x) : meta.function-call.arguments.python, meta.function-call.python, source.python, storage.modifier.flag.regexp, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - This is a verbose pattern : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Optional whitespace at start of cookie : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -( : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.parenthesis.named.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp -?P : entity.name.tag.named.group.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Start of group 'key' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python -""" : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.end.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -+ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -_LegalKeyChars : meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -+ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -r : meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python -""" : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.begin.python, source.python, string.regexp.quoted.multi.python -] : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -+? : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Any word of at least one letter : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - ) : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - End of group 'key' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -( : meta.function-call.arguments.python, meta.function-call.python, punctuation.parenthesis.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Optional group: there may not be a value. : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -= : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Equal Sign : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -( : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.parenthesis.named.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp -?P : entity.name.tag.named.group.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Start of group 'val' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - " : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -(?: : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.parenthesis.non-capturing.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp -[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python -^ : keyword.operator.negation.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -\\ : constant.character.escape.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -" : constant.character.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -] : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.end.regexp, source.python, string.regexp.quoted.multi.python -| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -\\ : constant.character.escape.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -. : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.match.any.regexp -) : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.parenthesis.non-capturing.end.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp -* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -" : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Any doublequoted string : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - or : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -\w : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -{3} : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -, : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python -\w : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -\d : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -\s : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -- : constant.character.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -] : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.end.regexp, source.python, string.regexp.quoted.multi.python -{9,11} : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python -\d : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -: : constant.character.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -] : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.end.regexp, source.python, string.regexp.quoted.multi.python -{8} : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -GMT : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Special case for "expires" attr : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - or : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python -[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python -""" : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.end.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -+ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -_LegalValueChars : meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -+ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -r : meta.function-call.arguments.python, meta.function-call.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python -""" : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.begin.python, source.python, string.regexp.quoted.multi.python -] : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Any word or empty string : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - ) : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - End of group 'val' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - ) : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -? : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - End of optional value group : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -\s : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Any number of spaces. : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -( : meta.function-call.arguments.python, meta.function-call.python, punctuation.parenthesis.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp -\s : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp -+ : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -; : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -$ : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python, support.other.match.end.regexp -) : meta.function-call.arguments.python, meta.function-call.python, punctuation.parenthesis.end.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python - Ending either at space, semicolon, or EOS. : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python - : meta.function-call.arguments.python, meta.function-call.python, source.python, string.regexp.quoted.multi.python -""" : meta.function-call.arguments.python, meta.function-call.python, punctuation.definition.string.end.python, source.python, string.regexp.quoted.multi.python -, : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python - : meta.function-call.arguments.python, meta.function-call.python, source.python -re : meta.function-call.arguments.python, meta.function-call.python, source.python -. : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.period.python, source.python -ASCII : constant.other.caps.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +compile : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +r : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python +""" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.begin.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +(?x) : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.modifier.flag.regexp, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + This is a verbose pattern : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Optional whitespace at start of cookie : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +( : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.parenthesis.named.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp +?P : entity.name.tag.named.group.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Start of group 'key' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python +""" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.end.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python ++ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +_LegalKeyChars : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python ++ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +r : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python +""" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.begin.python, source.python, string.regexp.quoted.multi.python +] : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python ++? : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Any word of at least one letter : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + ) : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + End of group 'key' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +( : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.parenthesis.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Optional group: there may not be a value. : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python += : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Equal Sign : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +( : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.parenthesis.named.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp +?P : entity.name.tag.named.group.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Start of group 'val' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + " : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +(?: : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.parenthesis.non-capturing.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp +[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python +^ : keyword.operator.negation.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +\\ : constant.character.escape.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +" : constant.character.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +] : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.end.regexp, source.python, string.regexp.quoted.multi.python +| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +\\ : constant.character.escape.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +. : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.match.any.regexp +) : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.parenthesis.non-capturing.end.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp +* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Any doublequoted string : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + or : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +\w : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +{3} : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +, : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python +\w : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +\d : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +\s : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +- : constant.character.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +] : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.end.regexp, source.python, string.regexp.quoted.multi.python +{9,11} : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python +\d : meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +: : constant.character.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +] : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.end.regexp, source.python, string.regexp.quoted.multi.python +{8} : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +GMT : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Special case for "expires" attr : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + or : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, source.python, string.regexp.quoted.multi.python +[ : constant.other.set.regexp, meta.character.set.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, meta.named.regexp, punctuation.character.set.begin.regexp, source.python, string.regexp.quoted.multi.python +""" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.end.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python ++ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +_LegalValueChars : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python ++ : keyword.operator.arithmetic.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +r : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, storage.type.string.python, string.regexp.quoted.multi.python +""" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.begin.python, source.python, string.regexp.quoted.multi.python +] : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Any word or empty string : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + ) : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + End of group 'val' : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + ) : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +? : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + End of optional value group : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp +* : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Any number of spaces. : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +( : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.parenthesis.begin.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp +\s : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python, support.other.escape.special.regexp ++ : keyword.operator.quantifier.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +; : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +| : keyword.operator.disjunction.regexp, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +$ : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python, support.other.match.end.regexp +) : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.parenthesis.end.regexp, source.python, string.regexp.quoted.multi.python, support.other.parenthesis.regexp + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +# : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.comment.python, source.python, string.regexp.quoted.multi.python + Ending either at space, semicolon, or EOS. : comment.line.number-sign.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, string.regexp.quoted.multi.python +""" : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.definition.string.end.python, source.python, string.regexp.quoted.multi.python +, : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +re : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +. : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.separator.period.python, source.python +ASCII : constant.other.caps.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python : source.python # : comment.line.number-sign.python, punctuation.definition.comment.python, source.python May be removed if safe. : comment.line.number-sign.python, source.python diff --git a/test/statements/import5.py b/test/statements/import5.py index 01c57822..6050a777 100644 --- a/test/statements/import5.py +++ b/test/statements/import5.py @@ -10,6 +10,7 @@ def bar(): + from : keyword.control.import.python, source.python . : punctuation.separator.period.python, source.python foo : source.python @@ -24,8 +25,8 @@ def bar(): a : source.python : source.python foo : source.python -. : punctuation.separator.period.python, source.python -import : keyword.control.import.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +import : keyword.control.import.python, meta.member.access.python, source.python : source.python raise : keyword.control.flow.python, source.python : source.python diff --git a/test/strings/bug2.py b/test/strings/bug2.py index 0ba2bf8f..3f4622e8 100644 --- a/test/strings/bug2.py +++ b/test/strings/bug2.py @@ -30,6 +30,6 @@ -- ./**/*.proto > : source.python, string.quoted.single.python {OUTPUT} : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python -. : punctuation.separator.period.python, source.python -format : meta.function-call.generic.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +format : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python diff --git a/test/strings/format2.py b/test/strings/format2.py index 86227776..d6079535 100644 --- a/test/strings/format2.py +++ b/test/strings/format2.py @@ -2,6 +2,7 @@ + a : source.python : source.python = : keyword.operator.assignment.python, source.python @@ -20,10 +21,10 @@ !s : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, storage.type.format.python, string.quoted.single.python } : constant.character.format.placeholder.other.python, meta.format.brace.python, source.python, string.quoted.single.python " : punctuation.definition.string.end.python, source.python, string.quoted.single.python -. : punctuation.separator.period.python, source.python -format : meta.function-call.generic.python, meta.function-call.python, source.python -( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python -fo : meta.function-call.arguments.python, meta.function-call.python, source.python, variable.parameter.function-call.python -= : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python -1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, source.python -) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +format : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +fo : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python From 076e2bb99d458068f0b83b0576372995242fcb6d Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 17 Oct 2019 17:53:44 -0400 Subject: [PATCH 36/49] Bump syntaxdev dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 92b1a2ec..e859e0b7 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ }, "devDependencies": { "oniguruma": "^7.0.0", - "syntaxdev": "^0.1.0" + "syntaxdev": "^0.1.3" }, "dependencies": {} } From 9d40c7165cdd4d72129dafa29dced3e17c5b83bf Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Thu, 17 Oct 2019 18:33:31 -0400 Subject: [PATCH 37/49] Add an `update-test` make target. The `update-test` make target will automatically update the output of any test that failed. This kind of bulk update is intended to be used when the changes to scopes affect a large number of files. Of course, the actual updated tests should still be reviewed for correctness. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 85c19a17..21b1edbf 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,11 @@ ci-test: release ] ; \ then echo "Error: package.version != git.tag" && exit 1 ; fi +update-test: +# Run tests and overwrite the output + ./node_modules/.bin/syntaxdev test --tests test/**/*.py --syntax grammars/src/MagicPython.syntax.yaml --overwrite-tests + ./node_modules/.bin/syntaxdev test --tests test/**/*.re --syntax grammars/src/MagicRegExp.syntax.yaml --overwrite-tests + test: ci-test atom -t test/atom-spec From c9b3409deb69acec31bbf7913830e93a046b30cc Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 15 Feb 2020 17:06:09 -0800 Subject: [PATCH 38/49] Regenerate tmLanguage files using `make` (#196) --- grammars/MagicPython.tmLanguage | 2 +- grammars/MagicRegExp.tmLanguage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index ba24d9d1..6b243795 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1,7 +1,7 @@ - + name MagicPython diff --git a/grammars/MagicRegExp.tmLanguage b/grammars/MagicRegExp.tmLanguage index 3d19e058..3ddacc70 100644 --- a/grammars/MagicRegExp.tmLanguage +++ b/grammars/MagicRegExp.tmLanguage @@ -1,7 +1,7 @@ - + name MagicRegExp From 0b09c1fca238d22e15ac5712d03f9bf6da626f9c Mon Sep 17 00:00:00 2001 From: Michael Wilkinson Date: Mon, 30 Mar 2020 20:45:22 -0400 Subject: [PATCH 39/49] Add snakemake (#203) --- grammars/MagicPython.cson | 1 + grammars/MagicPython.tmLanguage | 1 + grammars/src/MagicPython.syntax.yaml | 2 +- package.json | 6 +++++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 33f23dad..0529d39d 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -17,6 +17,7 @@ fileTypes: [ "wsgi" "kv" "Snakefile" + "smk" "tac" ] first_line_match: "^#![ \\t]*/.*\\bpython[\\d\\.]*\\b" diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 6b243795..8f3b643c 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -24,6 +24,7 @@ wsgi kv Snakefile + smk tac first_line_match diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 7dbec777..97209a62 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -4,7 +4,7 @@ scopeName: source.python # NOTE: remember to update package.json with VSCode file types. fileTypes: [py, py3, rpy, pyw, cpy, pyi, SConstruct, Sconstruct, sconstruct, SConscript, - gyp, gypi, wsgi, kv, Snakefile, tac] + gyp, gypi, wsgi, kv, Snakefile, smk, tac] first_line_match: ^#![ \t]*/.*\bpython[\d\.]*\b firstLineMatch: ^#![ \t]*/.*\bpython[\d\.]*\b uuid: 742deb57-6e38-4192-bed6-410746efd85d diff --git a/package.json b/package.json index e859e0b7..a974bd74 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,11 @@ ".SConscript", ".gyp", ".gypi", - ".wsgi" + ".wsgi", + ".kv", + "Snakefile", + ".smk", + ".tac" ] } ], From dd48b8f87748ffb743466c12095ea66075f84c4c Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Wed, 23 Oct 2019 12:09:16 -0400 Subject: [PATCH 40/49] Add some more specific scopes for member access. Add `meta.attribute.python` to mark otherwise non-special attributes. Add `meta.indexed-name.python` to mark the name of the object being indexed. In combination with `meta.member.access.python` the above scopes can help highlight member access that is no otherwise using a builtin or some other special case. For highlighting method names in method calls the combination of `meta.member.access.python` and `meta.function-call.generic.python` could be used. Fixes #188. --- grammars/MagicPython.cson | 12 ++++++ grammars/MagicPython.tmLanguage | 17 ++++++++ grammars/src/MagicPython.syntax.yaml | 11 ++++- misc/scopes | 2 + test/atom-spec/python-spec.js | 62 ++++++++++++++-------------- test/builtins/builtins3.py | 4 +- test/builtins/builtins4.py | 12 +++--- test/calls/call1.py | 3 +- test/calls/call4.py | 2 +- test/calls/print1.py | 4 +- test/classes/class11.py | 10 ++--- test/classes/class12.py | 8 ++-- test/expressions/const1.py | 2 +- test/expressions/expr11.py | 2 +- test/expressions/expr15.py | 2 +- test/expressions/expr18.py | 4 +- test/fstrings/nested1.py | 2 +- test/functions/decl2.py | 4 +- test/functions/decorators6.py | 4 +- test/statements/annotation1.py | 3 +- test/strings/bytes2.py | 3 +- 21 files changed, 110 insertions(+), 63 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 0529d39d..0cf28d5e 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -431,6 +431,9 @@ repository: { include: "#member-access-base" } + { + include: "#member-access-attribute" + } ] "member-access-base": patterns: [ @@ -453,6 +456,14 @@ repository: include: "#item-access" } ] + "member-access-attribute": + comment: "Highlight attribute access in otherwise non-specialized cases." + name: "meta.attribute.python" + match: ''' + (?x) + \\b ([[:alpha:]_]\\w*) \\b + + ''' "special-names": name: "constant.other.caps.python" match: ''' @@ -1488,6 +1499,7 @@ repository: include: "#special-names" } { + name: "meta.indexed-name.python" match: ''' (?x) \\b ([[:alpha:]_]\\w*) \\b diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 8f3b643c..81d6e2d7 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -647,6 +647,10 @@ it's probably control flow like: include #member-access-base + + include + #member-access-attribute + member-access-base @@ -679,6 +683,17 @@ it's probably control flow like: + member-access-attribute + + comment + Highlight attribute access in otherwise non-specialized cases. + name + meta.attribute.python + match + (?x) + \b ([[:alpha:]_]\w*) \b + + special-names name @@ -2340,6 +2355,8 @@ it's probably control flow like: #special-names + name + meta.indexed-name.python match (?x) \b ([[:alpha:]_]\w*) \b diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 97209a62..c39cc8d2 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -449,6 +449,7 @@ repository: patterns: - include: '#function-call' - include: '#member-access-base' + - include: '#member-access-attribute' member-access-base: patterns: @@ -459,6 +460,13 @@ repository: - include: '#line-continuation' - include: '#item-access' + member-access-attribute: + comment: Highlight attribute access in otherwise non-specialized cases. + name: meta.attribute.python + match: | + (?x) + \b ([[:alpha:]_]\w*) \b + special-names: name: constant.other.caps.python match: | @@ -1142,7 +1150,8 @@ repository: - include: '#special-variables' - include: '#builtin-functions' - include: '#special-names' - - match: | + - name: meta.indexed-name.python + match: | (?x) \b ([[:alpha:]_]\w*) \b diff --git a/misc/scopes b/misc/scopes index 17a74a4a..12785af1 100644 --- a/misc/scopes +++ b/misc/scopes @@ -60,6 +60,7 @@ keyword.operator.python keyword.operator.quantifier.regexp keyword.operator.unpacking.arguments.python keyword.operator.unpacking.parameter.python +meta.attribute.python meta.backreference.named.regexp meta.backreference.regexp meta.character.set.regexp @@ -73,6 +74,7 @@ meta.function-call.python meta.function.decorator.python meta.function.parameters.python meta.function.python +meta.indexed-name.python meta.item-access.python meta.lambda-function.python meta.member.access.python diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index d1c7466b..2d052ff2 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -188,7 +188,7 @@ describe("Grammar Tests", function() { expect(tokens[5][1].value).toBe("."); expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[5][2].value).toBe("len"); - expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[6][0].value).toBe("print"); expect(tokens[6][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]); expect(tokens[6][1].value).toBe("("); @@ -412,7 +412,7 @@ describe("Grammar Tests", function() { expect(tokens[42][1].value).toBe("."); expect(tokens[42][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[42][2].value).toBe("__notspecial__"); - expect(tokens[42][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[42][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); }); it("test/builtins/builtins4.py", @@ -423,37 +423,37 @@ describe("Grammar Tests", function() { expect(tokens[0][1].value).toBe("."); expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("int"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[1][0].value).toBe("some"); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("."); expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("sum"); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[2][0].value).toBe("some"); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("."); expect(tokens[2][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][2].value).toBe("super"); - expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[3][0].value).toBe("some"); expect(tokens[3][0].scopes).toEqual(["source.python"]); expect(tokens[3][1].value).toBe("."); expect(tokens[3][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][2].value).toBe("unicode"); - expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[4][0].value).toBe("some"); expect(tokens[4][0].scopes).toEqual(["source.python"]); expect(tokens[4][1].value).toBe("."); expect(tokens[4][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][2].value).toBe("foo"); - expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[5][0].value).toBe("some"); expect(tokens[5][0].scopes).toEqual(["source.python"]); expect(tokens[5][1].value).toBe("."); expect(tokens[5][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[5][2].value).toBe("Exception"); - expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[5][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); }); it("test/builtins/builtins5.py", @@ -545,7 +545,7 @@ describe("Grammar Tests", function() { expect(tokens[0][7].value).toBe(" "); expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); expect(tokens[0][8].value).toBe("c"); - expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[0][9].value).toBe("["); expect(tokens[0][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][10].value).toBe("1"); @@ -753,7 +753,7 @@ describe("Grammar Tests", function() { expect(tokens[2][9].value).toBe("."); expect(tokens[2][9].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][10].value).toBe("baz"); - expect(tokens[2][10].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); }); it("test/calls/call5.py", @@ -1111,7 +1111,7 @@ describe("Grammar Tests", function() { expect(tokens[6][4].value).toBe("."); expect(tokens[6][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[6][5].value).toBe("stderr"); - expect(tokens[6][5].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[6][5].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[6][6].value).toBe(","); expect(tokens[6][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]); expect(tokens[6][7].value).toBe(" "); @@ -1145,7 +1145,7 @@ describe("Grammar Tests", function() { expect(tokens[7][10].value).toBe("."); expect(tokens[7][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][11].value).toBe("stderr"); - expect(tokens[7][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python"]); + expect(tokens[7][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[7][12].value).toBe(")"); expect(tokens[7][12].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); expect(tokens[8][0].value).toBe("print"); @@ -1316,7 +1316,7 @@ describe("Grammar Tests", function() { expect(tokens[2][2].value).toBe("."); expect(tokens[2][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[2][3].value).toBe("a"); - expect(tokens[2][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[2][4].value).toBe(" "); expect(tokens[2][4].scopes).toEqual(["source.python"]); expect(tokens[2][5].value).toBe("="); @@ -1332,7 +1332,7 @@ describe("Grammar Tests", function() { expect(tokens[3][2].value).toBe("."); expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][3].value).toBe("b"); - expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[3][4].value).toBe(" "); expect(tokens[3][4].scopes).toEqual(["source.python"]); expect(tokens[3][5].value).toBe("="); @@ -1366,7 +1366,7 @@ describe("Grammar Tests", function() { expect(tokens[6][2].value).toBe("."); expect(tokens[6][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[6][3].value).toBe("self"); - expect(tokens[6][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[6][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[6][4].value).toBe(" "); expect(tokens[6][4].scopes).toEqual(["source.python"]); expect(tokens[6][5].value).toBe("="); @@ -1382,11 +1382,11 @@ describe("Grammar Tests", function() { expect(tokens[7][2].value).toBe("."); expect(tokens[7][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][3].value).toBe("self"); - expect(tokens[7][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[7][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[7][4].value).toBe("."); expect(tokens[7][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[7][5].value).toBe("bar"); - expect(tokens[7][5].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[7][5].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[7][6].value).toBe(" "); expect(tokens[7][6].scopes).toEqual(["source.python"]); expect(tokens[7][7].value).toBe("="); @@ -1463,7 +1463,7 @@ describe("Grammar Tests", function() { expect(tokens[3][2].value).toBe("."); expect(tokens[3][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[3][3].value).toBe("a"); - expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[3][4].value).toBe(" "); expect(tokens[3][4].scopes).toEqual(["source.python"]); expect(tokens[3][5].value).toBe("="); @@ -1479,7 +1479,7 @@ describe("Grammar Tests", function() { expect(tokens[4][2].value).toBe("."); expect(tokens[4][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[4][3].value).toBe("b"); - expect(tokens[4][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[4][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[4][4].value).toBe(" "); expect(tokens[4][4].scopes).toEqual(["source.python"]); expect(tokens[4][5].value).toBe("="); @@ -1525,7 +1525,7 @@ describe("Grammar Tests", function() { expect(tokens[8][2].value).toBe("."); expect(tokens[8][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[8][3].value).toBe("cls"); - expect(tokens[8][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[8][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[8][4].value).toBe(" "); expect(tokens[8][4].scopes).toEqual(["source.python"]); expect(tokens[8][5].value).toBe("="); @@ -1541,7 +1541,7 @@ describe("Grammar Tests", function() { expect(tokens[9][2].value).toBe("."); expect(tokens[9][2].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[9][3].value).toBe("cls"); - expect(tokens[9][3].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[9][3].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[9][4].value).toBe("."); expect(tokens[9][4].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[9][5].value).toBe("__name__"); @@ -5071,7 +5071,7 @@ describe("Grammar Tests", function() { expect(tokens[0][9].value).toBe("."); expect(tokens[0][9].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][10].value).toBe("bar"); - expect(tokens[0][10].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[0][11].value).toBe(" "); expect(tokens[0][11].scopes).toEqual(["source.python"]); expect(tokens[0][12].value).toBe("baz"); @@ -5394,7 +5394,7 @@ describe("Grammar Tests", function() { expect(tokens[0][5].value).toBe("."); expect(tokens[0][5].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][6].value).toBe("some_list"); - expect(tokens[0][6].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[0][7].value).toBe("["); expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][8].value).toBe("1"); @@ -5470,7 +5470,7 @@ describe("Grammar Tests", function() { expect(tokens[0][1].value).toBe("."); expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("something"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); }); it("test/expressions/expr16.py", @@ -5541,13 +5541,13 @@ describe("Grammar Tests", function() { expect(tokens[0][1].value).toBe("."); expect(tokens[0][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[0][2].value).toBe("Exception"); - expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); expect(tokens[1][0].value).toBe("Exception"); expect(tokens[1][0].scopes).toEqual(["source.python","support.type.exception.python"]); expect(tokens[1][1].value).toBe("."); expect(tokens[1][1].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); expect(tokens[1][2].value).toBe("a"); - expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.member.access.python","meta.attribute.python"]); }); it("test/expressions/expr19.py", @@ -6537,7 +6537,7 @@ describe("Grammar Tests", function() { expect(tokens[4][2].value).toBe(" "); expect(tokens[4][2].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]); expect(tokens[4][3].value).toBe("bar"); - expect(tokens[4][3].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python"]); + expect(tokens[4][3].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[4][4].value).toBe("["); expect(tokens[4][4].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[4][5].value).toBe("\""); @@ -8458,7 +8458,7 @@ describe("Grammar Tests", function() { expect(tokens[0][11].value).toBe(" "); expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.python"]); expect(tokens[0][12].value).toBe("qqq"); - expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python"]); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[0][13].value).toBe("["); expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][14].value).toBe("None"); @@ -9363,7 +9363,7 @@ describe("Grammar Tests", function() { expect(tokens[2][0].value).toBe(" "); expect(tokens[2][0].scopes).toEqual(["source.python"]); expect(tokens[2][1].value).toBe("baz"); - expect(tokens[2][1].scopes).toEqual(["source.python","meta.item-access.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[2][2].value).toBe("["); expect(tokens[2][2].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[2][3].value).toBe("1"); @@ -12045,7 +12045,7 @@ describe("Grammar Tests", function() { expect(tokens[1][2].value).toBe(" "); expect(tokens[1][2].scopes).toEqual(["source.python"]); expect(tokens[1][3].value).toBe("List"); - expect(tokens[1][3].scopes).toEqual(["source.python","meta.item-access.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[1][4].value).toBe("["); expect(tokens[1][4].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[1][5].value).toBe("int"); @@ -13321,7 +13321,7 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("a[1] = b'''\nmultiline 'binary' string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n'''") expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python","meta.item-access.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.item-access.python","meta.indexed-name.python"]); expect(tokens[0][1].value).toBe("["); expect(tokens[0][1].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); expect(tokens[0][2].value).toBe("1"); diff --git a/test/builtins/builtins3.py b/test/builtins/builtins3.py index 17972344..181eacd1 100644 --- a/test/builtins/builtins3.py +++ b/test/builtins/builtins3.py @@ -71,7 +71,7 @@ __builtins__ : source.python, support.variable.magic.python __builtins__ : source.python, support.variable.magic.python . : meta.member.access.python, punctuation.separator.period.python, source.python -len : meta.member.access.python, source.python +len : meta.attribute.python, meta.member.access.python, source.python print : meta.function-call.python, source.python, support.function.builtin.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python __builtins__ : meta.function-call.arguments.python, meta.function-call.python, source.python, support.variable.magic.python @@ -183,4 +183,4 @@ __traceback__ : meta.member.access.python, source.python, support.variable.magic.python some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -__notspecial__ : meta.member.access.python, source.python +__notspecial__ : meta.attribute.python, meta.member.access.python, source.python diff --git a/test/builtins/builtins4.py b/test/builtins/builtins4.py index ac82589a..d126c0bf 100644 --- a/test/builtins/builtins4.py +++ b/test/builtins/builtins4.py @@ -10,19 +10,19 @@ some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -int : meta.member.access.python, source.python +int : meta.attribute.python, meta.member.access.python, source.python some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -sum : meta.member.access.python, source.python +sum : meta.attribute.python, meta.member.access.python, source.python some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -super : meta.member.access.python, source.python +super : meta.attribute.python, meta.member.access.python, source.python some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -unicode : meta.member.access.python, source.python +unicode : meta.attribute.python, meta.member.access.python, source.python some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -foo : meta.member.access.python, source.python +foo : meta.attribute.python, meta.member.access.python, source.python some : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -Exception : meta.member.access.python, source.python +Exception : meta.attribute.python, meta.member.access.python, source.python diff --git a/test/calls/call1.py b/test/calls/call1.py index aab3f9f7..86f32acb 100644 --- a/test/calls/call1.py +++ b/test/calls/call1.py @@ -2,6 +2,7 @@ + some_call : meta.function-call.generic.python, meta.function-call.python, source.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python A : meta.function-call.arguments.python, meta.function-call.python, source.python @@ -10,7 +11,7 @@ b : meta.function-call.arguments.python, meta.function-call.python, source.python , : meta.function-call.arguments.python, meta.function-call.python, punctuation.separator.arguments.python, source.python : meta.function-call.arguments.python, meta.function-call.python, source.python -c : meta.function-call.arguments.python, meta.function-call.python, meta.item-access.python, source.python +c : meta.function-call.arguments.python, meta.function-call.python, meta.indexed-name.python, meta.item-access.python, source.python [ : meta.function-call.arguments.python, meta.function-call.python, meta.item-access.python, punctuation.definition.arguments.begin.python, source.python 1 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.item-access.arguments.python, meta.item-access.python, source.python ] : meta.function-call.arguments.python, meta.function-call.python, meta.item-access.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/calls/call4.py b/test/calls/call4.py index 9cfce7af..6da33186 100644 --- a/test/calls/call4.py +++ b/test/calls/call4.py @@ -29,4 +29,4 @@ . : meta.member.access.python, punctuation.separator.period.python, source.python None : keyword.illegal.name.python, meta.member.access.python, source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -baz : meta.member.access.python, source.python +baz : meta.attribute.python, meta.member.access.python, source.python diff --git a/test/calls/print1.py b/test/calls/print1.py index 8ce2b03f..9339060e 100644 --- a/test/calls/print1.py +++ b/test/calls/print1.py @@ -57,7 +57,7 @@ >> : keyword.operator.bitwise.python, source.python sys : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -stderr : meta.member.access.python, source.python +stderr : meta.attribute.python, meta.member.access.python, source.python , : punctuation.separator.element.python, source.python : source.python " : punctuation.definition.string.begin.python, source.python, string.quoted.single.python @@ -74,7 +74,7 @@ = : keyword.operator.assignment.python, meta.function-call.arguments.python, meta.function-call.python, source.python sys : meta.function-call.arguments.python, meta.function-call.python, source.python . : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, punctuation.separator.period.python, source.python -stderr : meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +stderr : meta.attribute.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python ) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python print : meta.function-call.python, source.python, support.function.builtin.python : meta.function-call.python, source.python diff --git a/test/classes/class11.py b/test/classes/class11.py index 4995c536..4cb0b927 100644 --- a/test/classes/class11.py +++ b/test/classes/class11.py @@ -34,7 +34,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python self : source.python, variable.language.special.self.python . : meta.member.access.python, punctuation.separator.period.python, source.python -a : meta.member.access.python, source.python +a : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -42,7 +42,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python self : source.python, variable.language.special.self.python . : meta.member.access.python, punctuation.separator.period.python, source.python -b : meta.member.access.python, source.python +b : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -59,7 +59,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python a : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -self : meta.member.access.python, source.python +self : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -67,9 +67,9 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python a : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -self : meta.member.access.python, source.python +self : meta.attribute.python, meta.member.access.python, source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -bar : meta.member.access.python, source.python +bar : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python diff --git a/test/classes/class12.py b/test/classes/class12.py index 2d34fc81..838a1bb2 100644 --- a/test/classes/class12.py +++ b/test/classes/class12.py @@ -39,7 +39,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python cls : source.python, variable.language.special.cls.python . : meta.member.access.python, punctuation.separator.period.python, source.python -a : meta.member.access.python, source.python +a : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -47,7 +47,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python cls : source.python, variable.language.special.cls.python . : meta.member.access.python, punctuation.separator.period.python, source.python -b : meta.member.access.python, source.python +b : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -70,7 +70,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python a : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -cls : meta.member.access.python, source.python +cls : meta.attribute.python, meta.member.access.python, source.python : source.python = : keyword.operator.assignment.python, source.python : source.python @@ -78,7 +78,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python a : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -cls : meta.member.access.python, source.python +cls : meta.attribute.python, meta.member.access.python, source.python . : meta.member.access.python, punctuation.separator.period.python, source.python __name__ : meta.member.access.python, source.python, support.variable.magic.python : source.python diff --git a/test/expressions/const1.py b/test/expressions/const1.py index 384f93be..5288d71a 100644 --- a/test/expressions/const1.py +++ b/test/expressions/const1.py @@ -14,7 +14,7 @@ : source.python QQQ : constant.other.caps.python, source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -bar : meta.member.access.python, source.python +bar : meta.attribute.python, meta.member.access.python, source.python : source.python baz : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python diff --git a/test/expressions/expr11.py b/test/expressions/expr11.py index 754112c8..de8e348c 100644 --- a/test/expressions/expr11.py +++ b/test/expressions/expr11.py @@ -9,7 +9,7 @@ : source.python self : source.python, variable.language.special.self.python . : meta.member.access.python, punctuation.separator.period.python, source.python -some_list : meta.item-access.python, meta.member.access.python, source.python +some_list : meta.indexed-name.python, meta.item-access.python, meta.member.access.python, source.python [ : meta.item-access.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python 1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, source.python : : meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, punctuation.separator.slice.python, source.python diff --git a/test/expressions/expr15.py b/test/expressions/expr15.py index 0685ff23..4038218a 100644 --- a/test/expressions/expr15.py +++ b/test/expressions/expr15.py @@ -5,4 +5,4 @@ foofrom : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -something : meta.member.access.python, source.python +something : meta.attribute.python, meta.member.access.python, source.python diff --git a/test/expressions/expr18.py b/test/expressions/expr18.py index 3ef0ad22..6e9413bf 100644 --- a/test/expressions/expr18.py +++ b/test/expressions/expr18.py @@ -6,7 +6,7 @@ a : source.python . : meta.member.access.python, punctuation.separator.period.python, source.python -Exception : meta.member.access.python, source.python +Exception : meta.attribute.python, meta.member.access.python, source.python Exception : source.python, support.type.exception.python . : meta.member.access.python, punctuation.separator.period.python, source.python -a : meta.member.access.python, source.python +a : meta.attribute.python, meta.member.access.python, source.python diff --git a/test/fstrings/nested1.py b/test/fstrings/nested1.py index d7d1c8bf..91f15907 100644 --- a/test/fstrings/nested1.py +++ b/test/fstrings/nested1.py @@ -26,7 +26,7 @@ : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python, string.interpolated.python, string.quoted.multi.python { : constant.character.format.placeholder.other.python, meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, source.python -bar : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.item-access.python, source.python +bar : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.indexed-name.python, meta.item-access.python, source.python [ : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.item-access.python, punctuation.definition.arguments.begin.python, source.python " : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.item-access.arguments.python, meta.item-access.python, punctuation.definition.string.begin.python, source.python, string.quoted.single.python q : meta.fstring.python, meta.function-call.arguments.python, meta.function-call.python, meta.item-access.arguments.python, meta.item-access.python, source.python, string.quoted.single.python diff --git a/test/functions/decl2.py b/test/functions/decl2.py index 7da74fcb..f858ea26 100644 --- a/test/functions/decl2.py +++ b/test/functions/decl2.py @@ -2,6 +2,8 @@ def result_annot(lambda, lambda=) -> qqq[None]: pass + + def : meta.function.python, source.python, storage.type.function.python : meta.function.python, source.python result_annot : entity.name.function.python, meta.function.python, source.python @@ -14,7 +16,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : meta.function.python, source.python -> : meta.function.python, punctuation.separator.annotation.result.python, source.python : meta.function.python, source.python -qqq : meta.function.python, meta.item-access.python, source.python +qqq : meta.function.python, meta.indexed-name.python, meta.item-access.python, source.python [ : meta.function.python, meta.item-access.python, punctuation.definition.arguments.begin.python, source.python None : constant.language.python, meta.function.python, meta.item-access.arguments.python, meta.item-access.python, source.python ] : meta.function.python, meta.item-access.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/functions/decorators6.py b/test/functions/decorators6.py index 8a167cad..5c9b4289 100644 --- a/test/functions/decorators6.py +++ b/test/functions/decorators6.py @@ -6,6 +6,8 @@ def foo(): pass + + @ : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.definition.decorator.python, source.python a : entity.name.function.decorator.python, meta.function.decorator.python, source.python . : entity.name.function.decorator.python, meta.function.decorator.python, punctuation.separator.period.python, source.python @@ -29,7 +31,7 @@ def foo(): pass ) : meta.function.decorator.python, punctuation.definition.arguments.end.python, source.python . \ : invalid.illegal.decorator.python, meta.function.decorator.python, source.python : source.python -baz : meta.item-access.python, source.python +baz : meta.indexed-name.python, meta.item-access.python, source.python [ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python 1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python : : meta.item-access.arguments.python, meta.item-access.python, punctuation.separator.slice.python, source.python diff --git a/test/statements/annotation1.py b/test/statements/annotation1.py index a72bafc6..332cd26a 100644 --- a/test/statements/annotation1.py +++ b/test/statements/annotation1.py @@ -3,6 +3,7 @@ + some_number : source.python : : punctuation.separator.colon.python, source.python : source.python @@ -13,7 +14,7 @@ some_list : source.python : : punctuation.separator.colon.python, source.python : source.python -List : meta.item-access.python, source.python +List : meta.indexed-name.python, meta.item-access.python, source.python [ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python int : meta.item-access.arguments.python, meta.item-access.python, source.python, support.type.python ] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python diff --git a/test/strings/bytes2.py b/test/strings/bytes2.py index 22df557e..7aefd973 100644 --- a/test/strings/bytes2.py +++ b/test/strings/bytes2.py @@ -8,7 +8,8 @@ -a : meta.item-access.python, source.python + +a : meta.indexed-name.python, meta.item-access.python, source.python [ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python 1 : constant.numeric.dec.python, meta.item-access.arguments.python, meta.item-access.python, source.python ] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python From 72ccccbf68bb3e4e858e50386edaa0c55f637d8e Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Fri, 1 May 2020 07:43:27 -0400 Subject: [PATCH 41/49] Improve detection of call signature and kwargs. Correctly identify calls of the form "foo[123](bar=2)" to highlight the contents of the parentheses as call arguments. Issue: #197 --- grammars/MagicPython.cson | 26 ++++++++++ grammars/MagicPython.tmLanguage | 36 ++++++++++++++ grammars/src/MagicPython.syntax.yaml | 17 +++++++ test/atom-spec/python-spec.js | 71 ++++++++++++++++++++++++++++ test/calls/call11.py | 44 +++++++++++++++++ 5 files changed, 194 insertions(+) create mode 100644 test/calls/call11.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 0cf28d5e..c3a2a5f5 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -343,6 +343,9 @@ repository: { include: "#list" } + { + include: "#odd-function-call" + } { include: "#round-braces" } @@ -513,6 +516,28 @@ repository: include: "#expression" } ] + "odd-function-call": + comment: ''' + A bit obscured function call where there may have been an + arbitrary number of other operations to get the function. + E.g. "arr[idx](args)" + + ''' + begin: ''' + (?x) + (?<= \\] | \\) ) \\s* + (?=\\() + + ''' + end: "(\\))" + endCaptures: + "1": + name: "punctuation.definition.arguments.end.python" + patterns: [ + { + include: "#function-arguments" + } + ] "round-braces": begin: "\\(" end: "\\)" @@ -1627,6 +1652,7 @@ repository: ] "function-call": name: "meta.function-call.python" + comment: "Regular function call of the type \"name(args)\"" begin: ''' (?x) \\b(?= diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 81d6e2d7..5038a69c 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -521,6 +521,10 @@ it's probably control flow like: include #list + + include + #odd-function-call + include #round-braces @@ -779,6 +783,36 @@ it's probably control flow like: + odd-function-call + + comment + A bit obscured function call where there may have been an +arbitrary number of other operations to get the function. +E.g. "arr[idx](args)" + + begin + (?x) + (?<= \] | \) ) \s* + (?=\() + + end + (\)) + endCaptures + + 1 + + name + punctuation.definition.arguments.end.python + + + patterns + + + include + #function-arguments + + + round-braces begin @@ -2554,6 +2588,8 @@ it's probably control flow like: name meta.function-call.python + comment + Regular function call of the type "name(args)" begin (?x) \b(?= diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index c39cc8d2..1d35a767 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -404,6 +404,7 @@ repository: - include: '#curly-braces' - include: '#item-access' - include: '#list' + - include: '#odd-function-call' - include: '#round-braces' - include: '#function-call' - include: '#builtin-functions' @@ -505,6 +506,21 @@ repository: patterns: - include: '#expression' + odd-function-call: + comment: | + A bit obscured function call where there may have been an + arbitrary number of other operations to get the function. + E.g. "arr[idx](args)" + begin: | + (?x) + (?<= \] | \) ) \s* + (?=\() + end: (\)) + endCaptures: + '1': {name: punctuation.definition.arguments.end.python} + patterns: + - include: '#function-arguments' + round-braces: begin: \( end: \) @@ -1230,6 +1246,7 @@ repository: function-call: name: meta.function-call.python + comment: Regular function call of the type "name(args)" begin: | (?x) \b(?= diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 2d052ff2..ed69cdfe 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -651,6 +651,77 @@ describe("Grammar Tests", function() { expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); }); + it("test/calls/call11.py", + function() { + tokens = grammar.tokenizeLines("id = Field[uuid.UUID] (\n uuid.UUID,\n inheritable=False,\n simpledelta=False,\n allow_ddl_set=True,\n)") + expect(tokens[0][0].value).toBe("id"); + expect(tokens[0][0].scopes).toEqual(["source.python","support.function.builtin.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("Field"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.item-access.python","meta.indexed-name.python"]); + expect(tokens[0][5].value).toBe("["); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][6].value).toBe("uuid"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python"]); + expect(tokens[0][7].value).toBe("."); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","meta.member.access.python","punctuation.separator.period.python"]); + expect(tokens[0][8].value).toBe("UUID"); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","meta.member.access.python","constant.other.caps.python"]); + expect(tokens[0][9].value).toBe("]"); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][10].value).toBe(" "); + expect(tokens[0][10].scopes).toEqual(["source.python"]); + expect(tokens[0][11].value).toBe("("); + expect(tokens[0][11].scopes).toEqual(["source.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][0].value).toBe(" "); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.arguments.python"]); + expect(tokens[1][1].value).toBe("uuid"); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.arguments.python"]); + expect(tokens[1][2].value).toBe("."); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.arguments.python","meta.member.access.python","punctuation.separator.period.python"]); + expect(tokens[1][3].value).toBe("UUID"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.arguments.python","meta.member.access.python","constant.other.caps.python"]); + expect(tokens[1][4].value).toBe(","); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[2][0].value).toBe(" "); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.function-call.arguments.python"]); + expect(tokens[2][1].value).toBe("inheritable"); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[2][2].value).toBe("="); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[2][3].value).toBe("False"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.arguments.python","constant.language.python"]); + expect(tokens[2][4].value).toBe(","); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[3][0].value).toBe(" "); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.function-call.arguments.python"]); + expect(tokens[3][1].value).toBe("simpledelta"); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[3][2].value).toBe("="); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[3][3].value).toBe("False"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.arguments.python","constant.language.python"]); + expect(tokens[3][4].value).toBe(","); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[4][0].value).toBe(" "); + expect(tokens[4][0].scopes).toEqual(["source.python","meta.function-call.arguments.python"]); + expect(tokens[4][1].value).toBe("allow_ddl_set"); + expect(tokens[4][1].scopes).toEqual(["source.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]); + expect(tokens[4][2].value).toBe("="); + expect(tokens[4][2].scopes).toEqual(["source.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]); + expect(tokens[4][3].value).toBe("True"); + expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.arguments.python","constant.language.python"]); + expect(tokens[4][4].value).toBe(","); + expect(tokens[4][4].scopes).toEqual(["source.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]); + expect(tokens[5][0].value).toBe(")"); + expect(tokens[5][0].scopes).toEqual(["source.python","punctuation.definition.arguments.end.python"]); + }); + it("test/calls/call2.py", function() { tokens = grammar.tokenizeLines("foo(from=1)") diff --git a/test/calls/call11.py b/test/calls/call11.py new file mode 100644 index 00000000..3695fc57 --- /dev/null +++ b/test/calls/call11.py @@ -0,0 +1,44 @@ +id = Field[uuid.UUID] ( + uuid.UUID, + inheritable=False, + simpledelta=False, + allow_ddl_set=True, +) + + + + + +id : source.python, support.function.builtin.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +Field : meta.indexed-name.python, meta.item-access.python, source.python +[ : meta.item-access.python, punctuation.definition.arguments.begin.python, source.python +uuid : meta.item-access.arguments.python, meta.item-access.python, source.python +. : meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, punctuation.separator.period.python, source.python +UUID : constant.other.caps.python, meta.item-access.arguments.python, meta.item-access.python, meta.member.access.python, source.python +] : meta.item-access.python, punctuation.definition.arguments.end.python, source.python + : source.python +( : punctuation.definition.arguments.begin.python, source.python + : meta.function-call.arguments.python, source.python +uuid : meta.function-call.arguments.python, source.python +. : meta.function-call.arguments.python, meta.member.access.python, punctuation.separator.period.python, source.python +UUID : constant.other.caps.python, meta.function-call.arguments.python, meta.member.access.python, source.python +, : meta.function-call.arguments.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, source.python +inheritable : meta.function-call.arguments.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, source.python +False : constant.language.python, meta.function-call.arguments.python, source.python +, : meta.function-call.arguments.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, source.python +simpledelta : meta.function-call.arguments.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, source.python +False : constant.language.python, meta.function-call.arguments.python, source.python +, : meta.function-call.arguments.python, punctuation.separator.arguments.python, source.python + : meta.function-call.arguments.python, source.python +allow_ddl_set : meta.function-call.arguments.python, source.python, variable.parameter.function-call.python += : keyword.operator.assignment.python, meta.function-call.arguments.python, source.python +True : constant.language.python, meta.function-call.arguments.python, source.python +, : meta.function-call.arguments.python, punctuation.separator.arguments.python, source.python +) : punctuation.definition.arguments.end.python, source.python From 2ca894f270f92e2bc8f09a2ebdcd482fbb3b1074 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Fri, 1 May 2020 07:49:17 -0400 Subject: [PATCH 42/49] Update the way "in" is scoped. The "in" keyword is scoped as either `keyword.operator.logical.python` or as `keyword.control.flow.python` depending on whether it appears as part of a "for ... in" construct. Fixes: #193 --- grammars/MagicPython.cson | 25 +++++++++ grammars/MagicPython.tmLanguage | 42 ++++++++++++++ grammars/src/MagicPython.syntax.yaml | 15 +++++ test/atom-spec/python-spec.js | 83 ++++++++++++++++++++++++---- test/expressions/expr4.py | 2 +- test/expressions/keywords.py | 8 ++- test/functions/async1.py | 2 +- test/functions/decl4.py | 2 +- test/statements/for1.py | 2 +- test/statements/for2.py | 35 ++++++++++++ test/strings/bug1.py | 2 +- 11 files changed, 200 insertions(+), 18 deletions(-) create mode 100644 test/statements/for2.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index c3a2a5f5..1e776684 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -46,6 +46,9 @@ repository: { include: "#function-declaration" } + { + include: "#generator" + } { include: "#statement-keyword" } @@ -328,6 +331,9 @@ repository: { include: "#lambda" } + { + include: "#generator" + } { include: "#illegal-operator" } @@ -1318,6 +1324,25 @@ repository: include: "#expression" } ] + generator: + comment: ''' + Match "for ... in" construct used in generators and for loops to + correctly identify the "in" as a control flow keyword. + + ''' + 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: ''' diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 5038a69c..cbc2f0ba 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -69,6 +69,10 @@ include #function-declaration + + include + #generator + include #statement-keyword @@ -501,6 +505,10 @@ it's probably control flow like: include #lambda + + include + #generator + include #illegal-operator @@ -2046,6 +2054,40 @@ E.g. "arr[idx](args)" + generator + + comment + Match "for ... in" construct used in generators and for loops to +correctly identify the "in" as a control flow keyword. + + begin + for + beginCaptures + + 0 + + name + keyword.control.flow.python + + + end + in + endCaptures + + 0 + + name + keyword.control.flow.python + + + patterns + + + include + #expression + + + function-declaration name diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 1d35a767..778e7b1f 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -221,6 +221,7 @@ repository: - include: '#import' - include: '#class-declaration' - include: '#function-declaration' + - include: '#generator' - include: '#statement-keyword' - include: '#assignment-operator' - include: '#decorator' @@ -399,6 +400,7 @@ repository: - include: '#regexp' - include: '#string' - include: '#lambda' + - include: '#generator' - include: '#illegal-operator' - include: '#operator' - include: '#curly-braces' @@ -1040,6 +1042,19 @@ repository: patterns: - include: '#expression' + generator: + comment: | + Match "for ... in" construct used in generators and for loops to + correctly identify the "in" as a control flow keyword. + 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: | diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index ed69cdfe..5fe7f9a2 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -5865,7 +5865,7 @@ describe("Grammar Tests", function() { expect(tokens[0][10].value).toBe(" "); expect(tokens[0][10].scopes).toEqual(["source.python"]); expect(tokens[0][11].value).toBe("in"); - expect(tokens[0][11].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[0][11].scopes).toEqual(["source.python","keyword.control.flow.python"]); expect(tokens[0][12].value).toBe(" "); expect(tokens[0][12].scopes).toEqual(["source.python"]); expect(tokens[0][13].value).toBe("range"); @@ -6147,7 +6147,7 @@ describe("Grammar Tests", function() { it("test/expressions/keywords.py", function() { - tokens = grammar.tokenizeLines("as async await continue del assert break finally for\nfrom elif else if import except pass raise\nreturn try while with\n\nnonlocal global class def") + tokens = grammar.tokenizeLines("as async await continue del assert break finally\nfrom elif else if import except pass raise\nreturn try while with\n\nnonlocal global class def\n\nfor") expect(tokens[0][0].value).toBe("as"); expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]); expect(tokens[0][1].value).toBe(" "); @@ -6178,10 +6178,6 @@ describe("Grammar Tests", function() { expect(tokens[0][13].scopes).toEqual(["source.python"]); expect(tokens[0][14].value).toBe("finally"); expect(tokens[0][14].scopes).toEqual(["source.python","keyword.control.flow.python"]); - expect(tokens[0][15].value).toBe(" "); - expect(tokens[0][15].scopes).toEqual(["source.python"]); - expect(tokens[0][16].value).toBe("for"); - expect(tokens[0][16].scopes).toEqual(["source.python","keyword.control.flow.python"]); expect(tokens[1][0].value).toBe("from"); expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.import.python"]); expect(tokens[1][1].value).toBe(" "); @@ -6240,6 +6236,10 @@ describe("Grammar Tests", function() { expect(tokens[4][4].scopes).toEqual(["source.python","storage.type.class.python"]); expect(tokens[4][5].value).toBe(" def"); expect(tokens[4][5].scopes).toEqual(["source.python","storage.type.function.python"]); + expect(tokens[5][0].value).toBe(""); + expect(tokens[5][0].scopes).toEqual(["source.python"]); + expect(tokens[6][0].value).toBe("for"); + expect(tokens[6][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); }); it("test/expressions/special1.py", @@ -7988,7 +7988,7 @@ describe("Grammar Tests", function() { expect(tokens[3][12].value).toBe(" "); expect(tokens[3][12].scopes).toEqual(["source.python"]); expect(tokens[3][13].value).toBe("in"); - expect(tokens[3][13].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[3][13].scopes).toEqual(["source.python","keyword.control.flow.python"]); expect(tokens[3][14].value).toBe(" "); expect(tokens[3][14].scopes).toEqual(["source.python"]); expect(tokens[3][15].value).toBe("b"); @@ -8735,7 +8735,7 @@ describe("Grammar Tests", function() { expect(tokens[4][7].value).toBe(" "); expect(tokens[4][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); expect(tokens[4][8].value).toBe("in"); - expect(tokens[4][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.logical.python"]); + expect(tokens[4][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.control.flow.python"]); expect(tokens[5][0].value).toBe(" "); expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); expect(tokens[5][1].value).toBe("("); @@ -12165,7 +12165,7 @@ describe("Grammar Tests", function() { expect(tokens[0][9].value).toBe(" "); expect(tokens[0][9].scopes).toEqual(["source.python"]); expect(tokens[0][10].value).toBe("in"); - expect(tokens[0][10].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[0][10].scopes).toEqual(["source.python","keyword.control.flow.python"]); expect(tokens[0][11].value).toBe(" "); expect(tokens[0][11].scopes).toEqual(["source.python"]); expect(tokens[0][12].value).toBe("b"); @@ -12190,6 +12190,69 @@ describe("Grammar Tests", function() { expect(tokens[3][3].scopes).toEqual(["source.python","constant.numeric.dec.python"]); }); + it("test/statements/for2.py", + function() { + tokens = grammar.tokenizeLines("for a, b, c in [2 in q, 2 in w]:\n pass") + expect(tokens[0][0].value).toBe("for"); + expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("a"); + expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][3].value).toBe(","); + expect(tokens[0][3].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[0][4].value).toBe(" "); + expect(tokens[0][4].scopes).toEqual(["source.python"]); + expect(tokens[0][5].value).toBe("b"); + expect(tokens[0][5].scopes).toEqual(["source.python"]); + expect(tokens[0][6].value).toBe(","); + expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[0][7].value).toBe(" "); + expect(tokens[0][7].scopes).toEqual(["source.python"]); + expect(tokens[0][8].value).toBe("c"); + expect(tokens[0][8].scopes).toEqual(["source.python"]); + expect(tokens[0][9].value).toBe(" "); + expect(tokens[0][9].scopes).toEqual(["source.python"]); + expect(tokens[0][10].value).toBe("in"); + expect(tokens[0][10].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[0][11].value).toBe(" "); + expect(tokens[0][11].scopes).toEqual(["source.python"]); + expect(tokens[0][12].value).toBe("["); + expect(tokens[0][12].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]); + expect(tokens[0][13].value).toBe("2"); + expect(tokens[0][13].scopes).toEqual(["source.python","constant.numeric.dec.python"]); + expect(tokens[0][14].value).toBe(" "); + expect(tokens[0][14].scopes).toEqual(["source.python"]); + expect(tokens[0][15].value).toBe("in"); + expect(tokens[0][15].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[0][16].value).toBe(" "); + expect(tokens[0][16].scopes).toEqual(["source.python"]); + expect(tokens[0][17].value).toBe("q"); + expect(tokens[0][17].scopes).toEqual(["source.python"]); + expect(tokens[0][18].value).toBe(","); + expect(tokens[0][18].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[0][19].value).toBe(" "); + expect(tokens[0][19].scopes).toEqual(["source.python"]); + expect(tokens[0][20].value).toBe("2"); + expect(tokens[0][20].scopes).toEqual(["source.python","constant.numeric.dec.python"]); + expect(tokens[0][21].value).toBe(" "); + expect(tokens[0][21].scopes).toEqual(["source.python"]); + expect(tokens[0][22].value).toBe("in"); + expect(tokens[0][22].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[0][23].value).toBe(" "); + expect(tokens[0][23].scopes).toEqual(["source.python"]); + expect(tokens[0][24].value).toBe("w"); + expect(tokens[0][24].scopes).toEqual(["source.python"]); + expect(tokens[0][25].value).toBe("]"); + expect(tokens[0][25].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]); + expect(tokens[0][26].value).toBe(":"); + expect(tokens[0][26].scopes).toEqual(["source.python","punctuation.separator.colon.python"]); + expect(tokens[1][0].value).toBe(" "); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe("pass"); + expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]); + }); + it("test/statements/from1.py", function() { tokens = grammar.tokenizeLines("from ... import foo as bar\nraise Exception('done') from exc\nyield from foo") @@ -13271,7 +13334,7 @@ describe("Grammar Tests", function() { expect(tokens[2][21].value).toBe(" "); expect(tokens[2][21].scopes).toEqual(["source.python"]); expect(tokens[2][22].value).toBe("in"); - expect(tokens[2][22].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[2][22].scopes).toEqual(["source.python","keyword.control.flow.python"]); expect(tokens[2][23].value).toBe(" "); expect(tokens[2][23].scopes).toEqual(["source.python"]); expect(tokens[2][24].value).toBe("foo"); diff --git a/test/expressions/expr4.py b/test/expressions/expr4.py index 6795c76d..ac5e5ddc 100644 --- a/test/expressions/expr4.py +++ b/test/expressions/expr4.py @@ -13,7 +13,7 @@ : source.python i : source.python : source.python -in : keyword.operator.logical.python, source.python +in : keyword.control.flow.python, source.python : source.python range : meta.function-call.python, source.python, support.function.builtin.python ( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python diff --git a/test/expressions/keywords.py b/test/expressions/keywords.py index 6ff1d516..7c14d5c2 100644 --- a/test/expressions/keywords.py +++ b/test/expressions/keywords.py @@ -1,9 +1,11 @@ -as async await continue del assert break finally for +as async await continue del assert break finally from elif else if import except pass raise return try while with nonlocal global class def +for + as : keyword.control.import.python, source.python @@ -21,8 +23,6 @@ break : keyword.control.flow.python, source.python : source.python finally : keyword.control.flow.python, source.python - : source.python -for : keyword.control.flow.python, source.python from : keyword.control.import.python, source.python : source.python elif : keyword.control.flow.python, source.python @@ -52,3 +52,5 @@ : source.python class : source.python, storage.type.class.python def : source.python, storage.type.function.python + : source.python +for : keyword.control.flow.python, source.python diff --git a/test/functions/async1.py b/test/functions/async1.py index d6a5546b..0218fafd 100644 --- a/test/functions/async1.py +++ b/test/functions/async1.py @@ -36,7 +36,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : source.python c : source.python : source.python -in : keyword.operator.logical.python, source.python +in : keyword.control.flow.python, source.python : source.python b : source.python : : punctuation.separator.colon.python, source.python diff --git a/test/functions/decl4.py b/test/functions/decl4.py index f3b40fe5..5a452ea4 100644 --- a/test/functions/decl4.py +++ b/test/functions/decl4.py @@ -38,7 +38,7 @@ def : meta.function.python, source.python, storage.type.function.pytho : meta.function.parameters.python, meta.function.python, source.python val : meta.function.parameters.python, meta.function.python, source.python : meta.function.parameters.python, meta.function.python, source.python -in : keyword.operator.logical.python, meta.function.parameters.python, meta.function.python, source.python +in : keyword.control.flow.python, meta.function.parameters.python, meta.function.python, source.python : meta.function.parameters.python, meta.function.python, source.python ( : meta.function.parameters.python, meta.function.python, punctuation.parenthesis.begin.python, source.python x : meta.function.parameters.python, meta.function.python, source.python diff --git a/test/statements/for1.py b/test/statements/for1.py index 3300f8cb..b379ef19 100644 --- a/test/statements/for1.py +++ b/test/statements/for1.py @@ -15,7 +15,7 @@ : source.python c : source.python : source.python -in : keyword.operator.logical.python, source.python +in : keyword.control.flow.python, source.python : source.python b : source.python : : punctuation.separator.colon.python, source.python diff --git a/test/statements/for2.py b/test/statements/for2.py new file mode 100644 index 00000000..53b826d2 --- /dev/null +++ b/test/statements/for2.py @@ -0,0 +1,35 @@ +for a, b, c in [2 in q, 2 in w]: + pass + + + + +for : keyword.control.flow.python, source.python + : source.python +a : source.python +, : punctuation.separator.element.python, source.python + : source.python +b : source.python +, : punctuation.separator.element.python, source.python + : source.python +c : source.python + : source.python +in : keyword.control.flow.python, source.python + : source.python +[ : punctuation.definition.list.begin.python, source.python +2 : constant.numeric.dec.python, source.python + : source.python +in : keyword.operator.logical.python, source.python + : source.python +q : source.python +, : punctuation.separator.element.python, source.python + : source.python +2 : constant.numeric.dec.python, source.python + : source.python +in : keyword.operator.logical.python, source.python + : source.python +w : source.python +] : punctuation.definition.list.end.python, source.python +: : punctuation.separator.colon.python, source.python + : source.python +pass : keyword.control.flow.python, source.python diff --git a/test/strings/bug1.py b/test/strings/bug1.py index 9b43c6de..eeb0f950 100644 --- a/test/strings/bug1.py +++ b/test/strings/bug1.py @@ -35,7 +35,7 @@ : source.python v : source.python : source.python -in : keyword.operator.logical.python, source.python +in : keyword.control.flow.python, source.python : source.python foo : source.python : source.python From b4b2e6eb16fee36aea0788bf0aa1853c25f7d276 Mon Sep 17 00:00:00 2001 From: Ilia Novoselov Date: Mon, 18 May 2020 23:51:23 +0500 Subject: [PATCH 43/49] Fix for loop highlighting #211 (#212) --- grammars/MagicPython.cson | 4 +- grammars/MagicPython.tmLanguage | 4 +- grammars/src/MagicPython.syntax.yaml | 4 +- test/atom-spec/python-spec.js | 159 ++++++++++++++++++++------- test/statements/for2.py | 11 +- test/statements/for3.py | 38 +++++++ 6 files changed, 176 insertions(+), 44 deletions(-) create mode 100644 test/statements/for3.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 1e776684..26b9698c 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -1330,11 +1330,11 @@ repository: correctly identify the "in" as a control flow keyword. ''' - begin: "for" + begin: "\\bfor\\b" beginCaptures: "0": name: "keyword.control.flow.python" - end: "in" + end: "\\bin\\b" endCaptures: "0": name: "keyword.control.flow.python" diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index cbc2f0ba..d89bd165 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -2061,7 +2061,7 @@ E.g. "arr[idx](args)" correctly identify the "in" as a control flow keyword. begin - for + \bfor\b beginCaptures 0 @@ -2071,7 +2071,7 @@ correctly identify the "in" as a control flow keyword. end - in + \bin\b endCaptures 0 diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 778e7b1f..065d0873 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -1046,10 +1046,10 @@ repository: comment: | Match "for ... in" construct used in generators and for loops to correctly identify the "in" as a control flow keyword. - begin: for + begin: \bfor\b beginCaptures: '0': {name: keyword.control.flow.python} - end: in + end: \bin\b endCaptures: '0': {name: keyword.control.flow.python} patterns: diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 5fe7f9a2..032c3682 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -12192,11 +12192,90 @@ describe("Grammar Tests", function() { it("test/statements/for2.py", function() { - tokens = grammar.tokenizeLines("for a, b, c in [2 in q, 2 in w]:\n pass") - expect(tokens[0][0].value).toBe("for"); - expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); + tokens = grammar.tokenizeLines("forvariable = None\nfor a, b, c, invariable in [2 in q, 2 in w]:\n pass") + expect(tokens[0][0].value).toBe("forvariable"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); expect(tokens[0][1].value).toBe(" "); expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("None"); + expect(tokens[0][4].scopes).toEqual(["source.python","constant.language.python"]); + expect(tokens[1][0].value).toBe("for"); + expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("a"); + expect(tokens[1][2].scopes).toEqual(["source.python"]); + expect(tokens[1][3].value).toBe(","); + expect(tokens[1][3].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[1][4].value).toBe(" "); + expect(tokens[1][4].scopes).toEqual(["source.python"]); + expect(tokens[1][5].value).toBe("b"); + expect(tokens[1][5].scopes).toEqual(["source.python"]); + expect(tokens[1][6].value).toBe(","); + expect(tokens[1][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[1][7].value).toBe(" "); + expect(tokens[1][7].scopes).toEqual(["source.python"]); + expect(tokens[1][8].value).toBe("c"); + expect(tokens[1][8].scopes).toEqual(["source.python"]); + expect(tokens[1][9].value).toBe(","); + expect(tokens[1][9].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[1][10].value).toBe(" "); + expect(tokens[1][10].scopes).toEqual(["source.python"]); + expect(tokens[1][11].value).toBe("invariable"); + expect(tokens[1][11].scopes).toEqual(["source.python"]); + expect(tokens[1][12].value).toBe(" "); + expect(tokens[1][12].scopes).toEqual(["source.python"]); + expect(tokens[1][13].value).toBe("in"); + expect(tokens[1][13].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[1][14].value).toBe(" "); + expect(tokens[1][14].scopes).toEqual(["source.python"]); + expect(tokens[1][15].value).toBe("["); + expect(tokens[1][15].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]); + expect(tokens[1][16].value).toBe("2"); + expect(tokens[1][16].scopes).toEqual(["source.python","constant.numeric.dec.python"]); + expect(tokens[1][17].value).toBe(" "); + expect(tokens[1][17].scopes).toEqual(["source.python"]); + expect(tokens[1][18].value).toBe("in"); + expect(tokens[1][18].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[1][19].value).toBe(" "); + expect(tokens[1][19].scopes).toEqual(["source.python"]); + expect(tokens[1][20].value).toBe("q"); + expect(tokens[1][20].scopes).toEqual(["source.python"]); + expect(tokens[1][21].value).toBe(","); + expect(tokens[1][21].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[1][22].value).toBe(" "); + expect(tokens[1][22].scopes).toEqual(["source.python"]); + expect(tokens[1][23].value).toBe("2"); + expect(tokens[1][23].scopes).toEqual(["source.python","constant.numeric.dec.python"]); + expect(tokens[1][24].value).toBe(" "); + expect(tokens[1][24].scopes).toEqual(["source.python"]); + expect(tokens[1][25].value).toBe("in"); + expect(tokens[1][25].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[1][26].value).toBe(" "); + expect(tokens[1][26].scopes).toEqual(["source.python"]); + expect(tokens[1][27].value).toBe("w"); + expect(tokens[1][27].scopes).toEqual(["source.python"]); + expect(tokens[1][28].value).toBe("]"); + expect(tokens[1][28].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]); + expect(tokens[1][29].value).toBe(":"); + expect(tokens[1][29].scopes).toEqual(["source.python","punctuation.separator.colon.python"]); + expect(tokens[2][0].value).toBe(" "); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe("pass"); + expect(tokens[2][1].scopes).toEqual(["source.python","keyword.control.flow.python"]); + }); + + it("test/statements/for3.py", + function() { + tokens = grammar.tokenizeLines("for(a, b), c, invariable in[2 in q, 2 in w]:\n pass") + expect(tokens[0][0].value).toBe("for"); + expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[0][1].value).toBe("("); + expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]); expect(tokens[0][2].value).toBe("a"); expect(tokens[0][2].scopes).toEqual(["source.python"]); expect(tokens[0][3].value).toBe(","); @@ -12205,48 +12284,54 @@ describe("Grammar Tests", function() { expect(tokens[0][4].scopes).toEqual(["source.python"]); expect(tokens[0][5].value).toBe("b"); expect(tokens[0][5].scopes).toEqual(["source.python"]); - expect(tokens[0][6].value).toBe(","); - expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]); - expect(tokens[0][7].value).toBe(" "); - expect(tokens[0][7].scopes).toEqual(["source.python"]); - expect(tokens[0][8].value).toBe("c"); + expect(tokens[0][6].value).toBe(")"); + expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]); + expect(tokens[0][7].value).toBe(","); + expect(tokens[0][7].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[0][8].value).toBe(" "); expect(tokens[0][8].scopes).toEqual(["source.python"]); - expect(tokens[0][9].value).toBe(" "); + expect(tokens[0][9].value).toBe("c"); expect(tokens[0][9].scopes).toEqual(["source.python"]); - expect(tokens[0][10].value).toBe("in"); - expect(tokens[0][10].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[0][10].value).toBe(","); + expect(tokens[0][10].scopes).toEqual(["source.python","punctuation.separator.element.python"]); expect(tokens[0][11].value).toBe(" "); expect(tokens[0][11].scopes).toEqual(["source.python"]); - expect(tokens[0][12].value).toBe("["); - expect(tokens[0][12].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]); - expect(tokens[0][13].value).toBe("2"); - expect(tokens[0][13].scopes).toEqual(["source.python","constant.numeric.dec.python"]); - expect(tokens[0][14].value).toBe(" "); - expect(tokens[0][14].scopes).toEqual(["source.python"]); - expect(tokens[0][15].value).toBe("in"); - expect(tokens[0][15].scopes).toEqual(["source.python","keyword.operator.logical.python"]); - expect(tokens[0][16].value).toBe(" "); - expect(tokens[0][16].scopes).toEqual(["source.python"]); - expect(tokens[0][17].value).toBe("q"); + expect(tokens[0][12].value).toBe("invariable"); + expect(tokens[0][12].scopes).toEqual(["source.python"]); + expect(tokens[0][13].value).toBe(" "); + expect(tokens[0][13].scopes).toEqual(["source.python"]); + expect(tokens[0][14].value).toBe("in"); + expect(tokens[0][14].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[0][15].value).toBe("["); + expect(tokens[0][15].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]); + expect(tokens[0][16].value).toBe("2"); + expect(tokens[0][16].scopes).toEqual(["source.python","constant.numeric.dec.python"]); + expect(tokens[0][17].value).toBe(" "); expect(tokens[0][17].scopes).toEqual(["source.python"]); - expect(tokens[0][18].value).toBe(","); - expect(tokens[0][18].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[0][18].value).toBe("in"); + expect(tokens[0][18].scopes).toEqual(["source.python","keyword.operator.logical.python"]); expect(tokens[0][19].value).toBe(" "); expect(tokens[0][19].scopes).toEqual(["source.python"]); - expect(tokens[0][20].value).toBe("2"); - expect(tokens[0][20].scopes).toEqual(["source.python","constant.numeric.dec.python"]); - expect(tokens[0][21].value).toBe(" "); - expect(tokens[0][21].scopes).toEqual(["source.python"]); - expect(tokens[0][22].value).toBe("in"); - expect(tokens[0][22].scopes).toEqual(["source.python","keyword.operator.logical.python"]); - expect(tokens[0][23].value).toBe(" "); - expect(tokens[0][23].scopes).toEqual(["source.python"]); - expect(tokens[0][24].value).toBe("w"); + expect(tokens[0][20].value).toBe("q"); + expect(tokens[0][20].scopes).toEqual(["source.python"]); + expect(tokens[0][21].value).toBe(","); + expect(tokens[0][21].scopes).toEqual(["source.python","punctuation.separator.element.python"]); + expect(tokens[0][22].value).toBe(" "); + expect(tokens[0][22].scopes).toEqual(["source.python"]); + expect(tokens[0][23].value).toBe("2"); + expect(tokens[0][23].scopes).toEqual(["source.python","constant.numeric.dec.python"]); + expect(tokens[0][24].value).toBe(" "); expect(tokens[0][24].scopes).toEqual(["source.python"]); - expect(tokens[0][25].value).toBe("]"); - expect(tokens[0][25].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]); - expect(tokens[0][26].value).toBe(":"); - expect(tokens[0][26].scopes).toEqual(["source.python","punctuation.separator.colon.python"]); + expect(tokens[0][25].value).toBe("in"); + expect(tokens[0][25].scopes).toEqual(["source.python","keyword.operator.logical.python"]); + expect(tokens[0][26].value).toBe(" "); + expect(tokens[0][26].scopes).toEqual(["source.python"]); + expect(tokens[0][27].value).toBe("w"); + expect(tokens[0][27].scopes).toEqual(["source.python"]); + expect(tokens[0][28].value).toBe("]"); + expect(tokens[0][28].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]); + expect(tokens[0][29].value).toBe(":"); + expect(tokens[0][29].scopes).toEqual(["source.python","punctuation.separator.colon.python"]); expect(tokens[1][0].value).toBe(" "); expect(tokens[1][0].scopes).toEqual(["source.python"]); expect(tokens[1][1].value).toBe("pass"); diff --git a/test/statements/for2.py b/test/statements/for2.py index 53b826d2..8468e08e 100644 --- a/test/statements/for2.py +++ b/test/statements/for2.py @@ -1,9 +1,15 @@ -for a, b, c in [2 in q, 2 in w]: +forvariable = None +for a, b, c, invariable in [2 in q, 2 in w]: pass +forvariable : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +None : constant.language.python, source.python for : keyword.control.flow.python, source.python : source.python a : source.python @@ -13,6 +19,9 @@ , : punctuation.separator.element.python, source.python : source.python c : source.python +, : punctuation.separator.element.python, source.python + : source.python +invariable : source.python : source.python in : keyword.control.flow.python, source.python : source.python diff --git a/test/statements/for3.py b/test/statements/for3.py new file mode 100644 index 00000000..5ebfc592 --- /dev/null +++ b/test/statements/for3.py @@ -0,0 +1,38 @@ +for(a, b), c, invariable in[2 in q, 2 in w]: + pass + + + + +for : keyword.control.flow.python, source.python +( : punctuation.parenthesis.begin.python, source.python +a : source.python +, : punctuation.separator.element.python, source.python + : source.python +b : source.python +) : punctuation.parenthesis.end.python, source.python +, : punctuation.separator.element.python, source.python + : source.python +c : source.python +, : punctuation.separator.element.python, source.python + : source.python +invariable : source.python + : source.python +in : keyword.control.flow.python, source.python +[ : punctuation.definition.list.begin.python, source.python +2 : constant.numeric.dec.python, source.python + : source.python +in : keyword.operator.logical.python, source.python + : source.python +q : source.python +, : punctuation.separator.element.python, source.python + : source.python +2 : constant.numeric.dec.python, source.python + : source.python +in : keyword.operator.logical.python, source.python + : source.python +w : source.python +] : punctuation.definition.list.end.python, source.python +: : punctuation.separator.colon.python, source.python + : source.python +pass : keyword.control.flow.python, source.python From 225fa4c4e3d8bfe450e52ab03660851bcb99a705 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 21 Feb 2020 20:58:14 -0800 Subject: [PATCH 44/49] constant.numeric.dec.python only has 2 capture groups --- grammars/MagicPython.cson | 2 -- grammars/MagicPython.tmLanguage | 5 ----- grammars/src/MagicPython.syntax.yaml | 1 - 3 files changed, 8 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 26b9698c..6e75a4af 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -719,8 +719,6 @@ repository: name: "storage.type.imaginary.number.python" "2": name: "invalid.illegal.dec.python" - "3": - name: "invalid.illegal.dec.python" "number-hex": name: "constant.numeric.hex.python" match: ''' diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index d89bd165..fec12e3c 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -1092,11 +1092,6 @@ E.g. "arr[idx](args)" name invalid.illegal.dec.python - 3 - - name - invalid.illegal.dec.python - number-hex diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 065d0873..32186e92 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -650,7 +650,6 @@ repository: captures: '1': {name: storage.type.imaginary.number.python} '2': {name: invalid.illegal.dec.python} - '3': {name: invalid.illegal.dec.python} number-hex: name: constant.numeric.hex.python From b2b4f4ae7b4e6284e80bda8080106b93bd588f9e Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sat, 16 Dec 2017 12:45:51 +0100 Subject: [PATCH 45/49] Remove invalid first_line_match key --- grammars/MagicPython.cson | 1 - grammars/MagicPython.tmLanguage | 2 -- grammars/src/MagicPython.syntax.yaml | 1 - 3 files changed, 4 deletions(-) diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 6e75a4af..6486dba4 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -20,7 +20,6 @@ fileTypes: [ "smk" "tac" ] -first_line_match: "^#![ \\t]*/.*\\bpython[\\d\\.]*\\b" firstLineMatch: "^#![ \\t]*/.*\\bpython[\\d\\.]*\\b" uuid: "742deb57-6e38-4192-bed6-410746efd85d" patterns: [ diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index fec12e3c..5a07f545 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -27,8 +27,6 @@ smk tac - first_line_match - ^#![ \t]*/.*\bpython[\d\.]*\b firstLineMatch ^#![ \t]*/.*\bpython[\d\.]*\b uuid diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 32186e92..9c80c8b3 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -5,7 +5,6 @@ scopeName: source.python fileTypes: [py, py3, rpy, pyw, cpy, pyi, SConstruct, Sconstruct, sconstruct, SConscript, gyp, gypi, wsgi, kv, Snakefile, smk, tac] -first_line_match: ^#![ \t]*/.*\bpython[\d\.]*\b firstLineMatch: ^#![ \t]*/.*\bpython[\d\.]*\b uuid: 742deb57-6e38-4192-bed6-410746efd85d From 2802ded681e0ab1a1057821c1da287147d639505 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Wed, 11 Nov 2020 18:15:21 -0800 Subject: [PATCH 46/49] Github doesn't seem to use MP for highlighter tokenization MagicPython is still used by Linguist, but the actual syntax hightlighting seems to be driven by something else now. Thus, remove the outdated statement from the README. Closes: #225 --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 41a48420..64d9eb43 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ with [Sublime Text](http://www.sublimetext.com), [Atom](http://atom.io) and [Visual Studio Code](http://code.visualstudio.com). It is meant to be a drop-in replacement for the default Python package. -We are proud to say that MagicPython is used by GitHub to highlight Python. - **Attention VSCode users**: MagicPython is used as the _default_ Python highlighter in Visual Studio Code. Don't install it unless you want or need the cutting edge version of it. You will likely see no From db32a0d840b3a44d03596e31a4d5a936d99a8d8a Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Fri, 31 Jul 2020 05:08:47 -0400 Subject: [PATCH 47/49] Add Python 3.8 features. Add walrus operator `:=`. Add positional only args separator `/`. Add `=` to f-string formatting. Fixes #189 --- grammars/MagicPython.cson | 32 +++- grammars/MagicPython.tmLanguage | 43 ++++- grammars/src/MagicPython.syntax.yaml | 7 + grammars/src/pyfstring.inc.syntax.yaml | 8 +- misc/example.py | 12 +- misc/scopes | 1 + test/atom-spec/python-spec.js | 228 +++++++++++++++++++++++++ test/expressions/expr21.py | 39 +++++ test/fstrings/simple10.py | 18 ++ test/functions/decl15.py | 34 ++++ test/functions/lambda10.py | 35 ++++ 11 files changed, 439 insertions(+), 18 deletions(-) create mode 100644 test/expressions/expr21.py create mode 100644 test/fstrings/simple10.py create mode 100644 test/functions/decl15.py create mode 100644 test/functions/lambda10.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index 6486dba4..b137f776 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -619,6 +619,8 @@ repository: | (!= | == | >= | <= | < | >) (?# 5) + | (:=) (?# 6) + ''' captures: "1": @@ -631,6 +633,8 @@ repository: name: "keyword.operator.arithmetic.python" "5": name: "keyword.operator.comparison.python" + "6": + name: "keyword.operator.assignment.python" punctuation: patterns: [ { @@ -1255,6 +1259,10 @@ repository: name: "punctuation.section.function.lambda.begin.python" contentName: "meta.function.lambda.parameters.python" patterns: [ + { + name: "keyword.operator.positional.parameter.python" + match: "/" + } { name: "keyword.operator.unpacking.parameter.python" match: "(\\*\\*|\\*)" @@ -1402,6 +1410,10 @@ repository: "1": name: "punctuation.definition.parameters.end.python" patterns: [ + { + name: "keyword.operator.positional.parameter.python" + match: "/" + } { name: "keyword.operator.unpacking.parameter.python" match: "(\\*\\*|\\*)" @@ -4720,12 +4732,16 @@ repository: patterns: [ { name: "storage.type.format.python" - match: "(![rsa])(?=})" + match: "(=(![rsa])?)(?=})" + } + { + name: "storage.type.format.python" + match: "(=?![rsa])(?=})" } { match: ''' (?x) - (![rsa])? + ( (?: =?) (?: ![rsa])? ) ( : \\w? [<>=^]? [-+ ]? \\#? \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=}) @@ -4741,7 +4757,7 @@ repository: } ] "fstring-terminator-single-tail": - begin: "(![rsa])?(:)(?=.*?{)" + begin: "((?:=?)(?:![rsa])?)(:)(?=.*?{)" end: "(?=})|(?=\\n)" beginCaptures: "1": @@ -4944,12 +4960,16 @@ repository: patterns: [ { name: "storage.type.format.python" - match: "(![rsa])(?=})" + match: "(=(![rsa])?)(?=})" + } + { + name: "storage.type.format.python" + match: "(=?![rsa])(?=})" } { match: ''' (?x) - (![rsa])? + ( (?: =?) (?: ![rsa])? ) ( : \\w? [<>=^]? [-+ ]? \\#? \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=}) @@ -4965,7 +4985,7 @@ repository: } ] "fstring-terminator-multi-tail": - begin: "(![rsa])?(:)(?=.*?{)" + begin: "((?:=?)(?:![rsa])?)(:)(?=.*?{)" end: "(?=})" beginCaptures: "1": diff --git a/grammars/MagicPython.tmLanguage b/grammars/MagicPython.tmLanguage index 5a07f545..a4f973df 100644 --- a/grammars/MagicPython.tmLanguage +++ b/grammars/MagicPython.tmLanguage @@ -933,6 +933,8 @@ E.g. "arr[idx](args)" | (\*\* | \* | \+ | - | % | // | / | @) (?# 4) | (!= | == | >= | <= | < | >) (?# 5) + + | (:=) (?# 6) captures @@ -961,6 +963,11 @@ E.g. "arr[idx](args)" name keyword.operator.comparison.python + 6 + + name + keyword.operator.assignment.python + punctuation @@ -1936,6 +1943,12 @@ E.g. "arr[idx](args)" meta.function.lambda.parameters.python patterns + + name + keyword.operator.positional.parameter.python + match + / + name keyword.operator.unpacking.parameter.python @@ -2184,6 +2197,12 @@ correctly identify the "in" as a control flow keyword. patterns + + name + keyword.operator.positional.parameter.python + match + / + name keyword.operator.unpacking.parameter.python @@ -8259,12 +8278,18 @@ indirectly through syntactic constructs name storage.type.format.python match - (![rsa])(?=}) + (=(![rsa])?)(?=}) + + + name + storage.type.format.python + match + (=?![rsa])(?=}) match (?x) - (![rsa])? + ( (?: =?) (?: ![rsa])? ) ( : \w? [<>=^]? [-+ ]? \#? \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )(?=}) @@ -8291,7 +8316,7 @@ indirectly through syntactic constructs fstring-terminator-single-tail begin - (![rsa])?(:)(?=.*?{) + ((?:=?)(?:![rsa])?)(:)(?=.*?{) end (?=})|(?=\n) beginCaptures @@ -8631,12 +8656,18 @@ indirectly through syntactic constructs name storage.type.format.python match - (![rsa])(?=}) + (=(![rsa])?)(?=}) + + + name + storage.type.format.python + match + (=?![rsa])(?=}) match (?x) - (![rsa])? + ( (?: =?) (?: ![rsa])? ) ( : \w? [<>=^]? [-+ ]? \#? \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )(?=}) @@ -8663,7 +8694,7 @@ indirectly through syntactic constructs fstring-terminator-multi-tail begin - (![rsa])?(:)(?=.*?{) + ((?:=?)(?:![rsa])?)(:)(?=.*?{) end (?=}) beginCaptures diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 9c80c8b3..83948dc1 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -582,12 +582,15 @@ repository: | (!= | == | >= | <= | < | >) (?# 5) + | (:=) (?# 6) + captures: '1': {name: keyword.operator.logical.python} '2': {name: keyword.control.flow.python} '3': {name: keyword.operator.bitwise.python} '4': {name: keyword.operator.arithmetic.python} '5': {name: keyword.operator.comparison.python} + '6': {name: keyword.operator.assignment.python} punctuation: patterns: @@ -1002,6 +1005,8 @@ repository: contentName: meta.function.lambda.parameters.python patterns: + - name: keyword.operator.positional.parameter.python + match: / - name: keyword.operator.unpacking.parameter.python match: (\*\*|\*) - include: '#lambda-nested-incomplete' @@ -1096,6 +1101,8 @@ repository: '1': {name: punctuation.definition.parameters.end.python} patterns: + - name: keyword.operator.positional.parameter.python + match: / - name: keyword.operator.unpacking.parameter.python match: (\*\*|\*) - include: '#lambda-incomplete' diff --git a/grammars/src/pyfstring.inc.syntax.yaml b/grammars/src/pyfstring.inc.syntax.yaml index 993707cf..e605f17c 100644 --- a/grammars/src/pyfstring.inc.syntax.yaml +++ b/grammars/src/pyfstring.inc.syntax.yaml @@ -127,10 +127,12 @@ fstring-${line}-brace: fstring-terminator-${line}: patterns: - name: storage.type.format.python - match: (![rsa])(?=}) + match: (=(![rsa])?)(?=}) + - name: storage.type.format.python + match: (=?![rsa])(?=}) - match: | (?x) - (![rsa])? + ( (?: =?) (?: ![rsa])? ) ( : \w? [<>=^]? [-+ ]? \#? \d* ,? (\.\d+)? [bcdeEfFgGnosxX%]? )(?=}) captures: @@ -148,7 +150,7 @@ fstring-terminator-${line}: - include: '#fstring-terminator-${line}-tail' fstring-terminator-${line}-tail: - begin: (![rsa])?(:)(?=.*?{) + begin: ((?:=?)(?:![rsa])?)(:)(?=.*?{) end: (?=})${fguard} beginCaptures: '1': {name: storage.type.format.python} diff --git a/misc/example.py b/misc/example.py index 6b820e63..e6ea7ad0 100644 --- a/misc/example.py +++ b/misc/example.py @@ -1,7 +1,7 @@ import asyncio -def showcase(): +def showcase(a, b, /, c, d, *, e, f): """Some code to showcase the syntax. Docstrings are recognized and have an additional scope. @@ -21,7 +21,7 @@ async def coroutine(db:aio_db.DatabaseConnection) -> List[str]: async with db.transaction(): result = await db.query(...) - print(f'Result: {result!r}') + print(f'Result: {result!r} {a=} {b=!r}') mapping = None # type: Dict[int, Any] # PEP 484 @@ -41,8 +41,14 @@ async def coroutine(db:aio_db.DatabaseConnection) -> List[str]: # NOTE Numbers with leading zeros are invalid in Python 3, # use 0o... answer = func(0xdeadbeef + 0b00100001 + 0123 + 0o123 + - 1_005_123 + # PEP 515 + 1_005_123 + # PEP 515 # complex numbers .10e12 + 2j) @ mat + # walrus operator + filtered_data = [y for x in data if (y := f(x)) is not None] + + # position-only params + bar = lambda q, w, /, e, r: (q + w + e + r) + return R'''No escapes '\' in this \one''' diff --git a/misc/scopes b/misc/scopes index 12785af1..8eec651e 100644 --- a/misc/scopes +++ b/misc/scopes @@ -56,6 +56,7 @@ keyword.operator.lookahead.regexp keyword.operator.lookbehind.negative.regexp keyword.operator.lookbehind.regexp keyword.operator.negation.regexp +keyword.operator.positional.parameter.python keyword.operator.python keyword.operator.quantifier.regexp keyword.operator.unpacking.arguments.python diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index 032c3682..da7d08c1 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -5800,6 +5800,77 @@ describe("Grammar Tests", function() { expect(tokens[5][4].scopes).toEqual(["source.python"]); }); + it("test/expressions/expr21.py", + function() { + tokens = grammar.tokenizeLines("while chunk := file.read(8192):\n process(chunk)\n y0 = (y1 := f(x))") + expect(tokens[0][0].value).toBe("while"); + expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("chunk"); + expect(tokens[0][2].scopes).toEqual(["source.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe(":="); + expect(tokens[0][4].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][5].value).toBe(" "); + expect(tokens[0][5].scopes).toEqual(["source.python"]); + expect(tokens[0][6].value).toBe("file"); + expect(tokens[0][6].scopes).toEqual(["source.python","variable.legacy.builtin.python"]); + expect(tokens[0][7].value).toBe("."); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.member.access.python","punctuation.separator.period.python"]); + expect(tokens[0][8].value).toBe("read"); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[0][9].value).toBe("("); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[0][10].value).toBe("8192"); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]); + expect(tokens[0][11].value).toBe(")"); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.member.access.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[0][12].value).toBe(":"); + expect(tokens[0][12].scopes).toEqual(["source.python","punctuation.separator.colon.python"]); + expect(tokens[1][0].value).toBe(" "); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe("process"); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[1][2].value).toBe("("); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[1][3].value).toBe("chunk"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[1][4].value).toBe(")"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[2][0].value).toBe(" "); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe("y0"); + expect(tokens[2][1].scopes).toEqual(["source.python"]); + expect(tokens[2][2].value).toBe(" "); + expect(tokens[2][2].scopes).toEqual(["source.python"]); + expect(tokens[2][3].value).toBe("="); + expect(tokens[2][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[2][4].value).toBe(" "); + expect(tokens[2][4].scopes).toEqual(["source.python"]); + expect(tokens[2][5].value).toBe("("); + expect(tokens[2][5].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]); + expect(tokens[2][6].value).toBe("y1"); + expect(tokens[2][6].scopes).toEqual(["source.python"]); + expect(tokens[2][7].value).toBe(" "); + expect(tokens[2][7].scopes).toEqual(["source.python"]); + expect(tokens[2][8].value).toBe(":="); + expect(tokens[2][8].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[2][9].value).toBe(" "); + expect(tokens[2][9].scopes).toEqual(["source.python"]); + expect(tokens[2][10].value).toBe("f"); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]); + expect(tokens[2][11].value).toBe("("); + expect(tokens[2][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]); + expect(tokens[2][12].value).toBe("x"); + expect(tokens[2][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]); + expect(tokens[2][13].value).toBe(")"); + expect(tokens[2][13].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); + expect(tokens[2][14].value).toBe(")"); + expect(tokens[2][14].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]); + }); + it("test/expressions/expr3.py", function() { tokens = grammar.tokenizeLines("(a, *rest, b) = range(5)") @@ -7490,6 +7561,37 @@ describe("Grammar Tests", function() { expect(tokens[2][20].scopes).toEqual(["source.python","comment.line.number-sign.python"]); }); + it("test/fstrings/simple10.py", + function() { + tokens = grammar.tokenizeLines("f'values: {a=} {b=!r}'") + expect(tokens[0][0].value).toBe("f"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]); + expect(tokens[0][1].value).toBe("'"); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]); + expect(tokens[0][2].value).toBe("values: "); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][4].value).toBe("a"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[0][5].value).toBe("="); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]); + expect(tokens[0][6].value).toBe("}"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][7].value).toBe(" "); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]); + expect(tokens[0][8].value).toBe("{"); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][9].value).toBe("b"); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[0][10].value).toBe("=!r"); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]); + expect(tokens[0][11].value).toBe("}"); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][12].value).toBe("'"); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + it("test/fstrings/simple2.py", function() { tokens = grammar.tokenizeLines("a = f\"normal {{ normal }} normal } {10!r} normal {fo.__add__!s}\"") @@ -8501,6 +8603,67 @@ describe("Grammar Tests", function() { expect(tokens[14][9].scopes).toEqual(["source.python","constant.numeric.dec.python"]); }); + it("test/functions/decl15.py", + function() { + tokens = grammar.tokenizeLines("def showcase(a, b, /, c, d, *, e, f):\n return") + expect(tokens[0][0].value).toBe("def"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]); + expect(tokens[0][2].value).toBe("showcase"); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]); + expect(tokens[0][3].value).toBe("("); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]); + expect(tokens[0][4].value).toBe("a"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][5].value).toBe(","); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][6].value).toBe(" "); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][7].value).toBe("b"); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][8].value).toBe(","); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][9].value).toBe(" "); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][10].value).toBe("/"); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.positional.parameter.python"]); + expect(tokens[0][11].value).toBe(", "); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][12].value).toBe("c"); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][13].value).toBe(","); + expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][14].value).toBe(" "); + expect(tokens[0][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][15].value).toBe("d"); + expect(tokens[0][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][16].value).toBe(","); + expect(tokens[0][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][17].value).toBe(" "); + expect(tokens[0][17].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][18].value).toBe("*"); + expect(tokens[0][18].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]); + expect(tokens[0][19].value).toBe(", "); + expect(tokens[0][19].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][20].value).toBe("e"); + expect(tokens[0][20].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][21].value).toBe(","); + expect(tokens[0][21].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][22].value).toBe(" "); + expect(tokens[0][22].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]); + expect(tokens[0][23].value).toBe("f"); + expect(tokens[0][23].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][24].value).toBe(")"); + expect(tokens[0][24].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]); + expect(tokens[0][25].value).toBe(":"); + expect(tokens[0][25].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]); + expect(tokens[1][0].value).toBe(" "); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe("return"); + expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]); + }); + it("test/functions/decl2.py", function() { tokens = grammar.tokenizeLines("def result_annot(lambda, lambda=) -> qqq[None]:\n pass") @@ -9632,6 +9795,71 @@ describe("Grammar Tests", function() { expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]); }); + it("test/functions/lambda10.py", + function() { + tokens = grammar.tokenizeLines("showcase = lambda a, /, b, *, c: (a + b + c)") + expect(tokens[0][0].value).toBe("showcase"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("lambda"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]); + expect(tokens[0][5].value).toBe(" "); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]); + expect(tokens[0][6].value).toBe("a"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][7].value).toBe(","); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][8].value).toBe(" "); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]); + expect(tokens[0][9].value).toBe("/"); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.positional.parameter.python"]); + expect(tokens[0][10].value).toBe(", "); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]); + expect(tokens[0][11].value).toBe("b"); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][12].value).toBe(","); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]); + expect(tokens[0][13].value).toBe(" "); + expect(tokens[0][13].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]); + expect(tokens[0][14].value).toBe("*"); + expect(tokens[0][14].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.unpacking.parameter.python"]); + expect(tokens[0][15].value).toBe(", "); + expect(tokens[0][15].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]); + expect(tokens[0][16].value).toBe("c"); + expect(tokens[0][16].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]); + expect(tokens[0][17].value).toBe(":"); + expect(tokens[0][17].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]); + expect(tokens[0][18].value).toBe(" "); + expect(tokens[0][18].scopes).toEqual(["source.python"]); + expect(tokens[0][19].value).toBe("("); + expect(tokens[0][19].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]); + expect(tokens[0][20].value).toBe("a"); + expect(tokens[0][20].scopes).toEqual(["source.python"]); + expect(tokens[0][21].value).toBe(" "); + expect(tokens[0][21].scopes).toEqual(["source.python"]); + expect(tokens[0][22].value).toBe("+"); + expect(tokens[0][22].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]); + expect(tokens[0][23].value).toBe(" "); + expect(tokens[0][23].scopes).toEqual(["source.python"]); + expect(tokens[0][24].value).toBe("b"); + expect(tokens[0][24].scopes).toEqual(["source.python"]); + expect(tokens[0][25].value).toBe(" "); + expect(tokens[0][25].scopes).toEqual(["source.python"]); + expect(tokens[0][26].value).toBe("+"); + expect(tokens[0][26].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]); + expect(tokens[0][27].value).toBe(" "); + expect(tokens[0][27].scopes).toEqual(["source.python"]); + expect(tokens[0][28].value).toBe("c"); + expect(tokens[0][28].scopes).toEqual(["source.python"]); + expect(tokens[0][29].value).toBe(")"); + expect(tokens[0][29].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]); + }); + it("test/functions/lambda2.py", function() { tokens = grammar.tokenizeLines("lll(lambda=1)") diff --git a/test/expressions/expr21.py b/test/expressions/expr21.py new file mode 100644 index 00000000..59556710 --- /dev/null +++ b/test/expressions/expr21.py @@ -0,0 +1,39 @@ +while chunk := file.read(8192): + process(chunk) + y0 = (y1 := f(x)) + + + +while : keyword.control.flow.python, source.python + : source.python +chunk : source.python + : source.python +:= : keyword.operator.assignment.python, source.python + : source.python +file : source.python, variable.legacy.builtin.python +. : meta.member.access.python, punctuation.separator.period.python, source.python +read : meta.function-call.generic.python, meta.function-call.python, meta.member.access.python, source.python +( : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.begin.python, source.python +8192 : constant.numeric.dec.python, meta.function-call.arguments.python, meta.function-call.python, meta.member.access.python, source.python +) : meta.function-call.python, meta.member.access.python, punctuation.definition.arguments.end.python, source.python +: : punctuation.separator.colon.python, source.python + : source.python +process : meta.function-call.generic.python, meta.function-call.python, source.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +chunk : meta.function-call.arguments.python, meta.function-call.python, source.python +) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python + : source.python +y0 : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +( : punctuation.parenthesis.begin.python, source.python +y1 : source.python + : source.python +:= : keyword.operator.assignment.python, source.python + : source.python +f : meta.function-call.generic.python, meta.function-call.python, source.python +( : meta.function-call.python, punctuation.definition.arguments.begin.python, source.python +x : meta.function-call.arguments.python, meta.function-call.python, source.python +) : meta.function-call.python, punctuation.definition.arguments.end.python, source.python +) : punctuation.parenthesis.end.python, source.python diff --git a/test/fstrings/simple10.py b/test/fstrings/simple10.py new file mode 100644 index 00000000..ae793021 --- /dev/null +++ b/test/fstrings/simple10.py @@ -0,0 +1,18 @@ +f'values: {a=} {b=!r}' + + + + +f : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.quoted.single.python +values: : meta.fstring.python, source.python, string.interpolated.python, string.quoted.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +a : meta.fstring.python, source.python += : meta.fstring.python, source.python, storage.type.format.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +b : meta.fstring.python, source.python +=!r : meta.fstring.python, source.python, storage.type.format.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python diff --git a/test/functions/decl15.py b/test/functions/decl15.py new file mode 100644 index 00000000..7f5c4ecc --- /dev/null +++ b/test/functions/decl15.py @@ -0,0 +1,34 @@ +def showcase(a, b, /, c, d, *, e, f): + return + + + + +def : meta.function.python, source.python, storage.type.function.python + : meta.function.python, source.python +showcase : entity.name.function.python, meta.function.python, source.python +( : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.begin.python, source.python +a : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python +, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python + : meta.function.parameters.python, meta.function.python, source.python +b : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python +, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python + : meta.function.parameters.python, meta.function.python, source.python +/ : keyword.operator.positional.parameter.python, meta.function.parameters.python, meta.function.python, source.python +, : meta.function.parameters.python, meta.function.python, source.python +c : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python +, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python + : meta.function.parameters.python, meta.function.python, source.python +d : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python +, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python + : meta.function.parameters.python, meta.function.python, source.python +* : keyword.operator.unpacking.parameter.python, meta.function.parameters.python, meta.function.python, source.python +, : meta.function.parameters.python, meta.function.python, source.python +e : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python +, : meta.function.parameters.python, meta.function.python, punctuation.separator.parameters.python, source.python + : meta.function.parameters.python, meta.function.python, source.python +f : meta.function.parameters.python, meta.function.python, source.python, variable.parameter.function.language.python +) : meta.function.parameters.python, meta.function.python, punctuation.definition.parameters.end.python, source.python +: : meta.function.python, punctuation.section.function.begin.python, source.python + : source.python +return : keyword.control.flow.python, source.python diff --git a/test/functions/lambda10.py b/test/functions/lambda10.py new file mode 100644 index 00000000..c033ac71 --- /dev/null +++ b/test/functions/lambda10.py @@ -0,0 +1,35 @@ +showcase = lambda a, /, b, *, c: (a + b + c) + + + + +showcase : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +lambda : meta.lambda-function.python, source.python, storage.type.function.lambda.python + : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +a : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python, variable.parameter.function.language.python +, : meta.function.lambda.parameters.python, meta.lambda-function.python, punctuation.separator.parameters.python, source.python + : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +/ : keyword.operator.positional.parameter.python, meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +, : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +b : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python, variable.parameter.function.language.python +, : meta.function.lambda.parameters.python, meta.lambda-function.python, punctuation.separator.parameters.python, source.python + : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +* : keyword.operator.unpacking.parameter.python, meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +, : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python +c : meta.function.lambda.parameters.python, meta.lambda-function.python, source.python, variable.parameter.function.language.python +: : meta.lambda-function.python, punctuation.section.function.lambda.begin.python, source.python + : source.python +( : punctuation.parenthesis.begin.python, source.python +a : source.python + : source.python ++ : keyword.operator.arithmetic.python, source.python + : source.python +b : source.python + : source.python ++ : keyword.operator.arithmetic.python, source.python + : source.python +c : source.python +) : punctuation.parenthesis.end.python, source.python From 5b5f388fc46e45dff7e48edc90242c7f578d8705 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Fri, 31 Jul 2020 06:22:53 -0400 Subject: [PATCH 48/49] Make raw f-strings consistent. Any f-string allows variable interpolation, that includes a raw f-string. Make all raw prefixes (`r` or `R`) behave the same way in combination with `f` prefix. Fixes #186 --- grammars/MagicPython.cson | 910 +----------- grammars/MagicPython.tmLanguage | 1788 +----------------------- grammars/src/MagicPython.syntax.yaml | 80 -- grammars/src/pyfstring.inc.syntax.yaml | 2 +- misc/example.py | 2 + test/atom-spec/python-spec.js | 744 +++++----- test/fstrings/empty2.py | 36 +- test/fstrings/fraw1.py | 40 + test/fstrings/fraw2.py | 36 + test/fstrings/fraw3.py | 36 + test/fstrings/fraw4.py | 45 + test/fstrings/prefixes2.py | 24 +- test/fstrings/prefixes3.py | 24 +- test/regexp/fregexp1.py | 56 - test/regexp/fregexp2.py | 28 - test/regexp/fregexp3.py | 28 - test/regexp/fregexp4.py | 36 - test/regexp/fregexp5.py | 26 - test/regexp/fregexp6.py | 39 - 19 files changed, 546 insertions(+), 3434 deletions(-) create mode 100644 test/fstrings/fraw1.py create mode 100644 test/fstrings/fraw2.py create mode 100644 test/fstrings/fraw3.py create mode 100644 test/fstrings/fraw4.py delete mode 100644 test/regexp/fregexp1.py delete mode 100644 test/regexp/fregexp2.py delete mode 100644 test/regexp/fregexp3.py delete mode 100644 test/regexp/fregexp4.py delete mode 100644 test/regexp/fregexp5.py delete mode 100644 test/regexp/fregexp6.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index b137f776..afb32a6d 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -785,18 +785,6 @@ repository: { include: "#regexp-double-one-line" } - { - include: "#fregexp-single-three-line" - } - { - include: "#fregexp-double-three-line" - } - { - include: "#fregexp-single-one-line" - } - { - include: "#fregexp-double-one-line" - } ] string: patterns: [ @@ -3334,900 +3322,6 @@ repository: include: "#double-three-regexp-expression" } ] - "single-one-fregexp-expression": - patterns: [ - { - include: "#fregexp-base-expression" - } - { - include: "#single-one-regexp-character-set" - } - { - include: "#single-one-regexp-comments" - } - { - include: "#regexp-flags" - } - { - include: "#single-one-regexp-named-group" - } - { - include: "#regexp-backreference" - } - { - include: "#single-one-fregexp-lookahead" - } - { - include: "#single-one-fregexp-lookahead-negative" - } - { - include: "#single-one-fregexp-lookbehind" - } - { - include: "#single-one-fregexp-lookbehind-negative" - } - { - include: "#single-one-fregexp-conditional" - } - { - include: "#single-one-fregexp-parentheses-non-capturing" - } - { - include: "#single-one-fregexp-parentheses" - } - ] - "single-one-fregexp-named-group": - name: "meta.named.regexp" - begin: ''' - (?x) - (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>) - - ''' - end: "(\\)|(?=\\'))|((?=(?) - - ''' - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "1": - name: "punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp" - "2": - name: "entity.name.tag.named.group.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.named.end.regexp support.other.parenthesis.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookahead": - begin: "(\\()\\?=" - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookahead-negative": - begin: "(\\()\\?!" - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.negative.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.negative.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookbehind": - begin: "(\\()\\?<=" - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "0": - name: "keyword.operator.lookbehind.regexp" - "1": - name: "punctuation.parenthesis.lookbehind.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookbehind.end.regexp keyword.operator.lookbehind.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookbehind-negative": - begin: "(\\()\\?) - - ''' - end: "(\\)|(?=\"))|((?=(?) - - ''' - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "1": - name: "punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp" - "2": - name: "entity.name.tag.named.group.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.named.end.regexp support.other.parenthesis.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookahead": - begin: "(\\()\\?=" - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookahead-negative": - begin: "(\\()\\?!" - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.negative.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.negative.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookbehind": - begin: "(\\()\\?<=" - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "0": - name: "keyword.operator.lookbehind.regexp" - "1": - name: "punctuation.parenthesis.lookbehind.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookbehind.end.regexp keyword.operator.lookbehind.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookbehind-negative": - begin: "(\\()\\?include #regexp-double-one-line - - include - #fregexp-single-three-line - - - include - #fregexp-double-three-line - - - include - #fregexp-single-one-line - - - include - #fregexp-double-one-line - string @@ -5646,1774 +5630,6 @@ indirectly through syntactic constructs - single-one-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #single-one-regexp-character-set - - - include - #single-one-regexp-comments - - - include - #regexp-flags - - - include - #single-one-regexp-named-group - - - include - #regexp-backreference - - - include - #single-one-fregexp-lookahead - - - include - #single-one-fregexp-lookahead-negative - - - include - #single-one-fregexp-lookbehind - - - include - #single-one-fregexp-lookbehind-negative - - - include - #single-one-fregexp-conditional - - - include - #single-one-fregexp-parentheses-non-capturing - - - include - #single-one-fregexp-parentheses - - - - single-one-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-parentheses - - begin - \( - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-three-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #single-three-regexp-character-set - - - include - #single-three-regexp-comments - - - include - #regexp-flags - - - include - #single-three-regexp-named-group - - - include - #regexp-backreference - - - include - #single-three-fregexp-lookahead - - - include - #single-three-fregexp-lookahead-negative - - - include - #single-three-fregexp-lookbehind - - - include - #single-three-fregexp-lookbehind-negative - - - include - #single-three-fregexp-conditional - - - include - #single-three-fregexp-parentheses-non-capturing - - - include - #single-three-fregexp-parentheses - - - include - #comments-string-single-three - - - - single-three-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?=\'\'\')) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-parentheses - - begin - \( - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - double-one-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #double-one-regexp-character-set - - - include - #double-one-regexp-comments - - - include - #regexp-flags - - - include - #double-one-regexp-named-group - - - include - #regexp-backreference - - - include - #double-one-fregexp-lookahead - - - include - #double-one-fregexp-lookahead-negative - - - include - #double-one-fregexp-lookbehind - - - include - #double-one-fregexp-lookbehind-negative - - - include - #double-one-fregexp-conditional - - - include - #double-one-fregexp-parentheses-non-capturing - - - include - #double-one-fregexp-parentheses - - - - double-one-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-parentheses - - begin - \( - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-three-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #double-three-regexp-character-set - - - include - #double-three-regexp-comments - - - include - #regexp-flags - - - include - #double-three-regexp-named-group - - - include - #regexp-backreference - - - include - #double-three-fregexp-lookahead - - - include - #double-three-fregexp-lookahead-negative - - - include - #double-three-fregexp-lookbehind - - - include - #double-three-fregexp-lookbehind-negative - - - include - #double-three-fregexp-conditional - - - include - #double-three-fregexp-parentheses-non-capturing - - - include - #double-three-fregexp-parentheses - - - include - #comments-string-double-three - - - - double-three-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?=""")) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?=""")) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-parentheses - - begin - \( - end - (\)|(?=""")) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - fregexp-single-one-line - - name - string.interpolated.python string.regexp.quoted.single.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(\') - end - (\')|(?<!\\)(\n) - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - fregexp-single-three-line - - name - string.interpolated.python string.regexp.quoted.multi.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(\'\'\') - end - (\'\'\') - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - - fregexp-double-one-line - - name - string.interpolated.python string.regexp.quoted.single.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(") - end - (")|(?<!\\)(\n) - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - fregexp-double-three-line - - name - string.interpolated.python string.regexp.quoted.multi.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(""") - end - (""") - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - string-raw-quoted-single-line name @@ -8137,7 +6353,7 @@ indirectly through syntactic constructs name meta.fstring.python begin - (\b(?:[R][fF]|[fF][R]))((['"])) + (\b(?:[rR][fF]|[fF][rR]))((['"])) end (\2)|((?<!\\)\n) beginCaptures @@ -8515,7 +6731,7 @@ indirectly through syntactic constructs name meta.fstring.python begin - (\b(?:[R][fF]|[fF][R]))('''|""") + (\b(?:[rR][fF]|[fF][rR]))('''|""") end (\2) beginCaptures diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 83948dc1..bd740829 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -103,82 +103,6 @@ repository: bquote: '(""")' equote: '(""")' - - file: 'regexp.inc.syntax.yaml' - vars: - prefix: 'single-one-' - basename: 'fregexp' - marker: "|(?=\\')" - nested: '' - guard: "|((?=(? List[str]: async with db.transaction(): result = await db.query(...) print(f'Result: {result!r} {a=} {b=!r}') + print(Rf'data: {c=}') + print(rf'data: {c=}') mapping = None # type: Dict[int, Any] # PEP 484 diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index da7d08c1..cf00b257 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -6610,39 +6610,313 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("rf\"{} { }\"\nrf\"\"\"{}\n{ }\n\"\"\"") expect(tokens[0][0].value).toBe("rf"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[0][1].value).toBe("\""); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[0][2].value).toBe("{"); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][3].value).toBe("}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][4].value).toBe(" "); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[0][5].value).toBe("{"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][6].value).toBe(" "); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","invalid.illegal.brace.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]); expect(tokens[0][7].value).toBe("}"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][8].value).toBe("\""); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("rf"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); expect(tokens[1][1].value).toBe("\"\"\""); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); expect(tokens[1][2].value).toBe("{"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][3].value).toBe("}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][4].value).toBe(""); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); expect(tokens[2][0].value).toBe("{"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","invalid.illegal.brace.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]); expect(tokens[2][2].value).toBe("}"); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][3].value).toBe(""); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); expect(tokens[3][0].value).toBe("\"\"\""); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw1.py", + function() { + tokens = grammar.tokenizeLines("a = fr'[a-z]'\na = Fr'[a-z]'\na = rf'[a-z]'\na = rF'[a-z]'") + expect(tokens[0][0].value).toBe("a"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("fr"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][5].value).toBe("'"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][6].value).toBe("[a-z]"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][7].value).toBe("'"); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("a"); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("="); + expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("Fr"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][5].value).toBe("'"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][6].value).toBe("[a-z]"); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][7].value).toBe("'"); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("a"); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe(" "); + expect(tokens[2][1].scopes).toEqual(["source.python"]); + expect(tokens[2][2].value).toBe("="); + expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[2][3].value).toBe(" "); + expect(tokens[2][3].scopes).toEqual(["source.python"]); + expect(tokens[2][4].value).toBe("rf"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][5].value).toBe("'"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[2][6].value).toBe("[a-z]"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][7].value).toBe("'"); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[3][0].value).toBe("a"); + expect(tokens[3][0].scopes).toEqual(["source.python"]); + expect(tokens[3][1].value).toBe(" "); + expect(tokens[3][1].scopes).toEqual(["source.python"]); + expect(tokens[3][2].value).toBe("="); + expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[3][3].value).toBe(" "); + expect(tokens[3][3].scopes).toEqual(["source.python"]); + expect(tokens[3][4].value).toBe("rF"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[3][5].value).toBe("'"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[3][6].value).toBe("[a-z]"); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[3][7].value).toBe("'"); + expect(tokens[3][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw2.py", + function() { + tokens = grammar.tokenizeLines("rf'fo{{2}}'\nrf\"fo{{2}}\"\nrf'''fo{{2}}'''\nrf\"\"\"fo{{2}}\"\"\"") + expect(tokens[0][0].value).toBe("rf"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][1].value).toBe("'"); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][2].value).toBe("fo"); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][4].value).toBe("2"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][5].value).toBe("}}"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][6].value).toBe("'"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("rf"); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][1].value).toBe("\""); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][2].value).toBe("fo"); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][3].value).toBe("{{"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][4].value).toBe("2"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][5].value).toBe("}}"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][6].value).toBe("\""); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("rf"); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][1].value).toBe("'''"); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[2][2].value).toBe("fo"); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][3].value).toBe("{{"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][4].value).toBe("2"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][5].value).toBe("}}"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][6].value).toBe("'''"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[3][0].value).toBe("rf"); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][1].value).toBe("\"\"\""); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[3][2].value).toBe("fo"); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][3].value).toBe("{{"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[3][4].value).toBe("2"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][5].value).toBe("}}"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[3][6].value).toBe("\"\"\""); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw3.py", + function() { + tokens = grammar.tokenizeLines("rf'fo{2}'\nrf\"fo{2}\"\nrf'''fo{2}'''\nrf\"\"\"fo{2}\"\"\"") + expect(tokens[0][0].value).toBe("rf"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][1].value).toBe("'"); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][2].value).toBe("fo"); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][4].value).toBe("2"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][5].value).toBe("}"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].value).toBe("'"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("rf"); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][1].value).toBe("\""); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][2].value).toBe("fo"); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][3].value).toBe("{"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][4].value).toBe("2"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[1][5].value).toBe("}"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][6].value).toBe("\""); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("rf"); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][1].value).toBe("'''"); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[2][2].value).toBe("fo"); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][3].value).toBe("{"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][4].value).toBe("2"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[2][5].value).toBe("}"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][6].value).toBe("'''"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[3][0].value).toBe("rf"); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][1].value).toBe("\"\"\""); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[3][2].value).toBe("fo"); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][3].value).toBe("{"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][4].value).toBe("2"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[3][5].value).toBe("}"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][6].value).toBe("\"\"\""); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw4.py", + function() { + tokens = grammar.tokenizeLines("a = rf'fo{{{2}}}'\na = rf'fo{{{bar}}}'\na = rf'fo{{2}}'") + expect(tokens[0][0].value).toBe("a"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("rf"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][5].value).toBe("'"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][6].value).toBe("fo"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][7].value).toBe("{{"); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][8].value).toBe("{"); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][9].value).toBe("2"); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][10].value).toBe("}"); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][11].value).toBe("}}"); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][12].value).toBe("'"); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("a"); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("="); + expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("rf"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][5].value).toBe("'"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][6].value).toBe("fo"); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][7].value).toBe("{{"); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][8].value).toBe("{"); + expect(tokens[1][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][9].value).toBe("bar"); + expect(tokens[1][9].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[1][10].value).toBe("}"); + expect(tokens[1][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][11].value).toBe("}}"); + expect(tokens[1][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][12].value).toBe("'"); + expect(tokens[1][12].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("a"); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe(" "); + expect(tokens[2][1].scopes).toEqual(["source.python"]); + expect(tokens[2][2].value).toBe("="); + expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[2][3].value).toBe(" "); + expect(tokens[2][3].scopes).toEqual(["source.python"]); + expect(tokens[2][4].value).toBe("rf"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][5].value).toBe("'"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[2][6].value).toBe("fo"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][7].value).toBe("{{"); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][8].value).toBe("2"); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][9].value).toBe("}}"); + expect(tokens[2][9].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][10].value).toBe("'"); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); }); it("test/fstrings/nested1.py", @@ -7084,25 +7358,33 @@ describe("Grammar Tests", function() { expect(tokens[1][6].value).toBe("'"); expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[2][0].value).toBe("rf"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[2][1].value).toBe("'"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[2][2].value).toBe("some "); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[2][3].value).toBe("{obj}"); - expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[2][4].value).toBe("'"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][3].value).toBe("{"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][4].value).toBe("obj"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[2][5].value).toBe("}"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][6].value).toBe("'"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[3][0].value).toBe("rF"); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[3][1].value).toBe("'"); - expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[3][2].value).toBe("some "); - expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[3][3].value).toBe("{obj}"); - expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[3][4].value).toBe("'"); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[3][3].value).toBe("{"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][4].value).toBe("obj"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[3][5].value).toBe("}"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][6].value).toBe("'"); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[4][0].value).toBe("Rf"); expect(tokens[4][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[4][1].value).toBe("'"); @@ -7137,25 +7419,33 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("fr'some {obj}'\nFr'some {obj}'\nfR'some {obj}'\nFR'some {obj}'") expect(tokens[0][0].value).toBe("fr"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[0][1].value).toBe("'"); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[0][2].value).toBe("some "); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][3].value).toBe("{obj}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][4].value).toBe("'"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][4].value).toBe("obj"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[0][5].value).toBe("}"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].value).toBe("'"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("Fr"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[1][1].value).toBe("'"); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[1][2].value).toBe("some "); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][3].value).toBe("{obj}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][4].value).toBe("'"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][3].value).toBe("{"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][4].value).toBe("obj"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[1][5].value).toBe("}"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][6].value).toBe("'"); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[2][0].value).toBe("fR"); expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[2][1].value).toBe("'"); @@ -10724,370 +11014,6 @@ describe("Grammar Tests", function() { expect(tokens[0][15].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); }); - it("test/regexp/fregexp1.py", - function() { - tokens = grammar.tokenizeLines("a = fr'[a-z]'\na = Fr'[a-z]'\na = rf'[a-z]'\na = rF'[a-z]'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("fr"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("["); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[0][7].value).toBe("a"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[0][8].value).toBe("-"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[0][9].value).toBe("z"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[0][10].value).toBe("]"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[0][11].value).toBe("'"); - expect(tokens[0][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("Fr"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("["); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[1][7].value).toBe("a"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[1][8].value).toBe("-"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[1][9].value).toBe("z"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[1][10].value).toBe("]"); - expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[1][11].value).toBe("'"); - expect(tokens[1][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("a"); - expect(tokens[2][0].scopes).toEqual(["source.python"]); - expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python"]); - expect(tokens[2][2].value).toBe("="); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python"]); - expect(tokens[2][4].value).toBe("rf"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][5].value).toBe("'"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][6].value).toBe("["); - expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[2][7].value).toBe("a"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[2][8].value).toBe("-"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[2][9].value).toBe("z"); - expect(tokens[2][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[2][10].value).toBe("]"); - expect(tokens[2][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[2][11].value).toBe("'"); - expect(tokens[2][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[3][0].value).toBe("a"); - expect(tokens[3][0].scopes).toEqual(["source.python"]); - expect(tokens[3][1].value).toBe(" "); - expect(tokens[3][1].scopes).toEqual(["source.python"]); - expect(tokens[3][2].value).toBe("="); - expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[3][3].value).toBe(" "); - expect(tokens[3][3].scopes).toEqual(["source.python"]); - expect(tokens[3][4].value).toBe("rF"); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[3][5].value).toBe("'"); - expect(tokens[3][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[3][6].value).toBe("["); - expect(tokens[3][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[3][7].value).toBe("a"); - expect(tokens[3][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[3][8].value).toBe("-"); - expect(tokens[3][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[3][9].value).toBe("z"); - expect(tokens[3][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[3][10].value).toBe("]"); - expect(tokens[3][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[3][11].value).toBe("'"); - expect(tokens[3][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp2.py", - function() { - tokens = grammar.tokenizeLines("rf'fo{{2}}'\nrf\"fo{{2}}\"\nrf'''fo{{2}}'''\nrf\"\"\"fo{{2}}\"\"\"") - expect(tokens[0][0].value).toBe("rf"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][1].value).toBe("'"); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][2].value).toBe("fo"); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][3].value).toBe("{{2}}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[0][4].value).toBe("'"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("rf"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][1].value).toBe("\""); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][2].value).toBe("fo"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][3].value).toBe("{{2}}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[1][4].value).toBe("\""); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("rf"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][1].value).toBe("'''"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][2].value).toBe("fo"); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[2][3].value).toBe("{{2}}"); - expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[2][4].value).toBe("'''"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[3][0].value).toBe("rf"); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[3][1].value).toBe("\"\"\""); - expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[3][2].value).toBe("fo"); - expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[3][3].value).toBe("{{2}}"); - expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[3][4].value).toBe("\"\"\""); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp3.py", - function() { - tokens = grammar.tokenizeLines("rf'fo{2}'\nrf\"fo{2}\"\nrf'''fo{2}'''\nrf\"\"\"fo{2}\"\"\"") - expect(tokens[0][0].value).toBe("rf"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][1].value).toBe("'"); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][2].value).toBe("fo"); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][3].value).toBe("{2}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][4].value).toBe("'"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("rf"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][1].value).toBe("\""); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][2].value).toBe("fo"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][3].value).toBe("{2}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][4].value).toBe("\""); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("rf"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][1].value).toBe("'''"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][2].value).toBe("fo"); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[2][3].value).toBe("{2}"); - expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[2][4].value).toBe("'''"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[3][0].value).toBe("rf"); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[3][1].value).toBe("\"\"\""); - expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[3][2].value).toBe("fo"); - expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[3][3].value).toBe("{2}"); - expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[3][4].value).toBe("\"\"\""); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp4.py", - function() { - tokens = grammar.tokenizeLines("a = rf'fo{{2}}'\na = r'fo{{2}}'\na = r'fo{2}'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("rf"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("fo"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][7].value).toBe("{{2}}"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[0][8].value).toBe("'"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("r"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("fo{"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[1][7].value).toBe("{2}"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.quantifier.regexp"]); - expect(tokens[1][8].value).toBe("}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[1][9].value).toBe("'"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("a"); - expect(tokens[2][0].scopes).toEqual(["source.python"]); - expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python"]); - expect(tokens[2][2].value).toBe("="); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python"]); - expect(tokens[2][4].value).toBe("r"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]); - expect(tokens[2][5].value).toBe("'"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][6].value).toBe("fo"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[2][7].value).toBe("{2}"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.quantifier.regexp"]); - expect(tokens[2][8].value).toBe("'"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp5.py", - function() { - tokens = grammar.tokenizeLines("a = rf'{{foo}}'\na = r'\\{foo\\}'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("rf"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("{{"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][7].value).toBe("foo"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][8].value).toBe("}}"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][9].value).toBe("'"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("r"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("\\{"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]); - expect(tokens[1][7].value).toBe("foo"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[1][8].value).toBe("\\}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]); - expect(tokens[1][9].value).toBe("'"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp6.py", - function() { - tokens = grammar.tokenizeLines("a = rf'fo{{{2}}}'\na = rf'fo{{{bar}}}'\na = rf'fo{{2}}'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("rf"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("fo"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][7].value).toBe("{{"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][8].value).toBe("{2}"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][9].value).toBe("}}"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][10].value).toBe("'"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("rf"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("fo"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][7].value).toBe("{{"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[1][8].value).toBe("{bar}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][9].value).toBe("}}"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[1][10].value).toBe("'"); - expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("a"); - expect(tokens[2][0].scopes).toEqual(["source.python"]); - expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python"]); - expect(tokens[2][2].value).toBe("="); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python"]); - expect(tokens[2][4].value).toBe("rf"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][5].value).toBe("'"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][6].value).toBe("fo"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[2][7].value).toBe("{{2}}"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[2][8].value).toBe("'"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - it("test/regexp/python1.py", function() { tokens = grammar.tokenizeLines("a = r'[a-z]'\na = R'[a-z]'") diff --git a/test/fstrings/empty2.py b/test/fstrings/empty2.py index 77dc9087..9a007e14 100644 --- a/test/fstrings/empty2.py +++ b/test/fstrings/empty2.py @@ -7,20 +7,22 @@ -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python - : source.python, string.interpolated.python, string.regexp.quoted.single.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python - : invalid.illegal.brace.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python - : invalid.illegal.brace.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : invalid.illegal.brace.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : invalid.illegal.brace.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python diff --git a/test/fstrings/fraw1.py b/test/fstrings/fraw1.py new file mode 100644 index 00000000..31e2196e --- /dev/null +++ b/test/fstrings/fraw1.py @@ -0,0 +1,40 @@ +a = fr'[a-z]' +a = Fr'[a-z]' +a = rf'[a-z]' +a = rF'[a-z]' + + + + +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +Fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rF : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/fstrings/fraw2.py b/test/fstrings/fraw2.py new file mode 100644 index 00000000..df0a2fed --- /dev/null +++ b/test/fstrings/fraw2.py @@ -0,0 +1,36 @@ +rf'fo{{2}}' +rf"fo{{2}}" +rf'''fo{{2}}''' +rf"""fo{{2}}""" + + + + +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +}} : constant.character.escape.python, meta.fstring.python, source.python +" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +''' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +}} : constant.character.escape.python, meta.fstring.python, source.python +''' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +}} : constant.character.escape.python, meta.fstring.python, source.python +""" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python diff --git a/test/fstrings/fraw3.py b/test/fstrings/fraw3.py new file mode 100644 index 00000000..da1a6aff --- /dev/null +++ b/test/fstrings/fraw3.py @@ -0,0 +1,36 @@ +rf'fo{2}' +rf"fo{2}" +rf'''fo{2}''' +rf"""fo{2}""" + + + + +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +''' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +''' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +""" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python diff --git a/test/fstrings/fraw4.py b/test/fstrings/fraw4.py new file mode 100644 index 00000000..2bf2d465 --- /dev/null +++ b/test/fstrings/fraw4.py @@ -0,0 +1,45 @@ +a = rf'fo{{{2}}}' +a = rf'fo{{{bar}}}' +a = rf'fo{{2}}' + + + + + +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +bar : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/fstrings/prefixes2.py b/test/fstrings/prefixes2.py index 861d2b66..78ee4246 100644 --- a/test/fstrings/prefixes2.py +++ b/test/fstrings/prefixes2.py @@ -22,16 +22,20 @@ obj : meta.fstring.python, source.python } : constant.character.format.placeholder.other.python, meta.fstring.python, source.python ' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rF : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rF : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python Rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python ' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/fstrings/prefixes3.py b/test/fstrings/prefixes3.py index 200fa896..46d12ffb 100644 --- a/test/fstrings/prefixes3.py +++ b/test/fstrings/prefixes3.py @@ -6,16 +6,20 @@ -fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -Fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python +fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +Fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python fR : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python ' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/regexp/fregexp1.py b/test/regexp/fregexp1.py deleted file mode 100644 index 9e77d66b..00000000 --- a/test/regexp/fregexp1.py +++ /dev/null @@ -1,56 +0,0 @@ -a = fr'[a-z]' -a = Fr'[a-z]' -a = rf'[a-z]' -a = rF'[a-z]' - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -Fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rF : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python diff --git a/test/regexp/fregexp2.py b/test/regexp/fregexp2.py deleted file mode 100644 index 72eccc28..00000000 --- a/test/regexp/fregexp2.py +++ /dev/null @@ -1,28 +0,0 @@ -rf'fo{{2}}' -rf"fo{{2}}" -rf'''fo{{2}}''' -rf"""fo{{2}}""" - - - - -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python diff --git a/test/regexp/fregexp3.py b/test/regexp/fregexp3.py deleted file mode 100644 index ede8a6c3..00000000 --- a/test/regexp/fregexp3.py +++ /dev/null @@ -1,28 +0,0 @@ -rf'fo{2}' -rf"fo{2}" -rf'''fo{2}''' -rf"""fo{2}""" - - - - -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python diff --git a/test/regexp/fregexp4.py b/test/regexp/fregexp4.py deleted file mode 100644 index 5b707ad3..00000000 --- a/test/regexp/fregexp4.py +++ /dev/null @@ -1,36 +0,0 @@ -a = rf'fo{{2}}' -a = r'fo{{2}}' -a = r'fo{2}' - - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -r : source.python, storage.type.string.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python -fo{ : source.python, string.regexp.quoted.single.python -{2} : keyword.operator.quantifier.regexp, source.python, string.regexp.quoted.single.python -} : source.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -r : source.python, storage.type.string.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python -fo : source.python, string.regexp.quoted.single.python -{2} : keyword.operator.quantifier.regexp, source.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python diff --git a/test/regexp/fregexp5.py b/test/regexp/fregexp5.py deleted file mode 100644 index 0d339e27..00000000 --- a/test/regexp/fregexp5.py +++ /dev/null @@ -1,26 +0,0 @@ -a = rf'{{foo}}' -a = r'\{foo\}' - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{{ : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -foo : source.python, string.interpolated.python, string.regexp.quoted.single.python -}} : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -r : source.python, storage.type.string.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python -\{ : constant.character.escape.regexp, source.python, string.regexp.quoted.single.python -foo : source.python, string.regexp.quoted.single.python -\} : constant.character.escape.regexp, source.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python diff --git a/test/regexp/fregexp6.py b/test/regexp/fregexp6.py deleted file mode 100644 index a51311d0..00000000 --- a/test/regexp/fregexp6.py +++ /dev/null @@ -1,39 +0,0 @@ -a = rf'fo{{{2}}}' -a = rf'fo{{{bar}}}' -a = rf'fo{{2}}' - - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{ : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.single.python -}} : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{ : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{bar} : source.python, string.interpolated.python, string.regexp.quoted.single.python -}} : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python From 7d0f2b22a5ad8fccbd7341bc7b7a715169283044 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Tue, 18 Oct 2022 03:43:20 -0400 Subject: [PATCH 49/49] Update the syntax to Python 3.10 Update the built-ins, dunders and add `match` and `case` keywords. --- grammars/MagicPython.cson | 81 +- grammars/MagicPython.tmLanguage | 85 +- grammars/src/MagicPython.syntax.yaml | 76 +- test/atom-spec/python-spec.js | 1210 +++++++++++++++++++++++++- test/builtins/builtins3.py | 12 + test/builtins/builtins7.py | 8 + test/classes/class9.py | 16 + test/expressions/expr22.py | 33 + test/expressions/special2.py | 2 +- test/statements/match1.py | 61 ++ test/statements/match2.py | 112 +++ test/statements/match3.py | 114 +++ test/statements/match4.py | 59 ++ test/statements/match5.py | 112 +++ test/statements/match6.py | 53 ++ test/statements/match7.py | 97 +++ 16 files changed, 2028 insertions(+), 103 deletions(-) create mode 100644 test/expressions/expr22.py create mode 100644 test/statements/match1.py create mode 100644 test/statements/match2.py create mode 100644 test/statements/match3.py create mode 100644 test/statements/match4.py create mode 100644 test/statements/match5.py create mode 100644 test/statements/match6.py create mode 100644 test/statements/match7.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index afb32a6d..d837d6a3 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -308,6 +308,18 @@ repository: name: "storage.type.class.python" match: "\\b(?match \b(?<!\.)(class)\b + + match + (?x) + ^\s*( + case | match + )(?=\s*([-+\w\d(\[{'":#]|$))\b + + captures + + 1 + + name + keyword.control.flow.python + + + expression-bare @@ -2852,14 +2868,14 @@ correctly identify the "in" as a control flow keyword. match (?x) (?<!\.) \b( - __import__ | abs | all | any | ascii | bin | breakpoint | callable - | chr | compile | copyright | credits | delattr | dir | divmod - | enumerate | eval | exec | exit | filter | format | getattr - | globals | hasattr | hash | help | hex | id | input - | isinstance | issubclass | iter | len | license | locals | map - | max | memoryview | min | next | oct | open | ord | pow | print - | quit | range | reload | repr | reversed | round - | setattr | sorted | sum | vars | zip + __import__ | abs | aiter | all | any | anext | ascii | bin + | breakpoint | callable | chr | compile | copyright | credits + | delattr | dir | divmod | enumerate | eval | exec | exit + | filter | format | getattr | globals | hasattr | hash | help + | hex | id | input | isinstance | issubclass | iter | len + | license | locals | map | max | memoryview | min | next + | oct | open | ord | pow | print | quit | range | reload | repr + | reversed | round | setattr | sorted | sum | vars | zip )\b @@ -2904,24 +2920,29 @@ indirectly through syntactic constructs (?x) \b( __(?: - abs | add | aenter | aexit | aiter | and | anext | await - | bool | call | ceil | cmp | coerce | complex | contains - | copy | deepcopy | del | delattr | delete | delitem - | delslice | dir | div | divmod | enter | eq | exit | float - | floor | floordiv | format | ge | get | getattr - | getattribute | getinitargs | getitem | getnewargs - | getslice | getstate | gt | hash | hex | iadd | iand | idiv - | ifloordiv | ilshift | imod | imul | index | init - | instancecheck | int | invert | ior | ipow | irshift | isub - | iter | itruediv | ixor | le | len | long | lshift | lt - | missing | mod | mul | ne | neg | new | next | nonzero | oct | or - | pos | pow | radd | rand | rdiv | rdivmod | reduce - | reduce_ex | repr | reversed | rfloordiv | rlshift | rmod - | rmul | ror | round | rpow | rrshift | rshift | rsub - | rtruediv | rxor | set | setattr | setitem | setslice - | setstate | sizeof | str | sub | subclasscheck | truediv - | trunc | unicode | xor | matmul | rmatmul | imatmul - | init_subclass | set_name | fspath | bytes | prepare + abs | add | aenter | aexit | aiter | and | anext + | await | bool | call | ceil | class_getitem + | cmp | coerce | complex | contains | copy + | deepcopy | del | delattr | delete | delitem + | delslice | dir | div | divmod | enter | eq + | exit | float | floor | floordiv | format | ge + | get | getattr | getattribute | getinitargs + | getitem | getnewargs | getslice | getstate | gt + | hash | hex | iadd | iand | idiv | ifloordiv | + | ilshift | imod | imul | index | init + | instancecheck | int | invert | ior | ipow + | irshift | isub | iter | itruediv | ixor | le + | len | long | lshift | lt | missing | mod | mul + | ne | neg | new | next | nonzero | oct | or | pos + | pow | radd | rand | rdiv | rdivmod | reduce + | reduce_ex | repr | reversed | rfloordiv | + | rlshift | rmod | rmul | ror | round | rpow + | rrshift | rshift | rsub | rtruediv | rxor | set + | setattr | setitem | set_name | setslice + | setstate | sizeof | str | sub | subclasscheck + | truediv | trunc | unicode | xor | matmul + | rmatmul | imatmul | init_subclass | set_name + | fspath | bytes | prepare | length_hint )__ )\b @@ -2942,12 +2963,12 @@ indirectly through syntactic constructs (?x) \b( __(?: - all | bases | builtins | class | class_getitem | code | debug - | defaults | dict | doc | file | func | kwdefaults | members - | metaclass | methods | module | mro | mro_entries | name - | qualname | post_init | self | signature | slots | subclasses - | version | weakref | wrapped | annotations | classcell - | spec | path | package | future | traceback + all | annotations | bases | builtins | class + | closure | code | debug | defaults | dict | doc | file | func + | globals | kwdefaults | match_args | members | metaclass | methods + | module | mro | mro_entries | name | qualname | post_init | self + | signature | slots | subclasses | version | weakref | wrapped + | classcell | spec | path | package | future | traceback )__ )\b diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index bd740829..ebfccdaf 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -313,6 +313,13 @@ repository: )\b - name: storage.type.class.python match: \b(?