function e(e){for(var t={},n=e.split(` `),r=0;r<n.length;++r)t[n[r]]=!0;return t}var t=e(`abstract as assert boolean break byte case catch char class const continue def default do double else enum extends final finally float for goto if implements import in instanceof int interface long native new package private protected public return short static strictfp super switch synchronized threadsafe throw throws trait transient try void volatile while`),n=e(`catch class def do else enum finally for if interface switch trait try while`),r=e(`return break continue`),i=e(`null true false this`),a;function o(e,o){var c=e.next();if(c==`"`||c==`'`)return s(c,e,o);if(/[\[\]{}\(\),;\:\.]/.test(c))return a=c,null;if(/\d/.test(c))return e.eatWhile(/[\w\.]/),e.eat(/eE/)&&(e.eat(/\+\-/),e.eatWhile(/\d/)),`number`;if(c==`/`){if(e.eat(`*`))return o.tokenize.push(u),u(e,o);if(e.eat(`/`))return e.skipToEnd(),`comment`;if(d(o.lastToken,!1))return s(c,e,o)}if(c==`-`&&e.eat(`>`))return a=`->`,null;if(/[+\-*&%=<>!?|\/~]/.test(c))return e.eatWhile(/[+\-*&%=<>|~]/),`operator`;if(e.eatWhile(/[\w\$_]/),c==`@`)return e.eatWhile(/[\w\$_\.]/),`meta`;if(o.lastToken==`.`)return`property`;if(e.eat(`:`))return a=`proplabel`,`property`;var l=e.current();return i.propertyIsEnumerable(l)?`atom`:t.propertyIsEnumerable(l)?(n.propertyIsEnumerable(l)?a=`newstatement`:r.propertyIsEnumerable(l)&&(a=`standalone`),`keyword`):`variable`}o.isBase=!0;function s(e,t,n){var r=!1;if(e!=`/`&&t.eat(e))if(t.eat(e))r=!0;else return`string`;function i(t,n){for(var i=!1,a,o=!r;(a=t.next())!=null;){if(a==e&&!i){if(!r)break;if(t.match(e+e)){o=!0;break}}if(e==`"`&&a==`$`&&!i){if(t.eat(`{`))return n.tokenize.push(c()),`string`;if(t.match(/^\w/,!1))return n.tokenize.push(l),`string`}i=!i&&a==`\\`}return o&&n.tokenize.pop(),`string`}return n.tokenize.push(i),i(t,n)}function c(){var e=1;function t(t,n){if(t.peek()==`}`){if(e--,e==0)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)}else t.peek()==`{`&&e++;return o(t,n)}return t.isBase=!0,t}function l(e,t){var n=e.match(/^(\.|[\w\$_]+)/);return(!n||!e.match(n[0]==`.`?/^[\w$_]/:/^\./))&&t.tokenize.pop(),n?n[0]==`.`?null:`variable`:t.tokenize[t.tokenize.length-1](e,t)}function u(e,t){for(var n=!1,r;r=e.next();){if(r==`/`&&n){t.tokenize.pop();break}n=r==`*`}return`comment`}function d(e,t){return!e||e==`operator`||e==`->`||/[\.\[\{\(,;:]/.test(e)||e==`newstatement`||e==`keyword`||e==`proplabel`||e==`standalone`&&!t}function f(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function p(e,t,n){return e.context=new f(e.indented,t,n,null,e.context)}function m(e){var t=e.context.type;return(t==`)`||t==`]`||t==`}`)&&(e.indented=e.context.indented),e.context=e.context.prev}var h={name:`groovy`,startState:function(e){return{tokenize:[o],context:new f(-e,0,`top`,!1),indented:0,startOfLine:!0,lastToken:null}},token:function(e,t){var n=t.context;if(e.sol()&&(n.align??=!1,t.indented=e.indentation(),t.startOfLine=!0,n.type==`statement`&&!d(t.lastToken,!0)&&(m(t),n=t.context)),e.eatSpace())return null;a=null;var r=t.tokenize[t.tokenize.length-1](e,t);if(r==`comment`)return r;if(n.align??=!0,(a==`;`||a==`:`)&&n.type==`statement`)m(t);else if(a==`->`&&n.type==`statement`&&n.prev.type==`}`)m(t),t.context.align=!1;else if(a==`{`)p(t,e.column(),`}`);else if(a==`[`)p(t,e.column(),`]`);else if(a==`(`)p(t,e.column(),`)`);else if(a==`}`){for(;n.type==`statement`;)n=m(t);for(n.type==`}`&&(n=m(t));n.type==`statement`;)n=m(t)}else a==n.type?m(t):(n.type==`}`||n.type==`top`||n.type==`statement`&&a==`newstatement`)&&p(t,e.column(),`statement`);return t.startOfLine=!1,t.lastToken=a||r,r},indent:function(e,t,n){if(!e.tokenize[e.tokenize.length-1].isBase)return null;var r=t&&t.charAt(0),i=e.context;i.type==`statement`&&!d(e.lastToken,!0)&&(i=i.prev);var a=r==i.type;return i.type==`statement`?i.indented+(r==`{`?0:n.unit):i.align?i.column+ +!a:i.indented+(a?0:n.unit)},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,`'''`,`"""`]}}};export{h as groovy};