|
|
- import{ExternalTokenizer,LRParser}from"@lezer/lr";import{styleTags,tags}from"@lezer/highlight";const descendantOp=93,Unit=1,callee=94,identifier=95,VariableName=2;const space=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];const colon=58,parenL=40,underscore=95,bracketL=91,dash=45,period=46,hash=35,percent=37;function isAlpha(ch){return ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=161}function isDigit(ch){return ch>=48&&ch<=57}const identifiers=new ExternalTokenizer((input,stack)=>{for(let inside=false,dashes=0,i=0;;i++){let{next}=input;if(isAlpha(next)||next==dash||next==underscore||inside&&isDigit(next)){if(!inside&&(next!=dash||i>0))inside=true;if(dashes===i&&next==dash)dashes++;input.advance()}else{if(inside)input.acceptToken(next==parenL?callee:dashes==2&&stack.canShift(VariableName)?VariableName:identifier);break}}});const descendant=new ExternalTokenizer(input=>{if(space.includes(input.peek(-1))){let{next}=input;if(isAlpha(next)||next==underscore||next==hash||next==period||next==bracketL||next==colon||next==dash)input.acceptToken(descendantOp)}});const unitToken=new ExternalTokenizer(input=>{if(!space.includes(input.peek(-1))){let{next}=input;if(next==percent){input.advance();input.acceptToken(Unit)}if(isAlpha(next)){do{input.advance()}while(isAlpha(input.next));input.acceptToken(Unit)}}});const cssHighlighting=styleTags({"AtKeyword import charset namespace keyframes media supports":tags.definitionKeyword,"from to selector":tags.keyword,NamespaceName:tags.namespace,KeyframeName:tags.labelName,TagName:tags.tagName,ClassName:tags.className,PseudoClassName:tags.constant(tags.className),IdName:tags.labelName,"FeatureName PropertyName":tags.propertyName,AttributeName:tags.attributeName,NumberLiteral:tags.number,KeywordQuery:tags.keyword,UnaryQueryOp:tags.operatorKeyword,"CallTag ValueName":tags.atom,VariableName:tags.variableName,Callee:tags.operatorKeyword,Unit:tags.unit,"UniversalSelector NestingSelector":tags.definitionOperator,MatchOp:tags.compareOperator,"ChildOp SiblingOp, LogicOp":tags.logicOperator,BinOp:tags.arithmeticOperator,Important:tags.modifier,Comment:tags.blockComment,ParenthesizedContent:tags.special(tags.name),ColorLiteral:tags.color,StringLiteral:tags.string,":":tags.punctuation,"PseudoOp #":tags.derefOperator,"; ,":tags.separator,"( )":tags.paren,"[ ]":tags.squareBracket,"{ }":tags.brace});const spec_callee={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134};const spec_AtKeyword={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164};const spec_identifier={__proto__:null,not:128,only:128,from:158,to:160};const parser=LRParser.deserialize({version:14,states:"7WOYQ[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO!ZQ[O'#CfO!}QXO'#CaO#UQ[O'#ChO#aQ[O'#DPO#fQ[O'#DTOOQP'#Ec'#EcO#kQdO'#DeO$VQ[O'#DrO#kQdO'#DtO$hQ[O'#DvO$sQ[O'#DyO$xQ[O'#EPO%WQ[O'#EROOQS'#Eb'#EbOOQS'#ES'#ESQYQ[OOOOQP'#Cg'#CgOOQP,59Q,59QO!ZQ[O,59QO%_Q[O'#EVO%yQWO,58{O&RQ[O,59SO#aQ[O,59kO#fQ[O,59oO%_Q[O,59sO%_Q[O,59uO%_Q[O,59vO'bQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO'iQWO,59SO'nQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO'sQ`O,59oOOQS'#Cp'#CpO#kQdO'#CqO'{QvO'#CsO)VQtO,5:POOQO'#Cx'#CxO'nQWO'#CwO)kQWO'#CyOOQS'#Ef'#EfOOQO'#Dh'#DhO)pQ[O'#DoO*OQWO'#EiO$xQ[O'#DmO*^QWO'#DpOOQO'#Ej'#EjO%|QWO,5:^O*cQpO,5:`OOQS'#Dx'#DxO*kQWO,5:bO*pQ[O,5:bOOQO'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