PHP Classes

File: assets/codemirror/addon/grammar/codemirror_grammar.js

Recommend this page to a friend!
  Classes of Nikos M.   PHP Widget Library for HTML Pages   assets/codemirror/addon/grammar/codemirror_grammar.js   Download  
File: assets/codemirror/addon/grammar/codemirror_grammar.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Widget Library for HTML Pages
Generate HTML and JavaScript to show page widgets
Author: By
Last change:
Date: 2 years ago
Size: 58,280 bytes
 

Contents

Class file image Download
/** * * CodeMirrorGrammar * @version: 4.2.1 * * Transform a grammar specification in JSON format, into a syntax-highlight parser mode for CodeMirror * https://github.com/foo123/codemirror-grammar * https://github.com/foo123/editor-grammar * **/!function(e,t,n){"use strict";"object"==typeof module&&module.exports?(module.$deps=module.$deps||{})&&(module.exports=module.$deps[t]=n.call(e)):"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified(t)?define(t,["module"],function(t){return n.moduleUri=t.uri,n.call(e)}):t in e||(e[t]=n.call(e)||1)&&"function"==typeof define&&define.amd&&define(function(){return e[t]})}(this,"CodeMirrorGrammar",function(){"use strict";function e(e){var t=0;return null===e?t=Pt:!0===e||!1===e||e instanceof Boolean?t=It:$t===e?t=Et:(t=Kt[qt.call(e)]||_t,t=Tt===t||e instanceof Number?isNaN(e)?Nt:isFinite(e)?Tt:Dt:Ft===t||e instanceof String?1===e.length?At:Ft:jt===t||e instanceof Array?jt:Gt===t||e instanceof RegExp?Gt:Ut===t||e instanceof Date?Ut:zt===t||e instanceof Function?zt:Bt===t?Bt:_t),t}function t(e,t,n,o){var r,l,s,i,a,c,u=e.length;if(arguments.length<4&&(o=u-1),0>o&&(o+=u),arguments.length<3&&(n=0),n>o)return[];if(n===o)return[t(e[n],n,n,o)];for(s=o-n+1,i=15&s,a=1&i,c=new Array(s),a&&(c[0]=t(e[n],n,n,o)),r=a;i>r;r+=2)l=n+r,c[r]=t(e[l],l,n,o),c[r+1]=t(e[l+1],l+1,n,o);for(r=i;s>r;r+=16)l=n+r,c[r]=t(e[l],l,n,o),c[r+1]=t(e[l+1],l+1,n,o),c[r+2]=t(e[l+2],l+2,n,o),c[r+3]=t(e[l+3],l+3,n,o),c[r+4]=t(e[l+4],l+4,n,o),c[r+5]=t(e[l+5],l+5,n,o),c[r+6]=t(e[l+6],l+6,n,o),c[r+7]=t(e[l+7],l+7,n,o),c[r+8]=t(e[l+8],l+8,n,o),c[r+9]=t(e[l+9],l+9,n,o),c[r+10]=t(e[l+10],l+10,n,o),c[r+11]=t(e[l+11],l+11,n,o),c[r+12]=t(e[l+12],l+12,n,o),c[r+13]=t(e[l+13],l+13,n,o),c[r+14]=t(e[l+14],l+14,n,o),c[r+15]=t(e[l+15],l+15,n,o);return c}function n(e,t,n,o,r){var l,s,i,a,c,u=e.length,p=n;if(arguments.length<5&&(r=u-1),0>r&&(r+=u),arguments.length<4&&(o=0),o>r)return p;if(o===r)return t(p,e[o],o);for(i=r-o+1,a=15&i,c=1&a,c&&(p=t(p,e[o],o)),l=c;a>l;l+=2)s=o+l,p=t(t(p,e[s],s),e[s+1],s+1);for(l=a;i>l;l+=16)s=o+l,p=t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(p,e[s],s),e[s+1],s+1),e[s+2],s+2),e[s+3],s+3),e[s+4],s+4),e[s+5],s+5),e[s+6],s+6),e[s+7],s+7),e[s+8],s+8),e[s+9],s+9),e[s+10],s+10),e[s+11],s+11),e[s+12],s+12),e[s+13],s+13),e[s+14],s+14),e[s+15],s+15);return p}function o(e,t,n,o){if(t>n)return o;if(t===n)return e(t,o,t,n),o;var r,l,s=n-t+1,i=15&s,a=1&i;for(a&&e(t,o,t,n),r=a;i>r;r+=2)l=t+r,e(l,o,t,n),e(++l,o,t,n);for(r=i;s>r;r+=16)l=t+r,e(l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n);return o}function r(t,n){var o,l,s,i,a=e(t),c=0;if(Tt===e(n)?n>0?(c=n,n=!0):n=!1:n=!1!==n,Bt===a){l={};for(s in t)Lt.call(t,s)&&Mt.call(t,s)&&(o=e(t[s]),Bt===o?l[s]=n?r(t[s],c>0?c-1:n):t[s]:jt===o?l[s]=n?r(t[s],c>0?c-1:n):t[s].slice():Ut===o?l[s]=new Date(t[s]):Ft&o?l[s]=t[s].slice():Tt&o?l[s]=0+t[s]:l[s]=t[s])}else if(jt===a)for(i=t.length,l=new Array(i),s=0;i>s;s++)o=e(t[s]),Bt===o?l[s]=n?r(t[s],c>0?c-1:n):t[s]:jt===o?l[s]=n?r(t[s],c>0?c-1:n):t[s].slice():Ut===o?l[s]=new Date(t[s]):Ft&o?l[s]=t[s].slice():Tt&o?l[s]=0+t[s]:l[s]=t[s];else l=Ut===a?new Date(t):Ft&a?t.slice():Tt&a?0+t:t;return l}function l(){var t,n,o,s,i,a,c,u,p,f,m=arguments,h=m.length;if(1>h)return null;for(n=r(m[0]),o=1;h>o;o++)if(t=m[o])for(s in t)if(Lt.call(t,s)&&Mt.call(t,s))if(Lt.call(n,s)&&Mt.call(n,s)){if(p=e(n[s]),f=e(t[s]),Bt===p&&Bt===f)n[s]=l(n[s],t[s]);else if(jt===p&&jt===f){if(c=n[s],u=t[s],a=u.length,!a)continue;if(c.length)for(i=0;a>i;i++)0>c.indexOf(u[i])&&c.push(u[i]);else n[s]=u.slice()}}else n[s]=r(t[s]);return n}function s(){return!0}function i(t,n){return n||jt!==e(t)?[t]:t}function a(t,n){return t=i(t),(n||jt!==e(t[0]))&&(t=[t]),t}function c(t,n){return Ft&e(n)&&Ft&e(t)&&n.length&&n.length<=t.length&&n===t.substr(0,n.length)}function u(e,t,n){return n?e[t]=$t:delete e[t],e}function p(e){return(e||"id_")+ ++tn}function f(e){return(e||"uuid")+"_"+ ++tn+"_"+(new Date).getTime()}function m(){var t,n,o,r,l,s,i=arguments,a=i.length;for(t=i[0]||{},l=1;a>l;l++)if(n=i[l],Bt===e(n))for(r in n)Lt.call(n,r)&&Mt.call(n,r)&&(o=n[r],s=e(o),Tt&s?t[r]=0+o:Ut&s?t[r]=new Date(o):Ht&s?t[r]=o.slice():t[r]=o);return t}function h(e,t){var n,o=arguments.length,r="constructor";return 0===o?(e=Object,t={}):1===o?(t=e||{},e=Object):(e=e||Object,t=t||{}),Lt.call(t,r)||(t[r]=function(){}),n=t[r],delete t[r],n[yt]=m(xt(e[yt]),t),n[yt][r]=n,n}function d(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":'"'===e?"&quot;":"&apos;"}function k(e){return"&#"+e.charCodeAt(0)+";"}function g(e,t){return e.replace(on,t?d:k)}function $(e){return e.replace(nn,"\\$1")}function y(e,t){t=t||{l:0,x:0,i:0,g:0};var e=new RegExp(e,(t.g?"g":"")+(t.i?"i":""));return e.xflags=t,e}function v(e,t,n,o){var r,l=e.pos||0,s=e.length,i=t.length,a="";if(n)if(o)for(;s>l;)if(r=!1,n===e[Ot](l)&&(r=!0,l+=1),t===e.substr(l,i)){if(l+=i,!r)break;a+=t}else a+=e[Ot](l++);else for(;s>l;)if(r=!1,n===e[Ot](l)&&(r=!0,l+=1,a+=n),t===e.substr(l,i)){if(l+=i,!r)break;a+=t}else a+=e[Ot](l++);else for(;s>l;){if(t===e.substr(l,i)){l+=i;break}a+=e[Ot](l++)}return e.pos=l,a}function x(t,n,o,r){var l,s,i,a,c,u=!0===o?0:1,p=r?"\\":"$",f=r?92:36;for(Ft&e(n)&&(r&&(n=$(n)),n=[n,n,n],u=0),s=t.length,c="",l=0;s>l;)i=t[Ot](l),s>l+1&&p===i?(a=t.charCodeAt(l+1),f===a?(c+=p,l+=2):a>=48&&57>=a?(c+=n[u+a-48]||"",l+=2):(c+=i,l+=1)):(c+=i,l+=1);return c}function b(t,n,o,r){if(!t||(Tt|Gt)&e(t))return t;var l,s=n?n.length||0:0,i="",a={g:0,i:0,x:0,l:0};if(Ft&e(r)?i=r:r&&(i=ln),s&&t.substr(0,s)===n){var c,u,p,l,f,m=t.substr(s),h=m[Ot](0);for(l=m.length;l--&&(f=m[Ot](l),h!==f);)"i"===f.toLowerCase()?a.i=1:"x"===f.toLowerCase()?a.x=1:"l"===f.toLowerCase()&&(a.l=1);return c=m.substring(1,l),"^"===c.charAt(0)?(a.l=1,u="^("+c.slice(1)+")"):u="^("+c+")",p=u,(a.x||a.l||a.i)&&(u=(a.l?"l":"")+(a.x?"x":"")+(a.i?"i":"")+"::"+u),o[u]||(p=y(p,a),o[u]=p),o[u]}return i?(p=u="^("+$(t)+")"+i,o[u]||(p=y(p,a),o[u]=p),o[u]):t}function w(n,o,r){var l,s="";return Ft&e(o)?s=o:o&&(s=ln),l=t(n.sort(Qt),$).join("|"),[y("^("+l+")"+s,{l:0,x:0,i:r?1:0}),1]}function C(t,n,o,r){var l=e(n);if(Tt===l)return n;if(r[t])return r[t];o=o||0;var s,i=0;return n&&n.isCharList&&(i=1,u(n,"isCharList")),s=Pt===l?new R(Ae,t,n,Pt,o):At===l?new R(Ae,t,n,At,o):Wt&l?new R(Ae,t,n,Gt,o):Ft&l?new R(Ae,t,n,i?Rt:Ft,o):n,r[t]=s}function O(t,n,o,r,l,s,a,u){if(a[t])return a[t];var p,f,m,h,d,k,g,$=0,y=0,v=1,x=Ft&e(r)?!0:!!r;if(p=i(n),m=p.length,1===m)g=C(t,b(p[0],o,s,r),0,a);else if(m>1){for(h=(m>>>1)+1,f=0;h>=f;f++)d=e(p[f]),k=e(p[m-1-f]),At===d&&At===k||(v=0),jt&d||jt&k?$=1:(Gt&d||Gt&k||c(p[f],o)||c(p[m-1-f],o))&&(y=1);if(v&&!x)p=p.slice().join(""),p.isCharList=1,g=C(t,p,0,a);else if(!x||$||y)if($||y){for(f=0;m>f;f++)jt&e(p[f])?p[f]=O(t+"_"+f,p[f],o,r,l,s,a):p[f]=C(t+"_"+f,b(p[f],o,s),f,a);g=m>1?new R(Re,t,p):p[0]}else{for(u&&(u.keywords=i(n).slice()),p=p.sort(Qt),f=0;m>f;f++)p[f]=C(t+"_"+f,b(p[f],o,s),f,a);g=m>1?new R(Re,t,p):p[0]}else u&&(u.keywords=i(n).slice()),g=C(t,w(p,r,l),0,a)}return a[t]=g}function q(t,n,r,l,s){if(s[t])return s[t];var i=a(n),u=[],p=[];return o(function(n){var o,a,f,m;o=C(t+"_0_"+n,b(i[n][0],r,l),n,s),i[n].length>1?(f=c(i[n][1],r),m=f&&sn.test(i[n][1]),Gt!==o.ptype||Ft!==e(i[n][1])||!m&&f?a=C(t+"_1_"+n,b(i[n][1],r,l),n,s):m?(a=new String(i[n][1]),a.regex_pattern=r):a=i[n][1]):a=o,u.push(o),p.push(a)},0,i.length-1),s[t]=new R(je,t,[u,p])}function L(e,t){var n=a(e.tokens.slice());o(function(e){var o=n[e][0],r=n[e].length>1?n[e][1]:n[e][0],l=n[e].length>2?n[e][2]:"";null===r?(t.line=t.line||[],t.line.push(o)):(t.block=t.block||[],t.block.push([o,r,l]))},0,n.length-1)}function M(e,n,o,r){var l=e.meta||o,s=!(!e.caseInsesitive&&!e.ci),i=t(n,function(e){return{word:e,meta:l,ci:s}});return r.autocomplete=(r.autocomplete||[]).concat(i),i}function S(t){t.Lex||(t.Lex={}),t.Syntax||(t.Syntax={});var n,o,r,s,i,a,c,p,f,m,h,d=t.Lex,k=t.Syntax,g=[d,k],$=g.length;for(h=0;$>h;){m=g[h++];for(r in m)Lt.call(m,r)&&(n=r.split(":"),o=n[1]&&Jt(n[1]).length?Jt(n[1]):null,n=Jt(n[0]),n.length||(n=r,o=null),n!==r&&(m[n]=m[r],u(m,r),o&&(o=o[Ct](),s=m[n],i=e(s),Bt===i?m[n].type||(m[n].type=o):(m[n]={type:o},"error"===o?(m[n].type="action",m[n].error=s):"nop"===o?(m[n].type="action",m[n].nop=!0):"group"===o?(m[n].type="sequence",m[n].tokens=s):"action"===o&&Ft===i?m[n][s]=!0:m[n].tokens=s))),d===m&&(Zt&e(m[n])&&(m[n]={type:"simple",tokens:m[n]}),s=m[n],s.type&&(p=s.type=s.type[Ct](),"line-block"===p?(s.type="block",s.multiline=!1,s.escape=!1):"escaped-line-block"===p?(s.type="block",s.multiline=!1,s.escape="\\"):"escaped-block"===p&&(s.type="block",s.multiline=!0,s.escape="\\"))))}m=d;for(n in m)if(Lt.call(m,n))for(s=m[n];s.extend;)a=s.extend,u(s,"extend"),c=d[a],c&&(Zt&e(c)&&(c=d[a]={type:"simple",tokens:c}),s=l(c,s));m=d;for(n in m)Lt.call(m,n)&&(s=m[n],s.type?(p=s.type=s.type[Ct](),"action"===p?s.options=s.options||{}:"line-block"===p?(s.type="block",s.multiline=!1,s.escape=!1):"escaped-line-block"===p?(s.type="block",s.multiline=!1,s.escape="\\"):"escaped-block"===p&&(s.type="block",s.multiline=!0,s.escape="\\")):s["escaped-line-block"]?(s.type="block",s.multiline=!1,s.escape||(s.escape="\\"),s.tokens=s["escaped-line-block"],u(s,"escaped-line-block")):s["escaped-block"]?(s.type="block",s.multiline=!0,s.escape||(s.escape="\\"),s.tokens=s["escaped-block"],u(s,"escaped-block")):s["line-block"]?(s.type="block",s.multiline=!1,s.escape=!1,s.tokens=s["line-block"],u(s,"line-block")):s.comment?(s.type="comment",s.escape=!1,s.tokens=s.comment,u(s,"comment")):s.block?(s.type="block",s.tokens=s.block,u(s,"block")):s.simple?(s.type="simple",s.tokens=s.simple,u(s,"simple")):s.nop?(s.type="action",s.options=s.options||{},s.action=["nop",s.nop,s.options],s.nop=!0):s.error?(s.type="action",s.options=s.options||{},s.action=["error",s.error,s.options],u(s,"error")):Lt.call(s,"hypercontext")?(s.type="action",s.options=s.options||{},s.action=[s.hypercontext?"hypercontext-start":"hypercontext-end",s.hypercontext,s.options],u(s,"hypercontext")):Lt.call(s,"context")?(s.type="action",s.options=s.options||{},s.action=[s.context?"context-start":"context-end",s.context,s.options],u(s,"context")):s.indent?(s.type="action",s.options=s.options||{},s.action=["indent",s.indent,s.options],u(s,"indent")):s.outdent?(s.type="action",s.options=s.options||{},s.action=["outdent",s.outdent,s.options],u(s,"outdent")):s.define?(s.type="action",s.options=s.options||{},s.action=["define",Ft&e(s.define)?["*",s.define]:s.define,s.options],u(s,"define")):s.undefine?(s.type="action",s.options=s.options||{},s.action=["undefine",Ft&e(s.undefine)?["*",s.undefine]:s.undefine,s.options],u(s,"undefine")):s.defined?(s.type="action",s.options=s.options||{},s.action=["defined",Ft&e(s.defined)?["*",s.defined]:s.defined,s.options],u(s,"defined")):s.notdefined?(s.type="action",s.options=s.options||{},s.action=["notdefined",Ft&e(s.notdefined)?["*",s.notdefined]:s.notdefined,s.options],u(s,"notdefined")):s.unique?(s.type="action",s.options=s.options||{},s.action=["unique",Ft&e(s.unique)?["*",s.unique]:s.unique,s.options],u(s,"unique")):s.push?(s.type="action",s.options=s.options||{},s.action=["push",s.push,s.options],u(s,"push")):Lt.call(s,"pop")?(s.type="action",s.options=s.options||{},s.action=["pop",s.pop,s.options],u(s,"pop")):s.type="simple","action"===s.type?(s.options=s.options||{},s.options["in-context"]=!(!s.options["in-context"]&&!s["in-context"]),s.options["in-hypercontext"]=!(!s.options["in-hypercontext"]&&!s["in-hypercontext"]),s.options.ci=s.ci=!!(s.options.caseInsesitive||s.options.ci||s.caseInsesitive||s.ci),s.options.autocomplete=!(!s.options.autocomplete&&!s.autocomplete),s.options.mode=s.options.mode||s.mode):"block"===s.type||"comment"===s.type?(s.multiline=Lt.call(s,"multiline")?!!s.multiline:!0,Ft&e(s.escape)||(s.escape=!1)):"simple"===s.type&&(s.meta=s.autocomplete&&Ft&e(s.meta)?s.meta:null,s.ci=!(!s.caseInsesitive&&!s.ci)));m=k;for(n in m)Lt.call(m,n)&&(s=m[n],Bt!==e(s)||s.type?s.type&&(p=s.type=s.type[Ct](),"group"===p&&s.match?(i=e(s.match),Ft&i?(f=s.match[Ct](),"alternation"===f||"either"===f?(s.type="alternation",u(s,"match")):"sequence"===f||"all"===f?(s.type="sequence",u(s,"match")):"zeroorone"===f?(s.type="zeroOrOne",u(s,"match")):"zeroormore"===f?(s.type="zeroOrMore",u(s,"match")):"oneormore"===f?(s.type="oneOrMore",u(s,"match")):(s.type="sequence",u(s,"match"))):jt&i&&(s.type="repeat",s.repeat=s.match,u(s,"match"))):"either"===p?s.type="alternation":"all"===p?s.type="sequence":"lookahead"===p?s.type="positiveLookahead":"grammar"===p&&(s.type="subgrammar"),"subgrammar"!==s.type||s.tokens||(s.tokens=n)):s.ngram||s["n-gram"]?(s.type="ngram",s.tokens=s.ngram||s["n-gram"],s["n-gram"]?u(s,"n-gram"):u(s,"ngram")):s.sequence||s.all?(s.type="sequence",s.tokens=s.sequence||s.all,s.all?u(s,"all"):u(s,"sequence")):s.alternation||s.either?(s.type="alternation",s.tokens=s.alternation||s.either,s.either?u(s,"either"):u(s,"alternation")):s.zeroOrOne?(s.type="zeroOrOne",s.tokens=s.zeroOrOne,u(s,"zeroOrOne")):s.zeroOrMore?(s.type="zeroOrMore",s.tokens=s.zeroOrMore,u(s,"zeroOrMore")):s.oneOrMore?(s.type="oneOrMore",s.tokens=s.oneOrMore,u(s,"oneOrMore")):s.positiveLookahead||s.lookahead?(s.type="positiveLookahead",s.tokens=s.positiveLookahead||s.lookahead,s.lookahead?u(s,"lookahead"):u(s,"positiveLookahead")):s.negativeLookahead?(s.type="negativeLookahead",s.tokens=s.negativeLookahead,u(s,"negativeLookahead")):(s.subgrammar||s.grammar)&&(s.type="subgrammar",s.tokens=s.subgrammar||s.grammar,s.subgrammar?u(s,"subgrammar"):u(s,"grammar")));return t}function _(e,t){t=t||[];var n,o,r,l;for(n=e.ctx;n;){for(o=n.val.symb;o;)l=o.val[1],l[7]&&t.push({word:l[5],meta:(l[6]||"")+" at ("+(l[0]+1)+","+(l[1]+1)+")",ci:l[8],token:l[6],pos:[l[0]+1,l[1]+1,l[2]+1,l[3]+1]}),o=o.prev;o=n.val.tabl;for(r in o)Lt.call(o,r)&&o[r][7]&&(l=o[r],t.push({word:l[5],meta:(l[6]||"")+" at ("+(l[0]+1)+","+(l[1]+1)+")",ci:l[8],token:l[6],pos:[l[0]+1,l[1]+1,l[2]+1,l[3]+1]}));n=n.prev}for(n=e.hctx;n;){for(o=n.val.symb;o;)l=o.val[1],l[7]&&t.push({word:l[5],meta:(l[6]||"")+" at ("+(l[0]+1)+","+(l[1]+1)+")",ci:l[8],token:l[6],pos:[l[0]+1,l[1]+1,l[2]+1,l[3]+1]}),o=o.prev;o=n.val.tabl;for(r in o)Lt.call(o,r)&&o[r][7]&&(l=o[r],t.push({word:l[5],meta:(l[6]||"")+" at ("+(l[0]+1)+","+(l[1]+1)+")",ci:l[8],token:l[6],pos:[l[0]+1,l[1]+1,l[2]+1,l[3]+1]}));n=n.prev}for(o=e.symb;o;)l=o.val[1],l[7]&&t.push({word:l[5],meta:(l[6]||"")+" at ("+(l[0]+1)+","+(l[1]+1)+")",ci:l[8],token:l[6],pos:[l[0]+1,l[1]+1,l[2]+1,l[3]+1]}),o=o.prev;o=e.tabl;for(r in o)Lt.call(o,r)&&o[r][7]&&(l=o[r],t.push({word:l[5],meta:(l[6]||"")+" at ("+(l[0]+1)+","+(l[1]+1)+")",ci:l[8],token:l[6],pos:[l[0]+1,l[1]+1,l[2]+1,l[3]+1]}));return t}function E(t,n,o,r){if(o=o||{},n=n||[],!t||!t.length)return n;var l,s,i,a,c,u,p;for(l=0,s=t.length;s>l;l++)if(c=t[l])if(Ze===c.type){if(r&&r.length&&c.name)for(i=r.length-1;i>=0;i--)r[i].token&&(c.name===r[i].token||c.name.length>r[i].token.length&&c.name.slice(0,r[i].token.length)===r[i].token||c.name.length<r[i].token.length&&c.name===r[i].token.slice(0,c.name.length))&&(r[i].meta=c.name+" at ("+r[i].pos[0]+","+r[i].pos[1]+")",n.push(r[i]),r.splice(i,1));if(c.autocompletions)for(i=0,a=c.autocompletions.length;a>i;i++)p=c.autocompletions[i],Lt.call(o,"w_"+p.word)||(n.push(p),o["w_"+p.word]=1);else Ft===c.token.ptype&&Ft&e(c.token.pattern)&&c.token.pattern.length>1&&(Lt.call(o,"w_"+c.token.pattern)||(n.push({word:""+c.token.pattern,meta:c.name,ci:!!c.ci}),o["w_"+c.token.pattern]=1))}else if(Je===c.type)E(c.token,n,o,r);else if(at&c.type){i=0,a=c.token.length;do E([u=c.token[i++]],n,o,r);while(a>i&&(Xe&u.type&&1>u.min||Be===u.type))}else Xe&c.type&&E([c.token[0]],n,o,r);return n}function P(t,n,o,r){for(var l;Ft&e(l=n[t]||o[t]);)t=l;return r?t:n[t]||o[t]||t}function T(e,t){return e.length>1?o(t?function(t,n){var o=n[n.length-1],r=e[t];o===r||n.push(r)}:function(t,n){var o=n[n.length-1],r=e[t];an.test(r)&&an.test(o)&&o===r||n.push(r)},1,e.length-1,[e[0]]):e}function D(n,o,l){var s,i,a,c,u,p,f,m,h,d,k,g,$,x,b,w=!1;if(b=n.modifier?n.modifier:null,m=new String(Jt(n)),m.pos=0,1===m.length)g=""+n,o[g]||l[g]||(o[g]={type:"simple",tokens:n}),n=g;else{for(s=[],i=[],a="",$=[];m.pos<m.length;)if(h=m[Ot](m.pos++),rn.test(h))if(a.length&&(w?(i.length&&(k=i[i.length-1],g=k+"."+a,p=o[g]||l[g],p||(f=P(k,o,l),l[g]=Ft&e(f)?new String(f):r(f),l[g].modifier=a),i[i.length-1]=g),w=!1):"0"===a?(o[kt]||(o[kt]={type:"simple",tokens:0}),i.push(kt)):"^^"===a?(o[pt]||(o[pt]={type:"simple",tokens:ze}),i.push(pt)):"^^1"===a?(o[ft]||(o[ft]={type:"simple",tokens:Ge}),i.push(ft)):"^"===a?(o[mt]||(o[mt]={type:"simple",tokens:Ye}),i.push(mt)):"$"===a?(o[ht]||(o[ht]={type:"simple",tokens:Ue}),i.push(ht)):(o[a]||l[a]||(o[a]={type:"simple",tokens:a}),i.push(a)),a=""),"."===h)i.length&&m.pos<m.length&&!rn.test(m[Ot](m.pos))?w=!0:a+=h;else if('"'===h||"'"===h)c=v(m,h,"\\",1),c.length?(g=""+c,o[g]||(o[g]={type:"simple",tokens:c}),i.push(g)):(o[gt]||(o[gt]={type:"simple",tokens:""}),i.push(gt));else if("["===h)h=m[Ot](m.pos+1),"^"===h?m.pos++:h="",c=v(m,"]","\\",0),g="["+h+c+"]",o[g]||(o[g]={type:"simple",tokens:y("^(["+h+c+"])")}),i.push(g);else{if("]"===h){a+=h;continue}if("/"===h)c=v(m,h,"\\",0),d="",c.length&&(m.pos<m.length&&"i"===m[Ot](m.pos)&&(m.pos++,d="i"),g="/"+c+"/"+d,o[g]||(o[g]={type:"simple",tokens:y("^("+c+")",{l:0,x:0,i:"i"===d})}),i.push(g));else if("*"===h||"+"===h||"?"===h)i.length?(k=i[i.length-1],g=""+k+h,l[g]||(l[g]={type:"*"===h?"zeroOrMore":"+"===h?"oneOrMore":"zeroOrOne",tokens:[k]}),i[i.length-1]=g):a+=h;else if("{"===h)i.length?(u=v(m,"}",0,0),u=t(u.split(","),Jt),u[0].length?u[0]=parseInt(u[0],10)||0:u[0]=0,0>u[0]&&(u[0]=0),2>u.length?u.push(u[0]):u[1].length?u[1]=parseInt(u[1],10)||St:u[1]=St,0>u[1]&&(u[1]=0),k=i[i.length-1],g=""+k+["{",u[0],",",isFinite(u[1])?u[1]:"","}"].join(""),l[g]||(l[g]={type:"repeat",repeat:[u[0],u[1]],tokens:[k]}),i[i.length-1]=g):a+=h;else{if("}"===h){a+=h;continue}"&"===h||"!"===h?i.length?(k=i[i.length-1],g=""+k+h,l[g]||(l[g]={type:"!"===h?"negativeLookahead":"positiveLookahead",tokens:[k]}),i[i.length-1]=g):a+=h:"|"===h?(w=!1,i=T(i),i.length>1?(g=""+i.join(" "),l[g]||(l[g]={type:"sequence",tokens:i}),s.push(g)):i.length?s.push(i[0]):a+=h,i=[]):"("===h?($.push([i,s,a]),i=[],s=[],a=""):")"===h&&(i=T(i),i.length>1?(g=""+i.join(" "),l[g]||(l[g]={type:"sequence",tokens:i}),s.push(g)):i.length&&s.push(i[0]),i=[],s=T(s,1),s.length>1?(g=""+s.join(" | "),l[g]||(l[g]={type:"alternation",tokens:s})):s.length&&(g=s[0]),s=[],x=$.pop(),i=x[0],s=x[1],a=x[2],k=g,g="("+k+")",l[g]||(l[g]=r(P(k,o,l))),i.push(g))}}else a+=h;a.length&&(w?(i.length&&(k=i[i.length-1],g=k+"."+a,p=o[g]||l[g],p||(f=P(k,o,l),l[g]=Ft&e(f)?new String(f):r(f),l[g].modifier=a),i[i.length-1]=g),w=!1):"0"===a?(o[kt]||(o[kt]={type:"simple",tokens:0}),i.push(kt)):"^^"===a?(o[pt]||(o[pt]={type:"simple",tokens:ze}),i.push(pt)):"^^1"===a?(o[ft]||(o[ft]={type:"simple",tokens:Ge}),i.push(ft)):"^"===a?(o[mt]||(o[mt]={type:"simple",tokens:Ye}),i.push(mt)):"$"===a?(o[ht]||(o[ht]={type:"simple",tokens:Ue}),i.push(ht)):(o[a]||l[a]||(o[a]={type:"simple",tokens:a}),i.push(a))),a="",i=T(i),i.length>1?(g=""+i.join(" "),l[g]||(l[g]={type:"sequence",tokens:i}),s.push(g)):i.length&&s.push(i[0]),i=[],s=T(s,1),s.length>1?(g=""+s.join(" | "),l[g]||(l[g]={type:"alternation",tokens:s}),n=g):s.length&&(n=s[0]),s=[]}return b&&(o[n]||l[n])&&((o[n]||l[n]).modifier=b),n}function N(r,l,s,c,u,p,f,m,h,d,k){var g,$,y,v,x,b,w,C=null,S=null,_=null;if(ze===r||Ge===r||Ye===r||Ue===r)return new z(r,ze===r?pt:Ge===r?$T_FBNL$:Ye===r?mt:ht,r,S);if(!1===r||0===r)return new z(He,kt,0,S);if(""===r)return new z(We,gt,"",S);if(null===r)return new z(Ze,dt,Pt,S,_);if(jt&e(r)&&(y=r,r="NGRAM_"+y.join("_"),c[r]||(c[r]={type:"ngram",tokens:y})),r=""+r,m[r])return m[r];if(x=P(r,s,c),Ft&e(x)&&(x=D(x,s,c),x=s[x]||c[x]||null),!x)return null;if(g=x.type?ut[x.type[Ct]().replace(en,"")]||Ze:Ze,S=x.msg||null,_=x.modifier||null,$=x.tokens,Ze&g){if(ze===$||Ge===$||Ye===$||Ue===$||!1===$||0===$)return C=new z($||He,r,$||0,S),m[r]=C,C;if(""===$)return C=new z(We,r,"",S),m[r]=C,C;if(null===$)return C=new z(Ze,r,Pt,S,_),m[r]=C,C;if(!$)return null}if(Be&g)x.options=x.options||{},x.options["in-context"]=!(!x.options["in-context"]&&!x["in-context"]),x.options["in-hypercontext"]=!(!x.options["in-hypercontext"]&&!x["in-hypercontext"]),x.options.ci=x.ci=!!(x.options.caseInsesitive||x.options.ci||x.caseInsesitive||x.ci),x.options.autocomplete=!(!x.options.autocomplete&&!x.autocomplete),x.options.mode=x.options.mode||x.mode,Lt.call(x,"action")?"nop"===x.action[0]?x.action[0]=we:"error"===x.action[0]?x.action[0]=Ce:"context-start"===x.action[0]?x.action[0]=_e:"context-end"===x.action[0]?x.action[0]=Ee:"hypercontext-start"===x.action[0]?x.action[0]=Pe:"hypercontext-end"===x.action[0]?x.action[0]=Te:"push"===x.action[0]?x.action[0]=De:"pop"===x.action[0]?x.action[0]=Ne:"define"===x.action[0]?x.action[0]=Oe:"undefine"===x.action[0]?x.action[0]=qe:"defined"===x.action[0]?x.action[0]=Le:"notdefined"===x.action[0]?x.action[0]=Me:"unique"===x.action[0]?x.action[0]=Se:"indent"===x.action[0]?x.action[0]=Ie:"outdent"===x.action[0]&&(x.action[0]=Fe):Lt.call(x,"nop")?x.action=[we,x.nop,x.options]:Lt.call(x,"error")?x.action=[Ce,x.error,x.options]:Lt.call(x,"context")?x.action=[x.context?_e:Ee,x.context,x.options]:Lt.call(x,"hypercontext")?x.action=[x.hypercontext?Pe:Te,x.hypercontext,x.options]:Lt.call(x,"context-start")?x.action=[_e,x["context-start"],x.options]:Lt.call(x,"context-end")?x.action=[Ee,x["context-end"],x.options]:Lt.call(x,"hypercontext-start")?x.action=[Pe,x["hypcontext-start"],x.options]:Lt.call(x,"hypercontext-end")?x.action=[Te,x["hypcontext-end"],x.options]:Lt.call(x,"push")?x.action=[De,x.push,x.options]:Lt.call(x,"pop")?x.action=[Ne,x.pop,x.options]:Lt.call(x,"define")?x.action=[Oe,Ft&e(x.define)?["*",x.define]:x.define,x.options]:Lt.call(x,"undefine")?x.action=[qe,Ft&e(x.undefine)?["*",x.undefine]:x.undefine,x.options]:Lt.call(x,"defined")?x.action=[Le,Ft&e(x.defined)?["*",x.defined]:x.defined,x.options]:Lt.call(x,"notdefined")?x.action=[Me,Ft&e(x.notdefined)?["*",x.notdefined]:x.notdefined,x.options]:Lt.call(x,"unique")?x.action=[Se,Ft&e(x.unique)?["*",x.unique]:x.unique,x.options]:Lt.call(x,"indent")?x.action=[Ie,x.indent,x.options]:Lt.call(x,"outdent")&&(x.action=[Fe,x.outdent,x.options]),!1===x.msg&&(S=!1),x.nop&&(x.action[0]=we),C=new z(Be,r,x.action.slice(),S,_),C.ci=!!(x.options.caseInsensitive||x.options.ci||x.caseInsensitive||x.ci),m[r]=C;else if($=i($),Ze&g){w=x.autocomplete?M(x,Ht&e(x.autocomplete)?i(x.autocomplete):$,r,k):null;var E={};if(b="undefined"!=typeof x.combine?x.combine:!!(jt&e(x.tokens)),C=new z(Ze,r,O(r,$.slice(),l,b,!(!x.caseInsensitive&&!x.ci),p,f,E),S,_,null,w),E.keywords&&(C.keywords=E.keywords.join("|")),m[r]=C,null!=x.except){var T,I,F=i(x.except),A=F.length,R=[];for(T=0;A>T;T++)F[T]&&(I=N(F[T],l,s,c,u,p,f,m,h,d,k),I&&R.push(I));R.length&&(C.except=R)}}else Ke&g?(Ve===g&&L(x,d),C=new z(g,r,q(r,$.slice(),l,p,f),S),C.empty=Lt.call(x,"empty")?!!x.empty:!0,C.mline=Lt.call(x,"multiline")?!!x.multiline:!0,C.esc=Lt.call(x,"escape")?x.escape:!1,C.inter=!!u[r+".inside"],Ve===g&&x.interleave&&h.push(U(C)),_&&(C.modifier=_),m[r]=C):ct&g&&(it===g?m[r]=new z(it,r,$,S,_):st===g?(v=a($),C=t(v,function(e,t){return new z(st,r+"_NGRAM_"+t,null,S,_)}),m[r]=C,o(function(e){C[e].token=i(n(v[e],function(e,t){return e.concat(N(t,l,s,c,u,p,f,m,h,d,k))},[]))},0,v.length-1)):(rt===g||lt===g?C=new z(g,r,null,S,_):Xe&g&&jt&e(x.repeat)?(C=new z(Xe,r,null,S,_),C.min=x.repeat[0],C.max=x.repeat[1]):et===g?(C=new z(et,r,null,S,_),C.min=0,C.max=1):tt===g?(C=new z(tt,r,null,S,_),C.min=0,C.max=St):nt===g?(C=new z(nt,r,null,S,_),C.min=1,C.max=St):C=Je===g?new z(Je,r,null,S,_):new z(Qe,r,null,S,_),m[r]=C,C.token=i(n($,function(e,t){return e.concat(N(t,l,s,c,u,p,f,m,h,d,k))},[]))));return m[r]}function I(e,t){var n,o,r=e.Style,l=e.Lex,s=e.Syntax,i=[],a={};for(n in r)Lt.call(r,n)&&(o=l[n]||s[n],!o||"block"!=o.type&&"comment"!==o.type||(t&&(r[n+".inside"]||r[n])?(n=r[n+".inside"]||r[n],Lt.call(a,n)||(i.push(n),a[n]=1)):t||Lt.call(a,n)||(i.push(n),a[n]=1)));return i}function F(t){var n={};return t.Lex=t.Lex||{},t.Syntax=t.Syntax||{},t=S(t),t.Parser&&t.Parser.length&&o(function r(l,s){var i,a,c,u=s[l];n[u]||(jt&e(u)&&(i=u,u="NGRAM_"+i.join("_"),t.Syntax[u]||(t.Syntax[u]={type:"ngram",tokens:i})),a=P(u,t.Lex,t.Syntax),Ft&e(a)&&(a=D(a,t.Lex,t.Syntax),a=t.Lex[a]||t.Syntax[a]||null),a&&(n[u]=a,c=a.type?ut[a.type[Ct]().replace(en,"")]||Ze:Ze,ct&c&&o(r,0,a.tokens.length-1,a.tokens)))},0,t.Parser.length-1,t.Parser),t}function A(t){var o,l,s,i,a,c,u,p,f,m,h,d,k,g;return t.__parsed?t:(o=t.RegExpID||null,s=t.Extra?r(t.Extra):{},i=t.Style?r(t.Style):{},a=null,c=null,u=t.Lex?r(t.Lex):{},p=t.Syntax?r(t.Syntax):{},f={},m={},h={},k={},g={},d=[],l=t.Parser?r(t.Parser):[],t=S({Style:i,Fold:a,Match:c,Lex:u,Syntax:p,$parser:null,$interleaved:null,$comments:null,$autocomplete:null,$extra:s,__parsed:0}),t.$parser=n(l,function(t,n){var r=N(n,o,u,p,i,f,m,h,d,k,g)||null;return r&&(jt&e(r)?t=t.concat(r):t.push(r)),t},[]),t.$interleaved=d&&d.length?d:null,t.$comments=k,t.$autocomplete=g&&g.autocomplete&&g.autocomplete.length?g.autocomplete:null,t.__parsed=1,t)}function R(t,n,o,r,l){var s,i,a=this;s=a.type=t,a.name=n,a.pattern=o,i=a.ptype=r||Ft,a.key=l||0,Re===s?a.key=!1!==l:je===s?a.pattern[0]=new R(Re,n+"_Start",o[0],null,!1):Pt===i?a.pattern=null:Gt===i&&(a.pattern=Gt&e(o)?[o,0]:[o[0],o[1]||0])}function j(t,n,o,r){var l,s,i,a,c,u,p,f,m,h,d,k=t,g=k.type,$=k.pattern,y=k.key;if(je===g){if(l=k.name,i=$[0],a=$[1],u=j(i,n,o,r))return c=a[u[0]],f=e(c),m=i.pattern[u[0]].ptype,Gt===m&&Yt&f&&(c.regex_pattern?(p=x(c,u[1]),c=new R(Ae,l+"_End",b(p,c.regex_pattern,{}),Gt)):(p=Tt&f?u[1][c+1]:x(c,u[1]),c=new R(Ae,l+"_End",p,p.length>1?Ft:At))),c}else if(Re===g){for(h=0,d=$.length;d>h;h++)if(p=j($[h],n,o,r))return y?[h,p[1]]:p}else{if(s=k.ptype,Pt===s)return!1!==o&&n.end(),[y,""];if(Gt===s){if(p=$[0].xflags.l?n.match($[0]):n.slice(n.pos).match($[0]),p&&0===p.index)return!1!==o&&n.mov(p[$[1]||0].length),[y,$[1]>0?p[$[1]]:p]}else if(Rt===s){if(!0===r){p=-1;var v,w;for(d=$.length-1;d>=0;d--)v=n.indexOf($[Ot](d),n.pos),v>-1&&(-1===p||p>v)&&(p=v,w=$[Ot](d));if(p>-1)return!1!==o&&(n.pos=p+1),[y,w]}else if(p=n[Ot](n.pos)||null,p&&-1<$.indexOf(p))return!1!==o&&n.mov(1),[y,p]}else if(At===s){if(!0===r){if(p=n.indexOf($,n.pos),p>-1)return!1!==o&&(n.pos=p+1),[y,$]}else if(p=n[Ot](n.pos)||null,$===p)return!1!==o&&n.mov(1),[y,p]}else if(Ft===s)if(d=$.length,!0===r){if(p=n.indexOf($,n.pos),p>-1)return!1!==o&&(n.pos=p+d),[y,$]}else if($===n.substr(n.pos,d))return!1!==o&&n.mov(d),[y,$]}return!1}function B(e,t){this.val=e||null,t?this.prev=t:this.prev=null}function z(e,t,n,o,r,l,s,i){var a=this;a.type=e,a.name=t,a.token=n,a.modifier=r||null,a.except=l||null,a.autocompletions=s||null,a.keywords=i||null,a.pos=null,a.msg=!1===o?!1:o||null,a.$msg=null,a.status=0,a.empty=!1,a.ci=!1,a.mline=!0,a.esc=!1,a.inter=!1,a.found=0,a.min=0,a.max=1,a.i0=0,a.$id=null}function G(){var e=this;e.T=0,e.id=null,e.type=null,e.match=null,e.str="",e.pos=null,e.block=null,e.space=null}function U(e,t,n,o){var r=new z(e.type,e.name,e.token,e.msg,e.modifier,e.except,e.autocompletions,e.keywords);return r.empty=e.empty,r.ci=e.ci,r.mline=e.mline,r.esc=e.esc,r.inter=e.inter,r.found=e.found,r.min=e.min,r.max=e.max,r.i0=e.i0,t&&(r.status|=$e),n&&(r.modifier=n),o&&(r.$id=o),r}function Y(e){var t=e.name;return e.$msg?e.$msg:e.status&$e?'Token "'+t+'"'+(e.keywords?": "+e.keywords:"")+" Expected":'Syntax Error: "'+t+'"'}function H(e,t,n,o,r,l,s){e.status&ke&&e.err&&(e.err[""+t+"_"+n+"_"+o+"_"+r+"_"+(l?l.name:"ERROR")]=[t,n,o,r,s||Y(l)])}function W(e,t,n){var o=null;if(n)e&&Lt.call(e,t)&&(o={list:e,key:t,val:e[t]});else for(var r=null,l=e;e;){if(t===e.val[0]){o={list:l,node:e,nodePrev:e.prev,nodeNext:r,key:t,val:e.val[1]};break}r=e,e=e.prev}return o}function Z(e,t,n,o){return o?(e[t]=n,e):new B([t,n],e)}function K(e,t){return t?delete e.list[e.key]:e.nodeNext?e.nodeNext.prev=e.nodePrev:e.list=e.list.prev,e.list}function V(e,t,n){if(e.stack===t)t=e.stack=new B(n,e.stack);else{for(var o=e.stack;o&&o.prev!==t;)o=o.prev;t=new B(n,t),o&&(o.prev=t)}return t}function J(e,t){if(null==e)return null;if(t){for(var n=new B(e.val),o=n,r=e;r.prev;)o.prev=new B(r.prev.val),r=r.prev,o=o.prev;return n}return e}function Q(e,t,n,o){var r,l,s,i,a,c=1/0,u=null,p=1/0;if(l=t.pos,t.spc(),s=t.pos,r=e.stack,t.pos<t.length){for(a=0;r&&(i=r.val,i.$id===o.$id);){for(;!(Be===i.type||X(i,t,e,n)||(t.pos=i.pos>t.pos?i.pos:t.pos+1,e.stack=r,t.pos>=t.length)););e.stack=r,t.pos<t.length&&c>t.pos?(c=t.pos,u=r,p=a):c===t.pos&&p>a&&(c=t.pos,u=r,p=a),t.pos=s,r=r.prev,a++}c<t.length?(t.pos=c,e.stack=u):(t.end(),e.stack=null)}return s>=l&&t.pos===s}function X(e,t,n,o){if(!e)return!1;var r=e.type,l=ct&r?oe:Ke&r?ne:Be&r?ee:te;return l(e,t,n,o)}function ee(t,n,o,r){var l,s,i,a,c,u,p,f,m,h,d,k,g,$,y,v,b,w,C,O,q=t,L=q.token||null,M=q.ci,S=q.name,_=!1,E=!(o.status&ke);if(q.status=0,q.$msg=null,!L||!r||!r.pos)return!0;if(b=!!(Ke&r.T),we===L[0]||b&&!r.block)return!0;if(l=L[0],s=L[1],w=L[2]||{},c=q.msg,g=w["in-context"],$=w["in-hypercontext"],b?(v=r.block.match||r.block.str,m=r.block.pos[0][0],h=r.block.pos[0][1],d=r.block.pos[0][2],k=r.block.pos[0][3],_=!0):(v=r.match||r.str,m=r.pos[0],h=r.pos[1],d=r.pos[2],k=r.pos[3],_=!1),Ee===l)o.ctx=o.ctx?o.ctx.prev:null;else if(_e===l)o.ctx=new B({tabl:{},symb:null,queu:null},o.ctx);else if(Te===l)o.hctx=o.hctx?o.hctx.prev:null;else if(Pe===l)o.hctx=new B({tabl:{},symb:null,queu:null},o.hctx);else if(Oe===l)C="hash"===w.mode,O=C?"tabl":"symb",i=s[1],a=s[0],i=x(i,v,_),M&&(i=i[Ct]()),a+="::"+i,f=$&&o.hctx?W(o.hctx.val[O],a,C):g&&o.ctx?W(o.ctx.val[O],a,C):W(o[O],a,C),f||($&&o.hctx?o.hctx.val[O]=Z(o.hctx.val[O],a,[m,h,d,k,a,i,r.type,!!w.autocomplete,M],C):g&&o.ctx?o.ctx.val[O]=Z(o.ctx.val[O],a,[m,h,d,k,a,i,r.type,!!w.autocomplete,M],C):o[O]=Z(o[O],a,[m,h,d,k,a,i,r.type,!!w.autocomplete,M],C));else if(qe===l)C="hash"===w.mode,O=C?"tabl":"symb",i=s[1],a=s[0],i=x(i,v,_),M&&(i=i[Ct]()),a+="::"+i,f=$&&o.hctx?W(o.hctx.val[O],a,C):g&&o.ctx?W(o.ctx.val[O],a,C):W(o[O],a,C),f&&($&&o.hctx?o.hctx.val[O]=K(f,C):g&&o.ctx?o.ctx.val[O]=K(f,C):o[O]=K(f,C));else if(Le===l){if(C="hash"===w.mode,O=C?"tabl":"symb",i=s[1],a=s[0],i=x(i,v,_),M&&(i=i[Ct]()),a+="::"+i,f=$&&o.hctx?W(o.hctx.val[O],a,C):g&&o.ctx?W(o.ctx.val[O],a,C):W(o[O],a,C),!f)return!1!==c&&(q.$msg=c?x(c,i,!0):'Undefined "'+i+'"',y=Y(q),H(o,m,h,d,k,q,y),q.status|=ye),!1}else if(Me===l&&(C="hash"===w.mode,O=C?"tabl":"symb",i=s[1],a=s[0],i=x(i,v,_),M&&(i=i[Ct]()),a+="::"+i,f=$&&o.hctx?W(o.hctx.val[O],a,C):g&&o.ctx?W(o.ctx.val[O],a,C):W(o[O],a,C)))return!1!==c&&(q.$msg=c?x(c,i,!0):'Defined "'+i+'"',y=Y(q),H(o,f.val[0],f.val[1],f.val[2],f.val[3],q,y),H(o,m,h,d,k,q,y),q.status|=ye),!1;if(E)return!0;if(Ce===l)return!c&&Ft&e(s)&&(c=s),q.$msg=c?x(c,v,!0):'Error "'+S+'"',H(o,m,h,d,k,q,Y(q)),q.status|=ye,!1;if(Se===l){if(C="hash"===w.mode,O=C?"tabl":"symb",$){if(!o.hctx)return!0;p=o.hctx.val[O]}else if(g){if(!o.ctx)return!0;p=o.ctx.val[O]}else p=o[O];if(i=s[1],a=s[0],i=x(i,v,_),M&&(i=i[Ct]()),a+="::"+i,f=W(p,a,C))return!1!==c&&(q.$msg=c?x(c,i,!0):'Duplicate "'+i+'"',y=Y(q),H(o,f.val[0],f.val[1],f.val[2],f.val[3],q,y),H(o,m,h,d,k,q,y),q.status|=ye),!1;$?o.hctx.val[O]=Z(o.hctx.val[O],a,[m,h,d,k,a,i,r.type,!!w.autocomplete,M],C):g?o.ctx.val[O]=Z(o.ctx.val[O],a,[m,h,d,k,a,i,r.type,!!w.autocomplete,M],C):o[O]=Z(o[O],a,[m,h,d,k,a,i,r.type,!!w.autocomplete,M],C)}else if(Ne===l){if($){if(!o.hctx)return!0;u=o.hctx.val.queu}else if(g){if(!o.ctx)return!0;u=o.ctx.val.queu}else u=o.queu;if(s){if(s=x(s,v,_),M&&(s=s[Ct]()),!u||s!==u.val[0])return!1!==c&&(u?(q.$msg=c?x(c,[u.val[0],s],!0):'Mismatched "'+u.val[0]+'","'+s+'"',y=Y(q),H(o,u.val[1],u.val[2],u.val[3],u.val[4],q,y),H(o,m,h,d,k,q,y),u=u.prev):(q.$msg=c?x(c,["",s],!0):'Missing matching "'+s+'"',y=Y(q),H(o,m,h,d,k,q,y)),q.status|=ye),$?o.hctx&&(o.hctx.val.queu=u):g?o.ctx&&(o.ctx.val.queu=u):o.queu=u,!1;u=u?u.prev:null}else u=u?u.prev:null;$?o.hctx&&(o.hctx.val.queu=u):g?o.ctx&&(o.ctx.val.queu=u):o.queu=u}else if(De===l&&s){if($){if(!o.hctx)return!0; u=o.hctx.val.queu}else if(g){if(!o.ctx)return!0;u=o.ctx.val.queu}else u=o.queu;s=x(s,v,_),M&&(s=s[Ct]()),q.$msg=c?x(c,s,!0):'Missing matching "'+s+'"',u=new B([s,m,h,d,k,Y(q)],u),$?o.hctx&&(o.hctx.val.queu=u):g?o.ctx&&(o.ctx.val.queu=u):o.queu=u}return!0}function te(e,t,n,o,r){var l,s,i=e,a=i.token,c=i.modifier,u=i.type,p=i.name,f=i.except,m=n.line,h=t.pos,d=null,k=!1;if(i.status&=xe,i.$msg=r?null:i.msg||null,i.pos=t.pos,f&&!r){s=le(n,t);for(var g=0,$=f.length;$>g;g++)if(l=f[g],i!==l&&Ze===l.type&&te(l,t,n,o,1))return i.pos=l.pos,le(n,t,s),!1}if(ze===u)k=0===n.line;else if(Ge===u)k=n.bline+1===n.line;else if(Ye===u)k=t.sol();else if(Ue===u)t.spc(),t.eol()?k=p:(i.pos=t.pos,t.bck(h));else if(He===u)i.status=0,k=!0;else if(We===u){if(null==o.space||t.eol()?t.spc()&&!t.eol()?(i.pos=t.pos,t.bck(h),i.status&$e&&(i.status|=ye)):k=!0:i.status&$e&&(i.status|=ye),i.status&=ve,!0===k)return k}else Pt===a?(t.end(),k=c||p):(d=j(a,t))&&(d=d[1],k=c||p);return r?k:(!1!==k&&(o.T=u,o.id=p,o.type=k,o.str=t.sel(h,t.pos),o.match=d,o.pos=[m,h,m,t.pos]),!k&&i.status&&i.$msg&&(i.$msg=x(i.$msg,p,!0)),k)}function ne(e,t,n,o){var r,l,s,i,a,c,u,p,f,m,h,d,k,g,$,y,v,b,w,C,O,q,L=e,M=L.name,S=L.type,_=L.modifier,E=L.token,P=L.mline,T=L.inter,D=T?M+".inside":M,N=L.esc,I=!!N,F="",A="",R="",B="",z=L.$id||M,G=n.outer,Y=G&&G[2],H=G&&G[1];if(L.status&=xe,L.$msg=L.msg||null,L.pos=t.pos,C=n.line,O=t.pos,Ve===S&&(L.status&=ve),$=L.status&$e,s=0,i=0,n.block&&n.block.name===M?(i=1,s=1,g=D,r=n.block.end,p=n.block.sp,m=n.block.ip,f=n.block.ep,F=n.block.s,A=n.block.i):!n.block&&(r=j(E,t))&&(i=1,g=M,v=t.pos,p=[C,O],m=[[C,v],[C,v]],f=[C,v],F=t.sel(O,v),A="",B="",n.block={name:M,end:r,sp:p,ip:m,ep:f,s:F,i:A,e:B}),i){if(w=n.stack,l=Pt===r.ptype,y=l||L.empty,T){if(l&&s&&t.sol())return L.status&=ve,n.block=null,!1;if(!s)return v=t.pos,o.T=S,o.id=M,o.type=_||g,o.str=t.sel(O,v),o.match=null,o.pos=[C,O,C,v],V(n,w,U(L,$,0,z)),_||g}if(v=t.pos,a=H?l&&t.eol():j(r,t),u=P,c=0,a)g=l?D:M,B=t.sel(v,t.pos);else if(b=t.pos,d=!1,H||I||Rt!==r.ptype&&At!==r.ptype&&Ft!==r.ptype){for(;!t.eol();){if(H){if(X(H,t,Y,o)){if(t.pos>b){l&&(a=1);break}return!0}if(l){k=t.nxt(1),R+=k;continue}}if(v=t.pos,!d&&j(r,t)){T&&t.pos>v&&v>b?(g=D,t.bck(v),c=1):(g=M,a=1),B=t.sel(v,t.pos);break}k=t.nxt(1),R+=k,d=I&&!d&&N===k,v=t.pos}l&&t.eol()&&(a=1)}else(q=j(r,t,!0,!0))?T&&t.pos>v+q[1].length?(g=D,t.mov(-q[1].length),c=1,R=t.sel(v,t.pos)):(g=M,a=1,R=t.sel(v,t.pos-q[1].length),B=q[1]):(t.end(),g=D,c=1,R=t.sel(v,t.pos));return u=P||I&&d,A+=R,m[1]=[C,v],f=[C,t.pos],a&&!y&&m[0][0]===m[1][0]&&m[0][1]===m[1][1]?(n.block=null,!1):(a||!u&&!c?n.block=null:(n.block.ip=m,n.block.ep=f,n.block.i=A,n.block.e=B,V(n,w,U(L,$,0,z))),o.T=S,o.id=M,o.type=_||g,o.str=t.sel(O,t.pos),o.match=null,o.pos=[C,O,f[0],f[1]],L.pos=t.pos,n.block||(h=F+A+B,o.block={str:h,match:[h,A,F,B],part:[h,F,A,B],pos:[[p[0],p[1],f[0],f[1]],[p[0],p[1],m[0][0],m[0][1]],[m[0][0],m[0][1],m[1][0],m[1][1]],[m[1][0],m[1][1],f[0],f[1]]]}),_||g)}return L.status&&L.$msg&&(L.$msg=x(L.$msg,M,!0)),!1}function oe(e,t,n,o){var r,l,s,i,a,c,u,f,m,h,d,k,g,$,y,v=e,x=v.type,b=(v.name,v.token),w=b.length,C=v.modifier;if(v.status&=xe,v.$msg=v.msg||null,f=t.pos,m=n.stack,v.pos=t.pos,c=0,u=0,it===x){v.status&=xe;var O=new String(b[0]),q=n.stack?n.stack.val:null;return O.subgrammar=1,O.next=q?new z(rt,q.name,[q]):null,O.required=q?q.status&$e:0,O}if(Je===x){for(g=p(),v.status|=$e,k=[],y=le(n,t),d=0,h=d;w>h;h++){if(r=U(b[h],1,C,g),l=X(r,t,n,o),v.pos=r.pos,r.status&$e&&(c++,k.push(Y(r))),!1!==l)return l;r.status&ye&&(u++,le(n,t,y))}return c>0?v.status|=$e:v.status&=ve,w===u&&c>0?v.status|=ye:v.status&=xe,v.status&&!v.$msg&&k.length&&(v.$msg=k.join(" | ")),!1}if(at&x){$=!!(x&Qe),g=v.$id||p(),$?v.status|=$e:v.status&=ve,y=le(n,t),d=0;do r=U(b[d++],$,C,g),l=X(r,t,n,o);while(w>d&&(!0===l&&ot&r.type||!1===l&&!(r.status&$e)));if(v.pos=r.pos,!1!==l){if(!0!==l||He!==r.type)for(h=w-1;h>=d;h--)m=V(n,m,U(b[h],1,C,g));return l.subgrammar&&w>d&&(l.next=new z(rt,b[d].name,[b[d]]),l.required=b[d].status&$e),l}return r.status&ye?($?v.status|=ye:v.status&=xe,le(n,t,y)):$&&r.status&$e&&(v.status|=ye),v.status&&!v.$msg&&(v.$msg=Y(r)),!1}if(ot&x)return it&b[0].type?!0:(y=le(n,t,null,!1),l=X(U(b[0],0),t,n,o),le(n,t,y),lt===x?!1===l:!1!==l);for(g=v.$id||p(),s=v.found,i=v.min,a=v.max,v.status=0,k=[],y=le(n,t),h=0;w>h;h++){if(r=U(b[h],1,C,g),l=X(r,t,n,o),v.pos=r.pos,!1!==l){if(++s,a>=s)return v.found=s,V(n,m,U(v,0,0,p())),v.found=0,l;break}r.status&$e&&(c++,k.push(Y(r))),r.status&ye&&le(n,t,y)}return i>s&&(v.status|=$e),(s>a||i>s&&c>0)&&(v.status|=ye),v.status&&!v.$msg&&k.length&&(v.$msg=k.join(" | ")),!1}function re(e,t){var n=this;n.id=e?f("state"):"state",t instanceof re?(n.line=t.line,n.bline=t.bline,n.status=t.status,n.stack=J(t.stack,!1),n.token=t.token,n.token2=t.token2,n.block=t.block,n.outer=t.outer?[t.outer[0],t.outer[1],new re(e,t.outer[2])]:null,n.queu=t.queu||null,n.symb=t.symb||null,n.tabl=t.tabl||null,n.ctx=t.ctx?new B({tabl:t.ctx.val.tabl,symb:t.ctx.val.symb,queu:t.ctx.val.queu},t.ctx.prev):null,n.hctx=t.hctx?new B({tabl:t.hctx.val.tabl,symb:t.hctx.val.symb,queu:t.hctx.val.queu},t.hctx.prev):null,n.err=t.err||null,n.$eol$=t.$eol$,n.$blank$=t.$blank$):(n.line=-1,n.bline=-1,n.status=t||0,n.stack=null,n.token=null,n.token2=null,n.block=null,n.outer=null,n.queu=null,n.symb=null,n.tabl={},n.ctx=null,n.hctx=null,n.err=n.status&ke?{}:null,n.$eol$=!0,n.$blank$=!0)}function le(e,t,n,o){return n?(e.status=n[0],e.block=n[1],e.outer=n[2],e.stack=n[3],t&&t.pos>n[4]&&t.bck(n[4]),void 0):(n=[e.status,e.block,e.outer,e.stack,t?t.pos:1/0],!1===o&&(e.status=0),n)}function se(e){e.id=null,e.line=null,e.bline=null,e.status=null,e.stack=null,e.token=null,e.token2=null,e.block=null,e.outer=null,e.queu=null,e.symb=null,e.tabl=null,e.ctx=null,e.hctx=null,e.err=null}function ie(e,t,n){var o=new String(e);return o.start=t||0,o.pos=n||0,o.sol=function(){return 0===o.pos},o.eol=function(){return o.pos>=o.length},o.end=function(){return o.pos=o.length,o},o.mov=function(e){return o.pos=0>e?bt(0,o.pos+e):wt(o.length,o.pos+e),o},o.bck=function(e){return o.pos=bt(0,e),o},o.sft=function(){return o.start=o.pos,o},o.nxt=function(e,t){var n,r,l="";if(!0===e){for(t=t||ie.$NONSPC$;o.pos<o.length&&t.test(n=o[Ot](o.pos++));)l+=n;return l.length?l:null}for(e=e||1,r=0;r++<e&&o.pos<o.length;)l+=o[Ot](o.pos++);return l},o.cur=function(e){var t=o.slice(o.start,o.pos);return e&&(o.start=o.pos),t},o.sel=function(e,t){return o.slice(e,t)},o.spc=function(e,t){var n;return(n=o.slice(o.pos).match(t||ie.$SPC$))?(!1!==e&&o.mov(n[0].length),n[0]):void 0},o}function ae(e,t,n,o,r){var l,s,i;for(null==t&&(t=e.search(ie.$NONSPC$),-1==t&&(t=e.length)),l=o||0,s=r||0;;){if(i=e.indexOf(" ",l),0>i||i>=t)return s+(t-l);s+=i-l,s+=n-s%n,l=i+1}}function ce(n,o){return Ht&e(n)&&(n=y("\\b("+t(i(n).sort(Qt),$).join("|")+")\\b")),!1===o?function(e){return!e||!n.test(e)}:function(e){return!!e&&n.test(e)}}function ue(e,t,n,o,r,l){for(;;){n.lastIndex=e.col;var s=n.exec(e.text);if(!s){if(e.next()){e.text=e.line(e.row);continue}return}{if(t(e.token(e.row,s.index+1)))return e.col=s.index+s[0].length,s;e.col=s.index+1}}}function pe(e,t,n,o,r,l){for(var s,i,a;;){if(s=e.text.indexOf(r,e.col),-1===s){if(e.next()){e.text=e.line(e.row);continue}return}if(t(e.token(e.row,s+1)))return i=e.text.lastIndexOf(l,s),a=i>-1&&!ie.$NOTEMPTY$.test(e.text.slice(i+1,s)),e.col=s+1,a?"autoclosed":"regular";e.col=s+1}}function fe(e,t,n,o,r,l,s,i,a,c){if(-1===e){var u,p,f,m,h,d,k,g,$=1,y=t.first(),v=(l.length,s.length,!1===r);e:for(u=n;u>=y;--u)for(p=t.line(u),f=p.length,m=u===n?o-1:f;;){if(0>m)break;if(h=p.lastIndexOf(l,m),d=p.lastIndexOf(s,m),0>h&&0>d)break;if(m=bt(h,d),v||c||t.token(u,m+1)==r)if(m===d)++$;else if(0===--$){k=u,g=m;break e}--m}return null==k||a&&k===n&&g===o?!1:[k,g,n,o]}var u,p,f,m,h,d,x,b,$=1,w=t.last(),v=(l.length,s.length,!1===r);e:for(u=n;w>=u;++u)for(p=t.line(u),f=p.length,m=u===n?o:0;;){if(m>=f)break;if(h=p.indexOf(l,m),d=p.indexOf(s,m),0>h&&0>d)break;if(0>h&&(h=f),0>d&&(d=f),m=wt(h,d),v||c||t.token(u,m+1)==r)if(m===h)++$;else if(0===--$){x=u,b=m;break e}++m}return null==x||a&&n===x&&b===o?!1:[n,o,x,b]}function me(e,t,n){var o=n.text,r=n.meta,l=n.start,s=n.end,i=t.list.maxlen-o.length-r.length+5;e.innerHTML=['<span class="cmg-autocomplete-keyword">',g(o.slice(0,l)),'<strong class="cmg-autocomplete-keyword-match">',g(o.slice(l,s)),"</strong>",g(o.slice(s)),"</span>",new Array(1+i).join("&nbsp;"),'<strong class="cmg-autocomplete-keyword-meta">',g(r),"</strong>","&nbsp;"].join(""),e.className=(e.className&&e.className.length?e.className+" ":"")+"cmg-autocomplete-keyword-hint",e.style.position="relative",e.style.width="100%",e.style.maxWidth="120%"}function he(e,t,n){function o(e,t){var r;return r={Mode:o,startState:function(){return{parser:o.$parser,state:new re,inner:{},name:null}},copyState:function(e){return{parser:e.parser,state:new re(0,e.state),inner:e.inner,name:e.name}},token:function(e,t){var n=ie(e.string,e.start,e.pos),o=t.parser.get(n,t).type;return e.pos=n.pos,o},indent:function(o,r,l){return o.parser.indent(o.state,r,l,e,t,n)},fold:o.foldType,lineComment:o.$parser.LC,blockCommentStart:o.$parser.BCS,blockCommentEnd:o.$parser.BCE,blockCommentContinue:o.$parser.BCC,blockCommentLead:o.$parser.BCL,electricInput:o.$parser.$grammar.$extra.electricInput||!1,electricChars:o.$parser.$grammar.$extra.electricChars||!1},o.mode=r,r}return n=n||fn,o.$id=f("codemirror_grammar_mode"),o.$parser=new kn.Parser(A(e),t),o.$parser.Mode=o,o.options=function(e,t,n){n=n||{};var r=e.getTokenAt(t).state,l=r&&r.parser||o.$parser;return n.lineComment=l.LC,n.blockCommentStart=l.BCS,n.blockCommentEnd=l.BCE,n.blockCommentContinue=l.BCC,n.blockCommentLead=l.BCL,n.electricInput=l.$grammar.$extra.electricInput||!1,n.electricChars=l.$grammar.$extra.electricChars||!1,n},o.supportGrammarAnnotations=!1,o.validator=function r(e,t){return o.supportGrammarAnnotations&&o.$parser&&e&&e.length?o.$parser.validate(e,r.options||t||{},n):[]},o.linter=o.validator,o.supportAutoCompletion=!0,o.autocompleter=function l(e,t){if(o.supportAutoCompletion){var r=e.getTokenAt(e.getCursor()).state,s=r&&r.parser||o.$parser;return t=l.options||t||{},Lt.call(t,"renderer")||(t.renderer=l.renderer||me),s.autocomplete(e,t,n)}},o.autocompleter.renderer=me,o.supportCodeFolding=!0,o.foldType="fold_"+o.$id,o.folder=function(e,t){if(o.supportCodeFolding){var r,l=e.getTokenAt(t).state,s=l&&l.parser||o.$parser;if(r=s.fold(e,t,n))return{from:n.Pos(r[0],r[1]),to:n.Pos(r[2],r[3])}}},o.supportCodeMatching=!0,o.matchType="match_"+o.$id,o.matcher=function s(e){if(o.supportCodeMatching){if(s.clear(e),e.state.$highlightPending)return;var t=e.getTokenAt(e.getCursor()).state,r=t&&t.parser||o.$parser;e.state.$highlightPending=!0,setTimeout(function(){e.operation(function(){e.state.$highlightPending=!1;var t,l=s.options||{},i=l.maxHighlightLineLength||1e3,a=[],c=e.listSelections(),u="CodeMirror-matchingtag",p="CodeMirror-nonmatchingbracket",f=0;for(c.length;1>f;f++)t=r.match(e,c[f].to(),n),null!=t&&(!1===t?(c[f].empty()?(t=c[f].to(),t=[n.Pos(t.line,t.ch-1),t]):t=[c[f].from(),c[f].to()],a.push(e.markText(t[0],t[1],{className:p}))):!1===t.match?a.push(e.markText(n.Pos(t[0],t[1]),n.Pos(t[2],t[3]),{className:p})):"end"===t.match&&e.getLine(t[0]).length<=i?(a.push(e.markText(n.Pos(t[0],t[1]),n.Pos(t[2],t[3]),{className:u})),e.getLine(t[4]).length<=i&&a.push(e.markText(n.Pos(t[4],t[5]),n.Pos(t[6],t[7]),{className:u}))):"start"===t.match&&e.getLine(t[4]).length<=i&&(a.push(e.markText(n.Pos(t[4],t[5]),n.Pos(t[6],t[7]),{className:u})),e.getLine(t[0]).length<=i&&a.push(e.markText(n.Pos(t[0],t[1]),n.Pos(t[2],t[3]),{className:u}))));e.state[o.matchType]=a})},50)}},o.matcher.clear=function(e){e.operation(function(){var t=e.state[o.matchType];if(e.state[o.matchType]=null,t&&t.length)for(var n=0,r=t.length;r>n;n++)t[n].clear()})},o.submode=function(e,t){o.$parser.subparser(e,t.Mode.$parser)},o.dispose=function(){o.$parser&&o.$parser.dispose(),o.$parser=o.validator=o.linter=o.autocompleter=o.folder=o.matcher=o.mode=null},o}var de=1,ke=2,ge=32,$e=4,ye=8,ve=~$e,xe=~ye,be=$e|ye,we=0,Ce=4,Oe=8,qe=9,Le=10,Me=11,Se=12,_e=16,Ee=17,Pe=18,Te=19,De=32,Ne=33,Ie=128,Fe=129,Ae=2,Re=4,je=8,Be=4,ze=8,Ge=9,Ue=16,Ye=32,He=128,We=256,Ze=512,Ke=1024,Ve=1025,Je=2048,Qe=4096,Xe=8192,et=8193,tt=8194,nt=8195,ot=16384,rt=ot,lt=16385,st=32768,it=65536,at=Qe|st,ct=Je|Qe|Xe|ot|st|it,ut={action:Be,simple:Ze,block:Ke,comment:Ve,subgrammar:it,alternation:Je,sequence:Qe,repeat:Xe,zeroorone:et,zeroormore:tt,oneormore:nt,positivelookahead:rt,negativelookahead:lt,ngram:st},pt="$|SOF|$",ft="$|NONBLANK|$",mt="$|SOL|$",ht="$|EOL|$",dt="$|ENDLINE|$",kt="$|EMPTY|$",gt="$|NONSPACE|$",$t=void 0,yt="prototype",vt=Object[yt],xt=Object.create,bt=Math.max,wt=Math.min,Ct="toLowerCase",Ot="charAt",qt=vt.toString,Lt=vt.hasOwnProperty,Mt=vt.propertyIsEnumerable,St=1/0,_t=4,Et=8,Pt=16,Tt=32,Dt=33,Nt=34,It=64,Ft=128,At=129,Rt=130,jt=256,Bt=512,zt=1024,Gt=2048,Ut=4096,Yt=Ft|Tt,Ht=Ft|jt,Wt=Gt|jt,Zt=Ft|jt|Gt,Kt={"[object Number]":Tt,"[object String]":Ft,"[object Array]":jt,"[object RegExp]":Gt,"[object Date]":Ut,"[object Function]":zt,"[object Object]":Bt},Vt=/^\s+|\s+$/g,Jt=String[yt].trim?function(e){return e.trim()}:function(e){return e.replace(Vt,"")},Qt=function(e,t){return t.length-e.length},Xt=/\r\n|\r|\n/g,en=/[\-_]/g,tn=0,nn=/([.*+?^${}()|[\]\/\\\-])/g,on=/[&"'<>]/g,rn=/^([.!&\[\]{}()*+?\/|'"]|\s)/,ln="(\\s|\\W|$)",sn=/(l?i?l?)x(l?i?l?)$/,an=/[*+]$/;re.prototype.toString=function(){var e=this;return e.id+"_"+e.line+"_"+e.bline+"_"+(e.block?e.block.name:"0")},ie.$SPC$=/^[\s\u00a0]+/,ie.$NONSPC$=/[^\s\u00a0]/,ie.$NOTEMPTY$=/\S/,ie.$SPACE$=/^\s*/;var cn=h({constructor:function(e,t,n){var o=this;o.$grammar=e,o.$DEF=t||null,o.$ERR=n||null,o.DEF=o.$DEF,o.ERR=o.$ERR,o.$folders=[],o.$matchers=[],o.$subgrammars={}},$grammar:null,$subgrammars:null,$folders:null,$matchers:null,$n$:"name",$t$:"type",$v$:"token",$DEF:null,$ERR:null,DEF:null,ERR:null,dispose:function(){var e=this;return e.$grammar=e.$subgrammars=null,e.$folders=e.$matchers=null,e.$n$=e.$t$=e.$v$=null,e.$DEF=e.$ERR=e.DEF=e.ERR=null,e},token:function(e,t,n){if(t.token2){var o=t.token2[0];return e.pos=t.token2[1],e.sft(),t.token=t.token2[3],t.$eol$=e.eol(),t.$blank$=t.$blank$&&(t.token2[2]||t.$eol$),t.token2=null,o}var r,l,s,i,a,c,u,p,f,m,h,d,k,g,$,y,v,x,b=this,w=b.$grammar,C=w.Style,O=b.DEF,q=b.ERR,o={},L=b.$n$,M=b.$t$,S=b.$v$,_=w.$interleaved,E=w.$parser,P=E.length,T=_?_.length:0,D=t.outer,N=D&&D[2],I=D&&D[1];if(e.sol()&&(t.$eol$&&(t.$blank$&&(t.bline=t.line),t.$eol$=!1,t.line++),t.$blank$=t.bline+1===t.line),t.$actionerr$=!1,t.token=null,i=t.line,a=e.pos,m=!1,d=!0,h=!1,k=!1,D&&b===D[0]){if(o[L]=null,o[M]=O,o[S]=null,I){if(s=new G,X(I,e,N,s))return t.outer=null,{parser:b,state:N};for(e.nxt(1);!e.eol();){if(X(I,e,N,s)){if(e.pos>a)break;return t.outer=null,{parser:b,state:N}}e.nxt(1)}}else e.spc(),e.eol()?k=!0:e.end();return o[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&(k||t.$eol$),o}if(t.stack&&Ue===t.stack.val.type&&e.sol()&&(t.stack=t.stack.prev),(!t.stack||null==t.block)&&e.spc()){if(t.stack&&it===t.stack.val.type)return e.bck(a),r=t.stack.val,t.stack=t.stack.prev,m=X(r,e,t,s),g=""+m,b.$subgrammars[g]?($=b.$subgrammars[g],y=new re(1,n[g]?n[g]:t.status),N=t):($=b,y=new re,N=t),y.outer=[b,m.next,N],{parser:$,state:y,toInner:g};d=!0,k=!0}if(o[L]=null,o[M]=O,o[S]=null,d)for(s=new G,k&&(s.space=[a,e.pos],e.sft()),c=0;d&&(t.stack||P>c)&&!e.eol();){if(p=e.pos,f=t.stack,I){if(e.spc(),X(I,e,N,s))return s.space||e.pos>p?(s.space&&(e.start=s.space[0],e.pos=s.space[1]),o[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&!0,o):(t.outer=null,{parser:D[0],state:N,fromInner:t});e.bck(p)}if(v=!1,T&&!t.block)for(u=0;T>u;u++)if(r=_[u],m=X(r,e,t,s),!1!==m){v=!0;break}if(d&&!v){if(!t.stack&&c>=P)break;t.stack?(r=t.stack.val,t.stack=t.stack.prev):r=E[c++],m=X(r,e,t,s)}if(!1===m){if(r.status&be){t.token=r,k=Q(t,e,s,r)||k,h=!0,d=!1;break}}else{if(m.subgrammar)return g=""+m,b.$subgrammars[g]?($=b.$subgrammars[g],y=new re(1,n[g]?n[g]:t.status),N=t):($=b,y=new re,N=t),y.outer=[b,m.next,N],s.space?(t.token2=[{parser:$,state:y,toInner:g},e.pos,k,t.token],t.token=null,e.start=s.space[0],e.pos=s.space[1],o[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&!0,o):{parser:$,state:y,toInner:g};if(t.stack&&t.stack.prev&&e.eol()&&Ke&t.stack.val.type&&t.block&&t.block.name===t.stack.val.name)for(u=t.stack.prev;u&&Be===u.val.type;)l=u,u=u.prev,x=ee(l,e,t,s),l.status&ye?t.$actionerr$=!0:x&&!0!==m&&l.modifier&&(m=l.modifier);else if(t.stack&&Be===t.stack.val.type)for(;t.stack&&Be===t.stack.val.type;)l=t.stack.val,t.stack=t.stack.prev,x=ee(l,e,t,s),l.status&ye?t.$actionerr$=!0:x&&!0!==m&&l.modifier&&(m=l.modifier);if(!0!==m){d=!1;break}}}return d&&(s.space?(e.start=s.space[0],e.pos=s.space[1],m=!1,s.space=null):e.nxt(1)),o[S]=e.cur(1),!1!==m?(m=m?C[m]||O:O,o[L]=r?r.name:null):h?(m=q,t.status&ke&&H(t,i,a,i,e.pos,r)):m=O,o[M]=m,s.space&&(t.token2=[o,e.pos,k,t.token],t.token=null,e.start=s.space[0],e.pos=s.space[1],o={},o[L]=null,o[M]=O,o[S]=e.cur(1),k=!0),t.$eol$=e.eol(),t.$blank$=t.$blank$&&(k||t.$eol$),o},get:function(e,t){for(var n=t.parser.token(e,t.state,t.inner);n&&n.parser;)n.fromInner&&t.parser!==n.parser&&(t.state.err=n.fromInner.err,t.name&&(t.inner[t.name]=n.fromInner)),n.state.err=t.state.err,n.state.line=t.state.line,n.state.bline=t.state.bline,n.state.$blank$=t.state.$blank$,n.state.$eol$=t.state.$eol$,n.state.$full_parse$=t.state.$full_parse$,t.state=n.state,t.parser=n.parser,t.name=n.toInner,n=t.parser.get(e,t);return n},tokenize:function(e,t,n,o){if(o=o||[],e.eol())t.state.line++,t.state.$blank$&&t.state.bline++;else for(;!e.eol();)o.push(t.parser.get(e,t));return o},parse:function(e,t){var n,r,l,s,i,a,c=(e||"").split(Xt),u=c.length,p=null;if(t=t||de,l=!!(t&ke),s=!!(t&de),r={parser:this,state:new re(0,t),inner:{}},r.state.$full_parse$=!0,o(function(e){c[e]+="\n"},0,u-2),s?p=o(t&ge?function(e,t){r.parser.tokenize(ie(c[e]),r,e,t)}:function(e,t){t.push(r.parser.tokenize(ie(c[e]),r,e))},0,u-1,[]):o(function(e){var t=ie(c[e]);if(t.eol())r.state.line++,r.state.$blank$&&r.state.bline++;else for(;!t.eol();)r.parser.get(t,r)},0,u-1),n=r.state,l&&n.queu)for(;n.queu;)i=n.queu.val,n.queu=n.queu.prev,H(n,i[1],i[2],i[3],i[4],null,i[5]);return a=s&&l?{tokens:p,errors:n.err}:s?p:n.err,se(n),r=n=null,a},autocompletion:function(e,t,n){var o,r,l=e.stack,s={},i=E([e.token],[],s,n);for(t=t||0;l;){if(o=l.val,r=o.type,Xe&r){if(i=E([o],i,s,n),0<o.min&&t<i.length)break}else if((Ze===r||Je===r||at&r)&&(i=E([o],i,s,n),t<i.length))break;l=l.prev}return n&&n.length?n.concat(i):i},dynamic_autocompletion:function(e){return e?_(e)||null:null},subparser:function(e,t){var n=this;return!1===t?Lt.call(n.$subgrammars,e)&&delete n.$subgrammars[e]:t&&(n.$subgrammars[e]=t),n},iterator:function(){},validate:function(){},autocomplete:function(){},indent:function(){},fold:function(){},match:function(){}}),un={Pattern:function(e,t,n){return function(){}},Indented:function(e){return e=e||ie.$NOTEMPTY$,function(t){var n,o,r,l,s,i,a,c,u,p=t.row;if(n=t.line(p),e.test(n)){for(o=t.indentation(n),i=null,s=n.length,c=p+1,u=t.last();u>=c;++c)if(r=t.line(c),l=t.indentation(r),l>o)i=c,a=r.length;else if(e.test(r))break;return i?[p,s,i,a]:void 0}}},Delimited:function(e,t,n,o){return e&&t&&e.length&&t.length?(n=n||s,function(r){var l,s,i,a,c,u,p=r.row,f=r.col;for(l=r.line(p),i=f,a=0;;){var c=0>=i?-1:l.lastIndexOf(e,i-1);if(-1!==c){if(1===a&&f>c)return;if(n(u=r.token(p,c+1))){s=c+e.length;break}i=c-1}else{if(1===a)return;a=1,i=l.length}}return fe(1,r,p,s,u,e,t,n,!0,o)}):function(){}},MarkedUp:function(e,t,n,o,r){return e=e||s,t=t||"<",n=n||">",o=o||"/",r=r||y($(t)+"("+$(o)+"?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)",{g:1}),function(l){l.col=0,l.min=l.first(),l.max=l.last(),l.text=l.line(l.row);for(var s,i,a,c,u,p,f,m,h,d=l.row;;){if(s=ue(l,e,r,t,n,o),!s||l.row!==d||!(i=pe(l,e,r,t,n,o)))return;if(!s[1]&&"autoclosed"!==i)for(a=[l.row,l.col],u=s[2],c=null,p=[];;){if(f=ue(l,e,r,t,n,o),d=l.row,m=l.col-(f?f[0].length:0),!f||!(i=pe(l,e,r,t,n,o)))return!1;if("autoclosed"!==i)if(f[1]){for(h=p.length-1;h>=0;--h)if(p[h]===f[2]){p.length=h;break}if(0>h&&(!u||u===f[2]))return[a[0],a[1],d,m]}else p.push(f[2])}}}}},pn={Pattern:function(e,t,n){return function(){}},Delimited:function(e,t,n,o){return e&&t&&e.length&&t.length?(n=n||s,function(r){var l,s=r.col,i=r.row,a=r.line(i),c=!1,u=e.length,p=t.length;return s>=u&&(1===u&&e===a.charAt(s-1)||e===a.slice(s-u,s))?(l=fe(1,r,i,s,c,e,t,n,!1,o),l?(l=[l[0],l[1]-u,l[0],l[1],l[2],l[3],l[2],l[3]+p],l.match="end"):(l=[i,s-u,i,s],l.match=!1),l):s>=p&&(1===p&&t===a.charAt(s-1)||t===a.slice(s-p,s))?(l=fe(-1,r,i,s-p,c,e,t,n,!1,o),l?(l=[l[0],l[1],l[0],l[1]+u,l[2],l[3],l[2],l[3]+p],l.match="start"):(l=[i,s-p,i,s],l.match=!1),l):void 0}):function(){}},MarkedUp:function(e,t,n,o,r){return function(){}}},fn="undefined"!=typeof CodeMirror?CodeMirror:{Pass:{toString:function(){return"CodeMirror.Pass"}}},mn=/[\w$]/,hn=function(e,t){return t.score-e.score},dn=h(cn,{constructor:function gn(t,n){var r,l=this,i=null,a=null;if(cn.call(l,t,null,"error"),l.DEF=n||l.$DEF,l.ERR=t.Style.error||l.$ERR,l.LC=t.$comments.line?t.$comments.line[0]:null,l.BCS=t.$comments.block?t.$comments.block[0][0]:null,l.BCE=t.$comments.block?t.$comments.block[0][1]:null,l.BCC=l.BCL=t.$comments.block?t.$comments.block[0][2]:null,t.$comments.block&&t.$comments.block.length){r=gn.Type("comment");for(var c=0,u=t.$comments.block.length;u>c;c++)l.$folders.push(gn.Fold.Delimited(t.$comments.block[c][0],t.$comments.block[c][1],r,"comment"))}t.Fold&&Ft&e(t.Fold)?i=t.Fold[Ct]():t.$extra.fold&&(i=t.$extra.fold[Ct]()),a=t.Match&&Ft&e(t.Match)?t.Match[Ct]():t.$extra.match?t.$extra.match[Ct]():i;var p=I(t,1);r=p.length?gn.Type(p,!1):s,i&&(i=i.split("+"),o(function(e,t){var n,o=Jt(t[e]);"braces"===o?l.$folders.push(gn.Fold.Delimited("{","}",r)):"brackets"===o?l.$folders.push(gn.Fold.Delimited("[","]",r)):"parens"===o||"parentheses"===o?l.$folders.push(gn.Fold.Delimited("(",")",r)):"brace"===o||"cstyle"===o||"c"===o?(l.$folders.push(gn.Fold.Delimited("{","}",r)),l.$folders.push(gn.Fold.Delimited("[","]",r))):"indent"===o||"indentation"===o?l.$folders.push(gn.Fold.Indented()):"tags"===o||"markup"===o||"html"===o||"xml"===o?(l.$folders.push(gn.Fold.Delimited("<![CDATA[","]]>",gn.Type(["comment","tag"],!1))),l.$folders.push(gn.Fold.MarkedUp(gn.Type("tag"),"<",">","/"))):-1<(n=o.indexOf(","))&&l.$folders.push(gn.Fold.Delimited(o.slice(0,n),o.slice(n+1),r))},0,i.length-1,i)),a&&(a=a.split("+"),o(function(e,t){var n,o=Jt(t[e]);"braces"===o?l.$matchers.push(gn.Match.Delimited("{","}")):"brackets"===o?l.$matchers.push(gn.Match.Delimited("[","]")):"parens"===o||"parentheses"===o?l.$matchers.push(gn.Match.Delimited("(",")")):"brace"===o||"cstyle"===o||"c"===o?(l.$matchers.push(gn.Match.Delimited("{","}")),l.$matchers.push(gn.Match.Delimited("[","]")),l.$matchers.push(gn.Match.Delimited("(",")"))):"tags"===o||"markup"===o||"html"===o||"xml"===o?l.$matchers.push(gn.Match.MarkedUp(gn.Type("tag"),"<",">","/")):-1<(n=o.indexOf(","))&&l.$matchers.push(gn.Match.Delimited(o.slice(0,n),o.slice(n+1)))},0,a.length-1,a))},LC:null,BCS:null,BCE:null,BCL:null,BCC:null,dispose:function(){var e=this;return e.LC=e.BCS=e.BCE=e.BCL=e.BCC=null,cn[yt].dispose.call(e)},validate:function(e,t,n){if(!e||!e.length)return[];var o,r,l,s,i=this,a=[],c=i.parse(e,ke);if(!c)return a;t=t||{},l=Lt.call(t,"type")?t.type:"error",s=Lt.call(t,"msg")?t.msg:"Syntax Error";for(o in c)Lt.call(c,o)&&(r=c[o],a.push({message:r[4]||s,severity:l,from:n.Pos(r[0],r[1]),to:n.Pos(r[2],r[3])}));return a},autocomplete:function(e,t,o){t=t||{};var r,l,s,i,a,c,u,p,f,m,h=this,d=[],k=Lt.call(t,"prefixMatch")?!!t.prefixMatch:!0,g=Lt.call(t,"inContext")?!!t.inContext:!1,$=Lt.call(t,"dynamic")?!!t.dynamic:!1,y=Lt.call(t,"caseInsensitiveMatch")?!!t.caseInsensitiveMatch:!1,v=e.getCursor(),x=v.ch,b=x,w=x,C=w,O=0,q=h.$grammar.$autocomplete&&h.$grammar.$autocomplete.length?h.$grammar.$autocomplete:null;if($||q){for(c=t.word||mn,l=e.getLine(v.line);b&&c.test(l[Ot](b-1));)--b;if(!k)for(;C<l.length&&c.test(l[Ot](C));)++C;s=l.slice(b,C),i=s[Ct](),a=s.length,u=t.renderer||null,p=!1,f=1e3,r=e.getTokenAt(o.Pos(v.line,b),!0).state.state;var L=function(e,t){var n,o,r,l,c,m,h,d=t.word,g=d.length;return a?g>=a&&(n=t.meta,o=!!d.ci,h=y||o,h?(c=d[Ct](),m=i):(c=d,m=s),(l=c.indexOf(m))>=0&&(!k||0===l)&&(r=h?d.indexOf(s):l,g+n.length>O&&(O=g+n.length),e.push({text:d,name:d,meta:n,start:0>r?l:r,end:(0>r?l:r)+s.length,match:s,displayText:d+" ["+n+"]",render:u,score:1e3-10*(g-a)-5*(0>r?l+3:r)}))):(n=t.meta,g+n.length>O&&(O=g+n.length),e.push({text:d,name:d,meta:n,start:0,end:0,match:"",displayText:d+" ["+n+"]",render:u,score:p?1e3-10*g:f--})),e};m=$?h.dynamic_autocompletion(r):null,g&&(p=!1,d=n(h.autocompletion(r,null,m),L,d)),m&&!m.length&&(m=null),d.length||!m&&!q||(p=!0,d=n((m||[]).concat(q||[]),L,d)),d.length&&(d=d.sort(hn)),d.maxlen=O}return{list:d,from:o.Pos(v.line,b),to:o.Pos(v.line,C)}},indent:function(e,t,n,o,r,l){return l.Pass},iterator:function(e,t){var n=e.getOption("tabSize");return{row:0,col:0,min:0,max:0,line:function(t){return e.getLine(t)},first:function(){return e.firstLine()},last:function(){return e.lastLine()},next:function(){var e=this;if(!(e.row>=e.max))return e.col=0,e.row++,!0},prev:function(){var e=this;if(!(e.row<=e.min))return e.col=0,e.row--,!0},indentation:function(e){return ae(e,null,n)},state:function(n,o){var r=e.getTokenAt(t.Pos(n,o||0)).state;return r.state||r},token:function(n,o){return e.getTokenTypeAt(t.Pos(n,o||0))},tokens:function(t){return e.getLineTokens(t)}}},fold:function(e,t,n){var o,r,l,s=this,i=s.$folders,a=i.length;if(a)for(r=s.iterator(e,n),r.row=t.line,r.col=t.ch||0,o=0;a>o;o++)if((l=i[o](r))||!1===l)return l},match:function(e,t,n){var o,r,l,s=this,i=s.$matchers,a=i.length;if(a)for(r=s.iterator(e,n),r.row=t.line,r.col=t.ch||0,o=0;a>o;o++)if((l=i[o](r))||!1===l)return l}});dn.Type=ce,dn.Fold=un,dn.Match=pn;var kn={VERSION:"4.2.1",clone:r,extend:l,pre_process:F,parse:A,getMode:he,Parser:dn};return kn});