diff --git a/beeld.config b/beeld.config index 3c4d1df..dd99b62 100644 --- a/beeld.config +++ b/beeld.config @@ -49,7 +49,7 @@ tasks =[{}] replace =[{}] "@@ROOT@@" = "this" - "@@VERSION@@" = "4.0.0" + "@@VERSION@@" = "4.0.1" "@@MODULE@@" = "CodeMirrorGrammar" @ diff --git a/build/codemirror_grammar.js b/build/codemirror_grammar.js index 2db1775..0324896 100644 --- a/build/codemirror_grammar.js +++ b/build/codemirror_grammar.js @@ -1,7 +1,7 @@ /** * * CodeMirrorGrammar -* @version: 4.0.0 +* @version: 4.0.1 * * Transform a grammar specification in JSON format, into a syntax-highlight parser mode for CodeMirror * https://github.com/foo123/codemirror-grammar @@ -23,7 +23,7 @@ else if ( !(name in root) ) /* Browser/WebWorker/.. */ "use strict"; /** * EditorGrammar Codebase -* @version: 4.0.0 +* @version: 4.0.1 * * https://github.com/foo123/editor-grammar **/ @@ -533,7 +533,10 @@ function esc_re( s ) function new_re( re, fl ) { - return new RegExp(re, fl||''); + fl = fl || {l:0,x:0,i:0,g:0}; + var re = new RegExp(re, (fl.g?'g':'')+(fl.i?'i':'')); + re.xflags = fl; + return re; } function get_delimited( src, delim, esc, collapse_esc ) @@ -587,7 +590,7 @@ function group_replace( pattern, token, raw, in_regex ) while ( i 1 ) { is_regex = has_prefix( tmp[i][1], RegExpID ); - is_regex_pattern = is_regex && regex_pattern_re.test(tmp[i][1]); - if ( T_REGEX === t1.ptype && T_STR === get_type( tmp[i][1] ) && (is_regex_pattern || !is_regex) ) + is_regex_pattern = is_regex && /*regex_pattern_re*/extended_regex_re.test(tmp[i][1]); + if ( (T_REGEX === t1.ptype) && (T_STR === get_type( tmp[i][1] )) && (is_regex_pattern || !is_regex) ) { if ( is_regex_pattern ) { @@ -1488,7 +1502,7 @@ function parse_peg_bnf_notation( tok, Lex, Syntax ) { if ( t.pos < t.length && 'i' === t[CHAR](t.pos) ) { t.pos++; fl = 'i'; } curr_token = '/' + literal + '/' + fl; - if ( !Lex[curr_token] ) Lex[curr_token] = { type:'simple', tokens:new_re("^("+literal+")",fl) }; + if ( !Lex[curr_token] ) Lex[curr_token] = { type:'simple', tokens:new_re("^("+literal+")",{l:0,x:0,i:'i'===fl}) }; sequence.push( curr_token ); } /*} @@ -1506,7 +1520,7 @@ function parse_peg_bnf_notation( tok, Lex, Syntax ) Syntax[ curr_token ] = { type:'*' === c ? 'zeroOrMore' : ('+' === c ? 'oneOrMore' : 'zeroOrOne'), tokens:[prev_token] - } + }; sequence[sequence.length-1] = curr_token; } else token += c; @@ -1563,7 +1577,7 @@ function parse_peg_bnf_notation( tok, Lex, Syntax ) Syntax[ curr_token ] = { type:'!' === c ? 'negativeLookahead' : 'positiveLookahead', tokens:[prev_token] - } + }; sequence[sequence.length-1] = curr_token; } else token += c; @@ -2210,7 +2224,7 @@ function t_match( t, stream, eat, any_match ) if ( end.regex_pattern ) { // dynamicaly-created regex with substistution group as well - m = group_replace( end, match[1], 0, 1 ); + m = group_replace( end, match[1]/*, 0, 1*/ ); end = new matcher( P_SIMPLE, name+'_End', get_re(m, end.regex_pattern, {}), T_REGEX ); } else @@ -2243,8 +2257,8 @@ function t_match( t, stream, eat, any_match ) } else if ( T_REGEX === type ) { - m = stream.slice( stream.pos ).match( pattern[0] ); - if ( m && 0 === m.index ) + m = pattern[0].xflags.l ? stream.match( pattern[0] ) : stream.slice( stream.pos ).match( pattern[0] ); + if ( m && (0 === m.index) ) { if ( false !== eat ) stream.mov( m[ pattern[1]||0 ].length ); return [ key, pattern[1] > 0 ? m[pattern[1]] : m ]; @@ -3361,11 +3375,12 @@ function State( unique, s ) } self.$eol$ = true; self.$blank$ = true; } - // make sure to generate a string which will cover most cases where state needs to be updated by the editor - self.toString = function() { - return self.id+'_'+self.line+'_'+self.bline+'_'+(self.block?self.block.name:'0'); - }; } +// make sure to generate a string which will cover most cases where state needs to be updated by the editor +State.prototype.toString = function( ){ + var self = this; + return self.id+'_'+self.line+'_'+self.bline+'_'+(self.block?self.block.name:'0'); +}; function state_backup( state, stream, backup, with_errors ) { @@ -4257,7 +4272,7 @@ var Folder = { ,MarkedUp: function( T, L, R, S, M ) { T = T || TRUE; L = L || "<"; R = R || ">"; S = S || "/"; - M = M || new_re( esc_re(L) + "(" + esc_re(S) + "?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)", "g" ); + M = M || new_re( esc_re(L) + "(" + esc_re(S) + "?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)", {g:1} ); return function fold_markup( iter ) { iter.col = 0; iter.min = iter.first( ); iter.max = iter.last( ); @@ -4389,7 +4404,7 @@ var Matcher = { /** * * CodeMirrorGrammar -* @version: 4.0.0 +* @version: 4.0.1 * * Transform a grammar specification in JSON format, into a syntax-highlight parser mode for CodeMirror * https://github.com/foo123/codemirror-grammar @@ -4932,7 +4947,7 @@ function get_mode( grammar, DEFAULT, CodeMirror ) [/DOC_MARKDOWN]**/ var CodeMirrorGrammar = { - VERSION: "4.0.0", + VERSION: "4.0.1", // clone a grammar /**[DOC_MARKDOWN] diff --git a/build/codemirror_grammar.min.js b/build/codemirror_grammar.min.js index 9c69668..8802f9b 100644 --- a/build/codemirror_grammar.min.js +++ b/build/codemirror_grammar.min.js @@ -1,11 +1,11 @@ /** * * CodeMirrorGrammar -* @version: 4.0.0 +* @version: 4.0.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=xt:!0===e||!1===e||e instanceof Boolean?t=_t:at===e?t=vt:(t=Rt[mt.call(e)]||bt,t=wt===t||e instanceof Number?isNaN(e)?Ot:isFinite(e)?wt:Ct:Lt===t||e instanceof String?1===e.length?St:Lt:Et===t||e instanceof Array?Et:Pt===t||e instanceof RegExp?Pt:Dt===t||e instanceof Date?Dt:qt===t||e instanceof Function?qt:Tt===t?Tt:bt),t}function t(e,t,n,r){var o,s,l,i,a,u,c=e.length;if(arguments.length<4&&(r=c-1),0>r&&(r+=c),arguments.length<3&&(n=0),n>r)return[];if(n===r)return[t(e[n],n,n,r)];for(l=r-n+1,i=15&l,a=1&i,u=new Array(l),a&&(u[0]=t(e[n],n,n,r)),o=a;i>o;o+=2)s=n+o,u[o]=t(e[s],s,n,r),u[o+1]=t(e[s+1],s+1,n,r);for(o=i;l>o;o+=16)s=n+o,u[o]=t(e[s],s,n,r),u[o+1]=t(e[s+1],s+1,n,r),u[o+2]=t(e[s+2],s+2,n,r),u[o+3]=t(e[s+3],s+3,n,r),u[o+4]=t(e[s+4],s+4,n,r),u[o+5]=t(e[s+5],s+5,n,r),u[o+6]=t(e[s+6],s+6,n,r),u[o+7]=t(e[s+7],s+7,n,r),u[o+8]=t(e[s+8],s+8,n,r),u[o+9]=t(e[s+9],s+9,n,r),u[o+10]=t(e[s+10],s+10,n,r),u[o+11]=t(e[s+11],s+11,n,r),u[o+12]=t(e[s+12],s+12,n,r),u[o+13]=t(e[s+13],s+13,n,r),u[o+14]=t(e[s+14],s+14,n,r),u[o+15]=t(e[s+15],s+15,n,r);return u}function n(e,t,n,r,o){var s,l,i,a,u,c=e.length,p=n;if(arguments.length<5&&(o=c-1),0>o&&(o+=c),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,u=1&a,u&&(p=t(p,e[r],r)),s=u;a>s;s+=2)l=r+s,p=t(t(p,e[l],l),e[l+1],l+1);for(s=a;i>s;s+=16)l=r+s,p=t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(p,e[l],l),e[l+1],l+1),e[l+2],l+2),e[l+3],l+3),e[l+4],l+4),e[l+5],l+5),e[l+6],l+6),e[l+7],l+7),e[l+8],l+8),e[l+9],l+9),e[l+10],l+10),e[l+11],l+11),e[l+12],l+12),e[l+13],l+13),e[l+14],l+14),e[l+15],l+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,s,l=n-t+1,i=15&l,a=1&i;for(a&&e(t,r,t,n),o=a;i>o;o+=2)s=t+o,e(s,r,t,n),e(++s,r,t,n);for(o=i;l>o;o+=16)s=t+o,e(s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n);return r}function o(t,n){var r,s,l,i,a=e(t),u=0;if(wt===e(n)?n>0?(u=n,n=!0):n=!1:n=!1!==n,Tt===a){s={};for(l in t)t[ct](l)&&t[pt](l)&&(r=e(t[l]),Tt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:Et===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Dt===r?s[l]=new Date(t[l]):Lt&r?s[l]=t[l].slice():wt&r?s[l]=0+t[l]:s[l]=t[l])}else if(Et===a)for(i=t.length,s=new Array(i),l=0;i>l;l++)r=e(t[l]),Tt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:Et===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Dt===r?s[l]=new Date(t[l]):Lt&r?s[l]=t[l].slice():wt&r?s[l]=0+t[l]:s[l]=t[l];else s=Dt===a?new Date(t):Lt&a?t.slice():wt&a?0+t:t;return s}function s(){var t,n,r,l,i,a,u,c,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(l in t)if(t[ct](l)&&t[pt](l))if(n[ct](l)&&n[pt](l)){if(p=e(n[l]),f=e(t[l]),Tt===p&&Tt===f)n[l]=s(n[l],t[l]);else if(Et===p&&Et===f){if(u=n[l],c=t[l],a=c.length,!a)continue;if(u.length)for(i=0;a>i;i++)0>u.indexOf(c[i])&&u.push(c[i]);else n[l]=c.slice()}}else n[l]=o(t[l]);return n}function l(){return!0}function i(t,n){return n||Et!==e(t)?[t]:t}function a(t,n){return t=i(t),(n||Et!==e(t[0]))&&(t=[t]),t}function u(t,n){return Lt&e(n)&&Lt&e(t)&&n.length&&n.length<=t.length&&n===t.substr(0,n.length)}function c(e,t,n){return n?e[t]=at:delete e[t],e}function p(e){return(e||"id_")+ ++Yt}function f(e){return(e||"uuid")+"_"+ ++Yt+"_"+(new Date).getTime()}function m(){var t,n,r,o,s,l,i=arguments,a=i.length;for(t=i[0]||{},s=1;a>s;s++)if(n=i[s],Tt===e(n))for(o in n)n[ct](o)&&n[pt](o)&&(r=n[o],l=e(r),wt&l?t[o]=0+r:Dt&l?t[o]=new Date(r):Nt&l?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[ct](o)||(t[o]=function(){}),n=t[o],delete t[o],n[ut]=m(ht(e[ut]),t),n[ut][o]=n,n}function g(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"}function k(e){return"&#"+e.charCodeAt(0)+";"}function d(e,t){return e.replace(Wt,t?g:k)}function $(e){return e.replace(Ht,"\\$1")}function y(e,t){return new RegExp(e,t||"")}function b(e,t,n,r){var o,s,l,i,a=e.pos,u=e.length,c="",p=!!n;if(p){for(r=!!r,s=!1,i=0;u>a&&(o=e[$t](a++),t!==o||s);)l=n===o,s=!s&&l,r?(l&&i++,(!l||2&i)&&(c+=o,i=0)):c+=o;2&i&&(c+=n)}else for(;u>a&&(o=e[$t](a++),t!==o);)c+=o;return e.pos=a,c}function v(t,n,r,o){var s,l,i,a,u,c=!0===r?0:1,p=o?"\\":"$",f=o?92:36;for(Lt&e(n)&&(o&&(n=$(n)),n=[n,n,n],c=0),l=t.length,u="",s=0;l>s;)i=t[$t](s),l>s+1&&p===i?(a=t.charCodeAt(s+1),f===a?(u+=p,s+=2):a>=48&&57>=a?(u+=n[c+a-48]||"",s+=2):(u+=i,s+=1)):(u+=i,s+=1);return u}function x(t,n,r,o){if(!t||(wt|Pt)&e(t))return t;var s,l=n?n.length||0:0,i="";if(Lt&e(o)?i=o:o&&(i=Kt),l&&n===t.substr(0,l)){var a,u,c,s,p,f=t.substr(l),m=f[$t](0),h="";for(s=f.length;s--&&(p=f[$t](s),m!==p);)"i"===p.toLowerCase()&&(h="i");return a=f.substring(1,s),u="^("+a+")",r[u]||(c=y(u,h),r[u]=c),r[u]}return i?(u="^("+$(t)+")"+i,r[u]||(c=y(u,h),r[u]=c),r[u]):t}function w(n,r,o){var s,l="";return Lt&e(r)?l=r:r&&(l=Kt),s=t(n.sort(zt),$).join("|"),[y("^("+s+")"+l,o?"i":""),1]}function C(t,n,r,o){var s=e(n);if(wt===s)return n;if(o[t])return o[t];r=r||0;var l,i=0;return n&&n.isCharList&&(i=1,c(n,"isCharList")),l=xt===s?new I(Se,t,n,xt,r):St===s?new I(Se,t,n,St,r):At&s?new I(Se,t,n,Pt,r):Lt&s?new I(Se,t,n,i?Mt:Lt,r):n,o[t]=l}function O(t,n,r,o,s,l,a,c){if(a[t])return a[t];var p,f,m,h,g,k,d,$=0,y=0,b=1,v=Lt&e(o)?!0:!!o;if(p=i(n),m=p.length,1===m)d=C(t,x(p[0],r,l,o),0,a);else if(m>1){for(h=(m>>>1)+1,f=0;h>=f;f++)g=e(p[f]),k=e(p[m-1-f]),St===g&&St===k||(b=0),Et&g||Et&k?$=1:(Pt&g||Pt&k||u(p[f],r)||u(p[m-1-f],r))&&(y=1);if(b&&!v)p=p.slice().join(""),p.isCharList=1,d=C(t,p,0,a);else if(!v||$||y)if($||y){for(f=0;m>f;f++)Et&e(p[f])?p[f]=O(t+"_"+f,p[f],r,o,s,l,a):p[f]=C(t+"_"+f,x(p[f],r,l),f,a);d=m>1?new I(Me,t,p):p[0]}else{for(c&&(c.keywords=i(n).slice()),p=p.sort(zt),f=0;m>f;f++)p[f]=C(t+"_"+f,x(p[f],r,l),f,a);d=m>1?new I(Me,t,p):p[0]}else c&&(c.keywords=i(n).slice()),d=C(t,w(p,o,s),0,a)}return a[t]=d}function _(t,n,o,s,l){if(l[t])return l[t];var i=a(n),c=[],p=[];return r(function(n){var r,a,f,m;r=C(t+"_0_"+n,x(i[n][0],o,s),n,l),i[n].length>1?(f=u(i[n][1],o),m=f&&Vt.test(i[n][1]),Pt!==r.ptype||Lt!==e(i[n][1])||!m&&f?a=C(t+"_1_"+n,x(i[n][1],o,s),n,l):m?(a=new String(i[n][1]),a.regex_pattern=o):a=i[n][1]):a=r,c.push(r),p.push(a)},0,i.length-1),l[t]=new I(Ee,t,[c,p])}function L(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],s=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,s]))},0,n.length-1)}function S(e,n,r,o){var s=e.meta||r,l=!(!e.caseInsesitive&&!e.ci),i=t(n,function(e){return{word:e,meta:s,ci:l}});return o.autocomplete=(o.autocomplete||[]).concat(i),i}function M(t){t.Lex||(t.Lex={}),t.Syntax||(t.Syntax={});var n,r,o,l,i,a,u,p,f,m,h,g=t.Lex,k=t.Syntax,d=[g,k],$=d.length;for(h=0;$>h;){m=d[h++];for(o in m)m[ct](o)&&(n=o.split(":"),r=n[1]&&Bt(n[1]).length?Bt(n[1]):null,n=Bt(n[0]),n.length||(n=o,r=null),n!==o&&(m[n]=m[o],c(m,o),r&&(r=r[dt](),l=m[n],i=e(l),Tt===i?m[n].type||(m[n].type=r):(m[n]={type:r},"error"===r?(m[n].type="action",m[n].error=l):"nop"===r?(m[n].type="action",m[n].nop=!0):"group"===r?(m[n].type="sequence",m[n].tokens=l):"action"===r&&Lt===i?m[n][l]=!0:m[n].tokens=l))),g===m&&(It&e(m[n])&&(m[n]={type:"simple",tokens:m[n]}),l=m[n],l.type&&(p=l.type=l.type[dt](),"line-block"===p?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===p?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===p&&(l.type="block",l.multiline=!0,l.escape="\\"))))}m=g;for(n in m)if(m[ct](n))for(l=m[n];l.extend;)a=l.extend,c(l,"extend"),u=g[a],u&&(It&e(u)&&(u=g[a]={type:"simple",tokens:u}),l=s(u,l));m=g;for(n in m)m[ct](n)&&(l=m[n],l.type?(p=l.type=l.type[dt](),"line-block"===p?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===p?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===p&&(l.type="block",l.multiline=!0,l.escape="\\")):l["escaped-line-block"]?(l.type="block",l.multiline=!1,l.escape||(l.escape="\\"),l.tokens=l["escaped-line-block"],c(l,"escaped-line-block")):l["escaped-block"]?(l.type="block",l.multiline=!0,l.escape||(l.escape="\\"),l.tokens=l["escaped-block"],c(l,"escaped-block")):l["line-block"]?(l.type="block",l.multiline=!1,l.escape=!1,l.tokens=l["line-block"],c(l,"line-block")):l.comment?(l.type="comment",l.escape=!1,l.tokens=l.comment,c(l,"comment")):l.block?(l.type="block",l.tokens=l.block,c(l,"block")):l.simple?(l.type="simple",l.tokens=l.simple,c(l,"simple")):l.nop?(l.type="action",l.action=["nop",l.nop,!1],l.nop=!0):l.error?(l.type="action",l.action=["error",l.error,!!l["in-context"]],c(l,"error")):l[ct]("context")?(l.type="action",l.action=[l.context?"context-start":"context-end",l.context,!!l["in-context"]],c(l,"context")):l.indent?(l.type="action",l.action=["indent",l.indent,!!l["in-context"]],c(l,"indent")):l.outdent?(l.type="action",l.action=["outdent",l.outdent,!!l["in-context"]],c(l,"outdent")):l.unique?(l.type="action",l.action=["unique",Lt&e(l.unique)?["_DEFAULT_",l.unique]:l.unique,!!l["in-context"]],c(l,"unique")):l.push?(l.type="action",l.action=["push",l.push,!!l["in-context"]],c(l,"push")):l[ct]("pop")?(l.type="action",l.action=["pop",l.pop,!!l["in-context"]],c(l,"pop")):l.type="simple","action"===l.type?l.ci=!(!l.caseInsesitive&&!l.ci):"block"===l.type||"comment"===l.type?(l.multiline=l[ct]("multiline")?!!l.multiline:!0,Lt&e(l.escape)||(l.escape=!1)):"simple"===l.type&&(l.meta=l.autocomplete&&Lt&e(l.meta)?l.meta:null,l.ci=!(!l.caseInsesitive&&!l.ci)));m=k;for(n in m)m[ct](n)&&(l=m[n],Tt!==e(l)||l.type?l.type&&(p=l.type=l.type[dt](),"group"===p&&l.match?(i=e(l.match),Lt&i?(f=l.match[dt](),"alternation"===f||"either"===f?(l.type="alternation",c(l,"match")):"sequence"===f||"all"===f?(l.type="sequence",c(l,"match")):"zeroorone"===f?(l.type="zeroOrOne",c(l,"match")):"zeroormore"===f?(l.type="zeroOrMore",c(l,"match")):"oneormore"===f?(l.type="oneOrMore",c(l,"match")):(l.type="sequence",c(l,"match"))):Et&i&&(l.type="repeat",l.repeat=l.match,c(l,"match"))):"either"===p?l.type="alternation":"all"===p?l.type="sequence":"lookahead"===p?l.type="positiveLookahead":"grammar"===p&&(l.type="subgrammar"),"subgrammar"!==l.type||l.tokens||(l.tokens=n)):l.ngram||l["n-gram"]?(l.type="ngram",l.tokens=l.ngram||l["n-gram"],l["n-gram"]?c(l,"n-gram"):c(l,"ngram")):l.sequence||l.all?(l.type="sequence",l.tokens=l.sequence||l.all,l.all?c(l,"all"):c(l,"sequence")):l.alternation||l.either?(l.type="alternation",l.tokens=l.alternation||l.either,l.either?c(l,"either"):c(l,"alternation")):l.zeroOrOne?(l.type="zeroOrOne",l.tokens=l.zeroOrOne,c(l,"zeroOrOne")):l.zeroOrMore?(l.type="zeroOrMore",l.tokens=l.zeroOrMore,c(l,"zeroOrMore")):l.oneOrMore?(l.type="oneOrMore",l.tokens=l.oneOrMore,c(l,"oneOrMore")):l.positiveLookahead||l.lookahead?(l.type="positiveLookahead",l.tokens=l.positiveLookahead||l.lookahead,l.lookahead?c(l,"lookahead"):c(l,"positiveLookahead")):l.negativeLookahead?(l.type="negativeLookahead",l.tokens=l.negativeLookahead,c(l,"negativeLookahead")):(l.subgrammar||l.grammar)&&(l.type="subgrammar",l.tokens=l.subgrammar||l.grammar,l.subgrammar?c(l,"subgrammar"):c(l,"grammar")));return t}function E(t,n,r){if(r=r||{},n=n||[],!t||!t.length)return n;var o,s,l,i,a,u,c;for(o=0,s=t.length;s>o;o++)if(a=t[o])if(Ie===a.type)if(a.autocompletions)for(l=0,i=a.autocompletions.length;i>l;l++)c=a.autocompletions[l],r[ct]("w_"+c.word)||(n.push(c),r["w_"+c.word]=1);else Lt===a.token.ptype&&Lt&e(a.token.pattern)&&a.token.pattern.length>1&&(r[ct]("w_"+a.token.pattern)||(n.push({word:""+a.token.pattern,meta:a.name,ci:!!a.ci}),r["w_"+a.token.pattern]=1));else if(Be===a.type)E(a.token,n,r);else if(Qe&a.type){l=0,i=a.token.length;do E([u=a.token[l++]],n,r);while(i>l&&(Ue&u.type&&1>u.min||Te===u.type))}else Ue&a.type&&E([a.token[0]],n,r);return n}function T(t,n,r,o){for(var s;Lt&e(s=n[t]||r[t]);)t=s;return o?t:n[t]||r[t]||t}function q(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];Jt.test(o)&&Jt.test(r)&&r===o||n.push(o)},1,e.length-1,[e[0]]):e}function P(n,r,s){var l,i,a,u,c,p,f,m,h,g,k,d,v,x,w,C=!1;if(w=n.modifier?n.modifier:null,m=new String(Bt(n)),m.pos=0,1===m.length)d=""+n,r[d]||s[d]||(r[d]={type:"simple",tokens:n}),n=d;else{for(l=[],i=[],a="",v=[];m.posc[0]&&(c[0]=0),2>c.length?c.push(c[0]):c[1].length?c[1]=parseInt(c[1],10)||yt:c[1]=yt,0>c[1]&&(c[1]=0),k=i[i.length-1],d=""+k+["{",c[0],",",isFinite(c[1])?c[1]:"","}"].join(""),s[d]||(s[d]={type:"repeat",repeat:[c[0],c[1]],tokens:[k]}),i[i.length-1]=d):a+=h;else{if("}"===h){a+=h;continue}"&"===h||"!"===h?i.length?(k=i[i.length-1],d=""+k+h,s[d]||(s[d]={type:"!"===h?"negativeLookahead":"positiveLookahead",tokens:[k]}),i[i.length-1]=d):a+=h:"|"===h?(C=!1,i=q(i),i.length>1?(d=""+i.join(" "),s[d]||(s[d]={type:"sequence",tokens:i}),l.push(d)):i.length?l.push(i[0]):a+=h,i=[]):"("===h?(v.push([i,l,a]),i=[],l=[],a=""):")"===h&&(i=q(i),i.length>1?(d=""+i.join(" "),s[d]||(s[d]={type:"sequence",tokens:i}),l.push(d)):i.length&&l.push(i[0]),i=[],l=q(l,1),l.length>1?(d=""+l.join(" | "),s[d]||(s[d]={type:"alternation",tokens:l})):l.length&&(d=l[0]),l=[],x=v.pop(),i=x[0],l=x[1],a=x[2],k=d,d="("+k+")",s[d]||(s[d]=o(T(k,r,s))),i.push(d))}}else a+=h;a.length&&(C?(i.length&&(k=i[i.length-1],d=k+"."+a,p=r[d]||s[d],p||(f=T(k,r,s),s[d]=Lt&e(f)?new String(f):o(f),s[d].modifier=a),i[i.length-1]=d),C=!1):"0"===a?(r[lt]||(r[lt]={type:"simple",tokens:0}),i.push(lt)):"^^"===a?(r[tt]||(r[tt]={type:"simple",tokens:qe}),i.push(tt)):"^^1"===a?(r[nt]||(r[nt]={type:"simple",tokens:Pe}),i.push(nt)):"^"===a?(r[rt]||(r[rt]={type:"simple",tokens:Fe}),i.push(rt)):"$"===a?(r[ot]||(r[ot]={type:"simple",tokens:De}),i.push(ot)):(r[a]||s[a]||(r[a]={type:"simple",tokens:a}),i.push(a))),a="",i=q(i),i.length>1?(d=""+i.join(" "),s[d]||(s[d]={type:"sequence",tokens:i}),l.push(d)):i.length&&l.push(i[0]),i=[],l=q(l,1),l.length>1?(d=""+l.join(" | "),s[d]||(s[d]={type:"alternation",tokens:l}),n=d):l.length&&(n=l[0]),l=[]}return w&&(r[n]||s[n])&&((r[n]||s[n]).modifier=w),n}function D(o,s,l,u,c,p,f,m,h,g,k){var d,$,y,b,v,x,w,C=null,M=null,E=null;if(qe===o||Pe===o||Fe===o||De===o)return new B(o,qe===o?tt:Pe===o?$T_FBNL$:Fe===o?rt:ot,o,M);if(!1===o||0===o)return new B(Ne,lt,0,M);if(""===o)return new B(Ae,it,"",M);if(null===o)return new B(Ie,st,xt,M,E);if(Et&e(o)&&(y=o,o="NGRAM_"+y.join("_"),u[o]||(u[o]={type:"ngram",tokens:y})),o=""+o,m[o])return m[o];if(v=T(o,l,u),Lt&e(v)&&(v=P(v,l,u),v=l[v]||u[v]||null),!v)return null;if(d=v.type?et[v.type[dt]().replace(Gt,"")]||Ie:Ie,M=v.msg||null,E=v.modifier||null,$=v.tokens,Ie&d){if(qe===$||Pe===$||Fe===$||De===$||!1===$||0===$)return C=new B($||Ne,o,$||0,M),m[o]=C,C;if(""===$)return C=new B(Ae,o,"",M),m[o]=C,C;if(null===$)return C=new B(Ie,o,xt,M,E),m[o]=C,C;if(!$)return null}if(Te&d)v[ct]("action")?"nop"===v.action[0]?v.action[0]=ye:"error"===v.action[0]?v.action[0]=be:"context-start"===v.action[0]?v.action[0]=xe:"context-end"===v.action[0]?v.action[0]=we:"push"===v.action[0]?v.action[0]=Ce:"pop"===v.action[0]?v.action[0]=Oe:"unique"===v.action[0]?v.action[0]=ve:"indent"===v.action[0]?v.action[0]=_e:"outdent"===v.action[0]&&(v.action[0]=Le):v[ct]("nop")?v.action=[ye,v.nop,!!v["in-context"]]:v[ct]("error")?v.action=[be,v.error,!!v["in-context"]]:v[ct]("context")?v.action=[v.context?xe:we,v.context,!!v["in-context"]]:v[ct]("context-start")?v.action=[xe,v["context-start"],!!v["in-context"]]:v[ct]("context-end")?v.action=[we,v["context-end"],!!v["in-context"]]:v[ct]("push")?v.action=[Ce,v.push,!!v["in-context"]]:v[ct]("pop")?v.action=[Oe,v.pop,!!v["in-context"]]:v[ct]("unique")?v.action=[ve,Lt&e(v.unique)?["_DEFAULT_",v.unique]:v.unique,!!v["in-context"]]:v[ct]("indent")?v.action=[_e,v.indent,!!v["in-context"]]:v[ct]("outdent")&&(v.action=[Le,v.outdent,!!v["in-context"]]),v.nop&&(v.action[0]=ye),C=new B(Te,o,v.action.slice(),M,E),C.ci=!!v.caseInsensitive||v.ci,m[o]=C;else if($=i($),Ie&d){w=v.autocomplete?S(v,Nt&e(v.autocomplete)?i(v.autocomplete):$,o,k):null;var q={};if(x="undefined"!=typeof v.combine?v.combine:!!(Et&e(v.tokens)),C=new B(Ie,o,O(o,$.slice(),s,x,!(!v.caseInsensitive&&!v.ci),p,f,q),M,E,null,w),q.keywords&&(C.keywords=q.keywords.join("|")),m[o]=C,null!=v.except){var F,N,A=i(v.except),I=A.length,R=[];for(F=0;I>F;F++)A[F]&&(N=D(A[F],s,l,u,c,p,f,m,h,g,k),N&&R.push(N));R.length&&(C.except=R)}}else Re&d?(je===d&&L(v,g),C=new B(d,o,_(o,$.slice(),s,p,f),M),C.empty=v[ct]("empty")?!!v.empty:!0,C.mline=v[ct]("multiline")?!!v.multiline:!0,C.esc=v[ct]("escape")?v.escape:!1,C.inter=!!c[o+".inside"],je===d&&v.interleave&&h.push(U(C)),E&&(C.modifier=E),m[o]=C):Xe&d&&(Je===d?m[o]=new B(Je,o,$,M,E):Ve===d?(b=a($),C=t(b,function(e,t){return new B(Ve,o+"_NGRAM_"+t,null,M,E)}),m[o]=C,r(function(e){C[e].token=i(n(b[e],function(e,t){return e.concat(D(t,s,l,u,c,p,f,m,h,g,k))},[]))},0,b.length-1)):(Ze===d||Ke===d?C=new B(d,o,null,M,E):Ue&d&&Et&e(v.repeat)?(C=new B(Ue,o,null,M,E),C.min=v.repeat[0],C.max=v.repeat[1]):Ge===d?(C=new B(Ge,o,null,M,E),C.min=0,C.max=1):Ye===d?(C=new B(Ye,o,null,M,E),C.min=0,C.max=yt):He===d?(C=new B(He,o,null,M,E),C.min=1,C.max=yt):C=Be===d?new B(Be,o,null,M,E):new B(ze,o,null,M,E),m[o]=C,C.token=i(n($,function(e,t){return e.concat(D(t,s,l,u,c,p,f,m,h,g,k))},[]))));return m[o]}function F(e,t){var n,r,o=e.Style,s=e.Lex,l=e.Syntax,i=[],a={};for(n in o)o[ct](n)&&(r=s[n]||l[n],!r||"block"!=r.type&&"comment"!==r.type||(t&&(o[n+".inside"]||o[n])?(n=o[n+".inside"]||o[n],a[ct](n)||(i.push(n),a[n]=1)):t||a[ct](n)||(i.push(n),a[n]=1)));return i}function N(t){var n={};return t.Lex=t.Lex||{},t.Syntax=t.Syntax||{},t=M(t),t.Parser&&t.Parser.length&&r(function o(s,l){var i,a,u,c=l[s];n[c]||(Et&e(c)&&(i=c,c="NGRAM_"+i.join("_"),t.Syntax[c]||(t.Syntax[c]={type:"ngram",tokens:i})),a=T(c,t.Lex,t.Syntax),Lt&e(a)&&(a=P(a,t.Lex,t.Syntax),a=t.Lex[a]||t.Syntax[a]||null),a&&(n[c]=a,u=a.type?et[a.type[dt]().replace(Gt,"")]||Ie:Ie,Xe&u&&r(o,0,a.tokens.length-1,a.tokens)))},0,t.Parser.length-1,t.Parser),t}function A(t){var r,s,l,i,a,u,c,p,f,m,h,g,k,d;return t.__parsed?t:(r=t.RegExpID||null,l=t.Extra?o(t.Extra):{},i=t.Style?o(t.Style):{},a=null,u=null,c=t.Lex?o(t.Lex):{},p=t.Syntax?o(t.Syntax):{},f={},m={},h={},k={},d={},g=[],s=t.Parser?o(t.Parser):[],t=M({Style:i,Fold:a,Match:u,Lex:c,Syntax:p,$parser:null,$interleaved:null,$comments:null,$autocomplete:null,$extra:l,__parsed:0}),t.$parser=n(s,function(t,n){var o=D(n,r,c,p,i,f,m,h,g,k,d)||null;return o&&(Et&e(o)?t=t.concat(o):t.push(o)),t},[]),t.$interleaved=g&&g.length?g:null,t.$comments=k,t.$autocomplete=d&&d.autocomplete&&d.autocomplete.length?d.autocomplete:null,t.__parsed=1,t)}function I(t,n,r,o,s){var l,i,a=this;l=a.type=t,a.name=n,a.pattern=r,i=a.ptype=o||Lt,a.key=s||0,Me===l?a.key=!1!==s:Ee===l?a.pattern[0]=new I(Me,n+"_Start",r[0],null,!1):xt===i?a.pattern=null:Pt===i&&(a.pattern=Pt&e(r)?[r,0]:[r[0],r[1]||0])}function R(t,n,r,o){var s,l,i,a,u,c,p,f,m,h,g,k=t,d=k.type,$=k.pattern,y=k.key;if(Ee===d){if(s=k.name,i=$[0],a=$[1],c=R(i,n,r,o))return u=a[c[0]],f=e(u),m=i.pattern[c[0]].ptype,Pt===m&&Ft&f&&(u.regex_pattern?(p=v(u,c[1],0,1),u=new I(Se,s+"_End",x(p,u.regex_pattern,{}),Pt)):(p=wt&f?c[1][u+1]:v(u,c[1]),u=new I(Se,s+"_End",p,p.length>1?Lt:St))),u}else if(Me===d){for(h=0,g=$.length;g>h;h++)if(p=R($[h],n,r,o))return y?[h,p[1]]:p}else{if(l=k.ptype,xt===l)return!1!==r&&n.end(),[y,""];if(Pt===l){if(p=n.slice(n.pos).match($[0]),p&&0===p.index)return!1!==r&&n.mov(p[$[1]||0].length),[y,$[1]>0?p[$[1]]:p]}else if(Mt===l){if(!0===o){p=-1;var b,w;for(g=$.length-1;g>=0;g--)b=n.indexOf($[$t](g),n.pos),b>-1&&(-1===p||p>b)&&(p=b,w=$[$t](g));if(p>-1)return!1!==r&&(n.pos=p+1),[y,w]}else if(p=n[$t](n.pos)||null,p&&-1<$.indexOf(p))return!1!==r&&n.mov(1),[y,p]}else if(St===l){if(!0===o){if(p=n.indexOf($,n.pos),p>-1)return!1!==r&&(n.pos=p+1),[y,$]}else if(p=n[$t](n.pos)||null,$===p)return!1!==r&&n.mov(1),[y,p]}else if(Lt===l)if(g=$.length,!0===o){if(p=n.indexOf($,n.pos),p>-1)return!1!==r&&(n.pos=p+g),[y,$]}else if($===n.substr(n.pos,g))return!1!==r&&n.mov(g),[y,$]}return!1}function j(e,t){this.val=e||null,t?this.prev=t:this.prev=null}function B(e,t,n,r,o,s,l,i){var a=this;a.type=e,a.name=t,a.token=n,a.modifier=o||null,a.except=s||null,a.autocompletions=l||null,a.keywords=i||null,a.pos=null,a.msg=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}function U(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|=he),n&&(o.modifier=n),r&&(o.$id=r),o}function G(e){var t=e.name;return e.$msg?e.$msg:e.status&he?'Token "'+t+'"'+(e.keywords?": "+e.keywords:"")+" Expected":'Syntax Error: "'+t+'"'}function Y(e,t,n,r,o,s,l){e.status&fe&&(e.err[""+t+"_"+n+"_"+r+"_"+o+"_"+(s?s.name:"ERROR")]=[t,n,r,o,l||G(s)])}function H(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 W(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 Z(e,t,n,r){var o,s,l,i,a,u=1/0,c=null,p=1/0;if(s=t.pos,t.spc(),l=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?(u=t.pos,c=o,p=a):u===t.pos&&p>a&&(u=t.pos,c=o,p=a),t.pos=l,o=o.prev,a++}u=s&&t.pos===l}function K(e,t,n,r){if(!e)return!1;var o=e.type,s=Xe&o?X:Re&o?Q:Te&o?V:J;return s(e,t,n,r)}function V(t,n,r,o){var s,l,i,a,u,c,p,f,m,h,g,k,d,$,y,b=t,x=b.token||null,w=b.ci,C=b.name,O=!(r.status&fe);if(b.status=0,b.$msg=null,O||!x||!o||!o.pos)return!0;if(y=!!(Re&o.T),ye===x[0]||y&&!o.block)return!0;if(s=x[0],l=x[1],k=x[2],u=b.msg,y?($=o.block.match||o.block.str,f=o.block.pos[0][0],m=o.block.pos[0][1],h=o.block.pos[0][2],g=o.block.pos[0][3]):($=o.match||o.str,f=o.pos[0],m=o.pos[1],h=o.pos[2],g=o.pos[3]),be===s)return!u&&Lt&e(l)&&(u=l),b.$msg=u?v(u,$,!0):'Error "'+C+'"',Y(r,f,m,h,g,b,G(b)),b.status|=ge,!1;if(we===s)r.ctx=r.ctx?r.ctx.prev:null;else if(xe===s)r.ctx=new j({symb:{},queu:null},r.ctx);else if(Oe===s){if(k){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;if(l){if(l=v(l,$),w&&(l=l[dt]()),!c||l!==c.val[0])return c?(b.$msg=u?v(u,[c.val[0],l],!0):'Tokens do not match "'+c.val[0]+'","'+l+'"',d=G(b),Y(r,c.val[1],c.val[2],c.val[3],c.val[4],b,d),Y(r,f,m,h,g,b,d),c=c.prev):(b.$msg=u?v(u,["",l],!0):'Token does not match "'+l+'"',d=G(b),Y(r,f,m,h,g,b,d)),b.status|=ge,k?r.ctx&&(r.ctx.val.queu=c):r.queu=c,!1;c=c?c.prev:null}else c=c?c.prev:null;k?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(Ce===s&&l){if(k){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;l=v(l,$),w&&(l=l[dt]()),b.$msg=u?v(u,l,!0):'Token does not match "'+l+'"',c=new j([l,f,m,h,g,G(b)],c),k?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(ve===s){if(k){if(!r.ctx)return!0;p=r.ctx.val.symb}else p=r.symb;if(i=l[1],a=l[0],i=v(i,$,!0),w&&(i=i[dt]()),p[ct](a)||(p[a]={}),p[a][ct](i))return b.$msg=u?v(u,i,!0):'Duplicate "'+i+'"',d=G(b),Y(r,p[a][i][0],p[a][i][1],p[a][i][2],p[a][i][3],b,d),Y(r,f,m,h,g,b,d),b.status|=ge,!1;p[a][i]=[f,m,h,g]}return!0}function J(e,t,n,r,o){var s,l,i=e,a=i.token,u=i.modifier,c=i.type,p=i.name,f=i.except,m=n.line,h=t.pos,g=null,k=!1;if(i.status&=de,i.$msg=o?null:i.msg||null,i.pos=t.pos,f&&!o){l=te(n,t);for(var d=0,$=f.length;$>d;d++)if(s=f[d],i!==s&&Ie===s.type&&J(s,t,n,r,1))return i.pos=s.pos,te(n,t,l),!1}return qe===c?k=0===n.line:Pe===c?k=n.bline+1===n.line:Fe===c?k=t.sol():De===c?(t.spc(),t.eol()?k=p:(i.pos=t.pos,t.bck(h))):Ne===c?(i.status=0,k=!0):Ae===c?(i.status&he&&t.spc()&&!t.eol()?(i.pos=t.pos,t.bck(h),i.status|=ge):k=!0,i.status&=ke):xt===a?(t.end(),k=u||p):(g=R(a,t))&&(g=g[1],k=u||p),o?k:(!1!==k&&(r.T=c,r.id=p,r.type=k,r.str=t.sel(h,t.pos),r.match=g,r.pos=[m,h,m,t.pos]),!k&&i.status&&i.$msg&&(i.$msg=v(i.$msg,p,!0)),k)}function Q(e,t,n,r){var o,s,l,i,a,u,c,p,f,m,h,g,k,d,$,y,b,x,w,C,O,_,L=e,S=L.name,M=L.type,E=L.modifier,T=L.token,q=L.mline,P=L.inter,D=P?S+".inside":S,F=L.esc,N=!!F,A="",I="",j="",B="",z=L.$id||S,G=n.outer,Y=G&&G[2],W=G&&G[1];if(L.status&=de,L.$msg=L.msg||null,L.pos=t.pos,C=n.line,O=t.pos,je===M&&(L.status&=ke),$=L.status&he,l=0,i=0,n.block&&n.block.name===S?(i=1,l=1,d=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,t))&&(i=1,d=S,b=t.pos,p=[C,O],m=[[C,b],[C,b]],f=[C,b],A=t.sel(O,b),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,s=xt===o.ptype,y=s||L.empty,P){if(s&&l&&t.sol())return L.status&=ke,n.block=null,!1;if(!l)return b=t.pos,r.T=M,r.id=S,r.type=E||d,r.str=t.sel(O,b),r.match=null,r.pos=[C,O,C,b],H(n,w,U(L,$,0,z)),E||d}if(b=t.pos,a=W?s&&t.eol():R(o,t),c=q,u=0,a)d=s?D:S,B=t.sel(b,t.pos);else if(x=t.pos,g=!1,W||N||Mt!==o.ptype&&St!==o.ptype&&Lt!==o.ptype){for(;!t.eol();){if(W){if(K(W,t,Y,r)){if(t.pos>x){s&&(a=1);break}return!0}if(s){k=t.nxt(1),j+=k;continue}}if(b=t.pos,!g&&R(o,t)){P&&t.pos>b&&b>x?(d=D,t.bck(b),u=1):(d=S,a=1),B=t.sel(b,t.pos);break}k=t.nxt(1),j+=k,g=N&&!g&&F===k,b=t.pos}s&&t.eol()&&(a=1)}else(_=R(o,t,!0,!0))?P&&t.pos>b+_[1].length?(d=D,t.mov(-_[1].length),u=1,j=t.sel(b,t.pos)):(d=S,a=1,j=t.sel(b,t.pos-_[1].length),B=_[1]):(t.end(),d=D,u=1,j=t.sel(b,t.pos));return c=q||N&&g,I+=j,m[1]=[C,b],f=[C,t.pos],a&&!y&&m[0][0]===m[1][0]&&m[0][1]===m[1][1]?(n.block=null,!1):(a||!c&&!u?n.block=null:(n.block.ip=m,n.block.ep=f,n.block.i=I,n.block.e=B,H(n,w,U(L,$,0,z))),r.T=M,r.id=S,r.type=E||d,r.str=t.sel(O,t.pos),r.match=null,r.pos=[C,O,f[0],f[1]],L.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||d)}return L.status&&L.$msg&&(L.$msg=v(L.$msg,S,!0)),!1}function X(e,t,n,r){var o,s,l,i,a,u,c,f,m,h,g,k,d,$,y,b=e,v=b.type,x=(b.name,b.token),w=x.length,C=b.modifier;if(b.status&=de,b.$msg=b.msg||null,f=t.pos,m=n.stack,b.pos=t.pos,u=0,c=0,Je===v){b.status&=de;var O=new String(x[0]),_=n.stack?n.stack.val:null;return O.subgrammar=1,O.next=_?new B(Ze,_.name,[_]):null,O.required=_?_.status&he:0,O}if(Be===v){for(d=p(),b.status|=he,k=[],y=te(n,t),g=0,h=g;w>h;h++){if(o=U(x[h],1,C,d),s=K(o,t,n,r),b.pos=o.pos,o.status&he&&(u++,k.push(G(o))),!1!==s)return s;o.status&ge&&(c++,te(n,t,y))}return u>0?b.status|=he:b.status&=ke,w===c&&u>0?b.status|=ge:b.status&=de,b.status&&!b.$msg&&k.length&&(b.$msg=k.join(" | ")),!1}if(Qe&v){$=!!(v&ze),d=b.$id||p(),$?b.status|=he:b.status&=ke,y=te(n,t),g=0;do o=U(x[g++],$,C,d),s=K(o,t,n,r);while(w>g&&(!0===s&&We&o.type||!1===s&&!(o.status&he)));if(b.pos=o.pos,!1!==s){if(!0!==s||Ne!==o.type)for(h=w-1;h>=g;h--)m=H(n,m,U(x[h],1,C,d));return s.subgrammar&&w>g&&(s.next=new B(Ze,x[g].name,[x[g]]),s.required=x[g].status&he),s}return o.status&ge?($?b.status|=ge:b.status&=de,te(n,t,y)):$&&o.status&he&&(b.status|=ge),b.status&&!b.$msg&&(b.$msg=G(o)),!1}if(We&v)return Je&x[0].type?!0:(y=te(n,t,null,!1),s=K(U(x[0],0),t,n,r),te(n,t,y),Ke===v?!1===s:!1!==s);for(d=b.$id||p(),l=b.found,i=b.min,a=b.max,b.status=0,k=[],y=te(n,t),h=0;w>h;h++){if(o=U(x[h],1,C,d),s=K(o,t,n,r),b.pos=o.pos,!1!==s){if(++l,a>=l)return b.found=l,H(n,m,U(b,0,0,p())),b.found=0,s;break}o.status&he&&(u++,k.push(G(o))),o.status&ge&&te(n,t,y)}return i>l&&(b.status|=he),(l>a||i>l&&u>0)&&(b.status|=ge),b.status&&!b.$msg&&k.length&&(b.$msg=k.join(" | ")),!1}function ee(e,t){var n=this;n.id=e?f("state"):"state",t instanceof ee?(n.line=t.line,n.bline=t.bline,n.status=t.status,n.stack=W(t.stack,!1),n.token=t.token,n.block=t.block,n.outer=t.outer?[t.outer[0],t.outer[1],new ee(e,t.outer[2])]:null,n.status&fe?(n.queu=t.queu,n.symb=t.symb,n.ctx=t.ctx,n.err=t.err):(n.queu=null,n.symb=null,n.ctx=null,n.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.block=null,n.outer=null,n.status&fe?(n.queu=[],n.symb={},n.ctx=null,n.err={}):(n.queu=null,n.symb=null,n.ctx=null,n.err=null),n.$eol$=!0,n.$blank$=!0),n.toString=function(){return n.id+"_"+n.line+"_"+n.bline+"_"+(n.block?n.block.name:"0")}}function te(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 ne(e){e.id=null,e.line=null,e.bline=null,e.status=null,e.stack=null,e.token=null,e.block=null,e.outer=null,e.queu=null,e.symb=null,e.ctx=null,e.err=null}function re(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?gt(0,r.pos+e):kt(r.length,r.pos+e),r},r.bck=function(e){return r.pos=gt(0,e),r},r.sft=function(){return r.start=r.pos,r},r.nxt=function(e,t){var n,o,s="";if(!0===e){for(t=t||re.$NONSPC$;r.posi||i>=t)return l+(t-s);l+=i-s,l+=n-l%n,s=i+1}}function se(n,r){return Nt&e(n)&&(n=y("\\b("+t(i(n).sort(zt),$).join("|")+")\\b")),!1===r?function(e){return!e||!n.test(e)}:function(e){return!!e&&n.test(e)}}function le(e,t,n,r,o,s){for(;;){n.lastIndex=e.col;var l=n.exec(e.text);if(!l){if(e.next()){e.text=e.line(e.row);continue}return}{if(t(e.token(e.row,l.index+1)))return e.col=l.index+l[0].length, -l;e.col=l.index+1}}}function ie(e,t,n,r,o,s){for(var l,i,a;;){if(l=e.text.indexOf(o,e.col),-1===l){if(e.next()){e.text=e.line(e.row);continue}return}if(t(e.token(e.row,l+1)))return i=e.text.lastIndexOf(s,l),a=i>-1&&!re.$NOTEMPTY$.test(e.text.slice(i+1,l)),e.col=l+1,a?"autoclosed":"regular";e.col=l+1}}function ae(e,t,n,r,o,s,l,i,a,u){if(-1===e){var c,p,f,m,h,g,k,d,$=1,y=t.first(),b=(s.length,l.length,!1===o);e:for(c=n;c>=y;--c)for(p=t.line(c),f=p.length,m=c===n?r-1:f;;){if(0>m)break;if(h=p.lastIndexOf(s,m),g=p.lastIndexOf(l,m),0>h&&0>g)break;if(m=gt(h,g),b||u||t.token(c,m+1)==o)if(m===g)++$;else if(0===--$){k=c,d=m;break e}--m}return null==k||a&&k===n&&d===r?!1:[k,d,n,r]}var c,p,f,m,h,g,v,x,$=1,w=t.last(),b=(s.length,l.length,!1===o);e:for(c=n;w>=c;++c)for(p=t.line(c),f=p.length,m=c===n?r:0;;){if(m>=f)break;if(h=p.indexOf(s,m),g=p.indexOf(l,m),0>h&&0>g)break;if(0>h&&(h=f),0>g&&(g=f),m=kt(h,g),b||u||t.token(c,m+1)==o)if(m===h)++$;else if(0===--$){v=c,x=m;break e}++m}return null==v||a&&n===v&&x===r?!1:[n,r,v,x]}function ue(e,t,n){var r=n.text,o=n.meta,s=n.start,l=n.end,i=t.list.maxlen-r.length-o.length+5;e.innerHTML=['',d(r.slice(0,s)),'',d(r.slice(s,l)),"",d(r.slice(l)),"",new Array(1+i).join(" "),'',d(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 ce(e,t,n){function r(e,t){var o;return o={Mode:r,startState:function(){return{parser:r.$parser,state:new ee,inner:{},name:null}},copyState:function(e){return{parser:e.parser,state:new ee(0,e.state),inner:e.inner,name:e.name}},token:function(e,t){var n=re(e.string,e.start,e.pos),r=t.parser.get(n,t).type;return e.pos=n.pos,r},indent:function(r,o,s){return r.parser.indent(r.state,o,s,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||tn,r.$id=f("codemirror_grammar_mode"),r.$parser=new sn.Parser(A(e),t),r.$parser.Mode=r,r.options=function(e,t,n){n=n||{};var o=e.getTokenAt(t).state,s=o&&o.parser||r.$parser;return n.lineComment=s.LC,n.blockCommentStart=s.BCS,n.blockCommentEnd=s.BCE,n.blockCommentContinue=s.BCC,n.blockCommentLead=s.BCL,n.electricInput=s.$grammar.$extra.electricInput||!1,n.electricChars=s.$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 s(e,t){if(r.supportAutoCompletion){var o=e.getTokenAt(e.getCursor()).state,l=o&&o.parser||r.$parser;return t=s.options||t||{},t[ct]("renderer")||(t.renderer=s.renderer||ue),l.autocomplete(e,t,n)}},r.autocompleter.renderer=ue,r.supportCodeFolding=!0,r.foldType="fold_"+r.$id,r.folder=function(e,t){if(r.supportCodeFolding){var o,s=e.getTokenAt(t).state,l=s&&s.parser||r.$parser;if(o=l.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 l(e){if(r.supportCodeMatching){if(l.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,s=l.options||{},i=s.maxHighlightLineLength||1e3,a=[],u=e.listSelections(),c="CodeMirror-matchingtag",p="CodeMirror-nonmatchingbracket",f=0;for(u.length;1>f;f++)t=o.match(e,u[f].to(),n),null!=t&&(!1===t?(u[f].empty()?(t=u[f].to(),t=[n.Pos(t.line,t.ch-1),t]):t=[u[f].from(),u[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:c})),e.getLine(t[4]).length<=i&&a.push(e.markText(n.Pos(t[4],t[5]),n.Pos(t[6],t[7]),{className:c}))):"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:c})),e.getLine(t[0]).length<=i&&a.push(e.markText(n.Pos(t[0],t[1]),n.Pos(t[2],t[3]),{className:c}))));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 pe=1,fe=2,me=32,he=4,ge=8,ke=~he,de=~ge,$e=he|ge,ye=0,be=4,ve=8,xe=16,we=17,Ce=32,Oe=33,_e=128,Le=129,Se=2,Me=4,Ee=8,Te=4,qe=8,Pe=9,De=16,Fe=32,Ne=128,Ae=256,Ie=512,Re=1024,je=1025,Be=2048,ze=4096,Ue=8192,Ge=8193,Ye=8194,He=8195,We=16384,Ze=We,Ke=16385,Ve=32768,Je=65536,Qe=ze|Ve,Xe=Be|ze|Ue|We|Ve|Je,et={action:Te,simple:Ie,block:Re,comment:je,subgrammar:Je,alternation:Be,sequence:ze,repeat:Ue,zeroorone:Ge,zeroormore:Ye,oneormore:He,positivelookahead:Ze,negativelookahead:Ke,ngram:Ve},tt="$|SOF|$",nt="$|NONBLANK|$",rt="$|SOL|$",ot="$|EOL|$",st="$|ENDLINE|$",lt="$|EMPTY|$",it="$|NONSPACE|$",at=void 0,ut="prototype",ct="hasOwnProperty",pt="propertyIsEnumerable",ft=Object[ut],mt=ft.toString,ht=Object.create,gt=Math.max,kt=Math.min,dt="toLowerCase",$t="charAt",yt=1/0,bt=4,vt=8,xt=16,wt=32,Ct=33,Ot=34,_t=64,Lt=128,St=129,Mt=130,Et=256,Tt=512,qt=1024,Pt=2048,Dt=4096,Ft=Lt|wt,Nt=Lt|Et,At=Pt|Et,It=Lt|Et|Pt,Rt={"[object Number]":wt,"[object String]":Lt,"[object Array]":Et,"[object RegExp]":Pt,"[object Date]":Dt,"[object Function]":qt,"[object Object]":Tt},jt=/^\s+|\s+$/g,Bt=String[ut].trim?function(e){return e.trim()}:function(e){return e.replace(jt,"")},zt=function(e,t){return t.length-e.length},Ut=/\r\n|\r|\n/g,Gt=/[\-_]/g,Yt=0,Ht=/([.*+?^${}()|[\]\/\\\-])/g,Wt=/[&"'<>]/g,Zt=/^([.!&\[\]{}()*+?\/|'"]|\s)/,Kt="(\\s|\\W|$)",Vt=/(\\\\)*?\\\d/,Jt=/[*+]$/;re.$SPC$=/^[\s\u00a0]+/,re.$NONSPC$=/[^\s\u00a0]/,re.$NOTEMPTY$=/\S/,re.$SPACE$=/^\s*/;var Qt=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){var r,o,s,l,i,a,u,c,p,f,m,h,g,k,d,$,y,b=this,v=b.$grammar,x=v.Style,w=b.DEF,C=b.ERR,O={},_=b.$n$,L=b.$t$,S=b.$v$,M=v.$interleaved,E=v.$parser,T=E.length,q=M?M.length:0,P=t.outer,D=P&&P[2],F=P&&P[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,l=t.line,i=e.pos,f=!1,h=!0,m=!1,g=!1,P&&b===P[0]){if(O[_]=null,O[L]=w,O[S]=null,F){if(s=new z,K(F,e,D,s))return t.outer=null,{parser:b,state:D};for(e.nxt(1);!e.eol();){if(K(F,e,D,s)){if(e.pos>i)break;return t.outer=null,{parser:b,state:D}}e.nxt(1)}}else e.spc(),e.eol()?g=!0:e.end();return O[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||t.$eol$),O}if(t.stack&&De===t.stack.val.type&&e.sol()&&(t.stack=t.stack.prev),(!t.stack||Ae!==t.stack.val.type&&null==t.block)&&e.spc()){if(t.stack&&Je===t.stack.val.type)return e.bck(i),r=t.stack.val,t.stack=t.stack.prev,f=K(r,e,t,s),k=""+f,b.$subgrammars[k]?(d=b.$subgrammars[k],$=new ee(1,n[k]?n[k]:t.status),D=t):(d=b,$=new ee,D=t),$.outer=[b,f.next,D],{parser:d,state:$,toInner:k};h=!1,g=!0}if(O[_]=null,O[L]=w,O[S]=null,h)for(s=new z,a=0;h&&(t.stack||T>a)&&!e.eol();){if(c=e.pos,p=t.stack,F){if(e.spc(),K(F,e,D,s))return e.pos>c?(O[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&!0,O):(t.outer=null,{parser:P[0],state:D,fromInner:t});e.bck(c)}if(y=!1,q&&!t.block)for(u=0;q>u;u++)if(r=M[u],f=K(r,e,t,s),!1!==f){y=!0;break}if(h&&!y){if(!t.stack&&a>=T)break;t.stack?(r=t.stack.val,t.stack=t.stack.prev):r=E[a++],f=K(r,e,t,s)}if(!1===f){if(r.status&$e){t.token=r,g=Z(t,e,s,r)||g,m=!0,h=!1;break}}else{if(f.subgrammar)return k=""+f,b.$subgrammars[k]?(d=b.$subgrammars[k],$=new ee(1,n[k]?n[k]:t.status),D=t):(d=b,$=new ee,D=t),$.outer=[b,f.next,D],{parser:d,state:$,toInner:k};if(t.stack&&t.stack.prev&&e.eol()&&Re&t.stack.val.type&&t.block&&t.block.name===t.stack.val.name)for(u=t.stack.prev;u&&Te===u.val.type;)o=u,u=u.prev,V(o,e,t,s),o.status&ge&&(t.$actionerr$=!0);else if(t.stack&&Te===t.stack.val.type)for(;t.stack&&Te===t.stack.val.type;)o=t.stack.val,t.stack=t.stack.prev,V(o,e,t,s),o.status&ge&&(t.$actionerr$=!0);if(!0!==f){h=!1;break}}}return h&&e.nxt(1),O[S]=e.cur(1),!1!==f?(f=x[f]||w,O[_]=r.name):m?(f=C,t.status&fe&&Y(t,l,i,l,e.pos,r)):f=w,O[L]=f,t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||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){var r=[];if(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,s,l,i,a,u=(e||"").split(Ut),c=u.length,p=null;if(t=t||pe,s=!!(t&fe),l=!!(t&pe),o={parser:this,state:new ee(0,t),inner:{}},o.state.$full_parse$=!0,r(function(e){u[e]+="\n"},0,c-2),l?p=r(t&me?function(e,t){t._=t._.concat(o.parser.tokenize(re(u[e]),o,e))}:function(e,t){t._.push(o.parser.tokenize(re(u[e]),o,e))},0,c-1,{_:[]})._:r(function(e){var t=re(u[e]);if(t.eol())o.state.line++,o.state.$blank$&&o.state.bline++;else for(;!t.eol();)o.parser.get(t,o)},0,c-1),n=o.state,s&&n.queu&&n.queu.length)for(;n.queu.length;)i=n.queu.shift(),Y(n,i[1],i[2],i[3],i[4],null,i[5]);return a=l&&s?{tokens:p,errors:n.err}:l?p:n.err,ne(n),o=n=null,a},autocompletion:function(e,t){var n,r,o=e.stack,s={},l=E([e.token],[],s);for(t=t||0;o;){if(n=o.val,r=n.type,Ue&r){if(l=E([n],l,s),0=u;++u)if(o=t.line(u),s=t.indentation(o),s>r)i=u,a=o.length;else if(e.test(o))break;return i?[p,l,i,a]:void 0}}},Delimited:function(e,t,n,r){return e&&t&&e.length&&t.length?(n=n||l,function(o){var s,l,i,a,u,c,p=o.row,f=o.col;for(s=o.line(p),i=f,a=0;;){var u=0>=i?-1:s.lastIndexOf(e,i-1);if(-1!==u){if(1===a&&f>u)return;if(n(c=o.token(p,u+1))){l=u+e.length;break}i=u-1}else{if(1===a)return;a=1,i=s.length}}return ae(1,o,p,l,c,e,t,n,!0,r)}):function(){}},MarkedUp:function(e,t,n,r,o){return e=e||l,t=t||"<",n=n||">",r=r||"/",o=o||y($(t)+"("+$(r)+"?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)","g"),function(s){s.col=0,s.min=s.first(),s.max=s.last(),s.text=s.line(s.row);for(var l,i,a,u,c,p,f,m,h,g=s.row;;){if(l=le(s,e,o,t,n,r),!l||s.row!==g||!(i=ie(s,e,o,t,n,r)))return;if(!l[1]&&"autoclosed"!==i)for(a=[s.row,s.col],c=l[2],u=null,p=[];;){if(f=le(s,e,o,t,n,r),g=s.row,m=s.col-(f?f[0].length:0),!f||!(i=ie(s,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&&(!c||c===f[2]))return[a[0],a[1],g,m]}else p.push(f[2])}}}}},en={Pattern:function(e,t,n){return function(){}},Delimited:function(e,t,n,r){return e&&t&&e.length&&t.length?(n=n||l,function(o){var s,l=o.col,i=o.row,a=o.line(i),u=!1,c=e.length,p=t.length;return l>=c&&(1===c&&e===a.charAt(l-1)||e===a.slice(l-c,l))?(s=ae(1,o,i,l,u,e,t,n,!1,r),s?(s=[s[0],s[1]-c,s[0],s[1],s[2],s[3],s[2],s[3]+p],s.match="end"):(s=[i,l-c,i,l],s.match=!1),s):l>=p&&(1===p&&t===a.charAt(l-1)||t===a.slice(l-p,l))?(s=ae(-1,o,i,l-p,u,e,t,n,!1,r),s?(s=[s[0],s[1],s[0],s[1]+c,s[2],s[3],s[2],s[3]+p],s.match="start"):(s=[i,l-p,i,l],s.match=!1),s):void 0}):function(){}},MarkedUp:function(e,t,n,r,o){return function(){}}},tn="undefined"!=typeof CodeMirror?CodeMirror:{Pass:{toString:function(){return"CodeMirror.Pass"}}},nn=/[\w$]/,rn=function(e,t){return t.score-e.score},on=h(Qt,{constructor:function ln(t,n){var o,s=this,i=null,a=null;if(Qt.call(s,t,null,"error"),s.DEF=n||s.$DEF,s.ERR=t.Style.error||s.$ERR,s.LC=t.$comments.line?t.$comments.line[0]:null,s.BCS=t.$comments.block?t.$comments.block[0][0]:null,s.BCE=t.$comments.block?t.$comments.block[0][1]:null,s.BCC=s.BCL=t.$comments.block?t.$comments.block[0][2]:null,t.$comments.block&&t.$comments.block.length){o=ln.Type("comment");for(var u=0,c=t.$comments.block.length;c>u;u++)s.$folders.push(ln.Fold.Delimited(t.$comments.block[u][0],t.$comments.block[u][1],o,"comment"))}t.Fold&&Lt&e(t.Fold)?i=t.Fold[dt]():t.$extra.fold&&(i=t.$extra.fold[dt]()),a=t.Match&&Lt&e(t.Match)?t.Match[dt]():t.$extra.match?t.$extra.match[dt]():i;var p=F(t,1);o=p.length?ln.Type(p,!1):l,i&&(i=i.split("+"),r(function(e,t){var n,r=Bt(t[e]);"braces"===r?s.$folders.push(ln.Fold.Delimited("{","}",o)):"brackets"===r?s.$folders.push(ln.Fold.Delimited("[","]",o)):"parens"===r||"parentheses"===r?s.$folders.push(ln.Fold.Delimited("(",")",o)):"brace"===r||"cstyle"===r||"c"===r?(s.$folders.push(ln.Fold.Delimited("{","}",o)),s.$folders.push(ln.Fold.Delimited("[","]",o))):"indent"===r||"indentation"===r?s.$folders.push(ln.Fold.Indented()):"tags"===r||"markup"===r||"html"===r||"xml"===r?(s.$folders.push(ln.Fold.Delimited("",ln.Type(["comment","tag"],!1))),s.$folders.push(ln.Fold.MarkedUp(ln.Type("tag"),"<",">","/"))):-1<(n=r.indexOf(","))&&s.$folders.push(ln.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=Bt(t[e]);"braces"===r?s.$matchers.push(ln.Match.Delimited("{","}")):"brackets"===r?s.$matchers.push(ln.Match.Delimited("[","]")):"parens"===r||"parentheses"===r?s.$matchers.push(ln.Match.Delimited("(",")")):"brace"===r||"cstyle"===r||"c"===r?(s.$matchers.push(ln.Match.Delimited("{","}")),s.$matchers.push(ln.Match.Delimited("[","]")),s.$matchers.push(ln.Match.Delimited("(",")"))):"tags"===r||"markup"===r||"html"===r||"xml"===r?s.$matchers.push(ln.Match.MarkedUp(ln.Type("tag"),"<",">","/")):-1<(n=r.indexOf(","))&&s.$matchers.push(ln.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,Qt[ut].dispose.call(e)},validate:function(e,t,n){if(!e||!e.length)return[];var r,o,s,l,i=this,a=[],u=i.parse(e,fe);if(!u)return a;t=t||{},s=t[ct]("type")?t.type:"error",l=t[ct]("msg")?t.msg:"Syntax Error";for(r in u)u[ct](r)&&(o=u[r],a.push({message:o[4]||l,severity:s,from:n.Pos(o[0],o[1]),to:n.Pos(o[2],o[3])}));return a},autocomplete:function(e,t,r){var o,s,l,i,a,u,c,p,f,m,h,g=this,k=[],d=e.getCursor(),$=d.ch,y=$,b=$,v=b,x=0;if(g.$grammar.$autocomplete){for(t=t||{},a=t.word||nn,o=e.getLine(d.line),p=t[ct]("prefixMatch")?!!t.prefixMatch:!0,f=t[ct]("inContext")?!!t.inContext:!1,c=t[ct]("caseInsensitiveMatch")?!!t.caseInsensitiveMatch:!1;y&&a.test(o[$t](y-1));)--y;if(!p)for(;v=i&&(n=t.meta,r=!!d.ci,k=c||r,k?(f=d[dt](),g=l):(f=d,g=s),(a=f.indexOf(g))>=0&&(!p||0===a)&&(o=k?d.indexOf(s):a,$+n.length>x&&(x=$+n.length),e.push({text:d,name:d,meta:n,start:0>o?a:o,end:(0>o?a:o)+s.length,match:s,displayText:d+" ["+n+"]",render:u,score:1e3-10*($-i)-5*(0>o?a+3:o)}))):(n=t.meta,$+n.length>x&&(x=$+n.length),e.push({text:d,name:d,meta:n,start:0,end:0,match:"",displayText:d+" ["+n+"]",render:u,score:m?1e3-10*$:h--})),e};f?(m=!1,k=n(g.autocompletion(e.getTokenAt(r.Pos(d.line,y),!0).state.state),w,k),k.length||(m=!0,k=n(g.$grammar.$autocomplete,w,k))):(m=!0,k=n(g.$grammar.$autocomplete,w,k)),k.length&&(k=k.sort(rn)),k.maxlen=x}return{list:k,from:r.Pos(d.line,y),to:r.Pos(d.line,v)}},indent:function(e,t,n,r,o,s){return s.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 oe(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,s,l=this,i=l.$folders,a=i.length;if(a)for(o=l.iterator(e,n),o.row=t.line,o.col=t.ch||0,r=0;a>r;r++)if((s=i[r](o))||!1===s)return s},match:function(e,t,n){var r,o,s,l=this,i=l.$matchers,a=i.length;if(a)for(o=l.iterator(e,n),o.row=t.line,o.col=t.ch||0,r=0;a>r;r++)if((s=i[r](o))||!1===s)return s}});on.Type=se,on.Fold=Xt,on.Match=en;var sn={VERSION:"4.0.0",clone:o,extend:s,pre_process:N,parse:A,getMode:ce,Parser:on};return sn}); \ No newline at end of file +**/!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=xt:!0===e||!1===e||e instanceof Boolean?t=Lt:at===e?t=vt:(t=Rt[mt.call(e)]||bt,t=wt===t||e instanceof Number?isNaN(e)?Ot:isFinite(e)?wt:Ct:_t===t||e instanceof String?1===e.length?St:_t:Et===t||e instanceof Array?Et:Pt===t||e instanceof RegExp?Pt:Dt===t||e instanceof Date?Dt:qt===t||e instanceof Function?qt:Tt===t?Tt:bt),t}function t(e,t,n,r){var o,s,l,i,a,u,c=e.length;if(arguments.length<4&&(r=c-1),0>r&&(r+=c),arguments.length<3&&(n=0),n>r)return[];if(n===r)return[t(e[n],n,n,r)];for(l=r-n+1,i=15&l,a=1&i,u=new Array(l),a&&(u[0]=t(e[n],n,n,r)),o=a;i>o;o+=2)s=n+o,u[o]=t(e[s],s,n,r),u[o+1]=t(e[s+1],s+1,n,r);for(o=i;l>o;o+=16)s=n+o,u[o]=t(e[s],s,n,r),u[o+1]=t(e[s+1],s+1,n,r),u[o+2]=t(e[s+2],s+2,n,r),u[o+3]=t(e[s+3],s+3,n,r),u[o+4]=t(e[s+4],s+4,n,r),u[o+5]=t(e[s+5],s+5,n,r),u[o+6]=t(e[s+6],s+6,n,r),u[o+7]=t(e[s+7],s+7,n,r),u[o+8]=t(e[s+8],s+8,n,r),u[o+9]=t(e[s+9],s+9,n,r),u[o+10]=t(e[s+10],s+10,n,r),u[o+11]=t(e[s+11],s+11,n,r),u[o+12]=t(e[s+12],s+12,n,r),u[o+13]=t(e[s+13],s+13,n,r),u[o+14]=t(e[s+14],s+14,n,r),u[o+15]=t(e[s+15],s+15,n,r);return u}function n(e,t,n,r,o){var s,l,i,a,u,c=e.length,p=n;if(arguments.length<5&&(o=c-1),0>o&&(o+=c),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,u=1&a,u&&(p=t(p,e[r],r)),s=u;a>s;s+=2)l=r+s,p=t(t(p,e[l],l),e[l+1],l+1);for(s=a;i>s;s+=16)l=r+s,p=t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(p,e[l],l),e[l+1],l+1),e[l+2],l+2),e[l+3],l+3),e[l+4],l+4),e[l+5],l+5),e[l+6],l+6),e[l+7],l+7),e[l+8],l+8),e[l+9],l+9),e[l+10],l+10),e[l+11],l+11),e[l+12],l+12),e[l+13],l+13),e[l+14],l+14),e[l+15],l+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,s,l=n-t+1,i=15&l,a=1&i;for(a&&e(t,r,t,n),o=a;i>o;o+=2)s=t+o,e(s,r,t,n),e(++s,r,t,n);for(o=i;l>o;o+=16)s=t+o,e(s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n),e(++s,r,t,n);return r}function o(t,n){var r,s,l,i,a=e(t),u=0;if(wt===e(n)?n>0?(u=n,n=!0):n=!1:n=!1!==n,Tt===a){s={};for(l in t)t[ct](l)&&t[pt](l)&&(r=e(t[l]),Tt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:Et===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Dt===r?s[l]=new Date(t[l]):_t&r?s[l]=t[l].slice():wt&r?s[l]=0+t[l]:s[l]=t[l])}else if(Et===a)for(i=t.length,s=new Array(i),l=0;i>l;l++)r=e(t[l]),Tt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:Et===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Dt===r?s[l]=new Date(t[l]):_t&r?s[l]=t[l].slice():wt&r?s[l]=0+t[l]:s[l]=t[l];else s=Dt===a?new Date(t):_t&a?t.slice():wt&a?0+t:t;return s}function s(){var t,n,r,l,i,a,u,c,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(l in t)if(t[ct](l)&&t[pt](l))if(n[ct](l)&&n[pt](l)){if(p=e(n[l]),f=e(t[l]),Tt===p&&Tt===f)n[l]=s(n[l],t[l]);else if(Et===p&&Et===f){if(u=n[l],c=t[l],a=c.length,!a)continue;if(u.length)for(i=0;a>i;i++)0>u.indexOf(c[i])&&u.push(c[i]);else n[l]=c.slice()}}else n[l]=o(t[l]);return n}function l(){return!0}function i(t,n){return n||Et!==e(t)?[t]:t}function a(t,n){return t=i(t),(n||Et!==e(t[0]))&&(t=[t]),t}function u(t,n){return _t&e(n)&&_t&e(t)&&n.length&&n.length<=t.length&&n===t.substr(0,n.length)}function c(e,t,n){return n?e[t]=at:delete e[t],e}function p(e){return(e||"id_")+ ++Yt}function f(e){return(e||"uuid")+"_"+ ++Yt+"_"+(new Date).getTime()}function m(){var t,n,r,o,s,l,i=arguments,a=i.length;for(t=i[0]||{},s=1;a>s;s++)if(n=i[s],Tt===e(n))for(o in n)n[ct](o)&&n[pt](o)&&(r=n[o],l=e(r),wt&l?t[o]=0+r:Dt&l?t[o]=new Date(r):Nt&l?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[ct](o)||(t[o]=function(){}),n=t[o],delete t[o],n[ut]=m(ht(e[ut]),t),n[ut][o]=n,n}function g(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"}function k(e){return"&#"+e.charCodeAt(0)+";"}function d(e,t){return e.replace(Wt,t?g:k)}function $(e){return e.replace(Ht,"\\$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 b(e,t,n,r){var o,s,l,i,a=e.pos,u=e.length,c="",p=!!n;if(p){for(r=!!r,s=!1,i=0;u>a&&(o=e[$t](a++),t!==o||s);)l=n===o,s=!s&&l,r?(l&&i++,(!l||2&i)&&(c+=o,i=0)):c+=o;2&i&&(c+=n)}else for(;u>a&&(o=e[$t](a++),t!==o);)c+=o;return e.pos=a,c}function v(t,n,r,o){var s,l,i,a,u,c=!0===r?0:1,p=o?"\\":"$",f=o?92:36;for(_t&e(n)&&(o&&(n=$(n)),n=[n,n,n],c=0),l=t.length,u="",s=0;l>s;)i=t[$t](s),l>s+1&&p===i?(a=t.charCodeAt(s+1),f===a?(u+=p,s+=2):a>=48&&57>=a?(u+=n[c+a-48]||"",s+=2):(u+=i,s+=1)):(u+=i,s+=1);return u}function x(t,n,r,o){if(!t||(wt|Pt)&e(t))return t;var s,l=n?n.length||0:0,i="",a={g:0,i:0,x:0,l:0};if(_t&e(o)?i=o:o&&(i=Kt),l&&t.substr(0,l)===n){var u,c,p,s,f,m=t.substr(l),h=m[$t](0);for(s=m.length;s--&&(f=m[$t](s),h!==f);)"i"===f.toLowerCase()?a.i=1:"x"===f.toLowerCase()?a.x=1:"l"===f.toLowerCase()&&(a.l=1);return u=m.substring(1,s),"^"===u.charAt(0)?(a.l=1,c="^("+u.slice(1)+")"):c="^("+u+")",p=c,(a.x||a.l||a.i)&&(c=(a.l?"l":"")+(a.x?"x":"")+(a.i?"i":"")+"::"+c),r[c]||(p=y(p,a),r[c]=p),r[c]}return i?(p=c="^("+$(t)+")"+i,r[c]||(p=y(p,a),r[c]=p),r[c]):t}function w(n,r,o){var s,l="";return _t&e(r)?l=r:r&&(l=Kt),s=t(n.sort(zt),$).join("|"),[y("^("+s+")"+l,{l:0,x:0,i:o?1:0}),1]}function C(t,n,r,o){var s=e(n);if(wt===s)return n;if(o[t])return o[t];r=r||0;var l,i=0;return n&&n.isCharList&&(i=1,c(n,"isCharList")),l=xt===s?new I(Se,t,n,xt,r):St===s?new I(Se,t,n,St,r):At&s?new I(Se,t,n,Pt,r):_t&s?new I(Se,t,n,i?Mt:_t,r):n,o[t]=l}function O(t,n,r,o,s,l,a,c){if(a[t])return a[t];var p,f,m,h,g,k,d,$=0,y=0,b=1,v=_t&e(o)?!0:!!o;if(p=i(n),m=p.length,1===m)d=C(t,x(p[0],r,l,o),0,a);else if(m>1){for(h=(m>>>1)+1,f=0;h>=f;f++)g=e(p[f]),k=e(p[m-1-f]),St===g&&St===k||(b=0),Et&g||Et&k?$=1:(Pt&g||Pt&k||u(p[f],r)||u(p[m-1-f],r))&&(y=1);if(b&&!v)p=p.slice().join(""),p.isCharList=1,d=C(t,p,0,a);else if(!v||$||y)if($||y){for(f=0;m>f;f++)Et&e(p[f])?p[f]=O(t+"_"+f,p[f],r,o,s,l,a):p[f]=C(t+"_"+f,x(p[f],r,l),f,a);d=m>1?new I(Me,t,p):p[0]}else{for(c&&(c.keywords=i(n).slice()),p=p.sort(zt),f=0;m>f;f++)p[f]=C(t+"_"+f,x(p[f],r,l),f,a);d=m>1?new I(Me,t,p):p[0]}else c&&(c.keywords=i(n).slice()),d=C(t,w(p,o,s),0,a)}return a[t]=d}function L(t,n,o,s,l){if(l[t])return l[t];var i=a(n),c=[],p=[];return r(function(n){var r,a,f,m;r=C(t+"_0_"+n,x(i[n][0],o,s),n,l),i[n].length>1?(f=u(i[n][1],o),m=f&&Vt.test(i[n][1]),Pt!==r.ptype||_t!==e(i[n][1])||!m&&f?a=C(t+"_1_"+n,x(i[n][1],o,s),n,l):m?(a=new String(i[n][1]),a.regex_pattern=o):a=i[n][1]):a=r,c.push(r),p.push(a)},0,i.length-1),l[t]=new I(Ee,t,[c,p])}function _(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],s=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,s]))},0,n.length-1)}function S(e,n,r,o){var s=e.meta||r,l=!(!e.caseInsesitive&&!e.ci),i=t(n,function(e){return{word:e,meta:s,ci:l}});return o.autocomplete=(o.autocomplete||[]).concat(i),i}function M(t){t.Lex||(t.Lex={}),t.Syntax||(t.Syntax={});var n,r,o,l,i,a,u,p,f,m,h,g=t.Lex,k=t.Syntax,d=[g,k],$=d.length;for(h=0;$>h;){m=d[h++];for(o in m)m[ct](o)&&(n=o.split(":"),r=n[1]&&Bt(n[1]).length?Bt(n[1]):null,n=Bt(n[0]),n.length||(n=o,r=null),n!==o&&(m[n]=m[o],c(m,o),r&&(r=r[dt](),l=m[n],i=e(l),Tt===i?m[n].type||(m[n].type=r):(m[n]={type:r},"error"===r?(m[n].type="action",m[n].error=l):"nop"===r?(m[n].type="action",m[n].nop=!0):"group"===r?(m[n].type="sequence",m[n].tokens=l):"action"===r&&_t===i?m[n][l]=!0:m[n].tokens=l))),g===m&&(It&e(m[n])&&(m[n]={type:"simple",tokens:m[n]}),l=m[n],l.type&&(p=l.type=l.type[dt](),"line-block"===p?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===p?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===p&&(l.type="block",l.multiline=!0,l.escape="\\"))))}m=g;for(n in m)if(m[ct](n))for(l=m[n];l.extend;)a=l.extend,c(l,"extend"),u=g[a],u&&(It&e(u)&&(u=g[a]={type:"simple",tokens:u}),l=s(u,l));m=g;for(n in m)m[ct](n)&&(l=m[n],l.type?(p=l.type=l.type[dt](),"line-block"===p?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===p?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===p&&(l.type="block",l.multiline=!0,l.escape="\\")):l["escaped-line-block"]?(l.type="block",l.multiline=!1,l.escape||(l.escape="\\"),l.tokens=l["escaped-line-block"],c(l,"escaped-line-block")):l["escaped-block"]?(l.type="block",l.multiline=!0,l.escape||(l.escape="\\"),l.tokens=l["escaped-block"],c(l,"escaped-block")):l["line-block"]?(l.type="block",l.multiline=!1,l.escape=!1,l.tokens=l["line-block"],c(l,"line-block")):l.comment?(l.type="comment",l.escape=!1,l.tokens=l.comment,c(l,"comment")):l.block?(l.type="block",l.tokens=l.block,c(l,"block")):l.simple?(l.type="simple",l.tokens=l.simple,c(l,"simple")):l.nop?(l.type="action",l.action=["nop",l.nop,!1],l.nop=!0):l.error?(l.type="action",l.action=["error",l.error,!!l["in-context"]],c(l,"error")):l[ct]("context")?(l.type="action",l.action=[l.context?"context-start":"context-end",l.context,!!l["in-context"]],c(l,"context")):l.indent?(l.type="action",l.action=["indent",l.indent,!!l["in-context"]],c(l,"indent")):l.outdent?(l.type="action",l.action=["outdent",l.outdent,!!l["in-context"]],c(l,"outdent")):l.unique?(l.type="action",l.action=["unique",_t&e(l.unique)?["_DEFAULT_",l.unique]:l.unique,!!l["in-context"]],c(l,"unique")):l.push?(l.type="action",l.action=["push",l.push,!!l["in-context"]],c(l,"push")):l[ct]("pop")?(l.type="action",l.action=["pop",l.pop,!!l["in-context"]],c(l,"pop")):l.type="simple","action"===l.type?l.ci=!(!l.caseInsesitive&&!l.ci):"block"===l.type||"comment"===l.type?(l.multiline=l[ct]("multiline")?!!l.multiline:!0,_t&e(l.escape)||(l.escape=!1)):"simple"===l.type&&(l.meta=l.autocomplete&&_t&e(l.meta)?l.meta:null,l.ci=!(!l.caseInsesitive&&!l.ci)));m=k;for(n in m)m[ct](n)&&(l=m[n],Tt!==e(l)||l.type?l.type&&(p=l.type=l.type[dt](),"group"===p&&l.match?(i=e(l.match),_t&i?(f=l.match[dt](),"alternation"===f||"either"===f?(l.type="alternation",c(l,"match")):"sequence"===f||"all"===f?(l.type="sequence",c(l,"match")):"zeroorone"===f?(l.type="zeroOrOne",c(l,"match")):"zeroormore"===f?(l.type="zeroOrMore",c(l,"match")):"oneormore"===f?(l.type="oneOrMore",c(l,"match")):(l.type="sequence",c(l,"match"))):Et&i&&(l.type="repeat",l.repeat=l.match,c(l,"match"))):"either"===p?l.type="alternation":"all"===p?l.type="sequence":"lookahead"===p?l.type="positiveLookahead":"grammar"===p&&(l.type="subgrammar"),"subgrammar"!==l.type||l.tokens||(l.tokens=n)):l.ngram||l["n-gram"]?(l.type="ngram",l.tokens=l.ngram||l["n-gram"],l["n-gram"]?c(l,"n-gram"):c(l,"ngram")):l.sequence||l.all?(l.type="sequence",l.tokens=l.sequence||l.all,l.all?c(l,"all"):c(l,"sequence")):l.alternation||l.either?(l.type="alternation",l.tokens=l.alternation||l.either,l.either?c(l,"either"):c(l,"alternation")):l.zeroOrOne?(l.type="zeroOrOne",l.tokens=l.zeroOrOne,c(l,"zeroOrOne")):l.zeroOrMore?(l.type="zeroOrMore",l.tokens=l.zeroOrMore,c(l,"zeroOrMore")):l.oneOrMore?(l.type="oneOrMore",l.tokens=l.oneOrMore,c(l,"oneOrMore")):l.positiveLookahead||l.lookahead?(l.type="positiveLookahead",l.tokens=l.positiveLookahead||l.lookahead,l.lookahead?c(l,"lookahead"):c(l,"positiveLookahead")):l.negativeLookahead?(l.type="negativeLookahead",l.tokens=l.negativeLookahead,c(l,"negativeLookahead")):(l.subgrammar||l.grammar)&&(l.type="subgrammar",l.tokens=l.subgrammar||l.grammar,l.subgrammar?c(l,"subgrammar"):c(l,"grammar")));return t}function E(t,n,r){if(r=r||{},n=n||[],!t||!t.length)return n;var o,s,l,i,a,u,c;for(o=0,s=t.length;s>o;o++)if(a=t[o])if(Ie===a.type)if(a.autocompletions)for(l=0,i=a.autocompletions.length;i>l;l++)c=a.autocompletions[l],r[ct]("w_"+c.word)||(n.push(c),r["w_"+c.word]=1);else _t===a.token.ptype&&_t&e(a.token.pattern)&&a.token.pattern.length>1&&(r[ct]("w_"+a.token.pattern)||(n.push({word:""+a.token.pattern,meta:a.name,ci:!!a.ci}),r["w_"+a.token.pattern]=1));else if(Be===a.type)E(a.token,n,r);else if(Qe&a.type){l=0,i=a.token.length;do E([u=a.token[l++]],n,r);while(i>l&&(Ue&u.type&&1>u.min||Te===u.type))}else Ue&a.type&&E([a.token[0]],n,r);return n}function T(t,n,r,o){for(var s;_t&e(s=n[t]||r[t]);)t=s;return o?t:n[t]||r[t]||t}function q(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];Jt.test(o)&&Jt.test(r)&&r===o||n.push(o)},1,e.length-1,[e[0]]):e}function P(n,r,s){var l,i,a,u,c,p,f,m,h,g,k,d,v,x,w,C=!1;if(w=n.modifier?n.modifier:null,m=new String(Bt(n)),m.pos=0,1===m.length)d=""+n,r[d]||s[d]||(r[d]={type:"simple",tokens:n}),n=d;else{for(l=[],i=[],a="",v=[];m.posc[0]&&(c[0]=0),2>c.length?c.push(c[0]):c[1].length?c[1]=parseInt(c[1],10)||yt:c[1]=yt,0>c[1]&&(c[1]=0),k=i[i.length-1],d=""+k+["{",c[0],",",isFinite(c[1])?c[1]:"","}"].join(""),s[d]||(s[d]={type:"repeat",repeat:[c[0],c[1]],tokens:[k]}),i[i.length-1]=d):a+=h;else{if("}"===h){a+=h;continue}"&"===h||"!"===h?i.length?(k=i[i.length-1],d=""+k+h,s[d]||(s[d]={type:"!"===h?"negativeLookahead":"positiveLookahead",tokens:[k]}),i[i.length-1]=d):a+=h:"|"===h?(C=!1,i=q(i),i.length>1?(d=""+i.join(" "),s[d]||(s[d]={type:"sequence",tokens:i}),l.push(d)):i.length?l.push(i[0]):a+=h,i=[]):"("===h?(v.push([i,l,a]),i=[],l=[],a=""):")"===h&&(i=q(i),i.length>1?(d=""+i.join(" "),s[d]||(s[d]={type:"sequence",tokens:i}),l.push(d)):i.length&&l.push(i[0]),i=[],l=q(l,1),l.length>1?(d=""+l.join(" | "),s[d]||(s[d]={type:"alternation",tokens:l})):l.length&&(d=l[0]),l=[],x=v.pop(),i=x[0],l=x[1],a=x[2],k=d,d="("+k+")",s[d]||(s[d]=o(T(k,r,s))),i.push(d))}}else a+=h;a.length&&(C?(i.length&&(k=i[i.length-1],d=k+"."+a,p=r[d]||s[d],p||(f=T(k,r,s),s[d]=_t&e(f)?new String(f):o(f),s[d].modifier=a),i[i.length-1]=d),C=!1):"0"===a?(r[lt]||(r[lt]={type:"simple",tokens:0}),i.push(lt)):"^^"===a?(r[tt]||(r[tt]={type:"simple",tokens:qe}),i.push(tt)):"^^1"===a?(r[nt]||(r[nt]={type:"simple",tokens:Pe}),i.push(nt)):"^"===a?(r[rt]||(r[rt]={type:"simple",tokens:Fe}),i.push(rt)):"$"===a?(r[ot]||(r[ot]={type:"simple",tokens:De}),i.push(ot)):(r[a]||s[a]||(r[a]={type:"simple",tokens:a}),i.push(a))),a="",i=q(i),i.length>1?(d=""+i.join(" "),s[d]||(s[d]={type:"sequence",tokens:i}),l.push(d)):i.length&&l.push(i[0]),i=[],l=q(l,1),l.length>1?(d=""+l.join(" | "),s[d]||(s[d]={type:"alternation",tokens:l}),n=d):l.length&&(n=l[0]),l=[]}return w&&(r[n]||s[n])&&((r[n]||s[n]).modifier=w),n}function D(o,s,l,u,c,p,f,m,h,g,k){var d,$,y,b,v,x,w,C=null,M=null,E=null;if(qe===o||Pe===o||Fe===o||De===o)return new B(o,qe===o?tt:Pe===o?$T_FBNL$:Fe===o?rt:ot,o,M);if(!1===o||0===o)return new B(Ne,lt,0,M);if(""===o)return new B(Ae,it,"",M);if(null===o)return new B(Ie,st,xt,M,E);if(Et&e(o)&&(y=o,o="NGRAM_"+y.join("_"),u[o]||(u[o]={type:"ngram",tokens:y})),o=""+o,m[o])return m[o];if(v=T(o,l,u),_t&e(v)&&(v=P(v,l,u),v=l[v]||u[v]||null),!v)return null;if(d=v.type?et[v.type[dt]().replace(Gt,"")]||Ie:Ie,M=v.msg||null,E=v.modifier||null,$=v.tokens,Ie&d){if(qe===$||Pe===$||Fe===$||De===$||!1===$||0===$)return C=new B($||Ne,o,$||0,M),m[o]=C,C;if(""===$)return C=new B(Ae,o,"",M),m[o]=C,C;if(null===$)return C=new B(Ie,o,xt,M,E),m[o]=C,C;if(!$)return null}if(Te&d)v[ct]("action")?"nop"===v.action[0]?v.action[0]=ye:"error"===v.action[0]?v.action[0]=be:"context-start"===v.action[0]?v.action[0]=xe:"context-end"===v.action[0]?v.action[0]=we:"push"===v.action[0]?v.action[0]=Ce:"pop"===v.action[0]?v.action[0]=Oe:"unique"===v.action[0]?v.action[0]=ve:"indent"===v.action[0]?v.action[0]=Le:"outdent"===v.action[0]&&(v.action[0]=_e):v[ct]("nop")?v.action=[ye,v.nop,!!v["in-context"]]:v[ct]("error")?v.action=[be,v.error,!!v["in-context"]]:v[ct]("context")?v.action=[v.context?xe:we,v.context,!!v["in-context"]]:v[ct]("context-start")?v.action=[xe,v["context-start"],!!v["in-context"]]:v[ct]("context-end")?v.action=[we,v["context-end"],!!v["in-context"]]:v[ct]("push")?v.action=[Ce,v.push,!!v["in-context"]]:v[ct]("pop")?v.action=[Oe,v.pop,!!v["in-context"]]:v[ct]("unique")?v.action=[ve,_t&e(v.unique)?["_DEFAULT_",v.unique]:v.unique,!!v["in-context"]]:v[ct]("indent")?v.action=[Le,v.indent,!!v["in-context"]]:v[ct]("outdent")&&(v.action=[_e,v.outdent,!!v["in-context"]]),v.nop&&(v.action[0]=ye),C=new B(Te,o,v.action.slice(),M,E),C.ci=!!v.caseInsensitive||v.ci,m[o]=C;else if($=i($),Ie&d){w=v.autocomplete?S(v,Nt&e(v.autocomplete)?i(v.autocomplete):$,o,k):null;var q={};if(x="undefined"!=typeof v.combine?v.combine:!!(Et&e(v.tokens)),C=new B(Ie,o,O(o,$.slice(),s,x,!(!v.caseInsensitive&&!v.ci),p,f,q),M,E,null,w),q.keywords&&(C.keywords=q.keywords.join("|")),m[o]=C,null!=v.except){var F,N,A=i(v.except),I=A.length,R=[];for(F=0;I>F;F++)A[F]&&(N=D(A[F],s,l,u,c,p,f,m,h,g,k),N&&R.push(N));R.length&&(C.except=R)}}else Re&d?(je===d&&_(v,g),C=new B(d,o,L(o,$.slice(),s,p,f),M),C.empty=v[ct]("empty")?!!v.empty:!0,C.mline=v[ct]("multiline")?!!v.multiline:!0,C.esc=v[ct]("escape")?v.escape:!1,C.inter=!!c[o+".inside"],je===d&&v.interleave&&h.push(U(C)),E&&(C.modifier=E),m[o]=C):Xe&d&&(Je===d?m[o]=new B(Je,o,$,M,E):Ve===d?(b=a($),C=t(b,function(e,t){return new B(Ve,o+"_NGRAM_"+t,null,M,E)}),m[o]=C,r(function(e){C[e].token=i(n(b[e],function(e,t){return e.concat(D(t,s,l,u,c,p,f,m,h,g,k))},[]))},0,b.length-1)):(Ze===d||Ke===d?C=new B(d,o,null,M,E):Ue&d&&Et&e(v.repeat)?(C=new B(Ue,o,null,M,E),C.min=v.repeat[0],C.max=v.repeat[1]):Ge===d?(C=new B(Ge,o,null,M,E),C.min=0,C.max=1):Ye===d?(C=new B(Ye,o,null,M,E),C.min=0,C.max=yt):He===d?(C=new B(He,o,null,M,E),C.min=1,C.max=yt):C=Be===d?new B(Be,o,null,M,E):new B(ze,o,null,M,E),m[o]=C,C.token=i(n($,function(e,t){return e.concat(D(t,s,l,u,c,p,f,m,h,g,k))},[]))));return m[o]}function F(e,t){var n,r,o=e.Style,s=e.Lex,l=e.Syntax,i=[],a={};for(n in o)o[ct](n)&&(r=s[n]||l[n],!r||"block"!=r.type&&"comment"!==r.type||(t&&(o[n+".inside"]||o[n])?(n=o[n+".inside"]||o[n],a[ct](n)||(i.push(n),a[n]=1)):t||a[ct](n)||(i.push(n),a[n]=1)));return i}function N(t){var n={};return t.Lex=t.Lex||{},t.Syntax=t.Syntax||{},t=M(t),t.Parser&&t.Parser.length&&r(function o(s,l){var i,a,u,c=l[s];n[c]||(Et&e(c)&&(i=c,c="NGRAM_"+i.join("_"),t.Syntax[c]||(t.Syntax[c]={type:"ngram",tokens:i})),a=T(c,t.Lex,t.Syntax),_t&e(a)&&(a=P(a,t.Lex,t.Syntax),a=t.Lex[a]||t.Syntax[a]||null),a&&(n[c]=a,u=a.type?et[a.type[dt]().replace(Gt,"")]||Ie:Ie,Xe&u&&r(o,0,a.tokens.length-1,a.tokens)))},0,t.Parser.length-1,t.Parser),t}function A(t){var r,s,l,i,a,u,c,p,f,m,h,g,k,d;return t.__parsed?t:(r=t.RegExpID||null,l=t.Extra?o(t.Extra):{},i=t.Style?o(t.Style):{},a=null,u=null,c=t.Lex?o(t.Lex):{},p=t.Syntax?o(t.Syntax):{},f={},m={},h={},k={},d={},g=[],s=t.Parser?o(t.Parser):[],t=M({Style:i,Fold:a,Match:u,Lex:c,Syntax:p,$parser:null,$interleaved:null,$comments:null,$autocomplete:null,$extra:l,__parsed:0}),t.$parser=n(s,function(t,n){var o=D(n,r,c,p,i,f,m,h,g,k,d)||null;return o&&(Et&e(o)?t=t.concat(o):t.push(o)),t},[]),t.$interleaved=g&&g.length?g:null,t.$comments=k,t.$autocomplete=d&&d.autocomplete&&d.autocomplete.length?d.autocomplete:null,t.__parsed=1,t)}function I(t,n,r,o,s){var l,i,a=this;l=a.type=t,a.name=n,a.pattern=r,i=a.ptype=o||_t,a.key=s||0,Me===l?a.key=!1!==s:Ee===l?a.pattern[0]=new I(Me,n+"_Start",r[0],null,!1):xt===i?a.pattern=null:Pt===i&&(a.pattern=Pt&e(r)?[r,0]:[r[0],r[1]||0])}function R(t,n,r,o){var s,l,i,a,u,c,p,f,m,h,g,k=t,d=k.type,$=k.pattern,y=k.key;if(Ee===d){if(s=k.name,i=$[0],a=$[1],c=R(i,n,r,o))return u=a[c[0]],f=e(u),m=i.pattern[c[0]].ptype,Pt===m&&Ft&f&&(u.regex_pattern?(p=v(u,c[1]),u=new I(Se,s+"_End",x(p,u.regex_pattern,{}),Pt)):(p=wt&f?c[1][u+1]:v(u,c[1]),u=new I(Se,s+"_End",p,p.length>1?_t:St))),u}else if(Me===d){for(h=0,g=$.length;g>h;h++)if(p=R($[h],n,r,o))return y?[h,p[1]]:p}else{if(l=k.ptype,xt===l)return!1!==r&&n.end(),[y,""];if(Pt===l){if(p=$[0].xflags.l?n.match($[0]):n.slice(n.pos).match($[0]),p&&0===p.index)return!1!==r&&n.mov(p[$[1]||0].length),[y,$[1]>0?p[$[1]]:p]}else if(Mt===l){if(!0===o){p=-1;var b,w;for(g=$.length-1;g>=0;g--)b=n.indexOf($[$t](g),n.pos),b>-1&&(-1===p||p>b)&&(p=b,w=$[$t](g));if(p>-1)return!1!==r&&(n.pos=p+1),[y,w]}else if(p=n[$t](n.pos)||null,p&&-1<$.indexOf(p))return!1!==r&&n.mov(1),[y,p]}else if(St===l){if(!0===o){if(p=n.indexOf($,n.pos),p>-1)return!1!==r&&(n.pos=p+1),[y,$]}else if(p=n[$t](n.pos)||null,$===p)return!1!==r&&n.mov(1),[y,p]}else if(_t===l)if(g=$.length,!0===o){if(p=n.indexOf($,n.pos),p>-1)return!1!==r&&(n.pos=p+g),[y,$]}else if($===n.substr(n.pos,g))return!1!==r&&n.mov(g),[y,$]}return!1}function j(e,t){this.val=e||null,t?this.prev=t:this.prev=null}function B(e,t,n,r,o,s,l,i){var a=this;a.type=e,a.name=t,a.token=n,a.modifier=o||null,a.except=s||null,a.autocompletions=l||null,a.keywords=i||null,a.pos=null,a.msg=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}function U(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|=he),n&&(o.modifier=n),r&&(o.$id=r),o}function G(e){var t=e.name;return e.$msg?e.$msg:e.status&he?'Token "'+t+'"'+(e.keywords?": "+e.keywords:"")+" Expected":'Syntax Error: "'+t+'"'}function Y(e,t,n,r,o,s,l){e.status&fe&&(e.err[""+t+"_"+n+"_"+r+"_"+o+"_"+(s?s.name:"ERROR")]=[t,n,r,o,l||G(s)])}function H(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 W(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 Z(e,t,n,r){var o,s,l,i,a,u=1/0,c=null,p=1/0;if(s=t.pos,t.spc(),l=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?(u=t.pos,c=o,p=a):u===t.pos&&p>a&&(u=t.pos,c=o,p=a),t.pos=l,o=o.prev,a++}u=s&&t.pos===l}function K(e,t,n,r){if(!e)return!1;var o=e.type,s=Xe&o?X:Re&o?Q:Te&o?V:J;return s(e,t,n,r)}function V(t,n,r,o){var s,l,i,a,u,c,p,f,m,h,g,k,d,$,y,b=t,x=b.token||null,w=b.ci,C=b.name,O=!(r.status&fe);if(b.status=0,b.$msg=null,O||!x||!o||!o.pos)return!0;if(y=!!(Re&o.T),ye===x[0]||y&&!o.block)return!0;if(s=x[0],l=x[1],k=x[2],u=b.msg,y?($=o.block.match||o.block.str,f=o.block.pos[0][0],m=o.block.pos[0][1],h=o.block.pos[0][2],g=o.block.pos[0][3]):($=o.match||o.str,f=o.pos[0],m=o.pos[1],h=o.pos[2],g=o.pos[3]),be===s)return!u&&_t&e(l)&&(u=l),b.$msg=u?v(u,$,!0):'Error "'+C+'"',Y(r,f,m,h,g,b,G(b)),b.status|=ge,!1;if(we===s)r.ctx=r.ctx?r.ctx.prev:null;else if(xe===s)r.ctx=new j({symb:{},queu:null},r.ctx);else if(Oe===s){if(k){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;if(l){if(l=v(l,$),w&&(l=l[dt]()),!c||l!==c.val[0])return c?(b.$msg=u?v(u,[c.val[0],l],!0):'Tokens do not match "'+c.val[0]+'","'+l+'"',d=G(b),Y(r,c.val[1],c.val[2],c.val[3],c.val[4],b,d),Y(r,f,m,h,g,b,d),c=c.prev):(b.$msg=u?v(u,["",l],!0):'Token does not match "'+l+'"',d=G(b),Y(r,f,m,h,g,b,d)),b.status|=ge,k?r.ctx&&(r.ctx.val.queu=c):r.queu=c,!1;c=c?c.prev:null}else c=c?c.prev:null;k?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(Ce===s&&l){if(k){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;l=v(l,$),w&&(l=l[dt]()),b.$msg=u?v(u,l,!0):'Token does not match "'+l+'"',c=new j([l,f,m,h,g,G(b)],c),k?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(ve===s){if(k){if(!r.ctx)return!0;p=r.ctx.val.symb}else p=r.symb;if(i=l[1],a=l[0],i=v(i,$,!0),w&&(i=i[dt]()),p[ct](a)||(p[a]={}),p[a][ct](i))return b.$msg=u?v(u,i,!0):'Duplicate "'+i+'"',d=G(b),Y(r,p[a][i][0],p[a][i][1],p[a][i][2],p[a][i][3],b,d),Y(r,f,m,h,g,b,d),b.status|=ge,!1;p[a][i]=[f,m,h,g]}return!0}function J(e,t,n,r,o){var s,l,i=e,a=i.token,u=i.modifier,c=i.type,p=i.name,f=i.except,m=n.line,h=t.pos,g=null,k=!1;if(i.status&=de,i.$msg=o?null:i.msg||null,i.pos=t.pos,f&&!o){l=te(n,t);for(var d=0,$=f.length;$>d;d++)if(s=f[d],i!==s&&Ie===s.type&&J(s,t,n,r,1))return i.pos=s.pos,te(n,t,l),!1}return qe===c?k=0===n.line:Pe===c?k=n.bline+1===n.line:Fe===c?k=t.sol():De===c?(t.spc(),t.eol()?k=p:(i.pos=t.pos,t.bck(h))):Ne===c?(i.status=0,k=!0):Ae===c?(i.status&he&&t.spc()&&!t.eol()?(i.pos=t.pos,t.bck(h),i.status|=ge):k=!0,i.status&=ke):xt===a?(t.end(),k=u||p):(g=R(a,t))&&(g=g[1],k=u||p),o?k:(!1!==k&&(r.T=c,r.id=p,r.type=k,r.str=t.sel(h,t.pos),r.match=g,r.pos=[m,h,m,t.pos]),!k&&i.status&&i.$msg&&(i.$msg=v(i.$msg,p,!0)),k)}function Q(e,t,n,r){var o,s,l,i,a,u,c,p,f,m,h,g,k,d,$,y,b,x,w,C,O,L,_=e,S=_.name,M=_.type,E=_.modifier,T=_.token,q=_.mline,P=_.inter,D=P?S+".inside":S,F=_.esc,N=!!F,A="",I="",j="",B="",z=_.$id||S,G=n.outer,Y=G&&G[2],W=G&&G[1];if(_.status&=de,_.$msg=_.msg||null,_.pos=t.pos,C=n.line,O=t.pos,je===M&&(_.status&=ke),$=_.status&he,l=0,i=0,n.block&&n.block.name===S?(i=1,l=1,d=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,t))&&(i=1,d=S,b=t.pos,p=[C,O],m=[[C,b],[C,b]],f=[C,b],A=t.sel(O,b),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,s=xt===o.ptype,y=s||_.empty,P){if(s&&l&&t.sol())return _.status&=ke,n.block=null,!1;if(!l)return b=t.pos,r.T=M,r.id=S,r.type=E||d,r.str=t.sel(O,b),r.match=null,r.pos=[C,O,C,b],H(n,w,U(_,$,0,z)),E||d}if(b=t.pos,a=W?s&&t.eol():R(o,t),c=q,u=0,a)d=s?D:S,B=t.sel(b,t.pos);else if(x=t.pos,g=!1,W||N||Mt!==o.ptype&&St!==o.ptype&&_t!==o.ptype){for(;!t.eol();){if(W){if(K(W,t,Y,r)){if(t.pos>x){s&&(a=1);break}return!0}if(s){k=t.nxt(1),j+=k;continue}}if(b=t.pos,!g&&R(o,t)){P&&t.pos>b&&b>x?(d=D,t.bck(b),u=1):(d=S,a=1),B=t.sel(b,t.pos);break}k=t.nxt(1),j+=k,g=N&&!g&&F===k,b=t.pos}s&&t.eol()&&(a=1)}else(L=R(o,t,!0,!0))?P&&t.pos>b+L[1].length?(d=D,t.mov(-L[1].length),u=1,j=t.sel(b,t.pos)):(d=S,a=1,j=t.sel(b,t.pos-L[1].length),B=L[1]):(t.end(),d=D,u=1,j=t.sel(b,t.pos));return c=q||N&&g,I+=j,m[1]=[C,b],f=[C,t.pos],a&&!y&&m[0][0]===m[1][0]&&m[0][1]===m[1][1]?(n.block=null,!1):(a||!c&&!u?n.block=null:(n.block.ip=m,n.block.ep=f,n.block.i=I,n.block.e=B,H(n,w,U(_,$,0,z))),r.T=M,r.id=S,r.type=E||d,r.str=t.sel(O,t.pos),r.match=null,r.pos=[C,O,f[0],f[1]],_.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||d)}return _.status&&_.$msg&&(_.$msg=v(_.$msg,S,!0)),!1}function X(e,t,n,r){var o,s,l,i,a,u,c,f,m,h,g,k,d,$,y,b=e,v=b.type,x=(b.name,b.token),w=x.length,C=b.modifier;if(b.status&=de,b.$msg=b.msg||null,f=t.pos,m=n.stack,b.pos=t.pos,u=0,c=0,Je===v){b.status&=de;var O=new String(x[0]),L=n.stack?n.stack.val:null;return O.subgrammar=1,O.next=L?new B(Ze,L.name,[L]):null,O.required=L?L.status&he:0,O}if(Be===v){for(d=p(),b.status|=he,k=[],y=te(n,t),g=0,h=g;w>h;h++){if(o=U(x[h],1,C,d),s=K(o,t,n,r),b.pos=o.pos,o.status&he&&(u++,k.push(G(o))),!1!==s)return s;o.status&ge&&(c++,te(n,t,y))}return u>0?b.status|=he:b.status&=ke,w===c&&u>0?b.status|=ge:b.status&=de,b.status&&!b.$msg&&k.length&&(b.$msg=k.join(" | ")),!1}if(Qe&v){$=!!(v&ze),d=b.$id||p(),$?b.status|=he:b.status&=ke,y=te(n,t),g=0;do o=U(x[g++],$,C,d),s=K(o,t,n,r);while(w>g&&(!0===s&&We&o.type||!1===s&&!(o.status&he)));if(b.pos=o.pos,!1!==s){if(!0!==s||Ne!==o.type)for(h=w-1;h>=g;h--)m=H(n,m,U(x[h],1,C,d));return s.subgrammar&&w>g&&(s.next=new B(Ze,x[g].name,[x[g]]),s.required=x[g].status&he),s}return o.status&ge?($?b.status|=ge:b.status&=de,te(n,t,y)):$&&o.status&he&&(b.status|=ge),b.status&&!b.$msg&&(b.$msg=G(o)),!1}if(We&v)return Je&x[0].type?!0:(y=te(n,t,null,!1),s=K(U(x[0],0),t,n,r),te(n,t,y),Ke===v?!1===s:!1!==s);for(d=b.$id||p(),l=b.found,i=b.min,a=b.max,b.status=0,k=[],y=te(n,t),h=0;w>h;h++){if(o=U(x[h],1,C,d),s=K(o,t,n,r),b.pos=o.pos,!1!==s){if(++l,a>=l)return b.found=l,H(n,m,U(b,0,0,p())),b.found=0,s;break}o.status&he&&(u++,k.push(G(o))),o.status&ge&&te(n,t,y)}return i>l&&(b.status|=he),(l>a||i>l&&u>0)&&(b.status|=ge),b.status&&!b.$msg&&k.length&&(b.$msg=k.join(" | ")),!1}function ee(e,t){var n=this;n.id=e?f("state"):"state",t instanceof ee?(n.line=t.line,n.bline=t.bline,n.status=t.status,n.stack=W(t.stack,!1),n.token=t.token,n.block=t.block,n.outer=t.outer?[t.outer[0],t.outer[1],new ee(e,t.outer[2])]:null,n.status&fe?(n.queu=t.queu,n.symb=t.symb,n.ctx=t.ctx,n.err=t.err):(n.queu=null,n.symb=null,n.ctx=null,n.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.block=null,n.outer=null,n.status&fe?(n.queu=[],n.symb={},n.ctx=null,n.err={}):(n.queu=null,n.symb=null,n.ctx=null,n.err=null),n.$eol$=!0,n.$blank$=!0)}function te(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 ne(e){e.id=null,e.line=null,e.bline=null,e.status=null,e.stack=null,e.token=null,e.block=null,e.outer=null,e.queu=null,e.symb=null,e.ctx=null,e.err=null}function re(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?gt(0,r.pos+e):kt(r.length,r.pos+e),r},r.bck=function(e){return r.pos=gt(0,e),r},r.sft=function(){return r.start=r.pos,r},r.nxt=function(e,t){var n,o,s="";if(!0===e){for(t=t||re.$NONSPC$;r.posi||i>=t)return l+(t-s);l+=i-s,l+=n-l%n,s=i+1}}function se(n,r){return Nt&e(n)&&(n=y("\\b("+t(i(n).sort(zt),$).join("|")+")\\b")),!1===r?function(e){return!e||!n.test(e)}:function(e){ +return!!e&&n.test(e)}}function le(e,t,n,r,o,s){for(;;){n.lastIndex=e.col;var l=n.exec(e.text);if(!l){if(e.next()){e.text=e.line(e.row);continue}return}{if(t(e.token(e.row,l.index+1)))return e.col=l.index+l[0].length,l;e.col=l.index+1}}}function ie(e,t,n,r,o,s){for(var l,i,a;;){if(l=e.text.indexOf(o,e.col),-1===l){if(e.next()){e.text=e.line(e.row);continue}return}if(t(e.token(e.row,l+1)))return i=e.text.lastIndexOf(s,l),a=i>-1&&!re.$NOTEMPTY$.test(e.text.slice(i+1,l)),e.col=l+1,a?"autoclosed":"regular";e.col=l+1}}function ae(e,t,n,r,o,s,l,i,a,u){if(-1===e){var c,p,f,m,h,g,k,d,$=1,y=t.first(),b=(s.length,l.length,!1===o);e:for(c=n;c>=y;--c)for(p=t.line(c),f=p.length,m=c===n?r-1:f;;){if(0>m)break;if(h=p.lastIndexOf(s,m),g=p.lastIndexOf(l,m),0>h&&0>g)break;if(m=gt(h,g),b||u||t.token(c,m+1)==o)if(m===g)++$;else if(0===--$){k=c,d=m;break e}--m}return null==k||a&&k===n&&d===r?!1:[k,d,n,r]}var c,p,f,m,h,g,v,x,$=1,w=t.last(),b=(s.length,l.length,!1===o);e:for(c=n;w>=c;++c)for(p=t.line(c),f=p.length,m=c===n?r:0;;){if(m>=f)break;if(h=p.indexOf(s,m),g=p.indexOf(l,m),0>h&&0>g)break;if(0>h&&(h=f),0>g&&(g=f),m=kt(h,g),b||u||t.token(c,m+1)==o)if(m===h)++$;else if(0===--$){v=c,x=m;break e}++m}return null==v||a&&n===v&&x===r?!1:[n,r,v,x]}function ue(e,t,n){var r=n.text,o=n.meta,s=n.start,l=n.end,i=t.list.maxlen-r.length-o.length+5;e.innerHTML=['',d(r.slice(0,s)),'',d(r.slice(s,l)),"",d(r.slice(l)),"",new Array(1+i).join(" "),'',d(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 ce(e,t,n){function r(e,t){var o;return o={Mode:r,startState:function(){return{parser:r.$parser,state:new ee,inner:{},name:null}},copyState:function(e){return{parser:e.parser,state:new ee(0,e.state),inner:e.inner,name:e.name}},token:function(e,t){var n=re(e.string,e.start,e.pos),r=t.parser.get(n,t).type;return e.pos=n.pos,r},indent:function(r,o,s){return r.parser.indent(r.state,o,s,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||tn,r.$id=f("codemirror_grammar_mode"),r.$parser=new sn.Parser(A(e),t),r.$parser.Mode=r,r.options=function(e,t,n){n=n||{};var o=e.getTokenAt(t).state,s=o&&o.parser||r.$parser;return n.lineComment=s.LC,n.blockCommentStart=s.BCS,n.blockCommentEnd=s.BCE,n.blockCommentContinue=s.BCC,n.blockCommentLead=s.BCL,n.electricInput=s.$grammar.$extra.electricInput||!1,n.electricChars=s.$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 s(e,t){if(r.supportAutoCompletion){var o=e.getTokenAt(e.getCursor()).state,l=o&&o.parser||r.$parser;return t=s.options||t||{},t[ct]("renderer")||(t.renderer=s.renderer||ue),l.autocomplete(e,t,n)}},r.autocompleter.renderer=ue,r.supportCodeFolding=!0,r.foldType="fold_"+r.$id,r.folder=function(e,t){if(r.supportCodeFolding){var o,s=e.getTokenAt(t).state,l=s&&s.parser||r.$parser;if(o=l.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 l(e){if(r.supportCodeMatching){if(l.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,s=l.options||{},i=s.maxHighlightLineLength||1e3,a=[],u=e.listSelections(),c="CodeMirror-matchingtag",p="CodeMirror-nonmatchingbracket",f=0;for(u.length;1>f;f++)t=o.match(e,u[f].to(),n),null!=t&&(!1===t?(u[f].empty()?(t=u[f].to(),t=[n.Pos(t.line,t.ch-1),t]):t=[u[f].from(),u[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:c})),e.getLine(t[4]).length<=i&&a.push(e.markText(n.Pos(t[4],t[5]),n.Pos(t[6],t[7]),{className:c}))):"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:c})),e.getLine(t[0]).length<=i&&a.push(e.markText(n.Pos(t[0],t[1]),n.Pos(t[2],t[3]),{className:c}))));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 pe=1,fe=2,me=32,he=4,ge=8,ke=~he,de=~ge,$e=he|ge,ye=0,be=4,ve=8,xe=16,we=17,Ce=32,Oe=33,Le=128,_e=129,Se=2,Me=4,Ee=8,Te=4,qe=8,Pe=9,De=16,Fe=32,Ne=128,Ae=256,Ie=512,Re=1024,je=1025,Be=2048,ze=4096,Ue=8192,Ge=8193,Ye=8194,He=8195,We=16384,Ze=We,Ke=16385,Ve=32768,Je=65536,Qe=ze|Ve,Xe=Be|ze|Ue|We|Ve|Je,et={action:Te,simple:Ie,block:Re,comment:je,subgrammar:Je,alternation:Be,sequence:ze,repeat:Ue,zeroorone:Ge,zeroormore:Ye,oneormore:He,positivelookahead:Ze,negativelookahead:Ke,ngram:Ve},tt="$|SOF|$",nt="$|NONBLANK|$",rt="$|SOL|$",ot="$|EOL|$",st="$|ENDLINE|$",lt="$|EMPTY|$",it="$|NONSPACE|$",at=void 0,ut="prototype",ct="hasOwnProperty",pt="propertyIsEnumerable",ft=Object[ut],mt=ft.toString,ht=Object.create,gt=Math.max,kt=Math.min,dt="toLowerCase",$t="charAt",yt=1/0,bt=4,vt=8,xt=16,wt=32,Ct=33,Ot=34,Lt=64,_t=128,St=129,Mt=130,Et=256,Tt=512,qt=1024,Pt=2048,Dt=4096,Ft=_t|wt,Nt=_t|Et,At=Pt|Et,It=_t|Et|Pt,Rt={"[object Number]":wt,"[object String]":_t,"[object Array]":Et,"[object RegExp]":Pt,"[object Date]":Dt,"[object Function]":qt,"[object Object]":Tt},jt=/^\s+|\s+$/g,Bt=String[ut].trim?function(e){return e.trim()}:function(e){return e.replace(jt,"")},zt=function(e,t){return t.length-e.length},Ut=/\r\n|\r|\n/g,Gt=/[\-_]/g,Yt=0,Ht=/([.*+?^${}()|[\]\/\\\-])/g,Wt=/[&"'<>]/g,Zt=/^([.!&\[\]{}()*+?\/|'"]|\s)/,Kt="(\\s|\\W|$)",Vt=/(l?i?l?)x(l?i?l?)$/,Jt=/[*+]$/;ee.prototype.toString=function(){var e=this;return e.id+"_"+e.line+"_"+e.bline+"_"+(e.block?e.block.name:"0")},re.$SPC$=/^[\s\u00a0]+/,re.$NONSPC$=/[^\s\u00a0]/,re.$NOTEMPTY$=/\S/,re.$SPACE$=/^\s*/;var Qt=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){var r,o,s,l,i,a,u,c,p,f,m,h,g,k,d,$,y,b=this,v=b.$grammar,x=v.Style,w=b.DEF,C=b.ERR,O={},L=b.$n$,_=b.$t$,S=b.$v$,M=v.$interleaved,E=v.$parser,T=E.length,q=M?M.length:0,P=t.outer,D=P&&P[2],F=P&&P[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,l=t.line,i=e.pos,f=!1,h=!0,m=!1,g=!1,P&&b===P[0]){if(O[L]=null,O[_]=w,O[S]=null,F){if(s=new z,K(F,e,D,s))return t.outer=null,{parser:b,state:D};for(e.nxt(1);!e.eol();){if(K(F,e,D,s)){if(e.pos>i)break;return t.outer=null,{parser:b,state:D}}e.nxt(1)}}else e.spc(),e.eol()?g=!0:e.end();return O[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||t.$eol$),O}if(t.stack&&De===t.stack.val.type&&e.sol()&&(t.stack=t.stack.prev),(!t.stack||Ae!==t.stack.val.type&&null==t.block)&&e.spc()){if(t.stack&&Je===t.stack.val.type)return e.bck(i),r=t.stack.val,t.stack=t.stack.prev,f=K(r,e,t,s),k=""+f,b.$subgrammars[k]?(d=b.$subgrammars[k],$=new ee(1,n[k]?n[k]:t.status),D=t):(d=b,$=new ee,D=t),$.outer=[b,f.next,D],{parser:d,state:$,toInner:k};h=!1,g=!0}if(O[L]=null,O[_]=w,O[S]=null,h)for(s=new z,a=0;h&&(t.stack||T>a)&&!e.eol();){if(c=e.pos,p=t.stack,F){if(e.spc(),K(F,e,D,s))return e.pos>c?(O[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&!0,O):(t.outer=null,{parser:P[0],state:D,fromInner:t});e.bck(c)}if(y=!1,q&&!t.block)for(u=0;q>u;u++)if(r=M[u],f=K(r,e,t,s),!1!==f){y=!0;break}if(h&&!y){if(!t.stack&&a>=T)break;t.stack?(r=t.stack.val,t.stack=t.stack.prev):r=E[a++],f=K(r,e,t,s)}if(!1===f){if(r.status&$e){t.token=r,g=Z(t,e,s,r)||g,m=!0,h=!1;break}}else{if(f.subgrammar)return k=""+f,b.$subgrammars[k]?(d=b.$subgrammars[k],$=new ee(1,n[k]?n[k]:t.status),D=t):(d=b,$=new ee,D=t),$.outer=[b,f.next,D],{parser:d,state:$,toInner:k};if(t.stack&&t.stack.prev&&e.eol()&&Re&t.stack.val.type&&t.block&&t.block.name===t.stack.val.name)for(u=t.stack.prev;u&&Te===u.val.type;)o=u,u=u.prev,V(o,e,t,s),o.status&ge&&(t.$actionerr$=!0);else if(t.stack&&Te===t.stack.val.type)for(;t.stack&&Te===t.stack.val.type;)o=t.stack.val,t.stack=t.stack.prev,V(o,e,t,s),o.status&ge&&(t.$actionerr$=!0);if(!0!==f){h=!1;break}}}return h&&e.nxt(1),O[S]=e.cur(1),!1!==f?(f=x[f]||w,O[L]=r.name):m?(f=C,t.status&fe&&Y(t,l,i,l,e.pos,r)):f=w,O[_]=f,t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||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){var r=[];if(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,s,l,i,a,u=(e||"").split(Ut),c=u.length,p=null;if(t=t||pe,s=!!(t&fe),l=!!(t&pe),o={parser:this,state:new ee(0,t),inner:{}},o.state.$full_parse$=!0,r(function(e){u[e]+="\n"},0,c-2),l?p=r(t&me?function(e,t){t._=t._.concat(o.parser.tokenize(re(u[e]),o,e))}:function(e,t){t._.push(o.parser.tokenize(re(u[e]),o,e))},0,c-1,{_:[]})._:r(function(e){var t=re(u[e]);if(t.eol())o.state.line++,o.state.$blank$&&o.state.bline++;else for(;!t.eol();)o.parser.get(t,o)},0,c-1),n=o.state,s&&n.queu&&n.queu.length)for(;n.queu.length;)i=n.queu.shift(),Y(n,i[1],i[2],i[3],i[4],null,i[5]);return a=l&&s?{tokens:p,errors:n.err}:l?p:n.err,ne(n),o=n=null,a},autocompletion:function(e,t){var n,r,o=e.stack,s={},l=E([e.token],[],s);for(t=t||0;o;){if(n=o.val,r=n.type,Ue&r){if(l=E([n],l,s),0=u;++u)if(o=t.line(u),s=t.indentation(o),s>r)i=u,a=o.length;else if(e.test(o))break;return i?[p,l,i,a]:void 0}}},Delimited:function(e,t,n,r){return e&&t&&e.length&&t.length?(n=n||l,function(o){var s,l,i,a,u,c,p=o.row,f=o.col;for(s=o.line(p),i=f,a=0;;){var u=0>=i?-1:s.lastIndexOf(e,i-1);if(-1!==u){if(1===a&&f>u)return;if(n(c=o.token(p,u+1))){l=u+e.length;break}i=u-1}else{if(1===a)return;a=1,i=s.length}}return ae(1,o,p,l,c,e,t,n,!0,r)}):function(){}},MarkedUp:function(e,t,n,r,o){return e=e||l,t=t||"<",n=n||">",r=r||"/",o=o||y($(t)+"("+$(r)+"?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)",{g:1}),function(s){s.col=0,s.min=s.first(),s.max=s.last(),s.text=s.line(s.row);for(var l,i,a,u,c,p,f,m,h,g=s.row;;){if(l=le(s,e,o,t,n,r),!l||s.row!==g||!(i=ie(s,e,o,t,n,r)))return;if(!l[1]&&"autoclosed"!==i)for(a=[s.row,s.col],c=l[2],u=null,p=[];;){if(f=le(s,e,o,t,n,r),g=s.row,m=s.col-(f?f[0].length:0),!f||!(i=ie(s,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&&(!c||c===f[2]))return[a[0],a[1],g,m]}else p.push(f[2])}}}}},en={Pattern:function(e,t,n){return function(){}},Delimited:function(e,t,n,r){return e&&t&&e.length&&t.length?(n=n||l,function(o){var s,l=o.col,i=o.row,a=o.line(i),u=!1,c=e.length,p=t.length;return l>=c&&(1===c&&e===a.charAt(l-1)||e===a.slice(l-c,l))?(s=ae(1,o,i,l,u,e,t,n,!1,r),s?(s=[s[0],s[1]-c,s[0],s[1],s[2],s[3],s[2],s[3]+p],s.match="end"):(s=[i,l-c,i,l],s.match=!1),s):l>=p&&(1===p&&t===a.charAt(l-1)||t===a.slice(l-p,l))?(s=ae(-1,o,i,l-p,u,e,t,n,!1,r),s?(s=[s[0],s[1],s[0],s[1]+c,s[2],s[3],s[2],s[3]+p],s.match="start"):(s=[i,l-p,i,l],s.match=!1),s):void 0}):function(){}},MarkedUp:function(e,t,n,r,o){return function(){}}},tn="undefined"!=typeof CodeMirror?CodeMirror:{Pass:{toString:function(){return"CodeMirror.Pass"}}},nn=/[\w$]/,rn=function(e,t){return t.score-e.score},on=h(Qt,{constructor:function ln(t,n){var o,s=this,i=null,a=null;if(Qt.call(s,t,null,"error"),s.DEF=n||s.$DEF,s.ERR=t.Style.error||s.$ERR,s.LC=t.$comments.line?t.$comments.line[0]:null,s.BCS=t.$comments.block?t.$comments.block[0][0]:null,s.BCE=t.$comments.block?t.$comments.block[0][1]:null,s.BCC=s.BCL=t.$comments.block?t.$comments.block[0][2]:null,t.$comments.block&&t.$comments.block.length){o=ln.Type("comment");for(var u=0,c=t.$comments.block.length;c>u;u++)s.$folders.push(ln.Fold.Delimited(t.$comments.block[u][0],t.$comments.block[u][1],o,"comment"))}t.Fold&&_t&e(t.Fold)?i=t.Fold[dt]():t.$extra.fold&&(i=t.$extra.fold[dt]()),a=t.Match&&_t&e(t.Match)?t.Match[dt]():t.$extra.match?t.$extra.match[dt]():i;var p=F(t,1);o=p.length?ln.Type(p,!1):l,i&&(i=i.split("+"),r(function(e,t){var n,r=Bt(t[e]);"braces"===r?s.$folders.push(ln.Fold.Delimited("{","}",o)):"brackets"===r?s.$folders.push(ln.Fold.Delimited("[","]",o)):"parens"===r||"parentheses"===r?s.$folders.push(ln.Fold.Delimited("(",")",o)):"brace"===r||"cstyle"===r||"c"===r?(s.$folders.push(ln.Fold.Delimited("{","}",o)),s.$folders.push(ln.Fold.Delimited("[","]",o))):"indent"===r||"indentation"===r?s.$folders.push(ln.Fold.Indented()):"tags"===r||"markup"===r||"html"===r||"xml"===r?(s.$folders.push(ln.Fold.Delimited("",ln.Type(["comment","tag"],!1))),s.$folders.push(ln.Fold.MarkedUp(ln.Type("tag"),"<",">","/"))):-1<(n=r.indexOf(","))&&s.$folders.push(ln.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=Bt(t[e]);"braces"===r?s.$matchers.push(ln.Match.Delimited("{","}")):"brackets"===r?s.$matchers.push(ln.Match.Delimited("[","]")):"parens"===r||"parentheses"===r?s.$matchers.push(ln.Match.Delimited("(",")")):"brace"===r||"cstyle"===r||"c"===r?(s.$matchers.push(ln.Match.Delimited("{","}")),s.$matchers.push(ln.Match.Delimited("[","]")),s.$matchers.push(ln.Match.Delimited("(",")"))):"tags"===r||"markup"===r||"html"===r||"xml"===r?s.$matchers.push(ln.Match.MarkedUp(ln.Type("tag"),"<",">","/")):-1<(n=r.indexOf(","))&&s.$matchers.push(ln.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,Qt[ut].dispose.call(e)},validate:function(e,t,n){if(!e||!e.length)return[];var r,o,s,l,i=this,a=[],u=i.parse(e,fe);if(!u)return a;t=t||{},s=t[ct]("type")?t.type:"error",l=t[ct]("msg")?t.msg:"Syntax Error";for(r in u)u[ct](r)&&(o=u[r],a.push({message:o[4]||l,severity:s,from:n.Pos(o[0],o[1]),to:n.Pos(o[2],o[3])}));return a},autocomplete:function(e,t,r){var o,s,l,i,a,u,c,p,f,m,h,g=this,k=[],d=e.getCursor(),$=d.ch,y=$,b=$,v=b,x=0;if(g.$grammar.$autocomplete){for(t=t||{},a=t.word||nn,o=e.getLine(d.line),p=t[ct]("prefixMatch")?!!t.prefixMatch:!0,f=t[ct]("inContext")?!!t.inContext:!1,c=t[ct]("caseInsensitiveMatch")?!!t.caseInsensitiveMatch:!1;y&&a.test(o[$t](y-1));)--y;if(!p)for(;v=i&&(n=t.meta,r=!!d.ci,k=c||r,k?(f=d[dt](),g=l):(f=d,g=s),(a=f.indexOf(g))>=0&&(!p||0===a)&&(o=k?d.indexOf(s):a,$+n.length>x&&(x=$+n.length),e.push({text:d,name:d,meta:n,start:0>o?a:o,end:(0>o?a:o)+s.length,match:s,displayText:d+" ["+n+"]",render:u,score:1e3-10*($-i)-5*(0>o?a+3:o)}))):(n=t.meta,$+n.length>x&&(x=$+n.length),e.push({text:d,name:d,meta:n,start:0,end:0,match:"",displayText:d+" ["+n+"]",render:u,score:m?1e3-10*$:h--})),e};f?(m=!1,k=n(g.autocompletion(e.getTokenAt(r.Pos(d.line,y),!0).state.state),w,k),k.length||(m=!0,k=n(g.$grammar.$autocomplete,w,k))):(m=!0,k=n(g.$grammar.$autocomplete,w,k)),k.length&&(k=k.sort(rn)),k.maxlen=x}return{list:k,from:r.Pos(d.line,y),to:r.Pos(d.line,v)}},indent:function(e,t,n,r,o,s){return s.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 oe(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,s,l=this,i=l.$folders,a=i.length;if(a)for(o=l.iterator(e,n),o.row=t.line,o.col=t.ch||0,r=0;a>r;r++)if((s=i[r](o))||!1===s)return s},match:function(e,t,n){var r,o,s,l=this,i=l.$matchers,a=i.length;if(a)for(o=l.iterator(e,n),o.row=t.line,o.col=t.ch||0,r=0;a>r;r++)if((s=i[r](o))||!1===s)return s}});on.Type=se,on.Fold=Xt,on.Match=en;var sn={VERSION:"4.0.1",clone:o,extend:s,pre_process:N,parse:A,getMode:ce,Parser:on};return sn}); \ No newline at end of file diff --git a/editor-grammar b/editor-grammar index ad1d812..21a3d04 160000 --- a/editor-grammar +++ b/editor-grammar @@ -1 +1 @@ -Subproject commit ad1d8123832af71bd20767a1e23e0f1c0dbdc61d +Subproject commit 21a3d04bc5e2b1e1b67e5084e731495bd95cb14b diff --git a/test/grammars/php.js b/test/grammars/php.js index 703e159..91f4837 100644 --- a/test/grammars/php.js +++ b/test/grammars/php.js @@ -35,7 +35,7 @@ var php_grammar = { "Lex" : { "comment:comment" : [["//", null],["#", null],["/*", "*/"]] - ,"heredoc:block" : ["RE::/<<<([_A-Za-z][_A-Za-z0-9]*)/", "RE::/^(\\1)/"] + ,"heredoc:block" : ["RE::/<<<([_A-Za-z][_A-Za-z0-9]*)/", "RE::/^$1/x"] ,"string:escaped-block" : ["RE::/([`'\"])/", 1] ,"identifier" : "RE::/[_A-Za-z][_A-Za-z0-9]*/" ,"variable" : "RE::/\\$[_A-Za-z][_A-Za-z0-9]*/"