import{LeftParenthesis as t,Ident as e,Colon as i,RightParenthesis as s,Function as n,Dimension as o,Number as r,Delim as h}from"../../tokenizer/types.mjs";import"../../tokenizer/char-code-definitions.mjs";import"../../tokenizer/TokenStream.mjs";const a="Feature",k={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]};function u(a){const k=this.tokenStart;let u,c=null;if(this.eat(t),this.skipSC(),u=this.consume(e),this.skipSC(),this.tokenType!==s){switch(this.eat(i),this.skipSC(),this.tokenType){case r:c=this.lookupNonWSType(1)===h?this.Ratio():this.Number();break;case o:c=this.Dimension();break;case e:c=this.Identifier();break;case n:c=this.parseWithFallback(()=>{const t=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(47)&&this.error(),t},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(s),{type:"Feature",loc:this.getLocation(k,this.tokenStart),kind:a,name:u,value:c}}function c(n){this.token(t,"("),this.token(e,n.name),null!==n.value&&(this.token(i,":"),this.node(n.value)),this.token(s,")")}export{c as generate,a as name,u as parse,k as structure};