'use strict';(function(f){"object"==typeof exports&&"object"==typeof module?f(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],f):f(CodeMirror)})(function(f){f.defineMode("groovy",function(l){function h(a){var b={};a=a.split(" ");for(var c=0;c<a.length;++c)b[a[c]]=!0;return b}function m(a,b){var c=a.next();if('"'==c||"'"==c)return p(c,a,b);if(/[\[\]{}\(\),;:\.]/.test(c))return e=c,null;if(/\d/.test(c))return a.eatWhile(/[\w\.]/),a.eat(/eE/)&&(a.eat(/\+\-/),
a.eatWhile(/\d/)),"number";if("/"==c){if(a.eat("*"))return b.tokenize.push(q),q(a,b);if(a.eat("/"))return a.skipToEnd(),"comment";if(n(b.lastToken,!1))return p(c,a,b)}if("-"==c&&a.eat(">"))return e="->",null;if(/[+\-*&%=<>!?|\/~]/.test(c))return a.eatWhile(/[+\-*&%=<>|~]/),"operator";a.eatWhile(/[\w\$_]/);if("@"==c)return a.eatWhile(/[\w\$_\.]/),"meta";if("."==b.lastToken)return"property";if(a.eat(":"))return e="proplabel","property";a=a.current();return t.propertyIsEnumerable(a)?"atom":u.propertyIsEnumerable(a)?
(v.propertyIsEnumerable(a)?e="newstatement":w.propertyIsEnumerable(a)&&(e="standalone"),"keyword"):"variable"}function p(a,b,c){function d(c,b){for(var d=!1,f,g=!e;null!=(f=c.next());){if(f==a&&!d){if(!e)break;if(c.match(a+a)){g=!0;break}}if('"'==a&&"$"==f&&!d&&c.eat("{"))return b.tokenize.push(x()),"string";d=!d&&"\\"==f}g&&b.tokenize.pop();return"string"}var e=!1;if("/"!=a&&b.eat(a))if(b.eat(a))e=!0;else return"string";c.tokenize.push(d);return d(b,c)}function x(){function a(a,d){if("}"==a.peek()){if(b--,
0==b)return d.tokenize.pop(),d.tokenize[d.tokenize.length-1](a,d)}else"{"==a.peek()&&b++;return m(a,d)}var b=1;a.isBase=!0;return a}function q(a,b){for(var c=!1,d;d=a.next();){if("/"==d&&c){b.tokenize.pop();break}c="*"==d}return"comment"}function n(a,b){return!a||"operator"==a||"->"==a||/[\.\[\{\(,;:]/.test(a)||"newstatement"==a||"keyword"==a||"proplabel"==a||"standalone"==a&&!b}function r(a,b,c,d,e){this.indented=a;this.column=b;this.type=c;this.align=d;this.prev=e}function k(a,b,c){return a.context=
new r(a.indented,b,c,null,a.context)}function g(a){var b=a.context.type;if(")"==b||"]"==b||"}"==b)a.indented=a.context.indented;return a.context=a.context.prev}var u=h("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"),
v=h("catch class def do else enum finally for if interface switch trait try while"),w=h("return break continue"),t=h("null true false this"),e;m.isBase=!0;return{startState:function(a){return{tokenize:[m],context:new r((a||0)-l.indentUnit,0,"top",!1),indented:0,startOfLine:!0,lastToken:null}},token:function(a,b){var c=b.context;a.sol()&&(null==c.align&&(c.align=!1),b.indented=a.indentation(),b.startOfLine=!0,"statement"!=c.type||n(b.lastToken,!0)||(g(b),c=b.context));if(a.eatSpace())return null;e=
null;var d=b.tokenize[b.tokenize.length-1](a,b);if("comment"==d)return d;null==c.align&&(c.align=!0);if(";"!=e&&":"!=e||"statement"!=c.type)if("->"==e&&"statement"==c.type&&"}"==c.prev.type)g(b),b.context.align=!1;else if("{"==e)k(b,a.column(),"}");else if("["==e)k(b,a.column(),"]");else if("("==e)k(b,a.column(),")");else if("}"==e){for(;"statement"==c.type;)c=g(b);for("}"==c.type&&(c=g(b));"statement"==c.type;)c=g(b)}else e==c.type?g(b):("}"==c.type||"top"==c.type||"statement"==c.type&&"newstatement"==
e)&&k(b,a.column(),"statement");else g(b);b.startOfLine=!1;b.lastToken=e||d;return d},indent:function(a,b){if(!a.tokenize[a.tokenize.length-1].isBase)return f.Pass;b=b&&b.charAt(0);var c=a.context;"statement"!=c.type||n(a.lastToken,!0)||(c=c.prev);a=b==c.type;return"statement"==c.type?c.indented+("{"==b?0:l.indentUnit):c.align?c.column+(a?0:1):c.indented+(a?0:l.indentUnit)},electricChars:"{}",closeBrackets:{triples:"'\""},fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}});
f.defineMIME("text/x-groovy","groovy")});
