var e=`and.as.block.endblock.by.cycle.debug.else.elif.extends.filter.endfilter.firstof.do.for.endfor.if.endif.ifchanged.endifchanged.ifequal.endifequal.ifnotequal.set.raw.endraw.endifnotequal.in.include.load.not.now.or.parsed.regroup.reversed.spaceless.call.endcall.macro.endmacro.endspaceless.ssi.templatetag.openblock.closeblock.openvariable.closevariable.without.context.openbrace.closebrace.opencomment.closecomment.widthratio.url.with.endwith.get_current_language.trans.endtrans.noop.blocktrans.endblocktrans.get_available_languages.get_current_language_bidi.pluralize.autoescape.endautoescape`.split(`.`),t=/^[+\-*&%=<>!?|~^]/,n=/^[:\[\(\{]/,r=[`true`,`false`],i=/^(\d[+\-\*\/])?\d+(\.\d+)?/;e=RegExp(`((`+e.join(`)|(`)+`))\\b`),r=RegExp(`((`+r.join(`)|(`)+`))\\b`);function a(a,o){var s=a.peek();if(o.incomment)return a.skipTo(`#}`)?(a.eatWhile(/\#|}/),o.incomment=!1):a.skipToEnd(),`comment`;if(o.intag){if(o.operator){if(o.operator=!1,a.match(r))return`atom`;if(a.match(i))return`number`}if(o.sign){if(o.sign=!1,a.match(r))return`atom`;if(a.match(i))return`number`}if(o.instring)return s==o.instring&&(o.instring=!1),a.next(),`string`;if(s==`'`||s==`"`)return o.instring=s,a.next(),`string`;if(o.inbraces>0&&s==`)`)a.next(),o.inbraces--;else if(s==`(`)a.next(),o.inbraces++;else if(o.inbrackets>0&&s==`]`)a.next(),o.inbrackets--;else if(s==`[`)a.next(),o.inbrackets++;else if(!o.lineTag&&(a.match(o.intag+`}`)||a.eat(`-`)&&a.match(o.intag+`}`)))return o.intag=!1,`tag`;else if(a.match(t))return o.operator=!0,`operator`;else if(a.match(n))o.sign=!0;else{if(a.column()==1&&o.lineTag&&a.match(e))return`keyword`;if(a.eat(` `)||a.sol()){if(a.match(e))return`keyword`;if(a.match(r))return`atom`;if(a.match(i))return`number`;a.sol()&&a.next()}else a.next()}return`variable`}else if(a.eat(`{`)){if(a.eat(`#`))return o.incomment=!0,a.skipTo(`#}`)?(a.eatWhile(/\#|}/),o.incomment=!1):a.skipToEnd(),`comment`;if(s=a.eat(/\{|%/))return o.intag=s,o.inbraces=0,o.inbrackets=0,s==`{`&&(o.intag=`}`),a.eat(`-`),`tag`}else if(a.eat(`#`)){if(a.peek()==`#`)return a.skipToEnd(),`comment`;if(!a.eol())return o.intag=!0,o.lineTag=!0,o.inbraces=0,o.inbrackets=0,`tag`}a.next()}var o={name:`jinja2`,startState:function(){return{tokenize:a,inbrackets:0,inbraces:0}},token:function(e,t){var n=t.tokenize(e,t);return e.eol()&&t.lineTag&&!t.instring&&t.inbraces==0&&t.inbrackets==0&&(t.intag=!1,t.lineTag=!1),n},languageData:{commentTokens:{block:{open:`{#`,close:`#}`,line:`##`}}}};export{o as jinja2};