物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
54 KiB

  1. import{e as P,D as h,C as _,W as i,_ as k,a as g,T as E,S as U,Y as z,b as l,q as A,g as F,k as C,u as N,n as D,o as H,L as o}from"./index-Bo-aCpEW.js";const I=1,u=201,y=202,L=203,m=204,J=205,M=206,B=207,K=2,OO=208,rO=209,aO=3,QO=210,iO=211,xO=4,SO=212,eO=213,oO=5,TO=214,sO=26,tO=27,nO=51,PO=52,pO=57,qO=58,lO=59,$O=61,XO=62,wO=63,YO=64,cO=65,mO=67,dO=251,fO=74,bO=270,ZO=115,uO=133,yO=154,WO=155,VO=158,s=10,t=13,Y=32,p=9,c=35,RO=40,jO=46,d=123,W=39,V=34,vO=92,GO=new Set([tO,nO,PO,bO,mO,uO,qO,lO,dO,YO,cO,fO,XO,wO,yO,WO,VO,ZO]);function $(O){return O==s||O==t}const hO=new P((O,r)=>{let a;if(O.next<0)O.acceptToken(M);else if(r.context.depth<0)$(O.next)&&O.acceptToken(J,1);else if(((a=O.peek(-1))<0||$(a))&&r.canShift(m)){let Q=0;for(;O.next==Y||O.next==p;)O.advance(),Q++;(O.next==s||O.next==t||O.next==c)&&O.acceptToken(m,-Q)}else $(O.next)&&O.acceptToken(L,1)},{contextual:!0}),_O=new P((O,r)=>{let a=r.context.depth;if(a<0)return;let Q=O.peek(-1);if(Q==s||Q==t){let x=0,S=0;for(;;){if(O.next==Y)x++;else if(O.next==p)x+=8-x%8;else break;O.advance(),S++}x!=a&&O.next!=s&&O.next!=t&&O.next!=c&&(x<a?O.acceptToken(y,-S):O.acceptToken(u))}});function w(O,r){this.parent=O,this.depth=r,this.hash=(O?O.hash+O.hash<<8:0)+r+(r<<4)}const kO=new w(null,0);function gO(O){let r=0;for(let a=0;a<O.length;a++)r+=O.charCodeAt(a)==p?8-r%8:1;return r}const EO=new h({start:kO,reduce(O,r){return O.depth<0&&GO.has(r)?O.parent:O},shift(O,r,a,Q){return r==u?new w(O,gO(Q.read(Q.pos,a.pos))):r==y?O.parent:r==sO||r==pO||r==$O?new w(O,-1):O},hash(O){return O.hash}}),UO=new P(O=>{for(let r=0;r<5;r++){if(O.next!="print".charCodeAt(r))return;O.advance()}if(!/\w/.test(String.fromCharCode(O.next)))for(let r=0;;r++){let a=O.peek(r);if(!(a==Y||a==p)){a!=RO&&a!=jO&&a!=s&&a!=t&&a!=c&&O.acceptToken(I);return}}});function q(O,r,a,Q,x){return new P(S=>{let e=S.pos;for(;!(S.next<0);)if(S.next==d)if(S.peek(1)==d)S.advance(2);else{if(S.pos==e){S.acceptToken(Q,1);return}break}else if(S.next==vO)S.advance(),S.next>=0&&S.advance();else if(S.next==O&&(r==1||S.peek(1)==O&&S.peek(2)==O)){if(S.pos==e){S.acceptToken(x,r);return}break}else S.advance();S.pos>e&&S.acceptToken(a)})}const zO=q(W,1,B,K,OO),AO=q(V,1,rO,aO,QO),FO=q(W,3,iO,xO,SO),CO=q(V,3,eO,oO,TO),NO=_({'async "*" "**" FormatConversion FormatSpec':i.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":i.controlKeyword,"in not and or is del":i.operatorKeyword,"from def class global nonlocal lambda":i.definitionKeyword,import:i.moduleKeyword,"with as print":i.keyword,Boolean:i.bool,None:i.null,VariableName:i.variableName,"CallExpression/VariableName":i.function(i.variableName),"FunctionDefinition/VariableName":i.function(i.definition(i.variableName)),"ClassDefinition/VariableName":i.definition(i.className),PropertyName:i.propertyName,"CallExpression/MemberExpression/PropertyName":i.function(i.propertyName),Comment:i.lineComment,Number:i.number,String:i.string,FormatString:i.special(i.string),UpdateOp:i.updateOperator,"ArithOp!":i.arithmeticOperator,BitOp:i.bitwiseOperator,CompareOp:i.compareOperator,AssignOp:i.definitionOperator,Ellipsis:i.punctuation,At:i.meta,"( )":i.paren,"[ ]":i.squareBracket,"{ }":i.brace,".":i.derefOperator,", ;":i.separator}),DO={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:168,True:170,False:170,del:184,pass:188,break:192,continue:196,return:200,raise:208,import:212,as:214,global:218,nonlocal:220,assert:224,type:229,elif:242,while:246,try:252,except:254,finally:256,with:260,def:264,class:274,match:285,case:291},HO=k.deserialize({version:14,states:"#&jO`Q#yOOP$bOSOOO%kQ&nO'#HcOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HbOOQS'#Hc'#HcOOQS'#DW'#DWOOQS'#Hb'#HbO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HSOOQS'#HS'#HSO'ZQ#xO'#HRO/ZQ&nO'#HROOQS'#Ee'#EeO/rQ#xO'#EfOOQS'#HQ'#HQO/|Q#xO'#HPOOQV'#HP'#HPO0XQ#xO'#F]OOQS'#Ge'#GeO0^Q#xO'#F[OOQV'#IY'#IYOOQV'#HO'#HOOOQV'#Ft'#FtQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#
  2. `,{label:"if",detail:"block",type:"keyword"}),o("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),o("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),o("import ${module}",{label:"import",detail:"statement",type:"keyword"}),o("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],BO=E(v,D(JO.concat(MO)));function Z(O,r){let a=O.baseIndentFor(r),Q=O.lineAt(O.pos,-1),x=Q.from+Q.text.length;return/^\s*($|#)/.test(Q.text)&&O.node.to<x+100&&!/\S/.test(O.state.sliceDoc(x,O.node.to))&&O.lineIndent(O.pos,-1)<=a||/^\s*(else:|elif |except |finally:)/.test(O.textAfter)&&O.lineIndent(O.pos,-1)>a?null:a+O.unit}const X=U.define({name:"python",parser:HO.configure({props:[z.add({Body:O=>{var r;return(r=Z(O,O.node))!==null&&r!==void 0?r:O.continue()},IfStatement:O=>/^\s*(else:|elif )/.test(O.textAfter)?O.baseIndent:O.continue(),TryStatement:O=>/^\s*(except |finally:|else:)/.test(O.textAfter)?O.baseIndent:O.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":l({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":l({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":l({closing:"]"}),"String FormatString":()=>null,Script:O=>{if(O.pos+/\s*/.exec(O.textAfter)[0].length>=O.node.to){let r=null;for(let a=O.node,Q=a.to;a=a.lastChild,!(!a||a.to!=Q);)a.type.name=="Body"&&(r=a);if(r){let a=Z(O,r);if(a!=null)return a}}return O.continue()}}),A.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":F,Body:(O,r)=>({from:O.from+1,to:O.to-(O.to==r.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/}});function Or(){return new C(X,[X.data.of({autocomplete:LO}),X.data.of({autocomplete:BO})])}export{BO as globalCompletion,LO as localCompletionSource,Or as python,X as pythonLanguage};