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

CodeMirror (v.0) Grammar (v."] ,"open_tag" : "RE::/<([_a-zA-Z][_a-zA-Z0-9\\-]*)/" ,"close_tag" : "RE::/<\\/([_a-zA-Z][_a-zA-Z0-9\\-]*)>/" - ,"open_script_tag" : "RE::/<(script)/" - ,"open_style_tag" : "RE::/<(style)/" + ,"open_script_tag" : "RE::/<(script)\\b/" + ,"open_style_tag" : "RE::/<(style)\\b/" ,"close_script_tag" : "RE::/<\\/(script)>/" ,"close_style_tag" : "RE::/<\\/(style)>/" ,"attribute" : "RE::/[_a-zA-Z][_a-zA-Z0-9\\-]*/" ,"string:line-block" : [["\""], ["'"]] ,"number" : ["RE::/[0-9]\\d*/", "RE::/#[0-9a-fA-F]+/"] ,"atom" : ["RE::/&#x[a-fA-F\\d]+;/", "RE::/&#[\\d]+;/", "RE::/&[a-zA-Z][a-zA-Z0-9]*;/"] + ,"type_att" : "RE::/type\\b/" ,"text" : "RE::/[^<&]+/" // actions @@ -63,11 +64,12 @@ var htmlmixed_grammar = { // Syntax model (optional) "Syntax" : { - "javascript" : {"subgrammar":"javascript"} + "otherscript" : {"subgrammar":"otherscript"} + ,"javascript" : {"subgrammar":"javascript"} ,"css" : {"subgrammar":"css"} ,"tag_att" : "'id'.attribute unique_att '=' string unique_id | attribute unique_att '=' (string | number)" ,"style_tag" : "(open_style_tag.tag tag_ctx tag_opened tag_att* '>'.tag \\tag_ctx) css close_style_tag.tag tag_closed" - ,"script_tag" : "(open_script_tag.tag tag_ctx tag_opened tag_att* '>'.tag \\tag_ctx) javascript close_script_tag.tag tag_closed" + ,"script_tag" : "open_script_tag.tag tag_ctx tag_opened (type_att! tag_att)* (type_att.attribute unique_att '=' ('\"text/javascript\"'.string (type_att! tag_att)*'>'.tag \\tag_ctx javascript | string (type_att! tag_att)* '>'.tag \\tag_ctx otherscript) close_script_tag.tag tag_closed | '>'.tag \\tag_ctx javascript close_script_tag.tag tag_closed)" ,"start_tag" : "open_tag.tag tag_ctx tag_opened tag_att* ('>'.tag | '/>'.tag tag_autoclosed) \\tag_ctx" ,"end_tag" : "close_tag.tag tag_closed" ,"htmlmixed" : "(^^1 declaration? doctype?) (declaration.error out_of_place | doctype.error out_of_place | comment | meta | cdata | style_tag | script_tag | start_tag | end_tag | atom | text)*"