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