var e={slash:0,parenthesis:1},t={comment:0,_string:1,characterClass:2},n={name:`ebnf`,startState:function(){return{stringType:null,commentType:null,braced:0,lhs:!0,localState:null,stack:[],inDefinition:!1}},token:function(n,r){if(n){switch(r.stack.length===0&&(n.peek()==`"`||n.peek()==`'`?(r.stringType=n.peek(),n.next(),r.stack.unshift(t._string)):n.match(`/*`)?(r.stack.unshift(t.comment),r.commentType=e.slash):n.match(`(*`)&&(r.stack.unshift(t.comment),r.commentType=e.parenthesis)),r.stack[0]){case t._string:for(;r.stack[0]===t._string&&!n.eol();)n.peek()===r.stringType?(n.next(),r.stack.shift()):n.peek()===`\\`?(n.next(),n.next()):n.match(/^.[^\\\"\']*/);return r.lhs?`property`:`string`;case t.comment:for(;r.stack[0]===t.comment&&!n.eol();)r.commentType===e.slash&&n.match(`*/`)||r.commentType===e.parenthesis&&n.match(`*)`)?(r.stack.shift(),r.commentType=null):n.match(/^.[^\*]*/);return`comment`;case t.characterClass:for(;r.stack[0]===t.characterClass&&!n.eol();)n.match(/^[^\]\\]+/)||n.match(`.`)||r.stack.shift();return`operator`}var i=n.peek();switch(i){case`[`:return n.next(),r.stack.unshift(t.characterClass),`bracket`;case`:`:case`|`:case`;`:return n.next(),`operator`;case`%`:if(n.match(`%%`))return`header`;if(n.match(/[%][A-Za-z]+/))return`keyword`;if(n.match(/[%][}]/))return`bracket`;break;case`/`:if(n.match(/[\/][A-Za-z]+/))return`keyword`;case`\\`:if(n.match(/[\][a-z]+/))return`string.special`;case`.`:if(n.match(`.`))return`atom`;case`*`:case`-`:case`+`:case`^`:if(n.match(i))return`atom`;case`$`:if(n.match(`$$`))return`builtin`;if(n.match(/[$][0-9]+/))return`variableName.special`;case`<`:if(n.match(/<<[a-zA-Z_]+>>/))return`builtin`}return n.match(`//`)?(n.skipToEnd(),`comment`):n.match(`return`)?`operator`:n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)?n.match(/(?=[\(.])/)?`variable`:n.match(/(?=[\s\n]*[:=])/)?`def`:`variableName.special`:[`[`,`]`,`(`,`)`].indexOf(n.peek())==-1?(n.eatSpace()||n.next(),null):(n.next(),`bracket`)}}};export{n as ebnf};
//# sourceMappingURL=ebnf.D4c0_ac3.js.map