var JSParser=Editor.Parser=function(){function E(g,n,o,b,f,v){this.indented=g;this.column=n;this.type=o;if(b!=null)this.align=b;this.prev=f;this.info=v}function O(g){return function(n){var o=n&&n.charAt(0),b=g.type,f=o==b;return b=="vardef"?g.indented+4:b=="form"&&o=="{"?g.indented:b=="stat"||b=="form"?g.indented+indentUnit:g.info=="switch"&&!f?g.indented+(/^(?:case|default)\b/.test(n)?indentUnit:2*indentUnit):g.align?g.column-(f?1:0):g.indented+(f?0:indentUnit)}}var F={atom:true,number:true,variable:true,
string:true,regexp:true},G=false;return{make:function(g,n){function o(a){for(var c=a.length-1;c>=0;c--)p.push(a[c])}function b(){o(arguments);w=true}function f(){o(arguments);w=false}function v(){l={prev:l,vars:{"this":true,arguments:true}}}function H(){l=l.prev}function z(a){if(l){r="js-variabledef";l.vars[a]=true}}function h(a,c){var q=function(){j=new E(t,u,a,null,j,c)};q.lex=true;return q}function d(){if(j.type==")")t=j.indented;j=j.prev}function i(a){return function(c){if(c==a)b();else a==";"?
f():b(arguments.callee)}}function I(){return f(m,I)}function J(){return f(e,J)}function m(a){if(a=="var")b(h("vardef"),A,i(";"),d);else if(a=="keyword a")b(h("form"),e,m,d);else if(a=="keyword b")b(h("form"),m,d);else if(a=="{")b(h("}"),B,d);else if(a==";")b();else if(a=="function")b(C);else if(a=="for")b(h("form"),i("("),h(")"),P,i(")"),d,m,d);else if(a=="variable")b(h("stat"),Q);else if(a=="switch")b(h("form"),e,h("}","switch"),i("{"),B,d,d);else if(a=="case")b(e,i(":"));else if(a=="default")b(i(":"));
else a=="catch"?b(h("form"),v,i("("),K,i(")"),m,d,H):f(h("stat"),e,i(";"),d)}function e(a){if(F.hasOwnProperty(a))b(k);else if(a=="function")b(C);else if(a=="keyword c")b(e);else if(a=="(")b(h(")"),e,i(")"),d,k);else if(a=="operator")b(e);else if(a=="[")b(h("]"),x(e,"]"),d,k);else a=="{"?b(h("}"),x(R,"}"),d,k):b()}function k(a,c){if(a=="operator"&&/\+\+|--/.test(c))b(k);else if(a=="operator")b(e);else if(a==";")f();else if(a=="(")b(h(")"),x(e,")"),d,k);else if(a==".")b(S,k);else a=="["&&b(h("]"),
e,i("]"),d,k)}function Q(a){a==":"?b(d,m):f(k,i(";"),d)}function S(a){if(a=="variable"){r="js-property";b()}}function R(a){if(a=="variable")r="js-property";F.hasOwnProperty(a)&&b(i(":"),e)}function x(a,c){function q(s){if(s==",")b(a,q);else s==c?b():b(i(c))}return function(s){s==c?b():f(a,q)}}function B(a){a=="}"?b():f(m,B)}function A(a,c){if(a=="variable"){z(c);b(L)}else b()}function L(a,c){if(c=="=")b(e,L);else a==","&&b(A)}function P(a){if(a=="var")b(A,y);else if(a==";")f(y);else a=="variable"?
b(T):f(y)}function T(a,c){c=="in"?b(e):b(k,y)}function y(a,c){if(a==";")b(M);else c=="in"?b(e):b(e,i(";"),M)}function M(a){a==")"?f():b(e)}function C(a,c){if(a=="variable"){z(c);b(C)}else a=="("&&b(v,x(K,")"),m,H)}function K(a,c){if(a=="variable"){z(c);b()}}var D=tokenizeJavaScript(g),p=[G?J:I],l=null,j=new E((n||0)-indentUnit,0,"block",false),u=0,t=0,w,r,N={next:function(){for(;p[p.length-1].lex;)p.pop()();var a=D.next();if(a.type=="whitespace"&&u==0)t=a.value.length;u+=a.value.length;if(a.content==
"\n"){t=u=0;if(!("align"in j))j.align=false;a.indentation=O(j)}if(a.type=="whitespace"||a.type=="comment")return a;if(!("align"in j))j.align=true;for(;;){w=r=false;p.pop()(a.type,a.content);if(w){if(r)a.style=r;else{var c;if(c=a.type=="variable")a:{for(c=l;c;){if(c.vars[a.content]){c=true;break a}c=c.prev}c=false}if(c)a.style="js-localvariable"}return a}}},copy:function(){var a=l,c=j,q=p.concat([]),s=D.state;return function(U){l=a;j=c;p=q.concat([]);u=t=0;D=tokenizeJavaScript(U,s);return N}}};d.lex=
true;return N},electricChars:"{}:",configure:function(g){if(g.json!=null)G=g.json}}}();