!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict";e.defineMode("ecl",(function(e){function t(e){for(var t={},n=e.split(" "),r=0;r!?|\/]/;function f(e,t){var r,h=e.next();if(d[h]){var y=d[h](e,t);if(!1!==y)return y}if('"'==h||"'"==h)return t.tokenize=(r=h,function(e,t){for(var n,o=!1,i=!1;null!=(n=e.next());){if(n==r&&!o){i=!0;break}o=!o&&"\\"==n}return!i&&o||(t.tokenize=f),"string"}),t.tokenize(e,t);if(/[\[\]{}\(\),;\:\.]/.test(h))return n=h,null;if(/\d/.test(h))return e.eatWhile(/[\w\.]/),"number";if("/"==h){if(e.eat("*"))return t.tokenize=m,m(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(p.test(h))return e.eatWhile(p),"operator";e.eatWhile(/[\w\$_]/);var b=e.current().toLowerCase();if(o.propertyIsEnumerable(b))return c.propertyIsEnumerable(b)&&(n="newstatement"),"keyword";if(i.propertyIsEnumerable(b))return c.propertyIsEnumerable(b)&&(n="newstatement"),"variable";if(a.propertyIsEnumerable(b))return c.propertyIsEnumerable(b)&&(n="newstatement"),"variable-2";if(l.propertyIsEnumerable(b))return c.propertyIsEnumerable(b)&&(n="newstatement"),"variable-3";if(s.propertyIsEnumerable(b))return c.propertyIsEnumerable(b)&&(n="newstatement"),"builtin";for(var g=b.length-1;g>=0&&(!isNaN(b[g])||"_"==b[g]);)--g;if(g>0){var v=b.substr(0,g+1);if(l.propertyIsEnumerable(v))return c.propertyIsEnumerable(v)&&(n="newstatement"),"variable-3"}return u.propertyIsEnumerable(b)?"atom":null}function m(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=f;break}r="*"==n}return"comment"}function h(e,t,n,r,o){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=o}function y(e,t,n){return e.context=new h(e.indented,t,n,null,e.context)}function b(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}return{startState:function(e){return{tokenize:null,context:new h((e||0)-r,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;n=null;var o=(t.tokenize||f)(e,t);if("comment"==o||"meta"==o)return o;if(null==r.align&&(r.align=!0),";"!=n&&":"!=n||"statement"!=r.type)if("{"==n)y(t,e.column(),"}");else if("["==n)y(t,e.column(),"]");else if("("==n)y(t,e.column(),")");else if("}"==n){for(;"statement"==r.type;)r=b(t);for("}"==r.type&&(r=b(t));"statement"==r.type;)r=b(t)}else n==r.type?b(t):("}"==r.type||"top"==r.type||"statement"==r.type&&"newstatement"==n)&&y(t,e.column(),"statement");else b(t);return t.startOfLine=!1,o},indent:function(e,t){if(e.tokenize!=f&&null!=e.tokenize)return 0;var n=e.context,o=t&&t.charAt(0);"statement"==n.type&&"}"==o&&(n=n.prev);var i=o==n.type;return"statement"==n.type?n.indented+("{"==o?0:r):n.align?n.column+(i?0:1):n.indented+(i?0:r)},electricChars:"{}"}})),e.defineMIME("text/x-ecl","ecl")}));