MagicPython.tmLanguage.json 145 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335
  1. {
  2. "information_for_contributors": [
  3. "This file has been converted from https://github.com/MagicStack/MagicPython/blob/master/grammars/MagicPython.tmLanguage",
  4. "If you want to provide a fix or improvement, please create a pull request against the original repository.",
  5. "Once accepted there, we are happy to receive an update request."
  6. ],
  7. "version": "https://github.com/MagicStack/MagicPython/commit/b4b2e6eb16fee36aea0788bf0aa1853c25f7d276",
  8. "name": "MagicPython",
  9. "scopeName": "source.python",
  10. "patterns": [
  11. {
  12. "include": "#statement"
  13. },
  14. {
  15. "include": "#expression"
  16. }
  17. ],
  18. "repository": {
  19. "impossible": {
  20. "comment": "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token.",
  21. "match": "$.^"
  22. },
  23. "statement": {
  24. "patterns": [
  25. {
  26. "include": "#import"
  27. },
  28. {
  29. "include": "#class-declaration"
  30. },
  31. {
  32. "include": "#function-declaration"
  33. },
  34. {
  35. "include": "#generator"
  36. },
  37. {
  38. "include": "#statement-keyword"
  39. },
  40. {
  41. "include": "#assignment-operator"
  42. },
  43. {
  44. "include": "#decorator"
  45. },
  46. {
  47. "include": "#docstring-statement"
  48. },
  49. {
  50. "include": "#semicolon"
  51. }
  52. ]
  53. },
  54. "semicolon": {
  55. "patterns": [
  56. {
  57. "name": "invalid.deprecated.semicolon.python",
  58. "match": "\\;$"
  59. }
  60. ]
  61. },
  62. "comments": {
  63. "patterns": [
  64. {
  65. "name": "comment.line.number-sign.python",
  66. "contentName": "meta.typehint.comment.python",
  67. "begin": "(?x)\n (?:\n \\# \\s* (type:)\n \\s*+ (?# we want `\\s*+` which is possessive quantifier since\n we do not actually want to backtrack when matching\n whitespace here)\n (?! $ | \\#)\n )\n",
  68. "end": "(?:$|(?=\\#))",
  69. "beginCaptures": {
  70. "0": {
  71. "name": "meta.typehint.comment.python"
  72. },
  73. "1": {
  74. "name": "comment.typehint.directive.notation.python"
  75. }
  76. },
  77. "patterns": [
  78. {
  79. "name": "comment.typehint.ignore.notation.python",
  80. "match": "(?x)\n \\G ignore\n (?= \\s* (?: $ | \\#))\n"
  81. },
  82. {
  83. "name": "comment.typehint.type.notation.python",
  84. "match": "(?x)\n (?<!\\.)\\b(\n bool | bytes | float | int | object | str\n | List | Dict | Iterable | Sequence | Set\n | FrozenSet | Callable | Union | Tuple\n | Any | None\n )\\b\n"
  85. },
  86. {
  87. "name": "comment.typehint.punctuation.notation.python",
  88. "match": "([\\[\\]\\(\\),\\.\\=\\*]|(->))"
  89. },
  90. {
  91. "name": "comment.typehint.variable.notation.python",
  92. "match": "([[:alpha:]_]\\w*)"
  93. }
  94. ]
  95. },
  96. {
  97. "include": "#comments-base"
  98. }
  99. ]
  100. },
  101. "docstring-statement": {
  102. "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
  103. "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",
  104. "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
  105. "patterns": [
  106. {
  107. "include": "#docstring"
  108. }
  109. ]
  110. },
  111. "docstring": {
  112. "patterns": [
  113. {
  114. "name": "string.quoted.docstring.multi.python",
  115. "begin": "(\\'\\'\\'|\\\"\\\"\\\")",
  116. "end": "(\\1)",
  117. "beginCaptures": {
  118. "1": {
  119. "name": "punctuation.definition.string.begin.python"
  120. }
  121. },
  122. "endCaptures": {
  123. "1": {
  124. "name": "punctuation.definition.string.end.python"
  125. }
  126. },
  127. "patterns": [
  128. {
  129. "include": "#docstring-prompt"
  130. },
  131. {
  132. "include": "#codetags"
  133. },
  134. {
  135. "include": "#docstring-guts-unicode"
  136. }
  137. ]
  138. },
  139. {
  140. "name": "string.quoted.docstring.raw.multi.python",
  141. "begin": "([rR])(\\'\\'\\'|\\\"\\\"\\\")",
  142. "end": "(\\2)",
  143. "beginCaptures": {
  144. "1": {
  145. "name": "storage.type.string.python"
  146. },
  147. "2": {
  148. "name": "punctuation.definition.string.begin.python"
  149. }
  150. },
  151. "endCaptures": {
  152. "1": {
  153. "name": "punctuation.definition.string.end.python"
  154. }
  155. },
  156. "patterns": [
  157. {
  158. "include": "#string-consume-escape"
  159. },
  160. {
  161. "include": "#docstring-prompt"
  162. },
  163. {
  164. "include": "#codetags"
  165. }
  166. ]
  167. },
  168. {
  169. "name": "string.quoted.docstring.single.python",
  170. "begin": "(\\'|\\\")",
  171. "end": "(\\1)|(\\n)",
  172. "beginCaptures": {
  173. "1": {
  174. "name": "punctuation.definition.string.begin.python"
  175. }
  176. },
  177. "endCaptures": {
  178. "1": {
  179. "name": "punctuation.definition.string.end.python"
  180. },
  181. "2": {
  182. "name": "invalid.illegal.newline.python"
  183. }
  184. },
  185. "patterns": [
  186. {
  187. "include": "#codetags"
  188. },
  189. {
  190. "include": "#docstring-guts-unicode"
  191. }
  192. ]
  193. },
  194. {
  195. "name": "string.quoted.docstring.raw.single.python",
  196. "begin": "([rR])(\\'|\\\")",
  197. "end": "(\\2)|(\\n)",
  198. "beginCaptures": {
  199. "1": {
  200. "name": "storage.type.string.python"
  201. },
  202. "2": {
  203. "name": "punctuation.definition.string.begin.python"
  204. }
  205. },
  206. "endCaptures": {
  207. "1": {
  208. "name": "punctuation.definition.string.end.python"
  209. },
  210. "2": {
  211. "name": "invalid.illegal.newline.python"
  212. }
  213. },
  214. "patterns": [
  215. {
  216. "include": "#string-consume-escape"
  217. },
  218. {
  219. "include": "#codetags"
  220. }
  221. ]
  222. }
  223. ]
  224. },
  225. "docstring-guts-unicode": {
  226. "patterns": [
  227. {
  228. "include": "#escape-sequence-unicode"
  229. },
  230. {
  231. "include": "#escape-sequence"
  232. },
  233. {
  234. "include": "#string-line-continuation"
  235. }
  236. ]
  237. },
  238. "docstring-prompt": {
  239. "match": "(?x)\n (?:\n (?:^|\\G) \\s* (?# '\\G' is necessary for ST)\n ((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)\n )\n",
  240. "captures": {
  241. "1": {
  242. "name": "keyword.control.flow.python"
  243. }
  244. }
  245. },
  246. "statement-keyword": {
  247. "patterns": [
  248. {
  249. "name": "storage.type.function.python",
  250. "match": "\\b((async\\s+)?\\s*def)\\b"
  251. },
  252. {
  253. "name": "keyword.control.flow.python",
  254. "comment": "if `as` is eventually followed by `:` or line continuation\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n",
  255. "match": "\\b(?<!\\.)as\\b(?=.*[:\\\\])"
  256. },
  257. {
  258. "name": "keyword.control.import.python",
  259. "comment": "other legal use of `as` is in an import",
  260. "match": "\\b(?<!\\.)as\\b"
  261. },
  262. {
  263. "name": "keyword.control.flow.python",
  264. "match": "(?x)\n \\b(?<!\\.)(\n async | continue | del | assert | break | finally | for\n | from | elif | else | if | except | pass | raise\n | return | try | while | with\n )\\b\n"
  265. },
  266. {
  267. "name": "storage.modifier.declaration.python",
  268. "match": "(?x)\n \\b(?<!\\.)(\n global | nonlocal\n )\\b\n"
  269. },
  270. {
  271. "name": "storage.type.class.python",
  272. "match": "\\b(?<!\\.)(class)\\b"
  273. }
  274. ]
  275. },
  276. "expression-bare": {
  277. "comment": "valid Python expressions w/o comments and line continuation",
  278. "patterns": [
  279. {
  280. "include": "#backticks"
  281. },
  282. {
  283. "include": "#illegal-anno"
  284. },
  285. {
  286. "include": "#literal"
  287. },
  288. {
  289. "include": "#regexp"
  290. },
  291. {
  292. "include": "#string"
  293. },
  294. {
  295. "include": "#lambda"
  296. },
  297. {
  298. "include": "#generator"
  299. },
  300. {
  301. "include": "#illegal-operator"
  302. },
  303. {
  304. "include": "#operator"
  305. },
  306. {
  307. "include": "#curly-braces"
  308. },
  309. {
  310. "include": "#item-access"
  311. },
  312. {
  313. "include": "#list"
  314. },
  315. {
  316. "include": "#odd-function-call"
  317. },
  318. {
  319. "include": "#round-braces"
  320. },
  321. {
  322. "include": "#function-call"
  323. },
  324. {
  325. "include": "#builtin-functions"
  326. },
  327. {
  328. "include": "#builtin-types"
  329. },
  330. {
  331. "include": "#builtin-exceptions"
  332. },
  333. {
  334. "include": "#magic-names"
  335. },
  336. {
  337. "include": "#special-names"
  338. },
  339. {
  340. "include": "#illegal-names"
  341. },
  342. {
  343. "include": "#special-variables"
  344. },
  345. {
  346. "include": "#ellipsis"
  347. },
  348. {
  349. "include": "#punctuation"
  350. },
  351. {
  352. "include": "#line-continuation"
  353. }
  354. ]
  355. },
  356. "expression-base": {
  357. "comment": "valid Python expressions with comments and line continuation",
  358. "patterns": [
  359. {
  360. "include": "#comments"
  361. },
  362. {
  363. "include": "#expression-bare"
  364. },
  365. {
  366. "include": "#line-continuation"
  367. }
  368. ]
  369. },
  370. "expression": {
  371. "comment": "All valid Python expressions",
  372. "patterns": [
  373. {
  374. "include": "#expression-base"
  375. },
  376. {
  377. "include": "#member-access"
  378. },
  379. {
  380. "comment": "Tokenize identifiers to help linters",
  381. "match": "(?x) \\b ([[:alpha:]_]\\w*) \\b"
  382. }
  383. ]
  384. },
  385. "member-access": {
  386. "name": "meta.member.access.python",
  387. "begin": "(\\.)\\s*(?!\\.)",
  388. "end": "(?x)\n # stop when you've just read non-whitespace followed by non-word\n # i.e. when finished reading an identifier or function call\n (?<=\\S)(?=\\W) |\n # stop when seeing the start of something that's not a word,\n # i.e. when seeing a non-identifier\n (^|(?<=\\s))(?=[^\\\\\\w\\s]) |\n $\n",
  389. "beginCaptures": {
  390. "1": {
  391. "name": "punctuation.separator.period.python"
  392. }
  393. },
  394. "patterns": [
  395. {
  396. "include": "#function-call"
  397. },
  398. {
  399. "include": "#member-access-base"
  400. },
  401. {
  402. "include": "#member-access-attribute"
  403. }
  404. ]
  405. },
  406. "member-access-base": {
  407. "patterns": [
  408. {
  409. "include": "#magic-names"
  410. },
  411. {
  412. "include": "#illegal-names"
  413. },
  414. {
  415. "include": "#illegal-object-name"
  416. },
  417. {
  418. "include": "#special-names"
  419. },
  420. {
  421. "include": "#line-continuation"
  422. },
  423. {
  424. "include": "#item-access"
  425. }
  426. ]
  427. },
  428. "member-access-attribute": {
  429. "comment": "Highlight attribute access in otherwise non-specialized cases.",
  430. "name": "meta.attribute.python",
  431. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
  432. },
  433. "special-names": {
  434. "name": "constant.other.caps.python",
  435. "match": "(?x)\n \\b\n # we want to see \"enough\", meaning 2 or more upper-case\n # letters in the beginning of the constant\n #\n # for more details refer to:\n # https://github.com/MagicStack/MagicPython/issues/42\n (\n _* [[:upper:]] [_\\d]* [[:upper:]]\n )\n [[:upper:]\\d]* (_\\w*)?\n \\b\n"
  436. },
  437. "curly-braces": {
  438. "begin": "\\{",
  439. "end": "\\}",
  440. "beginCaptures": {
  441. "0": {
  442. "name": "punctuation.definition.dict.begin.python"
  443. }
  444. },
  445. "endCaptures": {
  446. "0": {
  447. "name": "punctuation.definition.dict.end.python"
  448. }
  449. },
  450. "patterns": [
  451. {
  452. "name": "punctuation.separator.dict.python",
  453. "match": ":"
  454. },
  455. {
  456. "include": "#expression"
  457. }
  458. ]
  459. },
  460. "list": {
  461. "begin": "\\[",
  462. "end": "\\]",
  463. "beginCaptures": {
  464. "0": {
  465. "name": "punctuation.definition.list.begin.python"
  466. }
  467. },
  468. "endCaptures": {
  469. "0": {
  470. "name": "punctuation.definition.list.end.python"
  471. }
  472. },
  473. "patterns": [
  474. {
  475. "include": "#expression"
  476. }
  477. ]
  478. },
  479. "odd-function-call": {
  480. "comment": "A bit obscured function call where there may have been an\narbitrary number of other operations to get the function.\nE.g. \"arr[idx](args)\"\n",
  481. "begin": "(?x)\n (?<= \\] | \\) ) \\s*\n (?=\\()\n",
  482. "end": "(\\))",
  483. "endCaptures": {
  484. "1": {
  485. "name": "punctuation.definition.arguments.end.python"
  486. }
  487. },
  488. "patterns": [
  489. {
  490. "include": "#function-arguments"
  491. }
  492. ]
  493. },
  494. "round-braces": {
  495. "begin": "\\(",
  496. "end": "\\)",
  497. "beginCaptures": {
  498. "0": {
  499. "name": "punctuation.parenthesis.begin.python"
  500. }
  501. },
  502. "endCaptures": {
  503. "0": {
  504. "name": "punctuation.parenthesis.end.python"
  505. }
  506. },
  507. "patterns": [
  508. {
  509. "include": "#expression"
  510. }
  511. ]
  512. },
  513. "line-continuation": {
  514. "patterns": [
  515. {
  516. "match": "(\\\\)\\s*(\\S.*$\\n?)",
  517. "captures": {
  518. "1": {
  519. "name": "punctuation.separator.continuation.line.python"
  520. },
  521. "2": {
  522. "name": "invalid.illegal.line.continuation.python"
  523. }
  524. }
  525. },
  526. {
  527. "begin": "(\\\\)\\s*$\\n?",
  528. "end": "(?x)\n (?=^\\s*$)\n |\n (?! (\\s* [rR]? (\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))\n |\n (\\G $) (?# '\\G' is necessary for ST)\n )\n",
  529. "beginCaptures": {
  530. "1": {
  531. "name": "punctuation.separator.continuation.line.python"
  532. }
  533. },
  534. "patterns": [
  535. {
  536. "include": "#regexp"
  537. },
  538. {
  539. "include": "#string"
  540. }
  541. ]
  542. }
  543. ]
  544. },
  545. "assignment-operator": {
  546. "name": "keyword.operator.assignment.python",
  547. "match": "(?x)\n <<= | >>= | //= | \\*\\*=\n | \\+= | -= | /= | @=\n | \\*= | %= | ~= | \\^= | &= | \\|=\n | =(?!=)\n"
  548. },
  549. "operator": {
  550. "match": "(?x)\n \\b(?<!\\.)\n (?:\n (and | or | not | in | is) (?# 1)\n |\n (for | if | else | await | (?:yield(?:\\s+from)?)) (?# 2)\n )\n (?!\\s*:)\\b\n\n | (<< | >> | & | \\| | \\^ | ~) (?# 3)\n\n | (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n | (!= | == | >= | <= | < | >) (?# 5)\n",
  551. "captures": {
  552. "1": {
  553. "name": "keyword.operator.logical.python"
  554. },
  555. "2": {
  556. "name": "keyword.control.flow.python"
  557. },
  558. "3": {
  559. "name": "keyword.operator.bitwise.python"
  560. },
  561. "4": {
  562. "name": "keyword.operator.arithmetic.python"
  563. },
  564. "5": {
  565. "name": "keyword.operator.comparison.python"
  566. }
  567. }
  568. },
  569. "punctuation": {
  570. "patterns": [
  571. {
  572. "name": "punctuation.separator.colon.python",
  573. "match": ":"
  574. },
  575. {
  576. "name": "punctuation.separator.element.python",
  577. "match": ","
  578. }
  579. ]
  580. },
  581. "literal": {
  582. "patterns": [
  583. {
  584. "name": "constant.language.python",
  585. "match": "\\b(True|False|None|NotImplemented|Ellipsis)\\b"
  586. },
  587. {
  588. "include": "#number"
  589. }
  590. ]
  591. },
  592. "number": {
  593. "name": "constant.numeric.python",
  594. "patterns": [
  595. {
  596. "include": "#number-float"
  597. },
  598. {
  599. "include": "#number-dec"
  600. },
  601. {
  602. "include": "#number-hex"
  603. },
  604. {
  605. "include": "#number-oct"
  606. },
  607. {
  608. "include": "#number-bin"
  609. },
  610. {
  611. "include": "#number-long"
  612. },
  613. {
  614. "name": "invalid.illegal.name.python",
  615. "match": "\\b[0-9]+\\w+"
  616. }
  617. ]
  618. },
  619. "number-float": {
  620. "name": "constant.numeric.float.python",
  621. "match": "(?x)\n (?<! \\w)(?:\n (?:\n \\.[0-9](?: _?[0-9] )*\n |\n [0-9](?: _?[0-9] )* \\. [0-9](?: _?[0-9] )*\n |\n [0-9](?: _?[0-9] )* \\.\n ) (?: [eE][+-]?[0-9](?: _?[0-9] )* )?\n |\n [0-9](?: _?[0-9] )* (?: [eE][+-]?[0-9](?: _?[0-9] )* )\n )([jJ])?\\b\n",
  622. "captures": {
  623. "1": {
  624. "name": "storage.type.imaginary.number.python"
  625. }
  626. }
  627. },
  628. "number-dec": {
  629. "name": "constant.numeric.dec.python",
  630. "match": "(?x)\n (?<![\\w\\.])(?:\n [1-9](?: _?[0-9] )*\n |\n 0+\n |\n [0-9](?: _?[0-9] )* ([jJ])\n |\n 0 ([0-9]+)(?![eE\\.])\n )\\b\n",
  631. "captures": {
  632. "1": {
  633. "name": "storage.type.imaginary.number.python"
  634. },
  635. "2": {
  636. "name": "invalid.illegal.dec.python"
  637. },
  638. "3": {
  639. "name": "invalid.illegal.dec.python"
  640. }
  641. }
  642. },
  643. "number-hex": {
  644. "name": "constant.numeric.hex.python",
  645. "match": "(?x)\n (?<![\\w\\.])\n (0[xX]) (_?[0-9a-fA-F])+\n \\b\n",
  646. "captures": {
  647. "1": {
  648. "name": "storage.type.number.python"
  649. }
  650. }
  651. },
  652. "number-oct": {
  653. "name": "constant.numeric.oct.python",
  654. "match": "(?x)\n (?<![\\w\\.])\n (0[oO]) (_?[0-7])+\n \\b\n",
  655. "captures": {
  656. "1": {
  657. "name": "storage.type.number.python"
  658. }
  659. }
  660. },
  661. "number-bin": {
  662. "name": "constant.numeric.bin.python",
  663. "match": "(?x)\n (?<![\\w\\.])\n (0[bB]) (_?[01])+\n \\b\n",
  664. "captures": {
  665. "1": {
  666. "name": "storage.type.number.python"
  667. }
  668. }
  669. },
  670. "number-long": {
  671. "name": "constant.numeric.bin.python",
  672. "comment": "this is to support python2 syntax for long ints",
  673. "match": "(?x)\n (?<![\\w\\.])\n ([1-9][0-9]* | 0) ([lL])\n \\b\n",
  674. "captures": {
  675. "2": {
  676. "name": "storage.type.number.python"
  677. }
  678. }
  679. },
  680. "regexp": {
  681. "patterns": [
  682. {
  683. "include": "#regexp-single-three-line"
  684. },
  685. {
  686. "include": "#regexp-double-three-line"
  687. },
  688. {
  689. "include": "#regexp-single-one-line"
  690. },
  691. {
  692. "include": "#regexp-double-one-line"
  693. },
  694. {
  695. "include": "#fregexp-single-three-line"
  696. },
  697. {
  698. "include": "#fregexp-double-three-line"
  699. },
  700. {
  701. "include": "#fregexp-single-one-line"
  702. },
  703. {
  704. "include": "#fregexp-double-one-line"
  705. }
  706. ]
  707. },
  708. "string": {
  709. "patterns": [
  710. {
  711. "include": "#string-quoted-multi-line"
  712. },
  713. {
  714. "include": "#string-quoted-single-line"
  715. },
  716. {
  717. "include": "#string-bin-quoted-multi-line"
  718. },
  719. {
  720. "include": "#string-bin-quoted-single-line"
  721. },
  722. {
  723. "include": "#string-raw-quoted-multi-line"
  724. },
  725. {
  726. "include": "#string-raw-quoted-single-line"
  727. },
  728. {
  729. "include": "#string-raw-bin-quoted-multi-line"
  730. },
  731. {
  732. "include": "#string-raw-bin-quoted-single-line"
  733. },
  734. {
  735. "include": "#fstring-fnorm-quoted-multi-line"
  736. },
  737. {
  738. "include": "#fstring-fnorm-quoted-single-line"
  739. },
  740. {
  741. "include": "#fstring-normf-quoted-multi-line"
  742. },
  743. {
  744. "include": "#fstring-normf-quoted-single-line"
  745. },
  746. {
  747. "include": "#fstring-raw-quoted-multi-line"
  748. },
  749. {
  750. "include": "#fstring-raw-quoted-single-line"
  751. }
  752. ]
  753. },
  754. "string-unicode-guts": {
  755. "patterns": [
  756. {
  757. "include": "#escape-sequence-unicode"
  758. },
  759. {
  760. "include": "#string-entity"
  761. },
  762. {
  763. "include": "#string-brace-formatting"
  764. }
  765. ]
  766. },
  767. "string-consume-escape": {
  768. "match": "\\\\['\"\\n\\\\]"
  769. },
  770. "string-raw-guts": {
  771. "patterns": [
  772. {
  773. "include": "#string-consume-escape"
  774. },
  775. {
  776. "include": "#string-formatting"
  777. },
  778. {
  779. "include": "#string-brace-formatting"
  780. }
  781. ]
  782. },
  783. "string-raw-bin-guts": {
  784. "patterns": [
  785. {
  786. "include": "#string-consume-escape"
  787. },
  788. {
  789. "include": "#string-formatting"
  790. }
  791. ]
  792. },
  793. "string-entity": {
  794. "patterns": [
  795. {
  796. "include": "#escape-sequence"
  797. },
  798. {
  799. "include": "#string-line-continuation"
  800. },
  801. {
  802. "include": "#string-formatting"
  803. }
  804. ]
  805. },
  806. "fstring-guts": {
  807. "patterns": [
  808. {
  809. "include": "#escape-sequence-unicode"
  810. },
  811. {
  812. "include": "#escape-sequence"
  813. },
  814. {
  815. "include": "#string-line-continuation"
  816. },
  817. {
  818. "include": "#fstring-formatting"
  819. }
  820. ]
  821. },
  822. "fstring-raw-guts": {
  823. "patterns": [
  824. {
  825. "include": "#string-consume-escape"
  826. },
  827. {
  828. "include": "#fstring-formatting"
  829. }
  830. ]
  831. },
  832. "fstring-illegal-single-brace": {
  833. "comment": "it is illegal to have a multiline brace inside a single-line string",
  834. "begin": "(\\{)(?=[^\\n}]*$\\n?)",
  835. "end": "(\\})|(?=\\n)",
  836. "beginCaptures": {
  837. "1": {
  838. "name": "constant.character.format.placeholder.other.python"
  839. }
  840. },
  841. "endCaptures": {
  842. "1": {
  843. "name": "constant.character.format.placeholder.other.python"
  844. }
  845. },
  846. "patterns": [
  847. {
  848. "include": "#fstring-terminator-single"
  849. },
  850. {
  851. "include": "#f-expression"
  852. }
  853. ]
  854. },
  855. "fstring-illegal-multi-brace": {
  856. "patterns": [
  857. {
  858. "include": "#impossible"
  859. }
  860. ]
  861. },
  862. "f-expression": {
  863. "comment": "All valid Python expressions, except comments and line continuation",
  864. "patterns": [
  865. {
  866. "include": "#expression-bare"
  867. },
  868. {
  869. "include": "#member-access"
  870. },
  871. {
  872. "comment": "Tokenize identifiers to help linters",
  873. "match": "(?x) \\b ([[:alpha:]_]\\w*) \\b"
  874. }
  875. ]
  876. },
  877. "escape-sequence-unicode": {
  878. "patterns": [
  879. {
  880. "name": "constant.character.escape.python",
  881. "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n | N\\{[\\w\\s]+?\\}\n )\n"
  882. }
  883. ]
  884. },
  885. "escape-sequence": {
  886. "name": "constant.character.escape.python",
  887. "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | [0-7]{1,3}\n | [\\\\\"'abfnrtv]\n )\n"
  888. },
  889. "string-line-continuation": {
  890. "name": "constant.language.python",
  891. "match": "\\\\$"
  892. },
  893. "string-formatting": {
  894. "name": "meta.format.percent.python",
  895. "match": "(?x)\n (\n % (\\([\\w\\s]*\\))?\n [-+#0 ]*\n (\\d+|\\*)? (\\.(\\d+|\\*))?\n ([hlL])?\n [diouxXeEfFgGcrsab%]\n )\n",
  896. "captures": {
  897. "1": {
  898. "name": "constant.character.format.placeholder.other.python"
  899. }
  900. }
  901. },
  902. "string-brace-formatting": {
  903. "patterns": [
  904. {
  905. "name": "meta.format.brace.python",
  906. "match": "(?x)\n (\n {{ | }}\n | (?:\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n",
  907. "captures": {
  908. "1": {
  909. "name": "constant.character.format.placeholder.other.python"
  910. },
  911. "3": {
  912. "name": "storage.type.format.python"
  913. },
  914. "4": {
  915. "name": "storage.type.format.python"
  916. }
  917. }
  918. },
  919. {
  920. "name": "meta.format.brace.python",
  921. "match": "(?x)\n (\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n (:)\n [^'\"{}\\n]* (?:\n \\{ [^'\"}\\n]*? \\} [^'\"{}\\n]*\n )*\n }\n )\n",
  922. "captures": {
  923. "1": {
  924. "name": "constant.character.format.placeholder.other.python"
  925. },
  926. "3": {
  927. "name": "storage.type.format.python"
  928. },
  929. "4": {
  930. "name": "storage.type.format.python"
  931. }
  932. }
  933. }
  934. ]
  935. },
  936. "fstring-formatting": {
  937. "patterns": [
  938. {
  939. "include": "#fstring-formatting-braces"
  940. },
  941. {
  942. "include": "#fstring-formatting-singe-brace"
  943. }
  944. ]
  945. },
  946. "fstring-formatting-singe-brace": {
  947. "name": "invalid.illegal.brace.python",
  948. "match": "(}(?!}))"
  949. },
  950. "import": {
  951. "comment": "Import statements used to correctly mark `from`, `import`, and `as`\n",
  952. "patterns": [
  953. {
  954. "begin": "\\b(?<!\\.)(from)\\b(?=.+import)",
  955. "end": "$|(?=import)",
  956. "beginCaptures": {
  957. "1": {
  958. "name": "keyword.control.import.python"
  959. }
  960. },
  961. "patterns": [
  962. {
  963. "name": "punctuation.separator.period.python",
  964. "match": "\\.+"
  965. },
  966. {
  967. "include": "#expression"
  968. }
  969. ]
  970. },
  971. {
  972. "begin": "\\b(?<!\\.)(import)\\b",
  973. "end": "$",
  974. "beginCaptures": {
  975. "1": {
  976. "name": "keyword.control.import.python"
  977. }
  978. },
  979. "patterns": [
  980. {
  981. "name": "keyword.control.import.python",
  982. "match": "\\b(?<!\\.)as\\b"
  983. },
  984. {
  985. "include": "#expression"
  986. }
  987. ]
  988. }
  989. ]
  990. },
  991. "class-declaration": {
  992. "patterns": [
  993. {
  994. "name": "meta.class.python",
  995. "begin": "(?x)\n \\s*(class)\\s+\n (?=\n [[:alpha:]_]\\w* \\s* (:|\\()\n )\n",
  996. "end": "(:)",
  997. "beginCaptures": {
  998. "1": {
  999. "name": "storage.type.class.python"
  1000. }
  1001. },
  1002. "endCaptures": {
  1003. "1": {
  1004. "name": "punctuation.section.class.begin.python"
  1005. }
  1006. },
  1007. "patterns": [
  1008. {
  1009. "include": "#class-name"
  1010. },
  1011. {
  1012. "include": "#class-inheritance"
  1013. }
  1014. ]
  1015. }
  1016. ]
  1017. },
  1018. "class-name": {
  1019. "patterns": [
  1020. {
  1021. "include": "#illegal-object-name"
  1022. },
  1023. {
  1024. "include": "#builtin-possible-callables"
  1025. },
  1026. {
  1027. "name": "entity.name.type.class.python",
  1028. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
  1029. }
  1030. ]
  1031. },
  1032. "class-inheritance": {
  1033. "name": "meta.class.inheritance.python",
  1034. "begin": "(\\()",
  1035. "end": "(\\))",
  1036. "beginCaptures": {
  1037. "1": {
  1038. "name": "punctuation.definition.inheritance.begin.python"
  1039. }
  1040. },
  1041. "endCaptures": {
  1042. "1": {
  1043. "name": "punctuation.definition.inheritance.end.python"
  1044. }
  1045. },
  1046. "patterns": [
  1047. {
  1048. "name": "keyword.operator.unpacking.arguments.python",
  1049. "match": "(\\*\\*|\\*)"
  1050. },
  1051. {
  1052. "name": "punctuation.separator.inheritance.python",
  1053. "match": ","
  1054. },
  1055. {
  1056. "name": "keyword.operator.assignment.python",
  1057. "match": "=(?!=)"
  1058. },
  1059. {
  1060. "name": "support.type.metaclass.python",
  1061. "match": "\\bmetaclass\\b"
  1062. },
  1063. {
  1064. "include": "#illegal-names"
  1065. },
  1066. {
  1067. "include": "#class-kwarg"
  1068. },
  1069. {
  1070. "include": "#call-wrapper-inheritance"
  1071. },
  1072. {
  1073. "include": "#expression-base"
  1074. },
  1075. {
  1076. "include": "#member-access-class"
  1077. },
  1078. {
  1079. "include": "#inheritance-identifier"
  1080. }
  1081. ]
  1082. },
  1083. "class-kwarg": {
  1084. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\s*(=)(?!=)\n",
  1085. "captures": {
  1086. "1": {
  1087. "name": "entity.other.inherited-class.python variable.parameter.class.python"
  1088. },
  1089. "2": {
  1090. "name": "keyword.operator.assignment.python"
  1091. }
  1092. }
  1093. },
  1094. "inheritance-identifier": {
  1095. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n",
  1096. "captures": {
  1097. "1": {
  1098. "name": "entity.other.inherited-class.python"
  1099. }
  1100. }
  1101. },
  1102. "member-access-class": {
  1103. "name": "meta.member.access.python",
  1104. "begin": "(\\.)\\s*(?!\\.)",
  1105. "end": "(?<=\\S)(?=\\W)|$",
  1106. "beginCaptures": {
  1107. "1": {
  1108. "name": "punctuation.separator.period.python"
  1109. }
  1110. },
  1111. "patterns": [
  1112. {
  1113. "include": "#call-wrapper-inheritance"
  1114. },
  1115. {
  1116. "include": "#member-access-base"
  1117. },
  1118. {
  1119. "include": "#inheritance-identifier"
  1120. }
  1121. ]
  1122. },
  1123. "lambda": {
  1124. "patterns": [
  1125. {
  1126. "match": "((?<=\\.)lambda|lambda(?=\\s*[\\.=]))",
  1127. "captures": {
  1128. "1": {
  1129. "name": "keyword.control.flow.python"
  1130. }
  1131. }
  1132. },
  1133. {
  1134. "match": "\\b(lambda)\\s*?(?=[,\\n]|$)",
  1135. "captures": {
  1136. "1": {
  1137. "name": "storage.type.function.lambda.python"
  1138. }
  1139. }
  1140. },
  1141. {
  1142. "name": "meta.lambda-function.python",
  1143. "begin": "(?x)\n \\b (lambda) \\b\n",
  1144. "end": "(:)|(\\n)",
  1145. "beginCaptures": {
  1146. "1": {
  1147. "name": "storage.type.function.lambda.python"
  1148. }
  1149. },
  1150. "endCaptures": {
  1151. "1": {
  1152. "name": "punctuation.section.function.lambda.begin.python"
  1153. }
  1154. },
  1155. "contentName": "meta.function.lambda.parameters.python",
  1156. "patterns": [
  1157. {
  1158. "name": "keyword.operator.unpacking.parameter.python",
  1159. "match": "(\\*\\*|\\*)"
  1160. },
  1161. {
  1162. "include": "#lambda-nested-incomplete"
  1163. },
  1164. {
  1165. "include": "#illegal-names"
  1166. },
  1167. {
  1168. "match": "([[:alpha:]_]\\w*)\\s*(?:(,)|(?=:|$))",
  1169. "captures": {
  1170. "1": {
  1171. "name": "variable.parameter.function.language.python"
  1172. },
  1173. "2": {
  1174. "name": "punctuation.separator.parameters.python"
  1175. }
  1176. }
  1177. },
  1178. {
  1179. "include": "#comments"
  1180. },
  1181. {
  1182. "include": "#backticks"
  1183. },
  1184. {
  1185. "include": "#illegal-anno"
  1186. },
  1187. {
  1188. "include": "#lambda-parameter-with-default"
  1189. },
  1190. {
  1191. "include": "#line-continuation"
  1192. },
  1193. {
  1194. "include": "#illegal-operator"
  1195. }
  1196. ]
  1197. }
  1198. ]
  1199. },
  1200. "lambda-incomplete": {
  1201. "name": "storage.type.function.lambda.python",
  1202. "match": "\\blambda(?=\\s*[,)])"
  1203. },
  1204. "lambda-nested-incomplete": {
  1205. "name": "storage.type.function.lambda.python",
  1206. "match": "\\blambda(?=\\s*[:,)])"
  1207. },
  1208. "lambda-parameter-with-default": {
  1209. "begin": "(?x)\n \\b\n ([[:alpha:]_]\\w*) \\s* (=)\n",
  1210. "end": "(,)|(?=:|$)",
  1211. "beginCaptures": {
  1212. "1": {
  1213. "name": "variable.parameter.function.language.python"
  1214. },
  1215. "2": {
  1216. "name": "keyword.operator.python"
  1217. }
  1218. },
  1219. "endCaptures": {
  1220. "1": {
  1221. "name": "punctuation.separator.parameters.python"
  1222. }
  1223. },
  1224. "patterns": [
  1225. {
  1226. "include": "#expression"
  1227. }
  1228. ]
  1229. },
  1230. "generator": {
  1231. "comment": "Match \"for ... in\" construct used in generators and for loops to\ncorrectly identify the \"in\" as a control flow keyword.\n",
  1232. "begin": "\\bfor\\b",
  1233. "beginCaptures": {
  1234. "0": {
  1235. "name": "keyword.control.flow.python"
  1236. }
  1237. },
  1238. "end": "\\bin\\b",
  1239. "endCaptures": {
  1240. "0": {
  1241. "name": "keyword.control.flow.python"
  1242. }
  1243. },
  1244. "patterns": [
  1245. {
  1246. "include": "#expression"
  1247. }
  1248. ]
  1249. },
  1250. "function-declaration": {
  1251. "name": "meta.function.python",
  1252. "begin": "(?x)\n \\s*\n (?:\\b(async) \\s+)? \\b(def)\\s+\n (?=\n [[:alpha:]_][[:word:]]* \\s* \\(\n )\n",
  1253. "end": "(:|(?=[#'\"\\n]))",
  1254. "beginCaptures": {
  1255. "1": {
  1256. "name": "storage.type.function.async.python"
  1257. },
  1258. "2": {
  1259. "name": "storage.type.function.python"
  1260. }
  1261. },
  1262. "endCaptures": {
  1263. "1": {
  1264. "name": "punctuation.section.function.begin.python"
  1265. }
  1266. },
  1267. "patterns": [
  1268. {
  1269. "include": "#function-def-name"
  1270. },
  1271. {
  1272. "include": "#parameters"
  1273. },
  1274. {
  1275. "include": "#line-continuation"
  1276. },
  1277. {
  1278. "include": "#return-annotation"
  1279. }
  1280. ]
  1281. },
  1282. "function-def-name": {
  1283. "patterns": [
  1284. {
  1285. "include": "#illegal-object-name"
  1286. },
  1287. {
  1288. "include": "#builtin-possible-callables"
  1289. },
  1290. {
  1291. "name": "entity.name.function.python",
  1292. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
  1293. }
  1294. ]
  1295. },
  1296. "parameters": {
  1297. "name": "meta.function.parameters.python",
  1298. "begin": "(\\()",
  1299. "end": "(\\))",
  1300. "beginCaptures": {
  1301. "1": {
  1302. "name": "punctuation.definition.parameters.begin.python"
  1303. }
  1304. },
  1305. "endCaptures": {
  1306. "1": {
  1307. "name": "punctuation.definition.parameters.end.python"
  1308. }
  1309. },
  1310. "patterns": [
  1311. {
  1312. "name": "keyword.operator.unpacking.parameter.python",
  1313. "match": "(\\*\\*|\\*)"
  1314. },
  1315. {
  1316. "include": "#lambda-incomplete"
  1317. },
  1318. {
  1319. "include": "#illegal-names"
  1320. },
  1321. {
  1322. "include": "#illegal-object-name"
  1323. },
  1324. {
  1325. "include": "#parameter-special"
  1326. },
  1327. {
  1328. "match": "(?x)\n ([[:alpha:]_]\\w*)\n \\s* (?: (,) | (?=[)#\\n=]))\n",
  1329. "captures": {
  1330. "1": {
  1331. "name": "variable.parameter.function.language.python"
  1332. },
  1333. "2": {
  1334. "name": "punctuation.separator.parameters.python"
  1335. }
  1336. }
  1337. },
  1338. {
  1339. "include": "#comments"
  1340. },
  1341. {
  1342. "include": "#loose-default"
  1343. },
  1344. {
  1345. "include": "#annotated-parameter"
  1346. }
  1347. ]
  1348. },
  1349. "parameter-special": {
  1350. "match": "(?x)\n \\b ((self)|(cls)) \\b \\s*(?:(,)|(?=\\)))\n",
  1351. "captures": {
  1352. "1": {
  1353. "name": "variable.parameter.function.language.python"
  1354. },
  1355. "2": {
  1356. "name": "variable.parameter.function.language.special.self.python"
  1357. },
  1358. "3": {
  1359. "name": "variable.parameter.function.language.special.cls.python"
  1360. },
  1361. "4": {
  1362. "name": "punctuation.separator.parameters.python"
  1363. }
  1364. }
  1365. },
  1366. "loose-default": {
  1367. "begin": "(=)",
  1368. "end": "(,)|(?=\\))",
  1369. "beginCaptures": {
  1370. "1": {
  1371. "name": "keyword.operator.python"
  1372. }
  1373. },
  1374. "endCaptures": {
  1375. "1": {
  1376. "name": "punctuation.separator.parameters.python"
  1377. }
  1378. },
  1379. "patterns": [
  1380. {
  1381. "include": "#expression"
  1382. }
  1383. ]
  1384. },
  1385. "annotated-parameter": {
  1386. "begin": "(?x)\n \\b\n ([[:alpha:]_]\\w*) \\s* (:)\n",
  1387. "end": "(,)|(?=\\))",
  1388. "beginCaptures": {
  1389. "1": {
  1390. "name": "variable.parameter.function.language.python"
  1391. },
  1392. "2": {
  1393. "name": "punctuation.separator.annotation.python"
  1394. }
  1395. },
  1396. "endCaptures": {
  1397. "1": {
  1398. "name": "punctuation.separator.parameters.python"
  1399. }
  1400. },
  1401. "patterns": [
  1402. {
  1403. "include": "#expression"
  1404. },
  1405. {
  1406. "name": "keyword.operator.assignment.python",
  1407. "match": "=(?!=)"
  1408. }
  1409. ]
  1410. },
  1411. "return-annotation": {
  1412. "begin": "(->)",
  1413. "end": "(?=:)",
  1414. "beginCaptures": {
  1415. "1": {
  1416. "name": "punctuation.separator.annotation.result.python"
  1417. }
  1418. },
  1419. "patterns": [
  1420. {
  1421. "include": "#expression"
  1422. }
  1423. ]
  1424. },
  1425. "item-access": {
  1426. "patterns": [
  1427. {
  1428. "name": "meta.item-access.python",
  1429. "begin": "(?x)\n \\b(?=\n [[:alpha:]_]\\w* \\s* \\[\n )\n",
  1430. "end": "(\\])",
  1431. "endCaptures": {
  1432. "1": {
  1433. "name": "punctuation.definition.arguments.end.python"
  1434. }
  1435. },
  1436. "patterns": [
  1437. {
  1438. "include": "#item-name"
  1439. },
  1440. {
  1441. "include": "#item-index"
  1442. },
  1443. {
  1444. "include": "#expression"
  1445. }
  1446. ]
  1447. }
  1448. ]
  1449. },
  1450. "item-name": {
  1451. "patterns": [
  1452. {
  1453. "include": "#special-variables"
  1454. },
  1455. {
  1456. "include": "#builtin-functions"
  1457. },
  1458. {
  1459. "include": "#special-names"
  1460. },
  1461. {
  1462. "name": "meta.indexed-name.python",
  1463. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
  1464. }
  1465. ]
  1466. },
  1467. "item-index": {
  1468. "begin": "(\\[)",
  1469. "end": "(?=\\])",
  1470. "beginCaptures": {
  1471. "1": {
  1472. "name": "punctuation.definition.arguments.begin.python"
  1473. }
  1474. },
  1475. "contentName": "meta.item-access.arguments.python",
  1476. "patterns": [
  1477. {
  1478. "name": "punctuation.separator.slice.python",
  1479. "match": ":"
  1480. },
  1481. {
  1482. "include": "#expression"
  1483. }
  1484. ]
  1485. },
  1486. "decorator": {
  1487. "name": "meta.function.decorator.python",
  1488. "begin": "(?x)\n ^\\s*\n ((@)) \\s* (?=[[:alpha:]_]\\w*)\n",
  1489. "end": "(?x)\n ( \\) )\n # trailing whitespace and comments are legal\n (?: (.*?) (?=\\s*(?:\\#|$)) )\n | (?=\\n|\\#)\n",
  1490. "beginCaptures": {
  1491. "1": {
  1492. "name": "entity.name.function.decorator.python"
  1493. },
  1494. "2": {
  1495. "name": "punctuation.definition.decorator.python"
  1496. }
  1497. },
  1498. "endCaptures": {
  1499. "1": {
  1500. "name": "punctuation.definition.arguments.end.python"
  1501. },
  1502. "2": {
  1503. "name": "invalid.illegal.decorator.python"
  1504. }
  1505. },
  1506. "patterns": [
  1507. {
  1508. "include": "#decorator-name"
  1509. },
  1510. {
  1511. "include": "#function-arguments"
  1512. }
  1513. ]
  1514. },
  1515. "decorator-name": {
  1516. "patterns": [
  1517. {
  1518. "include": "#builtin-callables"
  1519. },
  1520. {
  1521. "include": "#illegal-object-name"
  1522. },
  1523. {
  1524. "name": "entity.name.function.decorator.python",
  1525. "match": "(?x)\n ([[:alpha:]_]\\w*) | (\\.)\n",
  1526. "captures": {
  1527. "2": {
  1528. "name": "punctuation.separator.period.python"
  1529. }
  1530. }
  1531. },
  1532. {
  1533. "include": "#line-continuation"
  1534. },
  1535. {
  1536. "name": "invalid.illegal.decorator.python",
  1537. "match": "(?x)\n \\s* ([^([:alpha:]\\s_\\.#\\\\] .*?) (?=\\#|$)\n",
  1538. "captures": {
  1539. "1": {
  1540. "name": "invalid.illegal.decorator.python"
  1541. }
  1542. }
  1543. }
  1544. ]
  1545. },
  1546. "call-wrapper-inheritance": {
  1547. "comment": "same as a function call, but in inheritance context",
  1548. "name": "meta.function-call.python",
  1549. "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n",
  1550. "end": "(\\))",
  1551. "endCaptures": {
  1552. "1": {
  1553. "name": "punctuation.definition.arguments.end.python"
  1554. }
  1555. },
  1556. "patterns": [
  1557. {
  1558. "include": "#inheritance-name"
  1559. },
  1560. {
  1561. "include": "#function-arguments"
  1562. }
  1563. ]
  1564. },
  1565. "inheritance-name": {
  1566. "patterns": [
  1567. {
  1568. "include": "#lambda-incomplete"
  1569. },
  1570. {
  1571. "include": "#builtin-possible-callables"
  1572. },
  1573. {
  1574. "include": "#inheritance-identifier"
  1575. }
  1576. ]
  1577. },
  1578. "function-call": {
  1579. "name": "meta.function-call.python",
  1580. "comment": "Regular function call of the type \"name(args)\"",
  1581. "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n",
  1582. "end": "(\\))",
  1583. "endCaptures": {
  1584. "1": {
  1585. "name": "punctuation.definition.arguments.end.python"
  1586. }
  1587. },
  1588. "patterns": [
  1589. {
  1590. "include": "#special-variables"
  1591. },
  1592. {
  1593. "include": "#function-name"
  1594. },
  1595. {
  1596. "include": "#function-arguments"
  1597. }
  1598. ]
  1599. },
  1600. "function-name": {
  1601. "patterns": [
  1602. {
  1603. "include": "#builtin-possible-callables"
  1604. },
  1605. {
  1606. "comment": "Some color schemas support meta.function-call.generic scope",
  1607. "name": "meta.function-call.generic.python",
  1608. "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
  1609. }
  1610. ]
  1611. },
  1612. "function-arguments": {
  1613. "begin": "(\\()",
  1614. "end": "(?=\\))(?!\\)\\s*\\()",
  1615. "beginCaptures": {
  1616. "1": {
  1617. "name": "punctuation.definition.arguments.begin.python"
  1618. }
  1619. },
  1620. "contentName": "meta.function-call.arguments.python",
  1621. "patterns": [
  1622. {
  1623. "name": "punctuation.separator.arguments.python",
  1624. "match": "(,)"
  1625. },
  1626. {
  1627. "match": "(?x)\n (?:(?<=[,(])|^) \\s* (\\*{1,2})\n",
  1628. "captures": {
  1629. "1": {
  1630. "name": "keyword.operator.unpacking.arguments.python"
  1631. }
  1632. }
  1633. },
  1634. {
  1635. "include": "#lambda-incomplete"
  1636. },
  1637. {
  1638. "include": "#illegal-names"
  1639. },
  1640. {
  1641. "match": "\\b([[:alpha:]_]\\w*)\\s*(=)(?!=)",
  1642. "captures": {
  1643. "1": {
  1644. "name": "variable.parameter.function-call.python"
  1645. },
  1646. "2": {
  1647. "name": "keyword.operator.assignment.python"
  1648. }
  1649. }
  1650. },
  1651. {
  1652. "name": "keyword.operator.assignment.python",
  1653. "match": "=(?!=)"
  1654. },
  1655. {
  1656. "include": "#expression"
  1657. },
  1658. {
  1659. "match": "\\s*(\\))\\s*(\\()",
  1660. "captures": {
  1661. "1": {
  1662. "name": "punctuation.definition.arguments.end.python"
  1663. },
  1664. "2": {
  1665. "name": "punctuation.definition.arguments.begin.python"
  1666. }
  1667. }
  1668. }
  1669. ]
  1670. },
  1671. "builtin-callables": {
  1672. "patterns": [
  1673. {
  1674. "include": "#illegal-names"
  1675. },
  1676. {
  1677. "include": "#illegal-object-name"
  1678. },
  1679. {
  1680. "include": "#builtin-exceptions"
  1681. },
  1682. {
  1683. "include": "#builtin-functions"
  1684. },
  1685. {
  1686. "include": "#builtin-types"
  1687. }
  1688. ]
  1689. },
  1690. "builtin-possible-callables": {
  1691. "patterns": [
  1692. {
  1693. "include": "#builtin-callables"
  1694. },
  1695. {
  1696. "include": "#magic-names"
  1697. }
  1698. ]
  1699. },
  1700. "builtin-exceptions": {
  1701. "name": "support.type.exception.python",
  1702. "match": "(?x) (?<!\\.) \\b(\n (\n Arithmetic | Assertion | Attribute | Buffer | BlockingIO\n | BrokenPipe | ChildProcess\n | (Connection (Aborted | Refused | Reset)?)\n | EOF | Environment | FileExists | FileNotFound\n | FloatingPoint | IO | Import | Indentation | Index | Interrupted\n | IsADirectory | NotADirectory | Permission | ProcessLookup\n | Timeout\n | Key | Lookup | Memory | Name | NotImplemented | OS | Overflow\n | Reference | Runtime | Recursion | Syntax | System\n | Tab | Type | UnboundLocal | Unicode(Encode|Decode|Translate)?\n | Value | Windows | ZeroDivision | ModuleNotFound\n ) Error\n|\n ((Pending)?Deprecation | Runtime | Syntax | User | Future | Import\n | Unicode | Bytes | Resource\n )? Warning\n|\n SystemExit | Stop(Async)?Iteration\n | KeyboardInterrupt\n | GeneratorExit | (Base)?Exception\n)\\b\n"
  1703. },
  1704. "builtin-functions": {
  1705. "patterns": [
  1706. {
  1707. "name": "support.function.builtin.python",
  1708. "match": "(?x)\n (?<!\\.) \\b(\n __import__ | abs | all | any | ascii | bin | breakpoint | callable\n | chr | compile | copyright | credits | delattr | dir | divmod\n | enumerate | eval | exec | exit | filter | format | getattr\n | globals | hasattr | hash | help | hex | id | input\n | isinstance | issubclass | iter | len | license | locals | map\n | max | memoryview | min | next | oct | open | ord | pow | print\n | quit | range | reload | repr | reversed | round\n | setattr | sorted | sum | vars | zip\n )\\b\n"
  1709. },
  1710. {
  1711. "name": "variable.legacy.builtin.python",
  1712. "match": "(?x)\n (?<!\\.) \\b(\n file | reduce | intern | raw_input | unicode | cmp | basestring\n | execfile | long | xrange\n )\\b\n"
  1713. }
  1714. ]
  1715. },
  1716. "builtin-types": {
  1717. "name": "support.type.python",
  1718. "match": "(?x)\n (?<!\\.) \\b(\n bool | bytearray | bytes | classmethod | complex | dict\n | float | frozenset | int | list | object | property\n | set | slice | staticmethod | str | tuple | type\n\n (?# Although 'super' is not a type, it's related to types,\n and is special enough to be highlighted differently from\n other built-ins)\n | super\n )\\b\n"
  1719. },
  1720. "magic-function-names": {
  1721. "comment": "these methods have magic interpretation by python and are generally called\nindirectly through syntactic constructs\n",
  1722. "match": "(?x)\n \\b(\n __(?:\n abs | add | aenter | aexit | aiter | and | anext | await\n | bool | call | ceil | cmp | coerce | complex | contains\n | copy | deepcopy | del | delattr | delete | delitem\n | delslice | dir | div | divmod | enter | eq | exit | float\n | floor | floordiv | format | ge | get | getattr\n | getattribute | getinitargs | getitem | getnewargs\n | getslice | getstate | gt | hash | hex | iadd | iand | idiv\n | ifloordiv | ilshift | imod | imul | index | init\n | instancecheck | int | invert | ior | ipow | irshift | isub\n | iter | itruediv | ixor | le | len | long | lshift | lt\n | missing | mod | mul | ne | neg | new | next | nonzero | oct | or\n | pos | pow | radd | rand | rdiv | rdivmod | reduce\n | reduce_ex | repr | reversed | rfloordiv | rlshift | rmod\n | rmul | ror | round | rpow | rrshift | rshift | rsub\n | rtruediv | rxor | set | setattr | setitem | setslice\n | setstate | sizeof | str | sub | subclasscheck | truediv\n | trunc | unicode | xor | matmul | rmatmul | imatmul\n | init_subclass | set_name | fspath | bytes | prepare\n )__\n )\\b\n",
  1723. "captures": {
  1724. "1": {
  1725. "name": "support.function.magic.python"
  1726. }
  1727. }
  1728. },
  1729. "magic-variable-names": {
  1730. "comment": "magic variables which a class/module may have.",
  1731. "match": "(?x)\n \\b(\n __(?:\n all | bases | builtins | class | class_getitem | code | debug\n | defaults | dict | doc | file | func | kwdefaults | members\n | metaclass | methods | module | mro | mro_entries | name\n | qualname | post_init | self | signature | slots | subclasses\n | version | weakref | wrapped | annotations | classcell\n | spec | path | package | future | traceback\n )__\n )\\b\n",
  1732. "captures": {
  1733. "1": {
  1734. "name": "support.variable.magic.python"
  1735. }
  1736. }
  1737. },
  1738. "magic-names": {
  1739. "patterns": [
  1740. {
  1741. "include": "#magic-function-names"
  1742. },
  1743. {
  1744. "include": "#magic-variable-names"
  1745. }
  1746. ]
  1747. },
  1748. "illegal-names": {
  1749. "match": "(?x)\n \\b(?:\n (\n and | assert | async | await | break | class | continue | def\n | del | elif | else | except | finally | for | from | global\n | if | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=])\n | nonlocal | not | or | pass | raise | return | try | while | with\n | yield\n ) | (\n as | import\n )\n )\\b\n",
  1750. "captures": {
  1751. "1": {
  1752. "name": "keyword.control.flow.python"
  1753. },
  1754. "2": {
  1755. "name": "keyword.control.import.python"
  1756. }
  1757. }
  1758. },
  1759. "special-variables": {
  1760. "match": "(?x)\n \\b (?<!\\.) (?:\n (self) | (cls)\n )\\b\n",
  1761. "captures": {
  1762. "1": {
  1763. "name": "variable.language.special.self.python"
  1764. },
  1765. "2": {
  1766. "name": "variable.language.special.cls.python"
  1767. }
  1768. }
  1769. },
  1770. "ellipsis": {
  1771. "name": "constant.other.ellipsis.python",
  1772. "match": "\\.\\.\\."
  1773. },
  1774. "backticks": {
  1775. "name": "invalid.deprecated.backtick.python",
  1776. "begin": "\\`",
  1777. "end": "(?:\\`|(?<!\\\\)(\\n))",
  1778. "patterns": [
  1779. {
  1780. "include": "#expression"
  1781. }
  1782. ]
  1783. },
  1784. "illegal-operator": {
  1785. "patterns": [
  1786. {
  1787. "name": "invalid.illegal.operator.python",
  1788. "match": "&&|\\|\\||--|\\+\\+"
  1789. },
  1790. {
  1791. "name": "invalid.illegal.operator.python",
  1792. "match": "[?$]"
  1793. },
  1794. {
  1795. "name": "invalid.illegal.operator.python",
  1796. "comment": "We don't want `!` to flash when we're typing `!=`",
  1797. "match": "!\\b"
  1798. }
  1799. ]
  1800. },
  1801. "illegal-object-name": {
  1802. "comment": "It's illegal to name class or function \"True\"",
  1803. "name": "keyword.illegal.name.python",
  1804. "match": "\\b(True|False|None)\\b"
  1805. },
  1806. "illegal-anno": {
  1807. "name": "invalid.illegal.annotation.python",
  1808. "match": "->"
  1809. },
  1810. "regexp-base-expression": {
  1811. "patterns": [
  1812. {
  1813. "include": "#regexp-quantifier"
  1814. },
  1815. {
  1816. "include": "#regexp-base-common"
  1817. }
  1818. ]
  1819. },
  1820. "fregexp-base-expression": {
  1821. "patterns": [
  1822. {
  1823. "include": "#fregexp-quantifier"
  1824. },
  1825. {
  1826. "include": "#fstring-formatting-braces"
  1827. },
  1828. {
  1829. "match": "\\{.*?\\}"
  1830. },
  1831. {
  1832. "include": "#regexp-base-common"
  1833. }
  1834. ]
  1835. },
  1836. "fstring-formatting-braces": {
  1837. "patterns": [
  1838. {
  1839. "comment": "empty braces are illegal",
  1840. "match": "({)(\\s*?)(})",
  1841. "captures": {
  1842. "1": {
  1843. "name": "constant.character.format.placeholder.other.python"
  1844. },
  1845. "2": {
  1846. "name": "invalid.illegal.brace.python"
  1847. },
  1848. "3": {
  1849. "name": "constant.character.format.placeholder.other.python"
  1850. }
  1851. }
  1852. },
  1853. {
  1854. "name": "constant.character.escape.python",
  1855. "match": "({{|}})"
  1856. }
  1857. ]
  1858. },
  1859. "regexp-base-common": {
  1860. "patterns": [
  1861. {
  1862. "name": "support.other.match.any.regexp",
  1863. "match": "\\."
  1864. },
  1865. {
  1866. "name": "support.other.match.begin.regexp",
  1867. "match": "\\^"
  1868. },
  1869. {
  1870. "name": "support.other.match.end.regexp",
  1871. "match": "\\$"
  1872. },
  1873. {
  1874. "name": "keyword.operator.quantifier.regexp",
  1875. "match": "[+*?]\\??"
  1876. },
  1877. {
  1878. "name": "keyword.operator.disjunction.regexp",
  1879. "match": "\\|"
  1880. },
  1881. {
  1882. "include": "#regexp-escape-sequence"
  1883. }
  1884. ]
  1885. },
  1886. "regexp-quantifier": {
  1887. "name": "keyword.operator.quantifier.regexp",
  1888. "match": "(?x)\n \\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\n"
  1889. },
  1890. "fregexp-quantifier": {
  1891. "name": "keyword.operator.quantifier.regexp",
  1892. "match": "(?x)\n \\{\\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\\}\n"
  1893. },
  1894. "regexp-backreference-number": {
  1895. "name": "meta.backreference.regexp",
  1896. "match": "(\\\\[1-9]\\d?)",
  1897. "captures": {
  1898. "1": {
  1899. "name": "entity.name.tag.backreference.regexp"
  1900. }
  1901. }
  1902. },
  1903. "regexp-backreference": {
  1904. "name": "meta.backreference.named.regexp",
  1905. "match": "(?x)\n (\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n",
  1906. "captures": {
  1907. "1": {
  1908. "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.begin.regexp"
  1909. },
  1910. "2": {
  1911. "name": "entity.name.tag.named.backreference.regexp"
  1912. },
  1913. "3": {
  1914. "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.end.regexp"
  1915. }
  1916. }
  1917. },
  1918. "regexp-flags": {
  1919. "name": "storage.modifier.flag.regexp",
  1920. "match": "\\(\\?[aiLmsux]+\\)"
  1921. },
  1922. "regexp-escape-special": {
  1923. "name": "support.other.escape.special.regexp",
  1924. "match": "\\\\([AbBdDsSwWZ])"
  1925. },
  1926. "regexp-escape-character": {
  1927. "name": "constant.character.escape.regexp",
  1928. "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | 0[0-7]{1,2}\n | [0-7]{3}\n )\n"
  1929. },
  1930. "regexp-escape-unicode": {
  1931. "name": "constant.character.unicode.regexp",
  1932. "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n )\n"
  1933. },
  1934. "regexp-escape-catchall": {
  1935. "name": "constant.character.escape.regexp",
  1936. "match": "\\\\(.|\\n)"
  1937. },
  1938. "regexp-escape-sequence": {
  1939. "patterns": [
  1940. {
  1941. "include": "#regexp-escape-special"
  1942. },
  1943. {
  1944. "include": "#regexp-escape-character"
  1945. },
  1946. {
  1947. "include": "#regexp-escape-unicode"
  1948. },
  1949. {
  1950. "include": "#regexp-backreference-number"
  1951. },
  1952. {
  1953. "include": "#regexp-escape-catchall"
  1954. }
  1955. ]
  1956. },
  1957. "regexp-charecter-set-escapes": {
  1958. "patterns": [
  1959. {
  1960. "name": "constant.character.escape.regexp",
  1961. "match": "\\\\[abfnrtv\\\\]"
  1962. },
  1963. {
  1964. "include": "#regexp-escape-special"
  1965. },
  1966. {
  1967. "name": "constant.character.escape.regexp",
  1968. "match": "\\\\([0-7]{1,3})"
  1969. },
  1970. {
  1971. "include": "#regexp-escape-character"
  1972. },
  1973. {
  1974. "include": "#regexp-escape-unicode"
  1975. },
  1976. {
  1977. "include": "#regexp-escape-catchall"
  1978. }
  1979. ]
  1980. },
  1981. "codetags": {
  1982. "match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)",
  1983. "captures": {
  1984. "1": {
  1985. "name": "keyword.codetag.notation.python"
  1986. }
  1987. }
  1988. },
  1989. "comments-base": {
  1990. "name": "comment.line.number-sign.python",
  1991. "begin": "(\\#)",
  1992. "beginCaptures": {
  1993. "1": {
  1994. "name": "punctuation.definition.comment.python"
  1995. }
  1996. },
  1997. "end": "($)",
  1998. "patterns": [
  1999. {
  2000. "include": "#codetags"
  2001. }
  2002. ]
  2003. },
  2004. "comments-string-single-three": {
  2005. "name": "comment.line.number-sign.python",
  2006. "begin": "(\\#)",
  2007. "beginCaptures": {
  2008. "1": {
  2009. "name": "punctuation.definition.comment.python"
  2010. }
  2011. },
  2012. "end": "($|(?='''))",
  2013. "patterns": [
  2014. {
  2015. "include": "#codetags"
  2016. }
  2017. ]
  2018. },
  2019. "comments-string-double-three": {
  2020. "name": "comment.line.number-sign.python",
  2021. "begin": "(\\#)",
  2022. "beginCaptures": {
  2023. "1": {
  2024. "name": "punctuation.definition.comment.python"
  2025. }
  2026. },
  2027. "end": "($|(?=\"\"\"))",
  2028. "patterns": [
  2029. {
  2030. "include": "#codetags"
  2031. }
  2032. ]
  2033. },
  2034. "single-one-regexp-expression": {
  2035. "patterns": [
  2036. {
  2037. "include": "#regexp-base-expression"
  2038. },
  2039. {
  2040. "include": "#single-one-regexp-character-set"
  2041. },
  2042. {
  2043. "include": "#single-one-regexp-comments"
  2044. },
  2045. {
  2046. "include": "#regexp-flags"
  2047. },
  2048. {
  2049. "include": "#single-one-regexp-named-group"
  2050. },
  2051. {
  2052. "include": "#regexp-backreference"
  2053. },
  2054. {
  2055. "include": "#single-one-regexp-lookahead"
  2056. },
  2057. {
  2058. "include": "#single-one-regexp-lookahead-negative"
  2059. },
  2060. {
  2061. "include": "#single-one-regexp-lookbehind"
  2062. },
  2063. {
  2064. "include": "#single-one-regexp-lookbehind-negative"
  2065. },
  2066. {
  2067. "include": "#single-one-regexp-conditional"
  2068. },
  2069. {
  2070. "include": "#single-one-regexp-parentheses-non-capturing"
  2071. },
  2072. {
  2073. "include": "#single-one-regexp-parentheses"
  2074. }
  2075. ]
  2076. },
  2077. "single-one-regexp-character-set": {
  2078. "patterns": [
  2079. {
  2080. "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
  2081. },
  2082. {
  2083. "name": "meta.character.set.regexp",
  2084. "begin": "(\\[)(\\^)?(\\])?",
  2085. "end": "(\\]|(?=\\'))|((?=(?<!\\\\)\\n))",
  2086. "beginCaptures": {
  2087. "1": {
  2088. "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
  2089. },
  2090. "2": {
  2091. "name": "keyword.operator.negation.regexp"
  2092. },
  2093. "3": {
  2094. "name": "constant.character.set.regexp"
  2095. }
  2096. },
  2097. "endCaptures": {
  2098. "1": {
  2099. "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
  2100. },
  2101. "2": {
  2102. "name": "invalid.illegal.newline.python"
  2103. }
  2104. },
  2105. "patterns": [
  2106. {
  2107. "include": "#regexp-charecter-set-escapes"
  2108. },
  2109. {
  2110. "name": "constant.character.set.regexp",
  2111. "match": "[^\\n]"
  2112. }
  2113. ]
  2114. }
  2115. ]
  2116. },
  2117. "single-one-regexp-named-group": {
  2118. "name": "meta.named.regexp",
  2119. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  2120. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2121. "beginCaptures": {
  2122. "1": {
  2123. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  2124. },
  2125. "2": {
  2126. "name": "entity.name.tag.named.group.regexp"
  2127. }
  2128. },
  2129. "endCaptures": {
  2130. "1": {
  2131. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  2132. },
  2133. "2": {
  2134. "name": "invalid.illegal.newline.python"
  2135. }
  2136. },
  2137. "patterns": [
  2138. {
  2139. "include": "#single-one-regexp-expression"
  2140. }
  2141. ]
  2142. },
  2143. "single-one-regexp-comments": {
  2144. "name": "comment.regexp",
  2145. "begin": "\\(\\?#",
  2146. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2147. "beginCaptures": {
  2148. "0": {
  2149. "name": "punctuation.comment.begin.regexp"
  2150. }
  2151. },
  2152. "endCaptures": {
  2153. "1": {
  2154. "name": "punctuation.comment.end.regexp"
  2155. },
  2156. "2": {
  2157. "name": "invalid.illegal.newline.python"
  2158. }
  2159. },
  2160. "patterns": [
  2161. {
  2162. "include": "#codetags"
  2163. }
  2164. ]
  2165. },
  2166. "single-one-regexp-lookahead": {
  2167. "begin": "(\\()\\?=",
  2168. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2169. "beginCaptures": {
  2170. "0": {
  2171. "name": "keyword.operator.lookahead.regexp"
  2172. },
  2173. "1": {
  2174. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  2175. }
  2176. },
  2177. "endCaptures": {
  2178. "1": {
  2179. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  2180. },
  2181. "2": {
  2182. "name": "invalid.illegal.newline.python"
  2183. }
  2184. },
  2185. "patterns": [
  2186. {
  2187. "include": "#single-one-regexp-expression"
  2188. }
  2189. ]
  2190. },
  2191. "single-one-regexp-lookahead-negative": {
  2192. "begin": "(\\()\\?!",
  2193. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2194. "beginCaptures": {
  2195. "0": {
  2196. "name": "keyword.operator.lookahead.negative.regexp"
  2197. },
  2198. "1": {
  2199. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  2200. }
  2201. },
  2202. "endCaptures": {
  2203. "1": {
  2204. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  2205. },
  2206. "2": {
  2207. "name": "invalid.illegal.newline.python"
  2208. }
  2209. },
  2210. "patterns": [
  2211. {
  2212. "include": "#single-one-regexp-expression"
  2213. }
  2214. ]
  2215. },
  2216. "single-one-regexp-lookbehind": {
  2217. "begin": "(\\()\\?<=",
  2218. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2219. "beginCaptures": {
  2220. "0": {
  2221. "name": "keyword.operator.lookbehind.regexp"
  2222. },
  2223. "1": {
  2224. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  2225. }
  2226. },
  2227. "endCaptures": {
  2228. "1": {
  2229. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  2230. },
  2231. "2": {
  2232. "name": "invalid.illegal.newline.python"
  2233. }
  2234. },
  2235. "patterns": [
  2236. {
  2237. "include": "#single-one-regexp-expression"
  2238. }
  2239. ]
  2240. },
  2241. "single-one-regexp-lookbehind-negative": {
  2242. "begin": "(\\()\\?<!",
  2243. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2244. "beginCaptures": {
  2245. "0": {
  2246. "name": "keyword.operator.lookbehind.negative.regexp"
  2247. },
  2248. "1": {
  2249. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  2250. }
  2251. },
  2252. "endCaptures": {
  2253. "1": {
  2254. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  2255. },
  2256. "2": {
  2257. "name": "invalid.illegal.newline.python"
  2258. }
  2259. },
  2260. "patterns": [
  2261. {
  2262. "include": "#single-one-regexp-expression"
  2263. }
  2264. ]
  2265. },
  2266. "single-one-regexp-conditional": {
  2267. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  2268. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2269. "beginCaptures": {
  2270. "0": {
  2271. "name": "keyword.operator.conditional.regexp"
  2272. },
  2273. "1": {
  2274. "name": "punctuation.parenthesis.conditional.begin.regexp"
  2275. }
  2276. },
  2277. "endCaptures": {
  2278. "1": {
  2279. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  2280. },
  2281. "2": {
  2282. "name": "invalid.illegal.newline.python"
  2283. }
  2284. },
  2285. "patterns": [
  2286. {
  2287. "include": "#single-one-regexp-expression"
  2288. }
  2289. ]
  2290. },
  2291. "single-one-regexp-parentheses-non-capturing": {
  2292. "begin": "\\(\\?:",
  2293. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2294. "beginCaptures": {
  2295. "0": {
  2296. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  2297. }
  2298. },
  2299. "endCaptures": {
  2300. "1": {
  2301. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  2302. },
  2303. "2": {
  2304. "name": "invalid.illegal.newline.python"
  2305. }
  2306. },
  2307. "patterns": [
  2308. {
  2309. "include": "#single-one-regexp-expression"
  2310. }
  2311. ]
  2312. },
  2313. "single-one-regexp-parentheses": {
  2314. "begin": "\\(",
  2315. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  2316. "beginCaptures": {
  2317. "0": {
  2318. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  2319. }
  2320. },
  2321. "endCaptures": {
  2322. "1": {
  2323. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  2324. },
  2325. "2": {
  2326. "name": "invalid.illegal.newline.python"
  2327. }
  2328. },
  2329. "patterns": [
  2330. {
  2331. "include": "#single-one-regexp-expression"
  2332. }
  2333. ]
  2334. },
  2335. "single-three-regexp-expression": {
  2336. "patterns": [
  2337. {
  2338. "include": "#regexp-base-expression"
  2339. },
  2340. {
  2341. "include": "#single-three-regexp-character-set"
  2342. },
  2343. {
  2344. "include": "#single-three-regexp-comments"
  2345. },
  2346. {
  2347. "include": "#regexp-flags"
  2348. },
  2349. {
  2350. "include": "#single-three-regexp-named-group"
  2351. },
  2352. {
  2353. "include": "#regexp-backreference"
  2354. },
  2355. {
  2356. "include": "#single-three-regexp-lookahead"
  2357. },
  2358. {
  2359. "include": "#single-three-regexp-lookahead-negative"
  2360. },
  2361. {
  2362. "include": "#single-three-regexp-lookbehind"
  2363. },
  2364. {
  2365. "include": "#single-three-regexp-lookbehind-negative"
  2366. },
  2367. {
  2368. "include": "#single-three-regexp-conditional"
  2369. },
  2370. {
  2371. "include": "#single-three-regexp-parentheses-non-capturing"
  2372. },
  2373. {
  2374. "include": "#single-three-regexp-parentheses"
  2375. },
  2376. {
  2377. "include": "#comments-string-single-three"
  2378. }
  2379. ]
  2380. },
  2381. "single-three-regexp-character-set": {
  2382. "patterns": [
  2383. {
  2384. "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
  2385. },
  2386. {
  2387. "name": "meta.character.set.regexp",
  2388. "begin": "(\\[)(\\^)?(\\])?",
  2389. "end": "(\\]|(?=\\'\\'\\'))",
  2390. "beginCaptures": {
  2391. "1": {
  2392. "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
  2393. },
  2394. "2": {
  2395. "name": "keyword.operator.negation.regexp"
  2396. },
  2397. "3": {
  2398. "name": "constant.character.set.regexp"
  2399. }
  2400. },
  2401. "endCaptures": {
  2402. "1": {
  2403. "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
  2404. },
  2405. "2": {
  2406. "name": "invalid.illegal.newline.python"
  2407. }
  2408. },
  2409. "patterns": [
  2410. {
  2411. "include": "#regexp-charecter-set-escapes"
  2412. },
  2413. {
  2414. "name": "constant.character.set.regexp",
  2415. "match": "[^\\n]"
  2416. }
  2417. ]
  2418. }
  2419. ]
  2420. },
  2421. "single-three-regexp-named-group": {
  2422. "name": "meta.named.regexp",
  2423. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  2424. "end": "(\\)|(?=\\'\\'\\'))",
  2425. "beginCaptures": {
  2426. "1": {
  2427. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  2428. },
  2429. "2": {
  2430. "name": "entity.name.tag.named.group.regexp"
  2431. }
  2432. },
  2433. "endCaptures": {
  2434. "1": {
  2435. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  2436. },
  2437. "2": {
  2438. "name": "invalid.illegal.newline.python"
  2439. }
  2440. },
  2441. "patterns": [
  2442. {
  2443. "include": "#single-three-regexp-expression"
  2444. },
  2445. {
  2446. "include": "#comments-string-single-three"
  2447. }
  2448. ]
  2449. },
  2450. "single-three-regexp-comments": {
  2451. "name": "comment.regexp",
  2452. "begin": "\\(\\?#",
  2453. "end": "(\\)|(?=\\'\\'\\'))",
  2454. "beginCaptures": {
  2455. "0": {
  2456. "name": "punctuation.comment.begin.regexp"
  2457. }
  2458. },
  2459. "endCaptures": {
  2460. "1": {
  2461. "name": "punctuation.comment.end.regexp"
  2462. },
  2463. "2": {
  2464. "name": "invalid.illegal.newline.python"
  2465. }
  2466. },
  2467. "patterns": [
  2468. {
  2469. "include": "#codetags"
  2470. }
  2471. ]
  2472. },
  2473. "single-three-regexp-lookahead": {
  2474. "begin": "(\\()\\?=",
  2475. "end": "(\\)|(?=\\'\\'\\'))",
  2476. "beginCaptures": {
  2477. "0": {
  2478. "name": "keyword.operator.lookahead.regexp"
  2479. },
  2480. "1": {
  2481. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  2482. }
  2483. },
  2484. "endCaptures": {
  2485. "1": {
  2486. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  2487. },
  2488. "2": {
  2489. "name": "invalid.illegal.newline.python"
  2490. }
  2491. },
  2492. "patterns": [
  2493. {
  2494. "include": "#single-three-regexp-expression"
  2495. },
  2496. {
  2497. "include": "#comments-string-single-three"
  2498. }
  2499. ]
  2500. },
  2501. "single-three-regexp-lookahead-negative": {
  2502. "begin": "(\\()\\?!",
  2503. "end": "(\\)|(?=\\'\\'\\'))",
  2504. "beginCaptures": {
  2505. "0": {
  2506. "name": "keyword.operator.lookahead.negative.regexp"
  2507. },
  2508. "1": {
  2509. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  2510. }
  2511. },
  2512. "endCaptures": {
  2513. "1": {
  2514. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  2515. },
  2516. "2": {
  2517. "name": "invalid.illegal.newline.python"
  2518. }
  2519. },
  2520. "patterns": [
  2521. {
  2522. "include": "#single-three-regexp-expression"
  2523. },
  2524. {
  2525. "include": "#comments-string-single-three"
  2526. }
  2527. ]
  2528. },
  2529. "single-three-regexp-lookbehind": {
  2530. "begin": "(\\()\\?<=",
  2531. "end": "(\\)|(?=\\'\\'\\'))",
  2532. "beginCaptures": {
  2533. "0": {
  2534. "name": "keyword.operator.lookbehind.regexp"
  2535. },
  2536. "1": {
  2537. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  2538. }
  2539. },
  2540. "endCaptures": {
  2541. "1": {
  2542. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  2543. },
  2544. "2": {
  2545. "name": "invalid.illegal.newline.python"
  2546. }
  2547. },
  2548. "patterns": [
  2549. {
  2550. "include": "#single-three-regexp-expression"
  2551. },
  2552. {
  2553. "include": "#comments-string-single-three"
  2554. }
  2555. ]
  2556. },
  2557. "single-three-regexp-lookbehind-negative": {
  2558. "begin": "(\\()\\?<!",
  2559. "end": "(\\)|(?=\\'\\'\\'))",
  2560. "beginCaptures": {
  2561. "0": {
  2562. "name": "keyword.operator.lookbehind.negative.regexp"
  2563. },
  2564. "1": {
  2565. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  2566. }
  2567. },
  2568. "endCaptures": {
  2569. "1": {
  2570. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  2571. },
  2572. "2": {
  2573. "name": "invalid.illegal.newline.python"
  2574. }
  2575. },
  2576. "patterns": [
  2577. {
  2578. "include": "#single-three-regexp-expression"
  2579. },
  2580. {
  2581. "include": "#comments-string-single-three"
  2582. }
  2583. ]
  2584. },
  2585. "single-three-regexp-conditional": {
  2586. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  2587. "end": "(\\)|(?=\\'\\'\\'))",
  2588. "beginCaptures": {
  2589. "0": {
  2590. "name": "keyword.operator.conditional.regexp"
  2591. },
  2592. "1": {
  2593. "name": "punctuation.parenthesis.conditional.begin.regexp"
  2594. }
  2595. },
  2596. "endCaptures": {
  2597. "1": {
  2598. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  2599. },
  2600. "2": {
  2601. "name": "invalid.illegal.newline.python"
  2602. }
  2603. },
  2604. "patterns": [
  2605. {
  2606. "include": "#single-three-regexp-expression"
  2607. },
  2608. {
  2609. "include": "#comments-string-single-three"
  2610. }
  2611. ]
  2612. },
  2613. "single-three-regexp-parentheses-non-capturing": {
  2614. "begin": "\\(\\?:",
  2615. "end": "(\\)|(?=\\'\\'\\'))",
  2616. "beginCaptures": {
  2617. "0": {
  2618. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  2619. }
  2620. },
  2621. "endCaptures": {
  2622. "1": {
  2623. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  2624. },
  2625. "2": {
  2626. "name": "invalid.illegal.newline.python"
  2627. }
  2628. },
  2629. "patterns": [
  2630. {
  2631. "include": "#single-three-regexp-expression"
  2632. },
  2633. {
  2634. "include": "#comments-string-single-three"
  2635. }
  2636. ]
  2637. },
  2638. "single-three-regexp-parentheses": {
  2639. "begin": "\\(",
  2640. "end": "(\\)|(?=\\'\\'\\'))",
  2641. "beginCaptures": {
  2642. "0": {
  2643. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  2644. }
  2645. },
  2646. "endCaptures": {
  2647. "1": {
  2648. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  2649. },
  2650. "2": {
  2651. "name": "invalid.illegal.newline.python"
  2652. }
  2653. },
  2654. "patterns": [
  2655. {
  2656. "include": "#single-three-regexp-expression"
  2657. },
  2658. {
  2659. "include": "#comments-string-single-three"
  2660. }
  2661. ]
  2662. },
  2663. "double-one-regexp-expression": {
  2664. "patterns": [
  2665. {
  2666. "include": "#regexp-base-expression"
  2667. },
  2668. {
  2669. "include": "#double-one-regexp-character-set"
  2670. },
  2671. {
  2672. "include": "#double-one-regexp-comments"
  2673. },
  2674. {
  2675. "include": "#regexp-flags"
  2676. },
  2677. {
  2678. "include": "#double-one-regexp-named-group"
  2679. },
  2680. {
  2681. "include": "#regexp-backreference"
  2682. },
  2683. {
  2684. "include": "#double-one-regexp-lookahead"
  2685. },
  2686. {
  2687. "include": "#double-one-regexp-lookahead-negative"
  2688. },
  2689. {
  2690. "include": "#double-one-regexp-lookbehind"
  2691. },
  2692. {
  2693. "include": "#double-one-regexp-lookbehind-negative"
  2694. },
  2695. {
  2696. "include": "#double-one-regexp-conditional"
  2697. },
  2698. {
  2699. "include": "#double-one-regexp-parentheses-non-capturing"
  2700. },
  2701. {
  2702. "include": "#double-one-regexp-parentheses"
  2703. }
  2704. ]
  2705. },
  2706. "double-one-regexp-character-set": {
  2707. "patterns": [
  2708. {
  2709. "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
  2710. },
  2711. {
  2712. "name": "meta.character.set.regexp",
  2713. "begin": "(\\[)(\\^)?(\\])?",
  2714. "end": "(\\]|(?=\"))|((?=(?<!\\\\)\\n))",
  2715. "beginCaptures": {
  2716. "1": {
  2717. "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
  2718. },
  2719. "2": {
  2720. "name": "keyword.operator.negation.regexp"
  2721. },
  2722. "3": {
  2723. "name": "constant.character.set.regexp"
  2724. }
  2725. },
  2726. "endCaptures": {
  2727. "1": {
  2728. "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
  2729. },
  2730. "2": {
  2731. "name": "invalid.illegal.newline.python"
  2732. }
  2733. },
  2734. "patterns": [
  2735. {
  2736. "include": "#regexp-charecter-set-escapes"
  2737. },
  2738. {
  2739. "name": "constant.character.set.regexp",
  2740. "match": "[^\\n]"
  2741. }
  2742. ]
  2743. }
  2744. ]
  2745. },
  2746. "double-one-regexp-named-group": {
  2747. "name": "meta.named.regexp",
  2748. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  2749. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2750. "beginCaptures": {
  2751. "1": {
  2752. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  2753. },
  2754. "2": {
  2755. "name": "entity.name.tag.named.group.regexp"
  2756. }
  2757. },
  2758. "endCaptures": {
  2759. "1": {
  2760. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  2761. },
  2762. "2": {
  2763. "name": "invalid.illegal.newline.python"
  2764. }
  2765. },
  2766. "patterns": [
  2767. {
  2768. "include": "#double-one-regexp-expression"
  2769. }
  2770. ]
  2771. },
  2772. "double-one-regexp-comments": {
  2773. "name": "comment.regexp",
  2774. "begin": "\\(\\?#",
  2775. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2776. "beginCaptures": {
  2777. "0": {
  2778. "name": "punctuation.comment.begin.regexp"
  2779. }
  2780. },
  2781. "endCaptures": {
  2782. "1": {
  2783. "name": "punctuation.comment.end.regexp"
  2784. },
  2785. "2": {
  2786. "name": "invalid.illegal.newline.python"
  2787. }
  2788. },
  2789. "patterns": [
  2790. {
  2791. "include": "#codetags"
  2792. }
  2793. ]
  2794. },
  2795. "double-one-regexp-lookahead": {
  2796. "begin": "(\\()\\?=",
  2797. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2798. "beginCaptures": {
  2799. "0": {
  2800. "name": "keyword.operator.lookahead.regexp"
  2801. },
  2802. "1": {
  2803. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  2804. }
  2805. },
  2806. "endCaptures": {
  2807. "1": {
  2808. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  2809. },
  2810. "2": {
  2811. "name": "invalid.illegal.newline.python"
  2812. }
  2813. },
  2814. "patterns": [
  2815. {
  2816. "include": "#double-one-regexp-expression"
  2817. }
  2818. ]
  2819. },
  2820. "double-one-regexp-lookahead-negative": {
  2821. "begin": "(\\()\\?!",
  2822. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2823. "beginCaptures": {
  2824. "0": {
  2825. "name": "keyword.operator.lookahead.negative.regexp"
  2826. },
  2827. "1": {
  2828. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  2829. }
  2830. },
  2831. "endCaptures": {
  2832. "1": {
  2833. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  2834. },
  2835. "2": {
  2836. "name": "invalid.illegal.newline.python"
  2837. }
  2838. },
  2839. "patterns": [
  2840. {
  2841. "include": "#double-one-regexp-expression"
  2842. }
  2843. ]
  2844. },
  2845. "double-one-regexp-lookbehind": {
  2846. "begin": "(\\()\\?<=",
  2847. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2848. "beginCaptures": {
  2849. "0": {
  2850. "name": "keyword.operator.lookbehind.regexp"
  2851. },
  2852. "1": {
  2853. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  2854. }
  2855. },
  2856. "endCaptures": {
  2857. "1": {
  2858. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  2859. },
  2860. "2": {
  2861. "name": "invalid.illegal.newline.python"
  2862. }
  2863. },
  2864. "patterns": [
  2865. {
  2866. "include": "#double-one-regexp-expression"
  2867. }
  2868. ]
  2869. },
  2870. "double-one-regexp-lookbehind-negative": {
  2871. "begin": "(\\()\\?<!",
  2872. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2873. "beginCaptures": {
  2874. "0": {
  2875. "name": "keyword.operator.lookbehind.negative.regexp"
  2876. },
  2877. "1": {
  2878. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  2879. }
  2880. },
  2881. "endCaptures": {
  2882. "1": {
  2883. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  2884. },
  2885. "2": {
  2886. "name": "invalid.illegal.newline.python"
  2887. }
  2888. },
  2889. "patterns": [
  2890. {
  2891. "include": "#double-one-regexp-expression"
  2892. }
  2893. ]
  2894. },
  2895. "double-one-regexp-conditional": {
  2896. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  2897. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2898. "beginCaptures": {
  2899. "0": {
  2900. "name": "keyword.operator.conditional.regexp"
  2901. },
  2902. "1": {
  2903. "name": "punctuation.parenthesis.conditional.begin.regexp"
  2904. }
  2905. },
  2906. "endCaptures": {
  2907. "1": {
  2908. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  2909. },
  2910. "2": {
  2911. "name": "invalid.illegal.newline.python"
  2912. }
  2913. },
  2914. "patterns": [
  2915. {
  2916. "include": "#double-one-regexp-expression"
  2917. }
  2918. ]
  2919. },
  2920. "double-one-regexp-parentheses-non-capturing": {
  2921. "begin": "\\(\\?:",
  2922. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2923. "beginCaptures": {
  2924. "0": {
  2925. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  2926. }
  2927. },
  2928. "endCaptures": {
  2929. "1": {
  2930. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  2931. },
  2932. "2": {
  2933. "name": "invalid.illegal.newline.python"
  2934. }
  2935. },
  2936. "patterns": [
  2937. {
  2938. "include": "#double-one-regexp-expression"
  2939. }
  2940. ]
  2941. },
  2942. "double-one-regexp-parentheses": {
  2943. "begin": "\\(",
  2944. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  2945. "beginCaptures": {
  2946. "0": {
  2947. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  2948. }
  2949. },
  2950. "endCaptures": {
  2951. "1": {
  2952. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  2953. },
  2954. "2": {
  2955. "name": "invalid.illegal.newline.python"
  2956. }
  2957. },
  2958. "patterns": [
  2959. {
  2960. "include": "#double-one-regexp-expression"
  2961. }
  2962. ]
  2963. },
  2964. "double-three-regexp-expression": {
  2965. "patterns": [
  2966. {
  2967. "include": "#regexp-base-expression"
  2968. },
  2969. {
  2970. "include": "#double-three-regexp-character-set"
  2971. },
  2972. {
  2973. "include": "#double-three-regexp-comments"
  2974. },
  2975. {
  2976. "include": "#regexp-flags"
  2977. },
  2978. {
  2979. "include": "#double-three-regexp-named-group"
  2980. },
  2981. {
  2982. "include": "#regexp-backreference"
  2983. },
  2984. {
  2985. "include": "#double-three-regexp-lookahead"
  2986. },
  2987. {
  2988. "include": "#double-three-regexp-lookahead-negative"
  2989. },
  2990. {
  2991. "include": "#double-three-regexp-lookbehind"
  2992. },
  2993. {
  2994. "include": "#double-three-regexp-lookbehind-negative"
  2995. },
  2996. {
  2997. "include": "#double-three-regexp-conditional"
  2998. },
  2999. {
  3000. "include": "#double-three-regexp-parentheses-non-capturing"
  3001. },
  3002. {
  3003. "include": "#double-three-regexp-parentheses"
  3004. },
  3005. {
  3006. "include": "#comments-string-double-three"
  3007. }
  3008. ]
  3009. },
  3010. "double-three-regexp-character-set": {
  3011. "patterns": [
  3012. {
  3013. "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
  3014. },
  3015. {
  3016. "name": "meta.character.set.regexp",
  3017. "begin": "(\\[)(\\^)?(\\])?",
  3018. "end": "(\\]|(?=\"\"\"))",
  3019. "beginCaptures": {
  3020. "1": {
  3021. "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
  3022. },
  3023. "2": {
  3024. "name": "keyword.operator.negation.regexp"
  3025. },
  3026. "3": {
  3027. "name": "constant.character.set.regexp"
  3028. }
  3029. },
  3030. "endCaptures": {
  3031. "1": {
  3032. "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
  3033. },
  3034. "2": {
  3035. "name": "invalid.illegal.newline.python"
  3036. }
  3037. },
  3038. "patterns": [
  3039. {
  3040. "include": "#regexp-charecter-set-escapes"
  3041. },
  3042. {
  3043. "name": "constant.character.set.regexp",
  3044. "match": "[^\\n]"
  3045. }
  3046. ]
  3047. }
  3048. ]
  3049. },
  3050. "double-three-regexp-named-group": {
  3051. "name": "meta.named.regexp",
  3052. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  3053. "end": "(\\)|(?=\"\"\"))",
  3054. "beginCaptures": {
  3055. "1": {
  3056. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  3057. },
  3058. "2": {
  3059. "name": "entity.name.tag.named.group.regexp"
  3060. }
  3061. },
  3062. "endCaptures": {
  3063. "1": {
  3064. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  3065. },
  3066. "2": {
  3067. "name": "invalid.illegal.newline.python"
  3068. }
  3069. },
  3070. "patterns": [
  3071. {
  3072. "include": "#double-three-regexp-expression"
  3073. },
  3074. {
  3075. "include": "#comments-string-double-three"
  3076. }
  3077. ]
  3078. },
  3079. "double-three-regexp-comments": {
  3080. "name": "comment.regexp",
  3081. "begin": "\\(\\?#",
  3082. "end": "(\\)|(?=\"\"\"))",
  3083. "beginCaptures": {
  3084. "0": {
  3085. "name": "punctuation.comment.begin.regexp"
  3086. }
  3087. },
  3088. "endCaptures": {
  3089. "1": {
  3090. "name": "punctuation.comment.end.regexp"
  3091. },
  3092. "2": {
  3093. "name": "invalid.illegal.newline.python"
  3094. }
  3095. },
  3096. "patterns": [
  3097. {
  3098. "include": "#codetags"
  3099. }
  3100. ]
  3101. },
  3102. "double-three-regexp-lookahead": {
  3103. "begin": "(\\()\\?=",
  3104. "end": "(\\)|(?=\"\"\"))",
  3105. "beginCaptures": {
  3106. "0": {
  3107. "name": "keyword.operator.lookahead.regexp"
  3108. },
  3109. "1": {
  3110. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  3111. }
  3112. },
  3113. "endCaptures": {
  3114. "1": {
  3115. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  3116. },
  3117. "2": {
  3118. "name": "invalid.illegal.newline.python"
  3119. }
  3120. },
  3121. "patterns": [
  3122. {
  3123. "include": "#double-three-regexp-expression"
  3124. },
  3125. {
  3126. "include": "#comments-string-double-three"
  3127. }
  3128. ]
  3129. },
  3130. "double-three-regexp-lookahead-negative": {
  3131. "begin": "(\\()\\?!",
  3132. "end": "(\\)|(?=\"\"\"))",
  3133. "beginCaptures": {
  3134. "0": {
  3135. "name": "keyword.operator.lookahead.negative.regexp"
  3136. },
  3137. "1": {
  3138. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  3139. }
  3140. },
  3141. "endCaptures": {
  3142. "1": {
  3143. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  3144. },
  3145. "2": {
  3146. "name": "invalid.illegal.newline.python"
  3147. }
  3148. },
  3149. "patterns": [
  3150. {
  3151. "include": "#double-three-regexp-expression"
  3152. },
  3153. {
  3154. "include": "#comments-string-double-three"
  3155. }
  3156. ]
  3157. },
  3158. "double-three-regexp-lookbehind": {
  3159. "begin": "(\\()\\?<=",
  3160. "end": "(\\)|(?=\"\"\"))",
  3161. "beginCaptures": {
  3162. "0": {
  3163. "name": "keyword.operator.lookbehind.regexp"
  3164. },
  3165. "1": {
  3166. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  3167. }
  3168. },
  3169. "endCaptures": {
  3170. "1": {
  3171. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  3172. },
  3173. "2": {
  3174. "name": "invalid.illegal.newline.python"
  3175. }
  3176. },
  3177. "patterns": [
  3178. {
  3179. "include": "#double-three-regexp-expression"
  3180. },
  3181. {
  3182. "include": "#comments-string-double-three"
  3183. }
  3184. ]
  3185. },
  3186. "double-three-regexp-lookbehind-negative": {
  3187. "begin": "(\\()\\?<!",
  3188. "end": "(\\)|(?=\"\"\"))",
  3189. "beginCaptures": {
  3190. "0": {
  3191. "name": "keyword.operator.lookbehind.negative.regexp"
  3192. },
  3193. "1": {
  3194. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  3195. }
  3196. },
  3197. "endCaptures": {
  3198. "1": {
  3199. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  3200. },
  3201. "2": {
  3202. "name": "invalid.illegal.newline.python"
  3203. }
  3204. },
  3205. "patterns": [
  3206. {
  3207. "include": "#double-three-regexp-expression"
  3208. },
  3209. {
  3210. "include": "#comments-string-double-three"
  3211. }
  3212. ]
  3213. },
  3214. "double-three-regexp-conditional": {
  3215. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  3216. "end": "(\\)|(?=\"\"\"))",
  3217. "beginCaptures": {
  3218. "0": {
  3219. "name": "keyword.operator.conditional.regexp"
  3220. },
  3221. "1": {
  3222. "name": "punctuation.parenthesis.conditional.begin.regexp"
  3223. }
  3224. },
  3225. "endCaptures": {
  3226. "1": {
  3227. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  3228. },
  3229. "2": {
  3230. "name": "invalid.illegal.newline.python"
  3231. }
  3232. },
  3233. "patterns": [
  3234. {
  3235. "include": "#double-three-regexp-expression"
  3236. },
  3237. {
  3238. "include": "#comments-string-double-three"
  3239. }
  3240. ]
  3241. },
  3242. "double-three-regexp-parentheses-non-capturing": {
  3243. "begin": "\\(\\?:",
  3244. "end": "(\\)|(?=\"\"\"))",
  3245. "beginCaptures": {
  3246. "0": {
  3247. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  3248. }
  3249. },
  3250. "endCaptures": {
  3251. "1": {
  3252. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  3253. },
  3254. "2": {
  3255. "name": "invalid.illegal.newline.python"
  3256. }
  3257. },
  3258. "patterns": [
  3259. {
  3260. "include": "#double-three-regexp-expression"
  3261. },
  3262. {
  3263. "include": "#comments-string-double-three"
  3264. }
  3265. ]
  3266. },
  3267. "double-three-regexp-parentheses": {
  3268. "begin": "\\(",
  3269. "end": "(\\)|(?=\"\"\"))",
  3270. "beginCaptures": {
  3271. "0": {
  3272. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  3273. }
  3274. },
  3275. "endCaptures": {
  3276. "1": {
  3277. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  3278. },
  3279. "2": {
  3280. "name": "invalid.illegal.newline.python"
  3281. }
  3282. },
  3283. "patterns": [
  3284. {
  3285. "include": "#double-three-regexp-expression"
  3286. },
  3287. {
  3288. "include": "#comments-string-double-three"
  3289. }
  3290. ]
  3291. },
  3292. "regexp-single-one-line": {
  3293. "name": "string.regexp.quoted.single.python",
  3294. "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\\')",
  3295. "end": "(\\')|(?<!\\\\)(\\n)",
  3296. "beginCaptures": {
  3297. "2": {
  3298. "name": "invalid.deprecated.prefix.python"
  3299. },
  3300. "3": {
  3301. "name": "storage.type.string.python"
  3302. },
  3303. "4": {
  3304. "name": "storage.type.string.python"
  3305. },
  3306. "5": {
  3307. "name": "punctuation.definition.string.begin.python"
  3308. }
  3309. },
  3310. "endCaptures": {
  3311. "1": {
  3312. "name": "punctuation.definition.string.end.python"
  3313. },
  3314. "2": {
  3315. "name": "invalid.illegal.newline.python"
  3316. }
  3317. },
  3318. "patterns": [
  3319. {
  3320. "include": "#single-one-regexp-expression"
  3321. }
  3322. ]
  3323. },
  3324. "regexp-single-three-line": {
  3325. "name": "string.regexp.quoted.multi.python",
  3326. "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\\'\\'\\')",
  3327. "end": "(\\'\\'\\')",
  3328. "beginCaptures": {
  3329. "2": {
  3330. "name": "invalid.deprecated.prefix.python"
  3331. },
  3332. "3": {
  3333. "name": "storage.type.string.python"
  3334. },
  3335. "4": {
  3336. "name": "storage.type.string.python"
  3337. },
  3338. "5": {
  3339. "name": "punctuation.definition.string.begin.python"
  3340. }
  3341. },
  3342. "endCaptures": {
  3343. "1": {
  3344. "name": "punctuation.definition.string.end.python"
  3345. },
  3346. "2": {
  3347. "name": "invalid.illegal.newline.python"
  3348. }
  3349. },
  3350. "patterns": [
  3351. {
  3352. "include": "#single-three-regexp-expression"
  3353. }
  3354. ]
  3355. },
  3356. "regexp-double-one-line": {
  3357. "name": "string.regexp.quoted.single.python",
  3358. "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\")",
  3359. "end": "(\")|(?<!\\\\)(\\n)",
  3360. "beginCaptures": {
  3361. "2": {
  3362. "name": "invalid.deprecated.prefix.python"
  3363. },
  3364. "3": {
  3365. "name": "storage.type.string.python"
  3366. },
  3367. "4": {
  3368. "name": "storage.type.string.python"
  3369. },
  3370. "5": {
  3371. "name": "punctuation.definition.string.begin.python"
  3372. }
  3373. },
  3374. "endCaptures": {
  3375. "1": {
  3376. "name": "punctuation.definition.string.end.python"
  3377. },
  3378. "2": {
  3379. "name": "invalid.illegal.newline.python"
  3380. }
  3381. },
  3382. "patterns": [
  3383. {
  3384. "include": "#double-one-regexp-expression"
  3385. }
  3386. ]
  3387. },
  3388. "regexp-double-three-line": {
  3389. "name": "string.regexp.quoted.multi.python",
  3390. "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\"\"\")",
  3391. "end": "(\"\"\")",
  3392. "beginCaptures": {
  3393. "2": {
  3394. "name": "invalid.deprecated.prefix.python"
  3395. },
  3396. "3": {
  3397. "name": "storage.type.string.python"
  3398. },
  3399. "4": {
  3400. "name": "storage.type.string.python"
  3401. },
  3402. "5": {
  3403. "name": "punctuation.definition.string.begin.python"
  3404. }
  3405. },
  3406. "endCaptures": {
  3407. "1": {
  3408. "name": "punctuation.definition.string.end.python"
  3409. },
  3410. "2": {
  3411. "name": "invalid.illegal.newline.python"
  3412. }
  3413. },
  3414. "patterns": [
  3415. {
  3416. "include": "#double-three-regexp-expression"
  3417. }
  3418. ]
  3419. },
  3420. "single-one-fregexp-expression": {
  3421. "patterns": [
  3422. {
  3423. "include": "#fregexp-base-expression"
  3424. },
  3425. {
  3426. "include": "#single-one-regexp-character-set"
  3427. },
  3428. {
  3429. "include": "#single-one-regexp-comments"
  3430. },
  3431. {
  3432. "include": "#regexp-flags"
  3433. },
  3434. {
  3435. "include": "#single-one-regexp-named-group"
  3436. },
  3437. {
  3438. "include": "#regexp-backreference"
  3439. },
  3440. {
  3441. "include": "#single-one-fregexp-lookahead"
  3442. },
  3443. {
  3444. "include": "#single-one-fregexp-lookahead-negative"
  3445. },
  3446. {
  3447. "include": "#single-one-fregexp-lookbehind"
  3448. },
  3449. {
  3450. "include": "#single-one-fregexp-lookbehind-negative"
  3451. },
  3452. {
  3453. "include": "#single-one-fregexp-conditional"
  3454. },
  3455. {
  3456. "include": "#single-one-fregexp-parentheses-non-capturing"
  3457. },
  3458. {
  3459. "include": "#single-one-fregexp-parentheses"
  3460. }
  3461. ]
  3462. },
  3463. "single-one-fregexp-named-group": {
  3464. "name": "meta.named.regexp",
  3465. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  3466. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3467. "beginCaptures": {
  3468. "1": {
  3469. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  3470. },
  3471. "2": {
  3472. "name": "entity.name.tag.named.group.regexp"
  3473. }
  3474. },
  3475. "endCaptures": {
  3476. "1": {
  3477. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  3478. },
  3479. "2": {
  3480. "name": "invalid.illegal.newline.python"
  3481. }
  3482. },
  3483. "patterns": [
  3484. {
  3485. "include": "#single-one-fregexp-expression"
  3486. }
  3487. ]
  3488. },
  3489. "single-one-fregexp-lookahead": {
  3490. "begin": "(\\()\\?=",
  3491. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3492. "beginCaptures": {
  3493. "0": {
  3494. "name": "keyword.operator.lookahead.regexp"
  3495. },
  3496. "1": {
  3497. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  3498. }
  3499. },
  3500. "endCaptures": {
  3501. "1": {
  3502. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  3503. },
  3504. "2": {
  3505. "name": "invalid.illegal.newline.python"
  3506. }
  3507. },
  3508. "patterns": [
  3509. {
  3510. "include": "#single-one-fregexp-expression"
  3511. }
  3512. ]
  3513. },
  3514. "single-one-fregexp-lookahead-negative": {
  3515. "begin": "(\\()\\?!",
  3516. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3517. "beginCaptures": {
  3518. "0": {
  3519. "name": "keyword.operator.lookahead.negative.regexp"
  3520. },
  3521. "1": {
  3522. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  3523. }
  3524. },
  3525. "endCaptures": {
  3526. "1": {
  3527. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  3528. },
  3529. "2": {
  3530. "name": "invalid.illegal.newline.python"
  3531. }
  3532. },
  3533. "patterns": [
  3534. {
  3535. "include": "#single-one-fregexp-expression"
  3536. }
  3537. ]
  3538. },
  3539. "single-one-fregexp-lookbehind": {
  3540. "begin": "(\\()\\?<=",
  3541. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3542. "beginCaptures": {
  3543. "0": {
  3544. "name": "keyword.operator.lookbehind.regexp"
  3545. },
  3546. "1": {
  3547. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  3548. }
  3549. },
  3550. "endCaptures": {
  3551. "1": {
  3552. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  3553. },
  3554. "2": {
  3555. "name": "invalid.illegal.newline.python"
  3556. }
  3557. },
  3558. "patterns": [
  3559. {
  3560. "include": "#single-one-fregexp-expression"
  3561. }
  3562. ]
  3563. },
  3564. "single-one-fregexp-lookbehind-negative": {
  3565. "begin": "(\\()\\?<!",
  3566. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3567. "beginCaptures": {
  3568. "0": {
  3569. "name": "keyword.operator.lookbehind.negative.regexp"
  3570. },
  3571. "1": {
  3572. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  3573. }
  3574. },
  3575. "endCaptures": {
  3576. "1": {
  3577. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  3578. },
  3579. "2": {
  3580. "name": "invalid.illegal.newline.python"
  3581. }
  3582. },
  3583. "patterns": [
  3584. {
  3585. "include": "#single-one-fregexp-expression"
  3586. }
  3587. ]
  3588. },
  3589. "single-one-fregexp-conditional": {
  3590. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  3591. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3592. "beginCaptures": {
  3593. "0": {
  3594. "name": "keyword.operator.conditional.regexp"
  3595. },
  3596. "1": {
  3597. "name": "punctuation.parenthesis.conditional.begin.regexp"
  3598. }
  3599. },
  3600. "endCaptures": {
  3601. "1": {
  3602. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  3603. },
  3604. "2": {
  3605. "name": "invalid.illegal.newline.python"
  3606. }
  3607. },
  3608. "patterns": [
  3609. {
  3610. "include": "#single-one-fregexp-expression"
  3611. }
  3612. ]
  3613. },
  3614. "single-one-fregexp-parentheses-non-capturing": {
  3615. "begin": "\\(\\?:",
  3616. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3617. "beginCaptures": {
  3618. "0": {
  3619. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  3620. }
  3621. },
  3622. "endCaptures": {
  3623. "1": {
  3624. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  3625. },
  3626. "2": {
  3627. "name": "invalid.illegal.newline.python"
  3628. }
  3629. },
  3630. "patterns": [
  3631. {
  3632. "include": "#single-one-fregexp-expression"
  3633. }
  3634. ]
  3635. },
  3636. "single-one-fregexp-parentheses": {
  3637. "begin": "\\(",
  3638. "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
  3639. "beginCaptures": {
  3640. "0": {
  3641. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  3642. }
  3643. },
  3644. "endCaptures": {
  3645. "1": {
  3646. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  3647. },
  3648. "2": {
  3649. "name": "invalid.illegal.newline.python"
  3650. }
  3651. },
  3652. "patterns": [
  3653. {
  3654. "include": "#single-one-fregexp-expression"
  3655. }
  3656. ]
  3657. },
  3658. "single-three-fregexp-expression": {
  3659. "patterns": [
  3660. {
  3661. "include": "#fregexp-base-expression"
  3662. },
  3663. {
  3664. "include": "#single-three-regexp-character-set"
  3665. },
  3666. {
  3667. "include": "#single-three-regexp-comments"
  3668. },
  3669. {
  3670. "include": "#regexp-flags"
  3671. },
  3672. {
  3673. "include": "#single-three-regexp-named-group"
  3674. },
  3675. {
  3676. "include": "#regexp-backreference"
  3677. },
  3678. {
  3679. "include": "#single-three-fregexp-lookahead"
  3680. },
  3681. {
  3682. "include": "#single-three-fregexp-lookahead-negative"
  3683. },
  3684. {
  3685. "include": "#single-three-fregexp-lookbehind"
  3686. },
  3687. {
  3688. "include": "#single-three-fregexp-lookbehind-negative"
  3689. },
  3690. {
  3691. "include": "#single-three-fregexp-conditional"
  3692. },
  3693. {
  3694. "include": "#single-three-fregexp-parentheses-non-capturing"
  3695. },
  3696. {
  3697. "include": "#single-three-fregexp-parentheses"
  3698. },
  3699. {
  3700. "include": "#comments-string-single-three"
  3701. }
  3702. ]
  3703. },
  3704. "single-three-fregexp-named-group": {
  3705. "name": "meta.named.regexp",
  3706. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  3707. "end": "(\\)|(?=\\'\\'\\'))",
  3708. "beginCaptures": {
  3709. "1": {
  3710. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  3711. },
  3712. "2": {
  3713. "name": "entity.name.tag.named.group.regexp"
  3714. }
  3715. },
  3716. "endCaptures": {
  3717. "1": {
  3718. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  3719. },
  3720. "2": {
  3721. "name": "invalid.illegal.newline.python"
  3722. }
  3723. },
  3724. "patterns": [
  3725. {
  3726. "include": "#single-three-fregexp-expression"
  3727. },
  3728. {
  3729. "include": "#comments-string-single-three"
  3730. }
  3731. ]
  3732. },
  3733. "single-three-fregexp-lookahead": {
  3734. "begin": "(\\()\\?=",
  3735. "end": "(\\)|(?=\\'\\'\\'))",
  3736. "beginCaptures": {
  3737. "0": {
  3738. "name": "keyword.operator.lookahead.regexp"
  3739. },
  3740. "1": {
  3741. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  3742. }
  3743. },
  3744. "endCaptures": {
  3745. "1": {
  3746. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  3747. },
  3748. "2": {
  3749. "name": "invalid.illegal.newline.python"
  3750. }
  3751. },
  3752. "patterns": [
  3753. {
  3754. "include": "#single-three-fregexp-expression"
  3755. },
  3756. {
  3757. "include": "#comments-string-single-three"
  3758. }
  3759. ]
  3760. },
  3761. "single-three-fregexp-lookahead-negative": {
  3762. "begin": "(\\()\\?!",
  3763. "end": "(\\)|(?=\\'\\'\\'))",
  3764. "beginCaptures": {
  3765. "0": {
  3766. "name": "keyword.operator.lookahead.negative.regexp"
  3767. },
  3768. "1": {
  3769. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  3770. }
  3771. },
  3772. "endCaptures": {
  3773. "1": {
  3774. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  3775. },
  3776. "2": {
  3777. "name": "invalid.illegal.newline.python"
  3778. }
  3779. },
  3780. "patterns": [
  3781. {
  3782. "include": "#single-three-fregexp-expression"
  3783. },
  3784. {
  3785. "include": "#comments-string-single-three"
  3786. }
  3787. ]
  3788. },
  3789. "single-three-fregexp-lookbehind": {
  3790. "begin": "(\\()\\?<=",
  3791. "end": "(\\)|(?=\\'\\'\\'))",
  3792. "beginCaptures": {
  3793. "0": {
  3794. "name": "keyword.operator.lookbehind.regexp"
  3795. },
  3796. "1": {
  3797. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  3798. }
  3799. },
  3800. "endCaptures": {
  3801. "1": {
  3802. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  3803. },
  3804. "2": {
  3805. "name": "invalid.illegal.newline.python"
  3806. }
  3807. },
  3808. "patterns": [
  3809. {
  3810. "include": "#single-three-fregexp-expression"
  3811. },
  3812. {
  3813. "include": "#comments-string-single-three"
  3814. }
  3815. ]
  3816. },
  3817. "single-three-fregexp-lookbehind-negative": {
  3818. "begin": "(\\()\\?<!",
  3819. "end": "(\\)|(?=\\'\\'\\'))",
  3820. "beginCaptures": {
  3821. "0": {
  3822. "name": "keyword.operator.lookbehind.negative.regexp"
  3823. },
  3824. "1": {
  3825. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  3826. }
  3827. },
  3828. "endCaptures": {
  3829. "1": {
  3830. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  3831. },
  3832. "2": {
  3833. "name": "invalid.illegal.newline.python"
  3834. }
  3835. },
  3836. "patterns": [
  3837. {
  3838. "include": "#single-three-fregexp-expression"
  3839. },
  3840. {
  3841. "include": "#comments-string-single-three"
  3842. }
  3843. ]
  3844. },
  3845. "single-three-fregexp-conditional": {
  3846. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  3847. "end": "(\\)|(?=\\'\\'\\'))",
  3848. "beginCaptures": {
  3849. "0": {
  3850. "name": "keyword.operator.conditional.regexp"
  3851. },
  3852. "1": {
  3853. "name": "punctuation.parenthesis.conditional.begin.regexp"
  3854. }
  3855. },
  3856. "endCaptures": {
  3857. "1": {
  3858. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  3859. },
  3860. "2": {
  3861. "name": "invalid.illegal.newline.python"
  3862. }
  3863. },
  3864. "patterns": [
  3865. {
  3866. "include": "#single-three-fregexp-expression"
  3867. },
  3868. {
  3869. "include": "#comments-string-single-three"
  3870. }
  3871. ]
  3872. },
  3873. "single-three-fregexp-parentheses-non-capturing": {
  3874. "begin": "\\(\\?:",
  3875. "end": "(\\)|(?=\\'\\'\\'))",
  3876. "beginCaptures": {
  3877. "0": {
  3878. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  3879. }
  3880. },
  3881. "endCaptures": {
  3882. "1": {
  3883. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  3884. },
  3885. "2": {
  3886. "name": "invalid.illegal.newline.python"
  3887. }
  3888. },
  3889. "patterns": [
  3890. {
  3891. "include": "#single-three-fregexp-expression"
  3892. },
  3893. {
  3894. "include": "#comments-string-single-three"
  3895. }
  3896. ]
  3897. },
  3898. "single-three-fregexp-parentheses": {
  3899. "begin": "\\(",
  3900. "end": "(\\)|(?=\\'\\'\\'))",
  3901. "beginCaptures": {
  3902. "0": {
  3903. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  3904. }
  3905. },
  3906. "endCaptures": {
  3907. "1": {
  3908. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  3909. },
  3910. "2": {
  3911. "name": "invalid.illegal.newline.python"
  3912. }
  3913. },
  3914. "patterns": [
  3915. {
  3916. "include": "#single-three-fregexp-expression"
  3917. },
  3918. {
  3919. "include": "#comments-string-single-three"
  3920. }
  3921. ]
  3922. },
  3923. "double-one-fregexp-expression": {
  3924. "patterns": [
  3925. {
  3926. "include": "#fregexp-base-expression"
  3927. },
  3928. {
  3929. "include": "#double-one-regexp-character-set"
  3930. },
  3931. {
  3932. "include": "#double-one-regexp-comments"
  3933. },
  3934. {
  3935. "include": "#regexp-flags"
  3936. },
  3937. {
  3938. "include": "#double-one-regexp-named-group"
  3939. },
  3940. {
  3941. "include": "#regexp-backreference"
  3942. },
  3943. {
  3944. "include": "#double-one-fregexp-lookahead"
  3945. },
  3946. {
  3947. "include": "#double-one-fregexp-lookahead-negative"
  3948. },
  3949. {
  3950. "include": "#double-one-fregexp-lookbehind"
  3951. },
  3952. {
  3953. "include": "#double-one-fregexp-lookbehind-negative"
  3954. },
  3955. {
  3956. "include": "#double-one-fregexp-conditional"
  3957. },
  3958. {
  3959. "include": "#double-one-fregexp-parentheses-non-capturing"
  3960. },
  3961. {
  3962. "include": "#double-one-fregexp-parentheses"
  3963. }
  3964. ]
  3965. },
  3966. "double-one-fregexp-named-group": {
  3967. "name": "meta.named.regexp",
  3968. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  3969. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  3970. "beginCaptures": {
  3971. "1": {
  3972. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  3973. },
  3974. "2": {
  3975. "name": "entity.name.tag.named.group.regexp"
  3976. }
  3977. },
  3978. "endCaptures": {
  3979. "1": {
  3980. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  3981. },
  3982. "2": {
  3983. "name": "invalid.illegal.newline.python"
  3984. }
  3985. },
  3986. "patterns": [
  3987. {
  3988. "include": "#double-one-fregexp-expression"
  3989. }
  3990. ]
  3991. },
  3992. "double-one-fregexp-lookahead": {
  3993. "begin": "(\\()\\?=",
  3994. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  3995. "beginCaptures": {
  3996. "0": {
  3997. "name": "keyword.operator.lookahead.regexp"
  3998. },
  3999. "1": {
  4000. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  4001. }
  4002. },
  4003. "endCaptures": {
  4004. "1": {
  4005. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  4006. },
  4007. "2": {
  4008. "name": "invalid.illegal.newline.python"
  4009. }
  4010. },
  4011. "patterns": [
  4012. {
  4013. "include": "#double-one-fregexp-expression"
  4014. }
  4015. ]
  4016. },
  4017. "double-one-fregexp-lookahead-negative": {
  4018. "begin": "(\\()\\?!",
  4019. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  4020. "beginCaptures": {
  4021. "0": {
  4022. "name": "keyword.operator.lookahead.negative.regexp"
  4023. },
  4024. "1": {
  4025. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  4026. }
  4027. },
  4028. "endCaptures": {
  4029. "1": {
  4030. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  4031. },
  4032. "2": {
  4033. "name": "invalid.illegal.newline.python"
  4034. }
  4035. },
  4036. "patterns": [
  4037. {
  4038. "include": "#double-one-fregexp-expression"
  4039. }
  4040. ]
  4041. },
  4042. "double-one-fregexp-lookbehind": {
  4043. "begin": "(\\()\\?<=",
  4044. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  4045. "beginCaptures": {
  4046. "0": {
  4047. "name": "keyword.operator.lookbehind.regexp"
  4048. },
  4049. "1": {
  4050. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  4051. }
  4052. },
  4053. "endCaptures": {
  4054. "1": {
  4055. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  4056. },
  4057. "2": {
  4058. "name": "invalid.illegal.newline.python"
  4059. }
  4060. },
  4061. "patterns": [
  4062. {
  4063. "include": "#double-one-fregexp-expression"
  4064. }
  4065. ]
  4066. },
  4067. "double-one-fregexp-lookbehind-negative": {
  4068. "begin": "(\\()\\?<!",
  4069. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  4070. "beginCaptures": {
  4071. "0": {
  4072. "name": "keyword.operator.lookbehind.negative.regexp"
  4073. },
  4074. "1": {
  4075. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  4076. }
  4077. },
  4078. "endCaptures": {
  4079. "1": {
  4080. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  4081. },
  4082. "2": {
  4083. "name": "invalid.illegal.newline.python"
  4084. }
  4085. },
  4086. "patterns": [
  4087. {
  4088. "include": "#double-one-fregexp-expression"
  4089. }
  4090. ]
  4091. },
  4092. "double-one-fregexp-conditional": {
  4093. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  4094. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  4095. "beginCaptures": {
  4096. "0": {
  4097. "name": "keyword.operator.conditional.regexp"
  4098. },
  4099. "1": {
  4100. "name": "punctuation.parenthesis.conditional.begin.regexp"
  4101. }
  4102. },
  4103. "endCaptures": {
  4104. "1": {
  4105. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  4106. },
  4107. "2": {
  4108. "name": "invalid.illegal.newline.python"
  4109. }
  4110. },
  4111. "patterns": [
  4112. {
  4113. "include": "#double-one-fregexp-expression"
  4114. }
  4115. ]
  4116. },
  4117. "double-one-fregexp-parentheses-non-capturing": {
  4118. "begin": "\\(\\?:",
  4119. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  4120. "beginCaptures": {
  4121. "0": {
  4122. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  4123. }
  4124. },
  4125. "endCaptures": {
  4126. "1": {
  4127. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  4128. },
  4129. "2": {
  4130. "name": "invalid.illegal.newline.python"
  4131. }
  4132. },
  4133. "patterns": [
  4134. {
  4135. "include": "#double-one-fregexp-expression"
  4136. }
  4137. ]
  4138. },
  4139. "double-one-fregexp-parentheses": {
  4140. "begin": "\\(",
  4141. "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
  4142. "beginCaptures": {
  4143. "0": {
  4144. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  4145. }
  4146. },
  4147. "endCaptures": {
  4148. "1": {
  4149. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  4150. },
  4151. "2": {
  4152. "name": "invalid.illegal.newline.python"
  4153. }
  4154. },
  4155. "patterns": [
  4156. {
  4157. "include": "#double-one-fregexp-expression"
  4158. }
  4159. ]
  4160. },
  4161. "double-three-fregexp-expression": {
  4162. "patterns": [
  4163. {
  4164. "include": "#fregexp-base-expression"
  4165. },
  4166. {
  4167. "include": "#double-three-regexp-character-set"
  4168. },
  4169. {
  4170. "include": "#double-three-regexp-comments"
  4171. },
  4172. {
  4173. "include": "#regexp-flags"
  4174. },
  4175. {
  4176. "include": "#double-three-regexp-named-group"
  4177. },
  4178. {
  4179. "include": "#regexp-backreference"
  4180. },
  4181. {
  4182. "include": "#double-three-fregexp-lookahead"
  4183. },
  4184. {
  4185. "include": "#double-three-fregexp-lookahead-negative"
  4186. },
  4187. {
  4188. "include": "#double-three-fregexp-lookbehind"
  4189. },
  4190. {
  4191. "include": "#double-three-fregexp-lookbehind-negative"
  4192. },
  4193. {
  4194. "include": "#double-three-fregexp-conditional"
  4195. },
  4196. {
  4197. "include": "#double-three-fregexp-parentheses-non-capturing"
  4198. },
  4199. {
  4200. "include": "#double-three-fregexp-parentheses"
  4201. },
  4202. {
  4203. "include": "#comments-string-double-three"
  4204. }
  4205. ]
  4206. },
  4207. "double-three-fregexp-named-group": {
  4208. "name": "meta.named.regexp",
  4209. "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
  4210. "end": "(\\)|(?=\"\"\"))",
  4211. "beginCaptures": {
  4212. "1": {
  4213. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
  4214. },
  4215. "2": {
  4216. "name": "entity.name.tag.named.group.regexp"
  4217. }
  4218. },
  4219. "endCaptures": {
  4220. "1": {
  4221. "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
  4222. },
  4223. "2": {
  4224. "name": "invalid.illegal.newline.python"
  4225. }
  4226. },
  4227. "patterns": [
  4228. {
  4229. "include": "#double-three-fregexp-expression"
  4230. },
  4231. {
  4232. "include": "#comments-string-double-three"
  4233. }
  4234. ]
  4235. },
  4236. "double-three-fregexp-lookahead": {
  4237. "begin": "(\\()\\?=",
  4238. "end": "(\\)|(?=\"\"\"))",
  4239. "beginCaptures": {
  4240. "0": {
  4241. "name": "keyword.operator.lookahead.regexp"
  4242. },
  4243. "1": {
  4244. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  4245. }
  4246. },
  4247. "endCaptures": {
  4248. "1": {
  4249. "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
  4250. },
  4251. "2": {
  4252. "name": "invalid.illegal.newline.python"
  4253. }
  4254. },
  4255. "patterns": [
  4256. {
  4257. "include": "#double-three-fregexp-expression"
  4258. },
  4259. {
  4260. "include": "#comments-string-double-three"
  4261. }
  4262. ]
  4263. },
  4264. "double-three-fregexp-lookahead-negative": {
  4265. "begin": "(\\()\\?!",
  4266. "end": "(\\)|(?=\"\"\"))",
  4267. "beginCaptures": {
  4268. "0": {
  4269. "name": "keyword.operator.lookahead.negative.regexp"
  4270. },
  4271. "1": {
  4272. "name": "punctuation.parenthesis.lookahead.begin.regexp"
  4273. }
  4274. },
  4275. "endCaptures": {
  4276. "1": {
  4277. "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
  4278. },
  4279. "2": {
  4280. "name": "invalid.illegal.newline.python"
  4281. }
  4282. },
  4283. "patterns": [
  4284. {
  4285. "include": "#double-three-fregexp-expression"
  4286. },
  4287. {
  4288. "include": "#comments-string-double-three"
  4289. }
  4290. ]
  4291. },
  4292. "double-three-fregexp-lookbehind": {
  4293. "begin": "(\\()\\?<=",
  4294. "end": "(\\)|(?=\"\"\"))",
  4295. "beginCaptures": {
  4296. "0": {
  4297. "name": "keyword.operator.lookbehind.regexp"
  4298. },
  4299. "1": {
  4300. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  4301. }
  4302. },
  4303. "endCaptures": {
  4304. "1": {
  4305. "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
  4306. },
  4307. "2": {
  4308. "name": "invalid.illegal.newline.python"
  4309. }
  4310. },
  4311. "patterns": [
  4312. {
  4313. "include": "#double-three-fregexp-expression"
  4314. },
  4315. {
  4316. "include": "#comments-string-double-three"
  4317. }
  4318. ]
  4319. },
  4320. "double-three-fregexp-lookbehind-negative": {
  4321. "begin": "(\\()\\?<!",
  4322. "end": "(\\)|(?=\"\"\"))",
  4323. "beginCaptures": {
  4324. "0": {
  4325. "name": "keyword.operator.lookbehind.negative.regexp"
  4326. },
  4327. "1": {
  4328. "name": "punctuation.parenthesis.lookbehind.begin.regexp"
  4329. }
  4330. },
  4331. "endCaptures": {
  4332. "1": {
  4333. "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
  4334. },
  4335. "2": {
  4336. "name": "invalid.illegal.newline.python"
  4337. }
  4338. },
  4339. "patterns": [
  4340. {
  4341. "include": "#double-three-fregexp-expression"
  4342. },
  4343. {
  4344. "include": "#comments-string-double-three"
  4345. }
  4346. ]
  4347. },
  4348. "double-three-fregexp-conditional": {
  4349. "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
  4350. "end": "(\\)|(?=\"\"\"))",
  4351. "beginCaptures": {
  4352. "0": {
  4353. "name": "keyword.operator.conditional.regexp"
  4354. },
  4355. "1": {
  4356. "name": "punctuation.parenthesis.conditional.begin.regexp"
  4357. }
  4358. },
  4359. "endCaptures": {
  4360. "1": {
  4361. "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
  4362. },
  4363. "2": {
  4364. "name": "invalid.illegal.newline.python"
  4365. }
  4366. },
  4367. "patterns": [
  4368. {
  4369. "include": "#double-three-fregexp-expression"
  4370. },
  4371. {
  4372. "include": "#comments-string-double-three"
  4373. }
  4374. ]
  4375. },
  4376. "double-three-fregexp-parentheses-non-capturing": {
  4377. "begin": "\\(\\?:",
  4378. "end": "(\\)|(?=\"\"\"))",
  4379. "beginCaptures": {
  4380. "0": {
  4381. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
  4382. }
  4383. },
  4384. "endCaptures": {
  4385. "1": {
  4386. "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
  4387. },
  4388. "2": {
  4389. "name": "invalid.illegal.newline.python"
  4390. }
  4391. },
  4392. "patterns": [
  4393. {
  4394. "include": "#double-three-fregexp-expression"
  4395. },
  4396. {
  4397. "include": "#comments-string-double-three"
  4398. }
  4399. ]
  4400. },
  4401. "double-three-fregexp-parentheses": {
  4402. "begin": "\\(",
  4403. "end": "(\\)|(?=\"\"\"))",
  4404. "beginCaptures": {
  4405. "0": {
  4406. "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
  4407. }
  4408. },
  4409. "endCaptures": {
  4410. "1": {
  4411. "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
  4412. },
  4413. "2": {
  4414. "name": "invalid.illegal.newline.python"
  4415. }
  4416. },
  4417. "patterns": [
  4418. {
  4419. "include": "#double-three-fregexp-expression"
  4420. },
  4421. {
  4422. "include": "#comments-string-double-three"
  4423. }
  4424. ]
  4425. },
  4426. "fregexp-single-one-line": {
  4427. "name": "string.interpolated.python string.regexp.quoted.single.python",
  4428. "begin": "\\b(([uU]r)|([fF]r)|(r[fF]?))(\\')",
  4429. "end": "(\\')|(?<!\\\\)(\\n)",
  4430. "beginCaptures": {
  4431. "2": {
  4432. "name": "invalid.deprecated.prefix.python"
  4433. },
  4434. "3": {
  4435. "name": "storage.type.string.python"
  4436. },
  4437. "4": {
  4438. "name": "storage.type.string.python"
  4439. },
  4440. "5": {
  4441. "name": "punctuation.definition.string.begin.python"
  4442. }
  4443. },
  4444. "endCaptures": {
  4445. "1": {
  4446. "name": "punctuation.definition.string.end.python"
  4447. },
  4448. "2": {
  4449. "name": "invalid.illegal.newline.python"
  4450. }
  4451. },
  4452. "patterns": [
  4453. {
  4454. "include": "#single-one-fregexp-expression"
  4455. }
  4456. ]
  4457. },
  4458. "fregexp-single-three-line": {
  4459. "name": "string.interpolated.python string.regexp.quoted.multi.python",
  4460. "begin": "\\b(([uU]r)|([fF]r)|(r[fF]?))(\\'\\'\\')",
  4461. "end": "(\\'\\'\\')",
  4462. "beginCaptures": {
  4463. "2": {
  4464. "name": "invalid.deprecated.prefix.python"
  4465. },
  4466. "3": {
  4467. "name": "storage.type.string.python"
  4468. },
  4469. "4": {
  4470. "name": "storage.type.string.python"
  4471. },
  4472. "5": {
  4473. "name": "punctuation.definition.string.begin.python"
  4474. }
  4475. },
  4476. "endCaptures": {
  4477. "1": {
  4478. "name": "punctuation.definition.string.end.python"
  4479. },
  4480. "2": {
  4481. "name": "invalid.illegal.newline.python"
  4482. }
  4483. },
  4484. "patterns": [
  4485. {
  4486. "include": "#single-three-fregexp-expression"
  4487. }
  4488. ]
  4489. },
  4490. "fregexp-double-one-line": {
  4491. "name": "string.interpolated.python string.regexp.quoted.single.python",
  4492. "begin": "\\b(([uU]r)|([fF]r)|(r[fF]?))(\")",
  4493. "end": "(\")|(?<!\\\\)(\\n)",
  4494. "beginCaptures": {
  4495. "2": {
  4496. "name": "invalid.deprecated.prefix.python"
  4497. },
  4498. "3": {
  4499. "name": "storage.type.string.python"
  4500. },
  4501. "4": {
  4502. "name": "storage.type.string.python"
  4503. },
  4504. "5": {
  4505. "name": "punctuation.definition.string.begin.python"
  4506. }
  4507. },
  4508. "endCaptures": {
  4509. "1": {
  4510. "name": "punctuation.definition.string.end.python"
  4511. },
  4512. "2": {
  4513. "name": "invalid.illegal.newline.python"
  4514. }
  4515. },
  4516. "patterns": [
  4517. {
  4518. "include": "#double-one-fregexp-expression"
  4519. }
  4520. ]
  4521. },
  4522. "fregexp-double-three-line": {
  4523. "name": "string.interpolated.python string.regexp.quoted.multi.python",
  4524. "begin": "\\b(([uU]r)|([fF]r)|(r[fF]?))(\"\"\")",
  4525. "end": "(\"\"\")",
  4526. "beginCaptures": {
  4527. "2": {
  4528. "name": "invalid.deprecated.prefix.python"
  4529. },
  4530. "3": {
  4531. "name": "storage.type.string.python"
  4532. },
  4533. "4": {
  4534. "name": "storage.type.string.python"
  4535. },
  4536. "5": {
  4537. "name": "punctuation.definition.string.begin.python"
  4538. }
  4539. },
  4540. "endCaptures": {
  4541. "1": {
  4542. "name": "punctuation.definition.string.end.python"
  4543. },
  4544. "2": {
  4545. "name": "invalid.illegal.newline.python"
  4546. }
  4547. },
  4548. "patterns": [
  4549. {
  4550. "include": "#double-three-fregexp-expression"
  4551. }
  4552. ]
  4553. },
  4554. "string-raw-quoted-single-line": {
  4555. "name": "string.quoted.raw.single.python",
  4556. "begin": "\\b(([uU]R)|(R))((['\"]))",
  4557. "end": "(\\4)|((?<!\\\\)\\n)",
  4558. "beginCaptures": {
  4559. "2": {
  4560. "name": "invalid.deprecated.prefix.python"
  4561. },
  4562. "3": {
  4563. "name": "storage.type.string.python"
  4564. },
  4565. "4": {
  4566. "name": "punctuation.definition.string.begin.python"
  4567. }
  4568. },
  4569. "endCaptures": {
  4570. "1": {
  4571. "name": "punctuation.definition.string.end.python"
  4572. },
  4573. "2": {
  4574. "name": "invalid.illegal.newline.python"
  4575. }
  4576. },
  4577. "patterns": [
  4578. {
  4579. "include": "#string-single-bad-brace1-formatting-raw"
  4580. },
  4581. {
  4582. "include": "#string-single-bad-brace2-formatting-raw"
  4583. },
  4584. {
  4585. "include": "#string-raw-guts"
  4586. }
  4587. ]
  4588. },
  4589. "string-bin-quoted-single-line": {
  4590. "name": "string.quoted.binary.single.python",
  4591. "begin": "(\\b[bB])((['\"]))",
  4592. "end": "(\\2)|((?<!\\\\)\\n)",
  4593. "beginCaptures": {
  4594. "1": {
  4595. "name": "storage.type.string.python"
  4596. },
  4597. "2": {
  4598. "name": "punctuation.definition.string.begin.python"
  4599. }
  4600. },
  4601. "endCaptures": {
  4602. "1": {
  4603. "name": "punctuation.definition.string.end.python"
  4604. },
  4605. "2": {
  4606. "name": "invalid.illegal.newline.python"
  4607. }
  4608. },
  4609. "patterns": [
  4610. {
  4611. "include": "#string-entity"
  4612. }
  4613. ]
  4614. },
  4615. "string-raw-bin-quoted-single-line": {
  4616. "name": "string.quoted.raw.binary.single.python",
  4617. "begin": "(\\b(?:R[bB]|[bB]R))((['\"]))",
  4618. "end": "(\\2)|((?<!\\\\)\\n)",
  4619. "beginCaptures": {
  4620. "1": {
  4621. "name": "storage.type.string.python"
  4622. },
  4623. "2": {
  4624. "name": "punctuation.definition.string.begin.python"
  4625. }
  4626. },
  4627. "endCaptures": {
  4628. "1": {
  4629. "name": "punctuation.definition.string.end.python"
  4630. },
  4631. "2": {
  4632. "name": "invalid.illegal.newline.python"
  4633. }
  4634. },
  4635. "patterns": [
  4636. {
  4637. "include": "#string-raw-bin-guts"
  4638. }
  4639. ]
  4640. },
  4641. "string-quoted-single-line": {
  4642. "name": "string.quoted.single.python",
  4643. "begin": "(?:\\b([rR])(?=[uU]))?([uU])?((['\"]))",
  4644. "end": "(\\3)|((?<!\\\\)\\n)",
  4645. "beginCaptures": {
  4646. "1": {
  4647. "name": "invalid.illegal.prefix.python"
  4648. },
  4649. "2": {
  4650. "name": "storage.type.string.python"
  4651. },
  4652. "3": {
  4653. "name": "punctuation.definition.string.begin.python"
  4654. }
  4655. },
  4656. "endCaptures": {
  4657. "1": {
  4658. "name": "punctuation.definition.string.end.python"
  4659. },
  4660. "2": {
  4661. "name": "invalid.illegal.newline.python"
  4662. }
  4663. },
  4664. "patterns": [
  4665. {
  4666. "include": "#string-single-bad-brace1-formatting-unicode"
  4667. },
  4668. {
  4669. "include": "#string-single-bad-brace2-formatting-unicode"
  4670. },
  4671. {
  4672. "include": "#string-unicode-guts"
  4673. }
  4674. ]
  4675. },
  4676. "string-single-bad-brace1-formatting-unicode": {
  4677. "comment": "template using {% ... %}",
  4678. "begin": "(?x)\n (?= \\{%\n ( .*? (?!(['\"])|((?<!\\\\)\\n)) )\n %\\}\n )\n",
  4679. "end": "(?=(['\"])|((?<!\\\\)\\n))",
  4680. "patterns": [
  4681. {
  4682. "include": "#escape-sequence-unicode"
  4683. },
  4684. {
  4685. "include": "#escape-sequence"
  4686. },
  4687. {
  4688. "include": "#string-line-continuation"
  4689. }
  4690. ]
  4691. },
  4692. "string-single-bad-brace1-formatting-raw": {
  4693. "comment": "template using {% ... %}",
  4694. "begin": "(?x)\n (?= \\{%\n ( .*? (?!(['\"])|((?<!\\\\)\\n)) )\n %\\}\n )\n",
  4695. "end": "(?=(['\"])|((?<!\\\\)\\n))",
  4696. "patterns": [
  4697. {
  4698. "include": "#string-consume-escape"
  4699. }
  4700. ]
  4701. },
  4702. "string-single-bad-brace2-formatting-unicode": {
  4703. "comment": "odd format or format-like syntax",
  4704. "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!(['\"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]\n )\n .*?(?!(['\"])|((?<!\\\\)\\n))\n \\}\n )\n",
  4705. "end": "(?=(['\"])|((?<!\\\\)\\n))",
  4706. "patterns": [
  4707. {
  4708. "include": "#escape-sequence-unicode"
  4709. },
  4710. {
  4711. "include": "#string-entity"
  4712. }
  4713. ]
  4714. },
  4715. "string-single-bad-brace2-formatting-raw": {
  4716. "comment": "odd format or format-like syntax",
  4717. "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!(['\"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]\n )\n .*?(?!(['\"])|((?<!\\\\)\\n))\n \\}\n )\n",
  4718. "end": "(?=(['\"])|((?<!\\\\)\\n))",
  4719. "patterns": [
  4720. {
  4721. "include": "#string-consume-escape"
  4722. },
  4723. {
  4724. "include": "#string-formatting"
  4725. }
  4726. ]
  4727. },
  4728. "string-raw-quoted-multi-line": {
  4729. "name": "string.quoted.raw.multi.python",
  4730. "begin": "\\b(([uU]R)|(R))('''|\"\"\")",
  4731. "end": "(\\4)",
  4732. "beginCaptures": {
  4733. "2": {
  4734. "name": "invalid.deprecated.prefix.python"
  4735. },
  4736. "3": {
  4737. "name": "storage.type.string.python"
  4738. },
  4739. "4": {
  4740. "name": "punctuation.definition.string.begin.python"
  4741. }
  4742. },
  4743. "endCaptures": {
  4744. "1": {
  4745. "name": "punctuation.definition.string.end.python"
  4746. },
  4747. "2": {
  4748. "name": "invalid.illegal.newline.python"
  4749. }
  4750. },
  4751. "patterns": [
  4752. {
  4753. "include": "#string-multi-bad-brace1-formatting-raw"
  4754. },
  4755. {
  4756. "include": "#string-multi-bad-brace2-formatting-raw"
  4757. },
  4758. {
  4759. "include": "#string-raw-guts"
  4760. }
  4761. ]
  4762. },
  4763. "string-bin-quoted-multi-line": {
  4764. "name": "string.quoted.binary.multi.python",
  4765. "begin": "(\\b[bB])('''|\"\"\")",
  4766. "end": "(\\2)",
  4767. "beginCaptures": {
  4768. "1": {
  4769. "name": "storage.type.string.python"
  4770. },
  4771. "2": {
  4772. "name": "punctuation.definition.string.begin.python"
  4773. }
  4774. },
  4775. "endCaptures": {
  4776. "1": {
  4777. "name": "punctuation.definition.string.end.python"
  4778. },
  4779. "2": {
  4780. "name": "invalid.illegal.newline.python"
  4781. }
  4782. },
  4783. "patterns": [
  4784. {
  4785. "include": "#string-entity"
  4786. }
  4787. ]
  4788. },
  4789. "string-raw-bin-quoted-multi-line": {
  4790. "name": "string.quoted.raw.binary.multi.python",
  4791. "begin": "(\\b(?:R[bB]|[bB]R))('''|\"\"\")",
  4792. "end": "(\\2)",
  4793. "beginCaptures": {
  4794. "1": {
  4795. "name": "storage.type.string.python"
  4796. },
  4797. "2": {
  4798. "name": "punctuation.definition.string.begin.python"
  4799. }
  4800. },
  4801. "endCaptures": {
  4802. "1": {
  4803. "name": "punctuation.definition.string.end.python"
  4804. },
  4805. "2": {
  4806. "name": "invalid.illegal.newline.python"
  4807. }
  4808. },
  4809. "patterns": [
  4810. {
  4811. "include": "#string-raw-bin-guts"
  4812. }
  4813. ]
  4814. },
  4815. "string-quoted-multi-line": {
  4816. "name": "string.quoted.multi.python",
  4817. "begin": "(?:\\b([rR])(?=[uU]))?([uU])?('''|\"\"\")",
  4818. "end": "(\\3)",
  4819. "beginCaptures": {
  4820. "1": {
  4821. "name": "invalid.illegal.prefix.python"
  4822. },
  4823. "2": {
  4824. "name": "storage.type.string.python"
  4825. },
  4826. "3": {
  4827. "name": "punctuation.definition.string.begin.python"
  4828. }
  4829. },
  4830. "endCaptures": {
  4831. "1": {
  4832. "name": "punctuation.definition.string.end.python"
  4833. },
  4834. "2": {
  4835. "name": "invalid.illegal.newline.python"
  4836. }
  4837. },
  4838. "patterns": [
  4839. {
  4840. "include": "#string-multi-bad-brace1-formatting-unicode"
  4841. },
  4842. {
  4843. "include": "#string-multi-bad-brace2-formatting-unicode"
  4844. },
  4845. {
  4846. "include": "#string-unicode-guts"
  4847. }
  4848. ]
  4849. },
  4850. "string-multi-bad-brace1-formatting-unicode": {
  4851. "comment": "template using {% ... %}",
  4852. "begin": "(?x)\n (?= \\{%\n ( .*? (?!'''|\"\"\") )\n %\\}\n )\n",
  4853. "end": "(?='''|\"\"\")",
  4854. "patterns": [
  4855. {
  4856. "include": "#escape-sequence-unicode"
  4857. },
  4858. {
  4859. "include": "#escape-sequence"
  4860. },
  4861. {
  4862. "include": "#string-line-continuation"
  4863. }
  4864. ]
  4865. },
  4866. "string-multi-bad-brace1-formatting-raw": {
  4867. "comment": "template using {% ... %}",
  4868. "begin": "(?x)\n (?= \\{%\n ( .*? (?!'''|\"\"\") )\n %\\}\n )\n",
  4869. "end": "(?='''|\"\"\")",
  4870. "patterns": [
  4871. {
  4872. "include": "#string-consume-escape"
  4873. }
  4874. ]
  4875. },
  4876. "string-multi-bad-brace2-formatting-unicode": {
  4877. "comment": "odd format or format-like syntax",
  4878. "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!'''|\"\"\") [^!:\\.\\[}\\w]\n )\n .*?(?!'''|\"\"\")\n \\}\n )\n",
  4879. "end": "(?='''|\"\"\")",
  4880. "patterns": [
  4881. {
  4882. "include": "#escape-sequence-unicode"
  4883. },
  4884. {
  4885. "include": "#string-entity"
  4886. }
  4887. ]
  4888. },
  4889. "string-multi-bad-brace2-formatting-raw": {
  4890. "comment": "odd format or format-like syntax",
  4891. "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!'''|\"\"\") [^!:\\.\\[}\\w]\n )\n .*?(?!'''|\"\"\")\n \\}\n )\n",
  4892. "end": "(?='''|\"\"\")",
  4893. "patterns": [
  4894. {
  4895. "include": "#string-consume-escape"
  4896. },
  4897. {
  4898. "include": "#string-formatting"
  4899. }
  4900. ]
  4901. },
  4902. "fstring-fnorm-quoted-single-line": {
  4903. "name": "meta.fstring.python",
  4904. "begin": "(\\b[fF])([bBuU])?((['\"]))",
  4905. "end": "(\\3)|((?<!\\\\)\\n)",
  4906. "beginCaptures": {
  4907. "1": {
  4908. "name": "string.interpolated.python string.quoted.single.python storage.type.string.python"
  4909. },
  4910. "2": {
  4911. "name": "invalid.illegal.prefix.python"
  4912. },
  4913. "3": {
  4914. "name": "punctuation.definition.string.begin.python string.interpolated.python string.quoted.single.python"
  4915. }
  4916. },
  4917. "endCaptures": {
  4918. "1": {
  4919. "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python"
  4920. },
  4921. "2": {
  4922. "name": "invalid.illegal.newline.python"
  4923. }
  4924. },
  4925. "patterns": [
  4926. {
  4927. "include": "#fstring-guts"
  4928. },
  4929. {
  4930. "include": "#fstring-illegal-single-brace"
  4931. },
  4932. {
  4933. "include": "#fstring-single-brace"
  4934. },
  4935. {
  4936. "include": "#fstring-single-core"
  4937. }
  4938. ]
  4939. },
  4940. "fstring-normf-quoted-single-line": {
  4941. "name": "meta.fstring.python",
  4942. "begin": "(\\b[bBuU])([fF])((['\"]))",
  4943. "end": "(\\3)|((?<!\\\\)\\n)",
  4944. "beginCaptures": {
  4945. "1": {
  4946. "name": "invalid.illegal.prefix.python"
  4947. },
  4948. "2": {
  4949. "name": "string.interpolated.python string.quoted.single.python storage.type.string.python"
  4950. },
  4951. "3": {
  4952. "name": "punctuation.definition.string.begin.python string.quoted.single.python"
  4953. }
  4954. },
  4955. "endCaptures": {
  4956. "1": {
  4957. "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python"
  4958. },
  4959. "2": {
  4960. "name": "invalid.illegal.newline.python"
  4961. }
  4962. },
  4963. "patterns": [
  4964. {
  4965. "include": "#fstring-guts"
  4966. },
  4967. {
  4968. "include": "#fstring-illegal-single-brace"
  4969. },
  4970. {
  4971. "include": "#fstring-single-brace"
  4972. },
  4973. {
  4974. "include": "#fstring-single-core"
  4975. }
  4976. ]
  4977. },
  4978. "fstring-raw-quoted-single-line": {
  4979. "name": "meta.fstring.python",
  4980. "begin": "(\\b(?:[R][fF]|[fF][R]))((['\"]))",
  4981. "end": "(\\2)|((?<!\\\\)\\n)",
  4982. "beginCaptures": {
  4983. "1": {
  4984. "name": "string.interpolated.python string.quoted.raw.single.python storage.type.string.python"
  4985. },
  4986. "2": {
  4987. "name": "punctuation.definition.string.begin.python string.quoted.raw.single.python"
  4988. }
  4989. },
  4990. "endCaptures": {
  4991. "1": {
  4992. "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.single.python"
  4993. },
  4994. "2": {
  4995. "name": "invalid.illegal.newline.python"
  4996. }
  4997. },
  4998. "patterns": [
  4999. {
  5000. "include": "#fstring-raw-guts"
  5001. },
  5002. {
  5003. "include": "#fstring-illegal-single-brace"
  5004. },
  5005. {
  5006. "include": "#fstring-single-brace"
  5007. },
  5008. {
  5009. "include": "#fstring-raw-single-core"
  5010. }
  5011. ]
  5012. },
  5013. "fstring-single-core": {
  5014. "name": "string.interpolated.python string.quoted.single.python",
  5015. "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|(['\"])|((?<!\\\\)\\n))\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n"
  5016. },
  5017. "fstring-raw-single-core": {
  5018. "name": "string.interpolated.python string.quoted.raw.single.python",
  5019. "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|(['\"])|((?<!\\\\)\\n))\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n"
  5020. },
  5021. "fstring-single-brace": {
  5022. "comment": "value interpolation using { ... }",
  5023. "begin": "(\\{)",
  5024. "end": "(?x)\n (\\})|(?=\\n)\n",
  5025. "beginCaptures": {
  5026. "1": {
  5027. "name": "constant.character.format.placeholder.other.python"
  5028. }
  5029. },
  5030. "endCaptures": {
  5031. "1": {
  5032. "name": "constant.character.format.placeholder.other.python"
  5033. }
  5034. },
  5035. "patterns": [
  5036. {
  5037. "include": "#fstring-terminator-single"
  5038. },
  5039. {
  5040. "include": "#f-expression"
  5041. }
  5042. ]
  5043. },
  5044. "fstring-terminator-single": {
  5045. "patterns": [
  5046. {
  5047. "name": "storage.type.format.python",
  5048. "match": "(![rsa])(?=})"
  5049. },
  5050. {
  5051. "match": "(?x)\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n",
  5052. "captures": {
  5053. "1": {
  5054. "name": "storage.type.format.python"
  5055. },
  5056. "2": {
  5057. "name": "storage.type.format.python"
  5058. }
  5059. }
  5060. },
  5061. {
  5062. "include": "#fstring-terminator-single-tail"
  5063. }
  5064. ]
  5065. },
  5066. "fstring-terminator-single-tail": {
  5067. "begin": "(![rsa])?(:)(?=.*?{)",
  5068. "end": "(?=})|(?=\\n)",
  5069. "beginCaptures": {
  5070. "1": {
  5071. "name": "storage.type.format.python"
  5072. },
  5073. "2": {
  5074. "name": "storage.type.format.python"
  5075. }
  5076. },
  5077. "patterns": [
  5078. {
  5079. "include": "#fstring-illegal-single-brace"
  5080. },
  5081. {
  5082. "include": "#fstring-single-brace"
  5083. },
  5084. {
  5085. "name": "storage.type.format.python",
  5086. "match": "([bcdeEfFgGnosxX%])(?=})"
  5087. },
  5088. {
  5089. "name": "storage.type.format.python",
  5090. "match": "(\\.\\d+)"
  5091. },
  5092. {
  5093. "name": "storage.type.format.python",
  5094. "match": "(,)"
  5095. },
  5096. {
  5097. "name": "storage.type.format.python",
  5098. "match": "(\\d+)"
  5099. },
  5100. {
  5101. "name": "storage.type.format.python",
  5102. "match": "(\\#)"
  5103. },
  5104. {
  5105. "name": "storage.type.format.python",
  5106. "match": "([-+ ])"
  5107. },
  5108. {
  5109. "name": "storage.type.format.python",
  5110. "match": "([<>=^])"
  5111. },
  5112. {
  5113. "name": "storage.type.format.python",
  5114. "match": "(\\w)"
  5115. }
  5116. ]
  5117. },
  5118. "fstring-fnorm-quoted-multi-line": {
  5119. "name": "meta.fstring.python",
  5120. "begin": "(\\b[fF])([bBuU])?('''|\"\"\")",
  5121. "end": "(\\3)",
  5122. "beginCaptures": {
  5123. "1": {
  5124. "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python"
  5125. },
  5126. "2": {
  5127. "name": "invalid.illegal.prefix.python"
  5128. },
  5129. "3": {
  5130. "name": "punctuation.definition.string.begin.python string.interpolated.python string.quoted.multi.python"
  5131. }
  5132. },
  5133. "endCaptures": {
  5134. "1": {
  5135. "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python"
  5136. },
  5137. "2": {
  5138. "name": "invalid.illegal.newline.python"
  5139. }
  5140. },
  5141. "patterns": [
  5142. {
  5143. "include": "#fstring-guts"
  5144. },
  5145. {
  5146. "include": "#fstring-illegal-multi-brace"
  5147. },
  5148. {
  5149. "include": "#fstring-multi-brace"
  5150. },
  5151. {
  5152. "include": "#fstring-multi-core"
  5153. }
  5154. ]
  5155. },
  5156. "fstring-normf-quoted-multi-line": {
  5157. "name": "meta.fstring.python",
  5158. "begin": "(\\b[bBuU])([fF])('''|\"\"\")",
  5159. "end": "(\\3)",
  5160. "beginCaptures": {
  5161. "1": {
  5162. "name": "invalid.illegal.prefix.python"
  5163. },
  5164. "2": {
  5165. "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python"
  5166. },
  5167. "3": {
  5168. "name": "punctuation.definition.string.begin.python string.quoted.multi.python"
  5169. }
  5170. },
  5171. "endCaptures": {
  5172. "1": {
  5173. "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python"
  5174. },
  5175. "2": {
  5176. "name": "invalid.illegal.newline.python"
  5177. }
  5178. },
  5179. "patterns": [
  5180. {
  5181. "include": "#fstring-guts"
  5182. },
  5183. {
  5184. "include": "#fstring-illegal-multi-brace"
  5185. },
  5186. {
  5187. "include": "#fstring-multi-brace"
  5188. },
  5189. {
  5190. "include": "#fstring-multi-core"
  5191. }
  5192. ]
  5193. },
  5194. "fstring-raw-quoted-multi-line": {
  5195. "name": "meta.fstring.python",
  5196. "begin": "(\\b(?:[R][fF]|[fF][R]))('''|\"\"\")",
  5197. "end": "(\\2)",
  5198. "beginCaptures": {
  5199. "1": {
  5200. "name": "string.interpolated.python string.quoted.raw.multi.python storage.type.string.python"
  5201. },
  5202. "2": {
  5203. "name": "punctuation.definition.string.begin.python string.quoted.raw.multi.python"
  5204. }
  5205. },
  5206. "endCaptures": {
  5207. "1": {
  5208. "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.multi.python"
  5209. },
  5210. "2": {
  5211. "name": "invalid.illegal.newline.python"
  5212. }
  5213. },
  5214. "patterns": [
  5215. {
  5216. "include": "#fstring-raw-guts"
  5217. },
  5218. {
  5219. "include": "#fstring-illegal-multi-brace"
  5220. },
  5221. {
  5222. "include": "#fstring-multi-brace"
  5223. },
  5224. {
  5225. "include": "#fstring-raw-multi-core"
  5226. }
  5227. ]
  5228. },
  5229. "fstring-multi-core": {
  5230. "name": "string.interpolated.python string.quoted.multi.python",
  5231. "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n"
  5232. },
  5233. "fstring-raw-multi-core": {
  5234. "name": "string.interpolated.python string.quoted.raw.multi.python",
  5235. "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n"
  5236. },
  5237. "fstring-multi-brace": {
  5238. "comment": "value interpolation using { ... }",
  5239. "begin": "(\\{)",
  5240. "end": "(?x)\n (\\})\n",
  5241. "beginCaptures": {
  5242. "1": {
  5243. "name": "constant.character.format.placeholder.other.python"
  5244. }
  5245. },
  5246. "endCaptures": {
  5247. "1": {
  5248. "name": "constant.character.format.placeholder.other.python"
  5249. }
  5250. },
  5251. "patterns": [
  5252. {
  5253. "include": "#fstring-terminator-multi"
  5254. },
  5255. {
  5256. "include": "#f-expression"
  5257. }
  5258. ]
  5259. },
  5260. "fstring-terminator-multi": {
  5261. "patterns": [
  5262. {
  5263. "name": "storage.type.format.python",
  5264. "match": "(![rsa])(?=})"
  5265. },
  5266. {
  5267. "match": "(?x)\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n",
  5268. "captures": {
  5269. "1": {
  5270. "name": "storage.type.format.python"
  5271. },
  5272. "2": {
  5273. "name": "storage.type.format.python"
  5274. }
  5275. }
  5276. },
  5277. {
  5278. "include": "#fstring-terminator-multi-tail"
  5279. }
  5280. ]
  5281. },
  5282. "fstring-terminator-multi-tail": {
  5283. "begin": "(![rsa])?(:)(?=.*?{)",
  5284. "end": "(?=})",
  5285. "beginCaptures": {
  5286. "1": {
  5287. "name": "storage.type.format.python"
  5288. },
  5289. "2": {
  5290. "name": "storage.type.format.python"
  5291. }
  5292. },
  5293. "patterns": [
  5294. {
  5295. "include": "#fstring-illegal-multi-brace"
  5296. },
  5297. {
  5298. "include": "#fstring-multi-brace"
  5299. },
  5300. {
  5301. "name": "storage.type.format.python",
  5302. "match": "([bcdeEfFgGnosxX%])(?=})"
  5303. },
  5304. {
  5305. "name": "storage.type.format.python",
  5306. "match": "(\\.\\d+)"
  5307. },
  5308. {
  5309. "name": "storage.type.format.python",
  5310. "match": "(,)"
  5311. },
  5312. {
  5313. "name": "storage.type.format.python",
  5314. "match": "(\\d+)"
  5315. },
  5316. {
  5317. "name": "storage.type.format.python",
  5318. "match": "(\\#)"
  5319. },
  5320. {
  5321. "name": "storage.type.format.python",
  5322. "match": "([-+ ])"
  5323. },
  5324. {
  5325. "name": "storage.type.format.python",
  5326. "match": "([<>=^])"
  5327. },
  5328. {
  5329. "name": "storage.type.format.python",
  5330. "match": "(\\w)"
  5331. }
  5332. ]
  5333. }
  5334. }
  5335. }