function e(e){for(var t={},n=e.split(` `),r=0;r<n.length;++r)t[n[r]]=!0;return t}var t=e(`#end #else #break #stop #[[ #]] #{end} #{else} #{break} #{stop}`),n=e(`#if #elseif #foreach #set #include #parse #macro #define #evaluate #{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}`),r=e(`$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent`),i=/[+\-*&%=<>!?:\/|]/;function a(e,t,n){return t.tokenize=n,n(e,t)}function o(e,o){var u=o.beforeParams;o.beforeParams=!1;var d=e.next();if(d==`'`&&!o.inString&&o.inParams)return o.lastTokenWasBuiltin=!1,a(e,o,s(d));if(d==`"`){if(o.lastTokenWasBuiltin=!1,o.inString)return o.inString=!1,`string`;if(o.inParams)return a(e,o,s(d))}else if(/[\[\]{}\(\),;\.]/.test(d))return d==`(`&&u?o.inParams=!0:d==`)`&&(o.inParams=!1,o.lastTokenWasBuiltin=!0),null;else if(/\d/.test(d))return o.lastTokenWasBuiltin=!1,e.eatWhile(/[\w\.]/),`number`;else if(d==`#`&&e.eat(`*`))return o.lastTokenWasBuiltin=!1,a(e,o,c);else if(d==`#`&&e.match(/ *\[ *\[/))return o.lastTokenWasBuiltin=!1,a(e,o,l);else if(d==`#`&&e.eat(`#`))return o.lastTokenWasBuiltin=!1,e.skipToEnd(),`comment`;else if(d==`$`)return e.eat(`!`),e.eatWhile(/[\w\d\$_\.{}-]/),r&&r.propertyIsEnumerable(e.current())?`keyword`:(o.lastTokenWasBuiltin=!0,o.beforeParams=!0,`builtin`);else if(i.test(d))return o.lastTokenWasBuiltin=!1,e.eatWhile(i),`operator`;else{e.eatWhile(/[\w\$_{}@]/);var f=e.current();return t&&t.propertyIsEnumerable(f)?`keyword`:n&&n.propertyIsEnumerable(f)||e.current().match(/^#@?[a-z0-9_]+ *$/i)&&e.peek()==`(`&&!(n&&n.propertyIsEnumerable(f.toLowerCase()))?(o.beforeParams=!0,o.lastTokenWasBuiltin=!1,`keyword`):o.inString?(o.lastTokenWasBuiltin=!1,`string`):e.pos>f.length&&e.string.charAt(e.pos-f.length-1)==`.`&&o.lastTokenWasBuiltin?`builtin`:(o.lastTokenWasBuiltin=!1,null)}}function s(e){return function(t,n){for(var r=!1,i,a=!1;(i=t.next())!=null;){if(i==e&&!r){a=!0;break}if(e==`"`&&t.peek()==`$`&&!r){n.inString=!0,a=!0;break}r=!r&&i==`\\`}return a&&(n.tokenize=o),`string`}}function c(e,t){for(var n=!1,r;r=e.next();){if(r==`#`&&n){t.tokenize=o;break}n=r==`*`}return`comment`}function l(e,t){for(var n=0,r;r=e.next();){if(r==`#`&&n==2){t.tokenize=o;break}r==`]`?n++:r!=` `&&(n=0)}return`meta`}const u={name:`velocity`,startState:function(){return{tokenize:o,beforeParams:!1,inParams:!1,inString:!1,lastTokenWasBuiltin:!1}},token:function(e,t){return e.eatSpace()?null:t.tokenize(e,t)},languageData:{commentTokens:{line:`##`,block:{open:`#*`,close:`*#`}}}};export{u as velocity};