Files

2 lines
37 KiB
JavaScript
Raw Permalink Normal View History

import{L as w,E as g,C as b}from"./vendor-lezer-lr-eZ5kYecM.js";import{s as u,t as a}from"./vendor-lezer-highlight-DuEf3ZFH.js";const Y=1,_=194,x=195,E=196,W=197,J=198,F=199,C=200,A=2,U=3,R=201,H=24,L=25,N=49,D=50,I=55,K=56,B=57,M=59,OO=60,QO=61,iO=62,aO=63,nO=65,eO=238,rO=71,dO=241,TO=242,tO=243,SO=244,oO=245,sO=246,qO=247,PO=248,f=72,$O=249,gO=250,lO=251,hO=252,pO=253,XO=254,mO=255,zO=256,cO=73,WO=77,RO=263,vO=112,kO=130,yO=151,_O=152,xO=155,S=10,q=13,m=32,l=9,z=35,UO=40,fO=46,X=123,v=125,V=39,G=34,k=92,VO=111,GO=120,ZO=78,jO=117,wO=85,bO=new Set([L,N,D,RO,nO,kO,K,B,eO,iO,aO,f,cO,WO,OO,QO,yO,_O,xO,vO]);function h(O){return O==S||O==q}function p(O){return O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102}const uO=new g((O,Q)=>{let i;if(O.next<0)O.acceptToken(F);else if(Q.context.flags&P)h(O.next)&&O.acceptToken(J,1);else if(((i=O.peek(-1))<0||h(i))&&Q.canShift(W)){let n=0;for(;O.next==m||O.next==l;)O.advance(),n++;(O.next==S||O.next==q||O.next==z)&&O.acceptToken(W,-n)}else h(O.next)&&O.acceptToken(E,1)},{contextual:!0}),YO=new g((O,Q)=>{let i=Q.context;if(i.flags)return;let n=O.peek(-1);if(n==S||n==q){let e=0,o=0;for(;;){if(O.next==m)e++;else if(O.next==l)e+=8-e%8;else break;O.advance(),o++}e!=i.indent&&O.next!=S&&O.next!=q&&O.next!=z&&(e<i.indent?O.acceptToken(x,-o):O.acceptToken(_))}}),P=1,Z=2,r=4,d=8,T=16,t=32;function $(O,Q,i){this.parent=O,this.indent=Q,this.flags=i,this.hash=(O?O.hash+O.hash<<8:0)+Q+(Q<<4)+i+(i<<6)}const EO=new $(null,0,0);function JO(O){let Q=0;for(let i=0;i<O.length;i++)Q+=O.charCodeAt(i)==l?8-Q%8:1;return Q}const y=new Map([[dO,0],[TO,r],[tO,d],[SO,d|r],[oO,T],[sO,T|r],[qO,T|d],[PO,T|d|r],[$O,t],[gO,t|r],[lO,t|d],[hO,t|d|r],[pO,t|T],[XO,t|T|r],[mO,t|T|d],[zO,t|T|d|r]].map(([O,Q])=>[O,Q|Z])),FO=new b({start:EO,reduce(O,Q,i,n){return O.flags&P&&bO.has(Q)||(Q==rO||Q==f)&&O.flags&Z?O.parent:O},shift(O,Q,i,n){return Q==_?new $(O,JO(n.read(n.pos,i.pos)),0):Q==x?O.parent:Q==H||Q==I||Q==M||Q==U?new $(O,0,P):y.has(Q)?new $(O,0,y.get(Q)|O.flags&P):O},hash(O){return O.hash}}),CO=new g(O=>{for(let Q=0;Q<5;Q++){if(O.next!="print".charCodeAt(Q))return;O.advance()}if(!/\w/.test(String.fromCharCode(O.next)))for(let Q=0;;Q++){let i=O.peek(Q);if(!(i==m||i==l)){i!=UO&&i!=fO&&i!=S&&i!=q&&i!=z&&O.acceptToken(Y);return}}}),AO=new g((O,Q)=>{let{flags:i}=Q.context,n=i&r?G:V,e=(i&d)>0,o=!(i&T),j=(i&t)>0,s=O.pos;for(;!(O.next<0);)if(j&&O.next==X)if(O.peek(1)==X)O.advance(2);else{if(O.pos==s){O.acceptToken(U,1);return}break}else if(o&&O.next==k){if(O.pos==s){O.advance();let c=O.next;c>=0&&(O.advance(),HO(O,c)),O.acceptToken(A);return}break}else if(O.next==k&&!o&&O.peek(1)>-1)O.advance(2);else if(O.next==n&&(!e||O.peek(1)==n&&O.peek(2)==n)){if(O.pos==s){O.acceptToken(R,e?3:1);return}break}else if(O.next==S){if(e)O.advance();else if(O.pos==s){O.acceptToken(R);return}break}else O.advance();O.pos>s&&O.acceptToken(C)});function HO(O,Q){if(Q==VO)for(let i=0;i<2&&O.next>=48&&O.next<=55;i++)O.advance();else if(Q==GO)for(let i=0;i<2&&p(O.next);i++)O.advance();else if(Q==jO)for(let i=0;i<4&&p(O.next);i++)O.advance();else if(Q==wO)for(let i=0;i<8&&p(O.next);i++)O.advance();else if(Q==ZO&&O.next==X){for(O.advance();O.next>=0&&O.next!=v&&O.next!=V&&O.next!=G&&O.next!=S;)O.advance();O.next==v&&O.advance()}}const LO=u({'async "*" "**" FormatConversion FormatSpec':a.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":a.controlKeyword,"in not and or is del":a.operatorKeyword,"from def class global nonlocal lambda":a.definitionKeyword,import:a.moduleKeyword,"with as print":a.keyword,Boolean:a.bool,None:a.null,VariableName:a.variableName,"CallExpression/VariableName":a.function(a.variableName),"FunctionDefinition/VariableName":a.function(a.definition(a.variableName)),"ClassDefinition/VariableName":a.definition(a.className),PropertyName:a.propertyName,"CallExpression/MemberExpression/PropertyName":a.function(a.propertyName),Comment:a.lineComment,Number:a.number,String:a.string,FormatString:a.special(a.string),Escape:a.escape,UpdateOp:a.updateOperator,"ArithOp!":a.arithmeticOperat