From 7b271296251899a9d59c35e416794ba8db3f662f Mon Sep 17 00:00:00 2001 From: Nikos M Date: Fri, 11 Nov 2016 14:09:29 +0200 Subject: [PATCH] v.4.0.1 (extended regular expression (block) patterns) --- beeld.config | 2 +- build/prism_grammar.js | 77 +++++++++++++++++++++++--------------- build/prism_grammar.min.js | 6 +-- editor-grammar | 2 +- 4 files changed, 51 insertions(+), 36 deletions(-) diff --git a/beeld.config b/beeld.config index f25abae..0861977 100644 --- a/beeld.config +++ b/beeld.config @@ -48,7 +48,7 @@ tasks =[{}] replace =[{}] "@@ROOT@@" = "this" - "@@VERSION@@" = "4.0.0" + "@@VERSION@@" = "4.0.1" "@@MODULE@@" = "PrismGrammar" @ diff --git a/build/prism_grammar.js b/build/prism_grammar.js index f0ecebf..d5b6534 100644 --- a/build/prism_grammar.js +++ b/build/prism_grammar.js @@ -1,7 +1,7 @@ /** * * PrismGrammar -* @version: 4.0.0 +* @version: 4.0.1 * * Transform a grammar specification in JSON format, into a syntax-highlighter for Prism * https://github.com/foo123/prism-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 ) { @@ -3991,7 +4006,7 @@ var Parser = Class({ /** * * PrismGrammar -* @version: 4.0.0 +* @version: 4.0.1 * * Transform a grammar specification in JSON format, into a syntax-highlighter for Prism * https://github.com/foo123/prism-grammar @@ -4295,7 +4310,7 @@ function get_mode( grammar, Prism ) [/DOC_MARKDOWN]**/ var PrismGrammar = { - VERSION: "4.0.0", + VERSION: "4.0.1", // clone a grammar /**[DOC_MARKDOWN] diff --git a/build/prism_grammar.min.js b/build/prism_grammar.min.js index d10b3f8..459ea20 100644 --- a/build/prism_grammar.min.js +++ b/build/prism_grammar.min.js @@ -1,11 +1,11 @@ /** * * PrismGrammar -* @version: 4.0.0 +* @version: 4.0.1 * * Transform a grammar specification in JSON format, into a syntax-highlighter for Prism * https://github.com/foo123/prism-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,"PrismGrammar",function(){"use strict";function e(e){var t=0;return null===e?t=$t:!0===e||!1===e||e instanceof Boolean?t=vt:rt===e?t=ht:(t=Dt[it.call(e)]||gt,t=dt===t||e instanceof Number?isNaN(e)?bt:isFinite(e)?dt:yt:xt===t||e instanceof String?1===e.length?wt:xt:qt===t||e instanceof Array?qt:St===t||e instanceof RegExp?St:Lt===t||e instanceof Date?Lt:Et===t||e instanceof Function?Et:Ot===t?Ot:gt),t}function t(e,t,n,r){var o,s,l,a,i,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,a=15&l,i=1&a,u=new Array(l),i&&(u[0]=t(e[n],n,n,r)),o=i;a>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=a;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,a,i,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(a=o-r+1,i=15&a,u=1&i,u&&(p=t(p,e[r],r)),s=u;i>s;s+=2)l=r+s,p=t(t(p,e[l],l),e[l+1],l+1);for(s=i;a>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,a=15&l,i=1&a;for(i&&e(t,r,t,n),o=i;a>o;o+=2)s=t+o,e(s,r,t,n),e(++s,r,t,n);for(o=a;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,a,i=e(t),u=0;if(dt===e(n)?n>0?(u=n,n=!0):n=!1:n=!1!==n,Ot===i){s={};for(l in t)t[st](l)&&t[lt](l)&&(r=e(t[l]),Ot===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:qt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Lt===r?s[l]=new Date(t[l]):xt&r?s[l]=t[l].slice():dt&r?s[l]=0+t[l]:s[l]=t[l])}else if(qt===i)for(a=t.length,s=new Array(a),l=0;a>l;l++)r=e(t[l]),Ot===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:qt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Lt===r?s[l]=new Date(t[l]):xt&r?s[l]=t[l].slice():dt&r?s[l]=0+t[l]:s[l]=t[l];else s=Lt===i?new Date(t):xt&i?t.slice():dt&i?0+t:t;return s}function s(){var t,n,r,l,a,i,u,c,p,f,m=arguments,k=m.length;if(1>k)return null;for(n=o(m[0]),r=1;k>r;r++)if(t=m[r])for(l in t)if(t[st](l)&&t[lt](l))if(n[st](l)&&n[lt](l)){if(p=e(n[l]),f=e(t[l]),Ot===p&&Ot===f)n[l]=s(n[l],t[l]);else if(qt===p&&qt===f){if(u=n[l],c=t[l],i=c.length,!i)continue;if(u.length)for(a=0;i>a;a++)0>u.indexOf(c[a])&&u.push(c[a]);else n[l]=c.slice()}}else n[l]=o(t[l]);return n}function l(t,n){return n||qt!==e(t)?[t]:t}function a(t,n){return t=l(t),(n||qt!==e(t[0]))&&(t=[t]),t}function i(t,n){return xt&e(n)&&xt&e(t)&&n.length&&n.length<=t.length&&n===t.substr(0,n.length)}function u(e,t,n){return n?e[t]=rt:delete e[t],e}function c(e){return(e||"id_")+ ++At}function p(e){return(e||"uuid")+"_"+ ++At+"_"+(new Date).getTime()}function f(){var t,n,r,o,s,l,a=arguments,i=a.length;for(t=a[0]||{},s=1;i>s;s++)if(n=a[s],Ot===e(n))for(o in n)n[st](o)&&n[lt](o)&&(r=n[o],l=e(r),dt&l?t[o]=0+r:Lt&l?t[o]=new Date(r):Rt&l?t[o]=r.slice():t[o]=r);return t}function m(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[st](o)||(t[o]=function(){}),n=t[o],delete t[o],n[ot]=f(ut(e[ot]),t),n[ot][o]=n,n}function k(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"}function g(e){return"&#"+e.charCodeAt(0)+";"}function h(e,t){return e.replace(Bt,t?k:g)}function $(e){return e.replace(Ct,"\\$1")}function d(e,t){return new RegExp(e,t||"")}function y(e,t,n,r){var o,s,l,a,i=e.pos,u=e.length,c="",p=!!n;if(p){for(r=!!r,s=!1,a=0;u>i&&(o=e[mt](i++),t!==o||s);)l=n===o,s=!s&&l,r?(l&&a++,(!l||2&a)&&(c+=o,a=0)):c+=o;2&a&&(c+=n)}else for(;u>i&&(o=e[mt](i++),t!==o);)c+=o;return e.pos=i,c}function b(t,n,r,o){var s,l,a,i,u,c=!0===r?0:1,p=o?"\\":"$",f=o?92:36;for(xt&e(n)&&(o&&(n=$(n)),n=[n,n,n],c=0),l=t.length,u="",s=0;l>s;)a=t[mt](s),l>s+1&&p===a?(i=t.charCodeAt(s+1),f===i?(u+=p,s+=2):i>=48&&57>=i?(u+=n[c+i-48]||"",s+=2):(u+=a,s+=1)):(u+=a,s+=1);return u}function v(t,n,r,o){if(!t||(dt|St)&e(t))return t;var s,l=n?n.length||0:0,a="";if(xt&e(o)?a=o:o&&(a=Ut),l&&n===t.substr(0,l)){var i,u,c,s,p,f=t.substr(l),m=f[mt](0),k="";for(s=f.length;s--&&(p=f[mt](s),m!==p);)"i"===p.toLowerCase()&&(k="i");return i=f.substring(1,s),u="^("+i+")",r[u]||(c=d(u,k),r[u]=c),r[u]}return a?(u="^("+$(t)+")"+a,r[u]||(c=d(u,k),r[u]=c),r[u]):t}function x(n,r,o){var s,l="";return xt&e(r)?l=r:r&&(l=Ut),s=t(n.sort(Ft),$).join("|"),[d("^("+s+")"+l,o?"i":""),1]}function w(t,n,r,o){var s=e(n);if(dt===s)return n;if(o[t])return o[t];r=r||0;var l,a=0;return n&&n.isCharList&&(a=1,u(n,"isCharList")),l=$t===s?new P(we,t,n,$t,r):wt===s?new P(we,t,n,wt,r):zt&s?new P(we,t,n,St,r):xt&s?new P(we,t,n,a?_t:xt,r):n,o[t]=l}function _(t,n,r,o,s,a,u,c){if(u[t])return u[t];var p,f,m,k,g,h,$,d=0,y=0,b=1,q=xt&e(o)?!0:!!o;if(p=l(n),m=p.length,1===m)$=w(t,v(p[0],r,a,o),0,u);else if(m>1){for(k=(m>>>1)+1,f=0;k>=f;f++)g=e(p[f]),h=e(p[m-1-f]),wt===g&&wt===h||(b=0),qt&g||qt&h?d=1:(St&g||St&h||i(p[f],r)||i(p[m-1-f],r))&&(y=1);if(b&&!q)p=p.slice().join(""),p.isCharList=1,$=w(t,p,0,u);else if(!q||d||y)if(d||y){for(f=0;m>f;f++)qt&e(p[f])?p[f]=_(t+"_"+f,p[f],r,o,s,a,u):p[f]=w(t+"_"+f,v(p[f],r,a),f,u);$=m>1?new P(_e,t,p):p[0]}else{for(c&&(c.keywords=l(n).slice()),p=p.sort(Ft),f=0;m>f;f++)p[f]=w(t+"_"+f,v(p[f],r,a),f,u);$=m>1?new P(_e,t,p):p[0]}else c&&(c.keywords=l(n).slice()),$=w(t,x(p,o,s),0,u)}return u[t]=$}function q(t,n,o,s,l){if(l[t])return l[t];var u=a(n),c=[],p=[];return r(function(n){var r,a,f,m;r=w(t+"_0_"+n,v(u[n][0],o,s),n,l),u[n].length>1?(f=i(u[n][1],o),m=f&&Wt.test(u[n][1]),St!==r.ptype||xt!==e(u[n][1])||!m&&f?a=w(t+"_1_"+n,v(u[n][1],o,s),n,l):m?(a=new String(u[n][1]),a.regex_pattern=o):a=u[n][1]):a=r,c.push(r),p.push(a)},0,u.length-1),l[t]=new P(qe,t,[c,p])}function O(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 E(e,n,r,o){var s=e.meta||r,l=!(!e.caseInsesitive&&!e.ci),a=t(n,function(e){return{word:e,meta:s,ci:l}});return o.autocomplete=(o.autocomplete||[]).concat(a),a}function S(t){t.Lex||(t.Lex={}),t.Syntax||(t.Syntax={});var n,r,o,l,a,i,c,p,f,m,k,g=t.Lex,h=t.Syntax,$=[g,h],d=$.length;for(k=0;d>k;){m=$[k++];for(o in m)m[st](o)&&(n=o.split(":"),r=n[1]&&Pt(n[1]).length?Pt(n[1]):null,n=Pt(n[0]),n.length||(n=o,r=null),n!==o&&(m[n]=m[o],u(m,o),r&&(r=r[ft](),l=m[n],a=e(l),Ot===a?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&&xt===a?m[n][l]=!0:m[n].tokens=l))),g===m&&(Mt&e(m[n])&&(m[n]={type:"simple",tokens:m[n]}),l=m[n],l.type&&(p=l.type=l.type[ft](),"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[st](n))for(l=m[n];l.extend;)i=l.extend,u(l,"extend"),c=g[i],c&&(Mt&e(c)&&(c=g[i]={type:"simple",tokens:c}),l=s(c,l));m=g;for(n in m)m[st](n)&&(l=m[n],l.type?(p=l.type=l.type[ft](),"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"],u(l,"escaped-line-block")):l["escaped-block"]?(l.type="block",l.multiline=!0,l.escape||(l.escape="\\"),l.tokens=l["escaped-block"],u(l,"escaped-block")):l["line-block"]?(l.type="block",l.multiline=!1,l.escape=!1,l.tokens=l["line-block"],u(l,"line-block")):l.comment?(l.type="comment",l.escape=!1,l.tokens=l.comment,u(l,"comment")):l.block?(l.type="block",l.tokens=l.block,u(l,"block")):l.simple?(l.type="simple",l.tokens=l.simple,u(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"]],u(l,"error")):l[st]("context")?(l.type="action",l.action=[l.context?"context-start":"context-end",l.context,!!l["in-context"]],u(l,"context")):l.indent?(l.type="action",l.action=["indent",l.indent,!!l["in-context"]],u(l,"indent")):l.outdent?(l.type="action",l.action=["outdent",l.outdent,!!l["in-context"]],u(l,"outdent")):l.unique?(l.type="action",l.action=["unique",xt&e(l.unique)?["_DEFAULT_",l.unique]:l.unique,!!l["in-context"]],u(l,"unique")):l.push?(l.type="action",l.action=["push",l.push,!!l["in-context"]],u(l,"push")):l[st]("pop")?(l.type="action",l.action=["pop",l.pop,!!l["in-context"]],u(l,"pop")):l.type="simple","action"===l.type?l.ci=!(!l.caseInsesitive&&!l.ci):"block"===l.type||"comment"===l.type?(l.multiline=l[st]("multiline")?!!l.multiline:!0,xt&e(l.escape)||(l.escape=!1)):"simple"===l.type&&(l.meta=l.autocomplete&&xt&e(l.meta)?l.meta:null,l.ci=!(!l.caseInsesitive&&!l.ci)));m=h;for(n in m)m[st](n)&&(l=m[n],Ot!==e(l)||l.type?l.type&&(p=l.type=l.type[ft](),"group"===p&&l.match?(a=e(l.match),xt&a?(f=l.match[ft](),"alternation"===f||"either"===f?(l.type="alternation",u(l,"match")):"sequence"===f||"all"===f?(l.type="sequence",u(l,"match")):"zeroorone"===f?(l.type="zeroOrOne",u(l,"match")):"zeroormore"===f?(l.type="zeroOrMore",u(l,"match")):"oneormore"===f?(l.type="oneOrMore",u(l,"match")):(l.type="sequence",u(l,"match"))):qt&a&&(l.type="repeat",l.repeat=l.match,u(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"]?u(l,"n-gram"):u(l,"ngram")):l.sequence||l.all?(l.type="sequence",l.tokens=l.sequence||l.all,l.all?u(l,"all"):u(l,"sequence")):l.alternation||l.either?(l.type="alternation",l.tokens=l.alternation||l.either,l.either?u(l,"either"):u(l,"alternation")):l.zeroOrOne?(l.type="zeroOrOne",l.tokens=l.zeroOrOne,u(l,"zeroOrOne")):l.zeroOrMore?(l.type="zeroOrMore",l.tokens=l.zeroOrMore,u(l,"zeroOrMore")):l.oneOrMore?(l.type="oneOrMore",l.tokens=l.oneOrMore,u(l,"oneOrMore")):l.positiveLookahead||l.lookahead?(l.type="positiveLookahead",l.tokens=l.positiveLookahead||l.lookahead,l.lookahead?u(l,"lookahead"):u(l,"positiveLookahead")):l.negativeLookahead?(l.type="negativeLookahead",l.tokens=l.negativeLookahead,u(l,"negativeLookahead")):(l.subgrammar||l.grammar)&&(l.type="subgrammar",l.tokens=l.subgrammar||l.grammar,l.subgrammar?u(l,"subgrammar"):u(l,"grammar")));return t}function L(t,n,r){if(r=r||{},n=n||[],!t||!t.length)return n;var o,s,l,a,i,u,c;for(o=0,s=t.length;s>o;o++)if(i=t[o])if(Me===i.type)if(i.autocompletions)for(l=0,a=i.autocompletions.length;a>l;l++)c=i.autocompletions[l],r[st]("w_"+c.word)||(n.push(c),r["w_"+c.word]=1);else xt===i.token.ptype&&xt&e(i.token.pattern)&&i.token.pattern.length>1&&(r[st]("w_"+i.token.pattern)||(n.push({word:""+i.token.pattern,meta:i.name,ci:!!i.ci}),r["w_"+i.token.pattern]=1));else if(Pe===i.type)L(i.token,n,r);else if(Ye&i.type){l=0,a=i.token.length;do L([u=i.token[l++]],n,r);while(a>l&&(Ie&u.type&&1>u.min||Oe===u.type))}else Ie&i.type&&L([i.token[0]],n,r);return n}function j(t,n,r,o){for(var s;xt&e(s=n[t]||r[t]);)t=s;return o?t:n[t]||r[t]||t}function R(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];Ht.test(o)&&Ht.test(r)&&r===o||n.push(o)},1,e.length-1,[e[0]]):e}function z(n,r,s){var l,a,i,u,c,p,f,m,k,g,h,b,v,x,w,_=!1;if(w=n.modifier?n.modifier:null,m=new String(Pt(n)),m.pos=0,1===m.length)b=""+n,r[b]||s[b]||(r[b]={type:"simple",tokens:n}),n=b;else{for(l=[],a=[],i="",v=[];m.posc[0]&&(c[0]=0),2>c.length?c.push(c[0]):c[1].length?c[1]=parseInt(c[1],10)||kt:c[1]=kt,0>c[1]&&(c[1]=0),h=a[a.length-1],b=""+h+["{",c[0],",",isFinite(c[1])?c[1]:"","}"].join(""),s[b]||(s[b]={type:"repeat",repeat:[c[0],c[1]],tokens:[h]}),a[a.length-1]=b):i+=k;else{if("}"===k){i+=k;continue}"&"===k||"!"===k?a.length?(h=a[a.length-1],b=""+h+k,s[b]||(s[b]={type:"!"===k?"negativeLookahead":"positiveLookahead",tokens:[h]}),a[a.length-1]=b):i+=k:"|"===k?(_=!1,a=R(a),a.length>1?(b=""+a.join(" "),s[b]||(s[b]={type:"sequence",tokens:a}),l.push(b)):a.length?l.push(a[0]):i+=k,a=[]):"("===k?(v.push([a,l,i]),a=[],l=[],i=""):")"===k&&(a=R(a),a.length>1?(b=""+a.join(" "),s[b]||(s[b]={type:"sequence",tokens:a}),l.push(b)):a.length&&l.push(a[0]),a=[],l=R(l,1),l.length>1?(b=""+l.join(" | "),s[b]||(s[b]={type:"alternation",tokens:l})):l.length&&(b=l[0]),l=[],x=v.pop(),a=x[0],l=x[1],i=x[2],h=b,b="("+h+")",s[b]||(s[b]=o(j(h,r,s))),a.push(b))}}else i+=k;i.length&&(_?(a.length&&(h=a[a.length-1],b=h+"."+i,p=r[b]||s[b],p||(f=j(h,r,s),s[b]=xt&e(f)?new String(f):o(f),s[b].modifier=i),a[a.length-1]=b),_=!1):"0"===i?(r[tt]||(r[tt]={type:"simple",tokens:0}),a.push(tt)):"^^"===i?(r[Je]||(r[Je]={type:"simple",tokens:Ee}),a.push(Je)):"^^1"===i?(r[Qe]||(r[Qe]={type:"simple",tokens:Se}),a.push(Qe)):"^"===i?(r[Xe]||(r[Xe]={type:"simple",tokens:je}),a.push(Xe)):"$"===i?(r[Ze]||(r[Ze]={type:"simple",tokens:Le}),a.push(Ze)):(r[i]||s[i]||(r[i]={type:"simple",tokens:i}),a.push(i))),i="",a=R(a),a.length>1?(b=""+a.join(" "),s[b]||(s[b]={type:"sequence",tokens:a}),l.push(b)):a.length&&l.push(a[0]),a=[],l=R(l,1),l.length>1?(b=""+l.join(" | "),s[b]||(s[b]={type:"alternation",tokens:l}),n=b):l.length&&(n=l[0]),l=[]}return w&&(r[n]||s[n])&&((r[n]||s[n]).modifier=w),n}function M(o,s,i,u,c,p,f,m,k,g,h){var $,d,y,b,v,x,w,S=null,L=null,R=null;if(Ee===o||Se===o||je===o||Le===o)return new T(o,Ee===o?Je:Se===o?$T_FBNL$:je===o?Xe:Ze,o,L);if(!1===o||0===o)return new T(Re,tt,0,L);if(""===o)return new T(ze,nt,"",L);if(null===o)return new T(Me,et,$t,L,R);if(qt&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=j(o,i,u),xt&e(v)&&(v=z(v,i,u),v=i[v]||u[v]||null),!v)return null;if($=v.type?Ve[v.type[ft]().replace(Tt,"")]||Me:Me,L=v.msg||null,R=v.modifier||null,d=v.tokens,Me&$){if(Ee===d||Se===d||je===d||Le===d||!1===d||0===d)return S=new T(d||Re,o,d||0,L),m[o]=S,S;if(""===d)return S=new T(ze,o,"",L),m[o]=S,S;if(null===d)return S=new T(Me,o,$t,L,R),m[o]=S,S;if(!d)return null}if(Oe&$)v[st]("action")?"nop"===v.action[0]?v.action[0]=ke:"error"===v.action[0]?v.action[0]=ge:"context-start"===v.action[0]?v.action[0]=$e:"context-end"===v.action[0]?v.action[0]=de:"push"===v.action[0]?v.action[0]=ye:"pop"===v.action[0]?v.action[0]=be:"unique"===v.action[0]?v.action[0]=he:"indent"===v.action[0]?v.action[0]=ve:"outdent"===v.action[0]&&(v.action[0]=xe):v[st]("nop")?v.action=[ke,v.nop,!!v["in-context"]]:v[st]("error")?v.action=[ge,v.error,!!v["in-context"]]:v[st]("context")?v.action=[v.context?$e:de,v.context,!!v["in-context"]]:v[st]("context-start")?v.action=[$e,v["context-start"],!!v["in-context"]]:v[st]("context-end")?v.action=[de,v["context-end"],!!v["in-context"]]:v[st]("push")?v.action=[ye,v.push,!!v["in-context"]]:v[st]("pop")?v.action=[be,v.pop,!!v["in-context"]]:v[st]("unique")?v.action=[he,xt&e(v.unique)?["_DEFAULT_",v.unique]:v.unique,!!v["in-context"]]:v[st]("indent")?v.action=[ve,v.indent,!!v["in-context"]]:v[st]("outdent")&&(v.action=[xe,v.outdent,!!v["in-context"]]),v.nop&&(v.action[0]=ke),S=new T(Oe,o,v.action.slice(),L,R),S.ci=!!v.caseInsensitive||v.ci,m[o]=S;else if(d=l(d),Me&$){w=v.autocomplete?E(v,Rt&e(v.autocomplete)?l(v.autocomplete):d,o,h):null;var D={};if(x="undefined"!=typeof v.combine?v.combine:!!(qt&e(v.tokens)),S=new T(Me,o,_(o,d.slice(),s,x,!(!v.caseInsensitive&&!v.ci),p,f,D),L,R,null,w),D.keywords&&(S.keywords=D.keywords.join("|")),m[o]=S,null!=v.except){var N,P,F=l(v.except),I=F.length,A=[];for(N=0;I>N;N++)F[N]&&(P=M(F[N],s,i,u,c,p,f,m,k,g,h),P&&A.push(P));A.length&&(S.except=A)}}else De&$?(Ne===$&&O(v,g),S=new T($,o,q(o,d.slice(),s,p,f),L),S.empty=v[st]("empty")?!!v.empty:!0,S.mline=v[st]("multiline")?!!v.multiline:!0,S.esc=v[st]("escape")?v.escape:!1,S.inter=!!c[o+".inside"],Ne===$&&v.interleave&&k.push(C(S)),R&&(S.modifier=R),m[o]=S):Ke&$&&(He===$?m[o]=new T(He,o,d,L,R):We===$?(b=a(d),S=t(b,function(e,t){return new T(We,o+"_NGRAM_"+t,null,L,R)}),m[o]=S,r(function(e){S[e].token=l(n(b[e],function(e,t){return e.concat(M(t,s,i,u,c,p,f,m,k,g,h))},[]))},0,b.length-1)):(Ge===$||Ue===$?S=new T($,o,null,L,R):Ie&$&&qt&e(v.repeat)?(S=new T(Ie,o,null,L,R),S.min=v.repeat[0],S.max=v.repeat[1]):Te===$?(S=new T(Te,o,null,L,R),S.min=0,S.max=1):Ae===$?(S=new T(Ae,o,null,L,R),S.min=0,S.max=kt):Ce===$?(S=new T(Ce,o,null,L,R),S.min=1,S.max=kt):S=Pe===$?new T(Pe,o,null,L,R):new T(Fe,o,null,L,R),m[o]=S,S.token=l(n(d,function(e,t){return e.concat(M(t,s,i,u,c,p,f,m,k,g,h))},[]))));return m[o]}function D(t){var n={};return t.Lex=t.Lex||{},t.Syntax=t.Syntax||{},t=S(t),t.Parser&&t.Parser.length&&r(function o(s,l){var a,i,u,c=l[s];n[c]||(qt&e(c)&&(a=c,c="NGRAM_"+a.join("_"),t.Syntax[c]||(t.Syntax[c]={type:"ngram",tokens:a})),i=j(c,t.Lex,t.Syntax),xt&e(i)&&(i=z(i,t.Lex,t.Syntax),i=t.Lex[i]||t.Syntax[i]||null),i&&(n[c]=i,u=i.type?Ve[i.type[ft]().replace(Tt,"")]||Me:Me,Ke&u&&r(o,0,i.tokens.length-1,i.tokens)))},0,t.Parser.length-1,t.Parser),t}function N(t){var r,s,l,a,i,u,c,p,f,m,k,g,h,$;return t.__parsed?t:(r=t.RegExpID||null,l=t.Extra?o(t.Extra):{},a=t.Style?o(t.Style):{},i=null,u=null,c=t.Lex?o(t.Lex):{},p=t.Syntax?o(t.Syntax):{},f={},m={},k={},h={},$={},g=[],s=t.Parser?o(t.Parser):[],t=S({Style:a,Fold:i,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=M(n,r,c,p,a,f,m,k,g,h,$)||null;return o&&(qt&e(o)?t=t.concat(o):t.push(o)),t},[]),t.$interleaved=g&&g.length?g:null,t.$comments=h,t.$autocomplete=$&&$.autocomplete&&$.autocomplete.length?$.autocomplete:null,t.__parsed=1,t)}function P(t,n,r,o,s){var l,a,i=this;l=i.type=t,i.name=n,i.pattern=r,a=i.ptype=o||xt,i.key=s||0,_e===l?i.key=!1!==s:qe===l?i.pattern[0]=new P(_e,n+"_Start",r[0],null,!1):$t===a?i.pattern=null:St===a&&(i.pattern=St&e(r)?[r,0]:[r[0],r[1]||0])}function F(t,n,r,o){var s,l,a,i,u,c,p,f,m,k,g,h=t,$=h.type,d=h.pattern,y=h.key;if(qe===$){if(s=h.name,a=d[0],i=d[1],c=F(a,n,r,o))return u=i[c[0]],f=e(u),m=a.pattern[c[0]].ptype,St===m&&jt&f&&(u.regex_pattern?(p=b(u,c[1],0,1),u=new P(we,s+"_End",v(p,u.regex_pattern,{}),St)):(p=dt&f?c[1][u+1]:b(u,c[1]),u=new P(we,s+"_End",p,p.length>1?xt:wt))),u}else if(_e===$){for(k=0,g=d.length;g>k;k++)if(p=F(d[k],n,r,o))return y?[k,p[1]]:p}else{if(l=h.ptype,$t===l)return!1!==r&&n.end(),[y,""];if(St===l){if(p=n.slice(n.pos).match(d[0]),p&&0===p.index)return!1!==r&&n.mov(p[d[1]||0].length),[y,d[1]>0?p[d[1]]:p]}else if(_t===l){if(!0===o){p=-1;var x,w;for(g=d.length-1;g>=0;g--)x=n.indexOf(d[mt](g),n.pos),x>-1&&(-1===p||p>x)&&(p=x,w=d[mt](g));if(p>-1)return!1!==r&&(n.pos=p+1),[y,w]}else if(p=n[mt](n.pos)||null,p&&-1-1)return!1!==r&&(n.pos=p+1),[y,d]}else if(p=n[mt](n.pos)||null,d===p)return!1!==r&&n.mov(1),[y,p]}else if(xt===l)if(g=d.length,!0===o){if(p=n.indexOf(d,n.pos),p>-1)return!1!==r&&(n.pos=p+g),[y,d]}else if(d===n.substr(n.pos,g))return!1!==r&&n.mov(g),[y,d]}return!1}function I(e,t){this.val=e||null,t?this.prev=t:this.prev=null}function T(e,t,n,r,o,s,l,a){var i=this;i.type=e,i.name=t,i.token=n,i.modifier=o||null,i.except=s||null,i.autocompletions=l||null,i.keywords=a||null,i.pos=null,i.msg=r||null,i.$msg=null,i.status=0,i.empty=!1,i.ci=!1,i.mline=!0,i.esc=!1,i.inter=!1,i.found=0,i.min=0,i.max=1,i.i0=0,i.$id=null}function A(){var e=this;e.T=0,e.id=null,e.type=null,e.match=null,e.str="",e.pos=null,e.block=null}function C(e,t,n,r){var o=new T(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|=ue),n&&(o.modifier=n),r&&(o.$id=r),o}function B(e){var t=e.name;return e.$msg?e.$msg:e.status&ue?'Token "'+t+'"'+(e.keywords?": "+e.keywords:"")+" Expected":'Syntax Error: "'+t+'"'}function G(e,t,n,r,o,s,l){e.status&ae&&(e.err[""+t+"_"+n+"_"+r+"_"+o+"_"+(s?s.name:"ERROR")]=[t,n,r,o,l||B(s)])}function U(e,t,n){if(e.stack===t)t=e.stack=new I(n,e.stack);else{for(var r=e.stack;r&&r.prev!==t;)r=r.prev;t=new I(n,t),r&&(r.prev=t)}return t}function W(e,t){if(null==e)return null;if(t){for(var n=new I(e.val),r=n,o=e;o.prev;)r.prev=new I(o.prev.val),o=o.prev,r=r.prev;return n}return e}function H(e,t,n,r){var o,s,l,a,i,u=1/0,c=null,p=1/0;if(s=t.pos,t.spc(),l=t.pos,o=e.stack,t.post.pos?a.pos:t.pos+1,e.stack=o,t.pos>=t.length)););e.stack=o,t.post.pos?(u=t.pos,c=o,p=i):u===t.pos&&p>i&&(u=t.pos,c=o,p=i),t.pos=l,o=o.prev,i++}u=s&&t.pos===l}function Y(e,t,n,r){if(!e)return!1;var o=e.type,s=Ke&o?Q:De&o?J:Oe&o?K:V;return s(e,t,n,r)}function K(t,n,r,o){var s,l,a,i,u,c,p,f,m,k,g,h,$,d,y,v=t,x=v.token||null,w=v.ci,_=v.name,q=!(r.status&ae);if(v.status=0,v.$msg=null,q||!x||!o||!o.pos)return!0;if(y=!!(De&o.T),ke===x[0]||y&&!o.block)return!0;if(s=x[0],l=x[1],h=x[2],u=v.msg,y?(d=o.block.match||o.block.str,f=o.block.pos[0][0],m=o.block.pos[0][1],k=o.block.pos[0][2],g=o.block.pos[0][3]):(d=o.match||o.str,f=o.pos[0],m=o.pos[1],k=o.pos[2],g=o.pos[3]),ge===s)return!u&&xt&e(l)&&(u=l),v.$msg=u?b(u,d,!0):'Error "'+_+'"',G(r,f,m,k,g,v,B(v)),v.status|=ce,!1;if(de===s)r.ctx=r.ctx?r.ctx.prev:null;else if($e===s)r.ctx=new I({symb:{},queu:null},r.ctx);else if(be===s){if(h){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;if(l){if(l=b(l,d),w&&(l=l[ft]()),!c||l!==c.val[0])return c?(v.$msg=u?b(u,[c.val[0],l],!0):'Tokens do not match "'+c.val[0]+'","'+l+'"',$=B(v),G(r,c.val[1],c.val[2],c.val[3],c.val[4],v,$),G(r,f,m,k,g,v,$),c=c.prev):(v.$msg=u?b(u,["",l],!0):'Token does not match "'+l+'"',$=B(v),G(r,f,m,k,g,v,$)),v.status|=ce,h?r.ctx&&(r.ctx.val.queu=c):r.queu=c,!1;c=c?c.prev:null}else c=c?c.prev:null;h?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(ye===s&&l){if(h){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;l=b(l,d),w&&(l=l[ft]()),v.$msg=u?b(u,l,!0):'Token does not match "'+l+'"',c=new I([l,f,m,k,g,B(v)],c),h?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(he===s){if(h){if(!r.ctx)return!0;p=r.ctx.val.symb}else p=r.symb;if(a=l[1],i=l[0],a=b(a,d,!0),w&&(a=a[ft]()),p[st](i)||(p[i]={}),p[i][st](a))return v.$msg=u?b(u,a,!0):'Duplicate "'+a+'"',$=B(v),G(r,p[i][a][0],p[i][a][1],p[i][a][2],p[i][a][3],v,$),G(r,f,m,k,g,v,$),v.status|=ce,!1;p[i][a]=[f,m,k,g]}return!0}function V(e,t,n,r,o){var s,l,a=e,i=a.token,u=a.modifier,c=a.type,p=a.name,f=a.except,m=n.line,k=t.pos,g=null,h=!1;if(a.status&=fe,a.$msg=o?null:a.msg||null,a.pos=t.pos,f&&!o){l=Z(n,t);for(var $=0,d=f.length;d>$;$++)if(s=f[$],a!==s&&Me===s.type&&V(s,t,n,r,1))return a.pos=s.pos,Z(n,t,l),!1}return Ee===c?h=0===n.line:Se===c?h=n.bline+1===n.line:je===c?h=t.sol():Le===c?(t.spc(),t.eol()?h=p:(a.pos=t.pos,t.bck(k))):Re===c?(a.status=0,h=!0):ze===c?(a.status&ue&&t.spc()&&!t.eol()?(a.pos=t.pos,t.bck(k),a.status|=ce):h=!0,a.status&=pe):$t===i?(t.end(),h=u||p):(g=F(i,t))&&(g=g[1],h=u||p),o?h:(!1!==h&&(r.T=c,r.id=p,r.type=h,r.str=t.sel(k,t.pos),r.match=g,r.pos=[m,k,m,t.pos]),!h&&a.status&&a.$msg&&(a.$msg=b(a.$msg,p,!0)),h)}function J(e,t,n,r){var o,s,l,a,i,u,c,p,f,m,k,g,h,$,d,y,v,x,w,_,q,O,E=e,S=E.name,L=E.type,j=E.modifier,R=E.token,z=E.mline,M=E.inter,D=M?S+".inside":S,N=E.esc,P=!!N,I="",T="",A="",B="",G=E.$id||S,W=n.outer,H=W&&W[2],K=W&&W[1];if(E.status&=fe,E.$msg=E.msg||null,E.pos=t.pos,_=n.line,q=t.pos,Ne===L&&(E.status&=pe),d=E.status&ue,l=0,a=0,n.block&&n.block.name===S?(a=1,l=1,$=D,o=n.block.end,p=n.block.sp,m=n.block.ip,f=n.block.ep,I=n.block.s,T=n.block.i):!n.block&&(o=F(R,t))&&(a=1,$=S,v=t.pos,p=[_,q],m=[[_,v],[_,v]],f=[_,v],I=t.sel(q,v),T="",B="",n.block={name:S,end:o,sp:p,ip:m,ep:f,s:I,i:T,e:B}),a){if(w=n.stack,s=$t===o.ptype,y=s||E.empty,M){if(s&&l&&t.sol())return E.status&=pe,n.block=null,!1;if(!l)return v=t.pos,r.T=L,r.id=S,r.type=j||$,r.str=t.sel(q,v),r.match=null,r.pos=[_,q,_,v],U(n,w,C(E,d,0,G)),j||$}if(v=t.pos,i=K?s&&t.eol():F(o,t),c=z,u=0,i)$=s?D:S,B=t.sel(v,t.pos);else if(x=t.pos,g=!1,K||P||_t!==o.ptype&&wt!==o.ptype&&xt!==o.ptype){for(;!t.eol();){if(K){if(Y(K,t,H,r)){if(t.pos>x){s&&(i=1);break}return!0}if(s){h=t.nxt(1),A+=h;continue}}if(v=t.pos,!g&&F(o,t)){M&&t.pos>v&&v>x?($=D,t.bck(v),u=1):($=S,i=1),B=t.sel(v,t.pos);break}h=t.nxt(1),A+=h,g=P&&!g&&N===h,v=t.pos}s&&t.eol()&&(i=1)}else(O=F(o,t,!0,!0))?M&&t.pos>v+O[1].length?($=D,t.mov(-O[1].length),u=1,A=t.sel(v,t.pos)):($=S,i=1,A=t.sel(v,t.pos-O[1].length),B=O[1]):(t.end(),$=D,u=1,A=t.sel(v,t.pos));return c=z||P&&g,T+=A,m[1]=[_,v],f=[_,t.pos],i&&!y&&m[0][0]===m[1][0]&&m[0][1]===m[1][1]?(n.block=null,!1):(i||!c&&!u?n.block=null:(n.block.ip=m,n.block.ep=f,n.block.i=T,n.block.e=B,U(n,w,C(E,d,0,G))),r.T=L,r.id=S,r.type=j||$,r.str=t.sel(q,t.pos),r.match=null,r.pos=[_,q,f[0],f[1]],E.pos=t.pos,n.block||(k=I+T+B,r.block={str:k,match:[k,T,I,B],part:[k,I,T,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]]]}),j||$)}return E.status&&E.$msg&&(E.$msg=b(E.$msg,S,!0)),!1}function Q(e,t,n,r){var o,s,l,a,i,u,p,f,m,k,g,h,$,d,y,b=e,v=b.type,x=(b.name,b.token),w=x.length,_=b.modifier;if(b.status&=fe,b.$msg=b.msg||null,f=t.pos,m=n.stack,b.pos=t.pos,u=0,p=0,He===v){b.status&=fe;var q=new String(x[0]),O=n.stack?n.stack.val:null;return q.subgrammar=1,q.next=O?new T(Ge,O.name,[O]):null,q.required=O?O.status&ue:0,q}if(Pe===v){for($=c(),b.status|=ue,h=[],y=Z(n,t),g=0,k=g;w>k;k++){if(o=C(x[k],1,_,$),s=Y(o,t,n,r),b.pos=o.pos,o.status&ue&&(u++,h.push(B(o))),!1!==s)return s;o.status&ce&&(p++,Z(n,t,y))}return u>0?b.status|=ue:b.status&=pe,w===p&&u>0?b.status|=ce:b.status&=fe,b.status&&!b.$msg&&h.length&&(b.$msg=h.join(" | ")),!1}if(Ye&v){d=!!(v&Fe),$=b.$id||c(),d?b.status|=ue:b.status&=pe,y=Z(n,t),g=0;do o=C(x[g++],d,_,$),s=Y(o,t,n,r);while(w>g&&(!0===s&&Be&o.type||!1===s&&!(o.status&ue)));if(b.pos=o.pos,!1!==s){if(!0!==s||Re!==o.type)for(k=w-1;k>=g;k--)m=U(n,m,C(x[k],1,_,$));return s.subgrammar&&w>g&&(s.next=new T(Ge,x[g].name,[x[g]]),s.required=x[g].status&ue),s}return o.status&ce?(d?b.status|=ce:b.status&=fe,Z(n,t,y)):d&&o.status&ue&&(b.status|=ce),b.status&&!b.$msg&&(b.$msg=B(o)),!1}if(Be&v)return He&x[0].type?!0:(y=Z(n,t,null,!1),s=Y(C(x[0],0),t,n,r),Z(n,t,y),Ue===v?!1===s:!1!==s);for($=b.$id||c(),l=b.found,a=b.min,i=b.max,b.status=0,h=[],y=Z(n,t),k=0;w>k;k++){if(o=C(x[k],1,_,$),s=Y(o,t,n,r),b.pos=o.pos,!1!==s){if(++l,i>=l)return b.found=l,U(n,m,C(b,0,0,c())),b.found=0,s;break}o.status&ue&&(u++,h.push(B(o))),o.status&ce&&Z(n,t,y)}return a>l&&(b.status|=ue),(l>i||a>l&&u>0)&&(b.status|=ce),b.status&&!b.$msg&&h.length&&(b.$msg=h.join(" | ")),!1}function X(e,t){var n=this;n.id=e?p("state"):"state",t instanceof X?(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 X(e,t.outer[2])]:null,n.status&ae?(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&ae?(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 Z(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 ee(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 te(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?ct(0,r.pos+e):pt(r.length,r.pos+e),r},r.bck=function(e){return r.pos=ct(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||te.$NONSPC$;r.poso;o++)n.subparser(r[o],new en.Parser(N(t.subgrammars[r[o]])))}else t.tokenize&&re.parser&&postMessage({tokenize:1,tokens:re.parser.parse(t.code,le|ae|ie).tokens})}function oe(e,t){var n=this,r=null,o=[];r=new Worker(Qt.file),r.postMessage({init:1,grammar:e,subgrammars:t}),r.onMessage=function(e){if(o&&o.length){var t,n=e.data||{};n.tokenize&&(t=o.shift())(n.tokens)}},n.tokenize=function(e,t){return r?(o.push(t),void r.postMessage({tokenize:1,code:e})):t(null)},n.dispose=function(){return o=null,r&&r.terminate(),r=null,n}}function se(t,n){n=n||Xt;var o,s=0,l={"before-highlight":function(e){ -o.$parser&&o.language===e.language&&(e._code=e.code,e.code="")},"before-insert":function(e){o.$parser&&o.language===e.language&&(e.code=e._code,e._code="",e.highlightedCode=n.Token.stringify(o.tokenize(e.code,o.escapeHtml),e.language))}};return o={$id:p("prism_grammar_highlighter"),$grammar:t,$parser:new en.Parser(N(t)),$worker:null,language:null,escapeHtml:!0,tokenize:function(e,t,n){var o=this;if("function"!=typeof n){var s=o.$parser.parse(e,le|ae|ie).tokens;return t&&r(ne,0,s.length-1,s),s}o.$worker||(o.$worker=new oe(o.$grammar,o.getSubgrammars())),o.$worker.tokenize(e,function(e){e&&t&&r(ne,0,e.length-1,e),n(e)})},hook:function(t,r){var o=this;if(s&&o.unhook(),xt&e(r)){var a=t;t=r,r=a}n=r||n,o.language=t;for(var i in l)l[st](i)&&n.hooks.add(i,l[i]);s=1},unhook:function(e){var t=this;if(n=e||n,s){var r,o,a=n.hooks.all;for(r in l)a[st](r)&&l[st](r)&&(o=a[r].indexOf(l[r]),o>-1&&a[r].splice(o,1));s=0,t.language=null}},getSubgrammars:function(){for(var e=this,t=e.$parser,n=Object.keys(t.$subgrammars),r={},o=0,s=n.length;s>o;o++)r[n[o]]=t.$subgrammars[n[o]].Mode.$grammar;return r},submode:function(e,t){this.$parser.subparser(e,t.$parser)},dispose:function(){var e=this;e.unhook(),e.$worker&&e.$worker.dispose(),e.$parser&&e.$parser.dispose(),e.$parser=e.$worker=e.language=n=null}},o.$parser.Mode=o,o}var le=1,ae=2,ie=32,ue=4,ce=8,pe=~ue,fe=~ce,me=ue|ce,ke=0,ge=4,he=8,$e=16,de=17,ye=32,be=33,ve=128,xe=129,we=2,_e=4,qe=8,Oe=4,Ee=8,Se=9,Le=16,je=32,Re=128,ze=256,Me=512,De=1024,Ne=1025,Pe=2048,Fe=4096,Ie=8192,Te=8193,Ae=8194,Ce=8195,Be=16384,Ge=Be,Ue=16385,We=32768,He=65536,Ye=Fe|We,Ke=Pe|Fe|Ie|Be|We|He,Ve={action:Oe,simple:Me,block:De,comment:Ne,subgrammar:He,alternation:Pe,sequence:Fe,repeat:Ie,zeroorone:Te,zeroormore:Ae,oneormore:Ce,positivelookahead:Ge,negativelookahead:Ue,ngram:We},Je="$|SOF|$",Qe="$|NONBLANK|$",Xe="$|SOL|$",Ze="$|EOL|$",et="$|ENDLINE|$",tt="$|EMPTY|$",nt="$|NONSPACE|$",rt=void 0,ot="prototype",st="hasOwnProperty",lt="propertyIsEnumerable",at=Object[ot],it=at.toString,ut=Object.create,ct=Math.max,pt=Math.min,ft="toLowerCase",mt="charAt",kt=1/0,gt=4,ht=8,$t=16,dt=32,yt=33,bt=34,vt=64,xt=128,wt=129,_t=130,qt=256,Ot=512,Et=1024,St=2048,Lt=4096,jt=xt|dt,Rt=xt|qt,zt=St|qt,Mt=xt|qt|St,Dt={"[object Number]":dt,"[object String]":xt,"[object Array]":qt,"[object RegExp]":St,"[object Date]":Lt,"[object Function]":Et,"[object Object]":Ot},Nt=/^\s+|\s+$/g,Pt=String[ot].trim?function(e){return e.trim()}:function(e){return e.replace(Nt,"")},Ft=function(e,t){return t.length-e.length},It=/\r\n|\r|\n/g,Tt=/[\-_]/g,At=0,Ct=/([.*+?^${}()|[\]\/\\\-])/g,Bt=/[&"'<>]/g,Gt=/^([.!&\[\]{}()*+?\/|'"]|\s)/,Ut="(\\s|\\W|$)",Wt=/(\\\\)*?\\\d/,Ht=/[*+]$/;te.$SPC$=/^[\s\u00a0]+/,te.$NONSPC$=/[^\s\u00a0]/,te.$NOTEMPTY$=/\S/,te.$SPACE$=/^\s*/;var Yt=m({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,a,i,u,c,p,f,m,k,g,h,$,d,y,b=this,v=b.$grammar,x=v.Style,w=b.DEF,_=b.ERR,q={},O=b.$n$,E=b.$t$,S=b.$v$,L=v.$interleaved,j=v.$parser,R=j.length,z=L?L.length:0,M=t.outer,D=M&&M[2],N=M&&M[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,a=e.pos,f=!1,k=!0,m=!1,g=!1,M&&b===M[0]){if(q[O]=null,q[E]=w,q[S]=null,N){if(s=new A,Y(N,e,D,s))return t.outer=null,{parser:b,state:D};for(e.nxt(1);!e.eol();){if(Y(N,e,D,s)){if(e.pos>a)break;return t.outer=null,{parser:b,state:D}}e.nxt(1)}}else e.spc(),e.eol()?g=!0:e.end();return q[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||t.$eol$),q}if(t.stack&&Le===t.stack.val.type&&e.sol()&&(t.stack=t.stack.prev),(!t.stack||ze!==t.stack.val.type&&null==t.block)&&e.spc()){if(t.stack&&He===t.stack.val.type)return e.bck(a),r=t.stack.val,t.stack=t.stack.prev,f=Y(r,e,t,s),h=""+f,b.$subgrammars[h]?($=b.$subgrammars[h],d=new X(1,n[h]?n[h]:t.status),D=t):($=b,d=new X,D=t),d.outer=[b,f.next,D],{parser:$,state:d,toInner:h};k=!1,g=!0}if(q[O]=null,q[E]=w,q[S]=null,k)for(s=new A,i=0;k&&(t.stack||R>i)&&!e.eol();){if(c=e.pos,p=t.stack,N){if(e.spc(),Y(N,e,D,s))return e.pos>c?(q[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&!0,q):(t.outer=null,{parser:M[0],state:D,fromInner:t});e.bck(c)}if(y=!1,z&&!t.block)for(u=0;z>u;u++)if(r=L[u],f=Y(r,e,t,s),!1!==f){y=!0;break}if(k&&!y){if(!t.stack&&i>=R)break;t.stack?(r=t.stack.val,t.stack=t.stack.prev):r=j[i++],f=Y(r,e,t,s)}if(!1===f){if(r.status&me){t.token=r,g=H(t,e,s,r)||g,m=!0,k=!1;break}}else{if(f.subgrammar)return h=""+f,b.$subgrammars[h]?($=b.$subgrammars[h],d=new X(1,n[h]?n[h]:t.status),D=t):($=b,d=new X,D=t),d.outer=[b,f.next,D],{parser:$,state:d,toInner:h};if(t.stack&&t.stack.prev&&e.eol()&&De&t.stack.val.type&&t.block&&t.block.name===t.stack.val.name)for(u=t.stack.prev;u&&Oe===u.val.type;)o=u,u=u.prev,K(o,e,t,s),o.status&ce&&(t.$actionerr$=!0);else if(t.stack&&Oe===t.stack.val.type)for(;t.stack&&Oe===t.stack.val.type;)o=t.stack.val,t.stack=t.stack.prev,K(o,e,t,s),o.status&ce&&(t.$actionerr$=!0);if(!0!==f){k=!1;break}}}return k&&e.nxt(1),q[S]=e.cur(1),!1!==f?(f=x[f]||w,q[O]=r.name):m?(f=_,t.status&ae&&G(t,l,a,l,e.pos,r)):f=w,q[E]=f,t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||t.$eol$),q},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,a,i,u=(e||"").split(It),c=u.length,p=null;if(t=t||le,s=!!(t&ae),l=!!(t&le),o={parser:this,state:new X(0,t),inner:{}},o.state.$full_parse$=!0,r(function(e){u[e]+="\n"},0,c-2),l?p=r(t&ie?function(e,t){t._=t._.concat(o.parser.tokenize(te(u[e]),o,e))}:function(e,t){t._.push(o.parser.tokenize(te(u[e]),o,e))},0,c-1,{_:[]})._:r(function(e){var t=te(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;)a=n.queu.shift(),G(n,a[1],a[2],a[3],a[4],null,a[5]);return i=l&&s?{tokens:p,errors:n.err}:l?p:n.err,ee(n),o=n=null,i},autocompletion:function(e,t){var n,r,o=e.stack,s={},l=L([e.token],[],s);for(t=t||0;o;){if(n=o.val,r=n.type,Ie&r){if(l=L([n],l,s),0r&&(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,a=15&l,i=1&a,u=new Array(l),i&&(u[0]=t(e[n],n,n,r)),o=i;a>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=a;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,a,i,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(a=o-r+1,i=15&a,u=1&i,u&&(p=t(p,e[r],r)),s=u;i>s;s+=2)l=r+s,p=t(t(p,e[l],l),e[l+1],l+1);for(s=i;a>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,a=15&l,i=1&a;for(i&&e(t,r,t,n),o=i;a>o;o+=2)s=t+o,e(s,r,t,n),e(++s,r,t,n);for(o=a;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,a,i=e(t),u=0;if(dt===e(n)?n>0?(u=n,n=!0):n=!1:n=!1!==n,Ot===i){s={};for(l in t)t[st](l)&&t[lt](l)&&(r=e(t[l]),Ot===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:qt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Lt===r?s[l]=new Date(t[l]):xt&r?s[l]=t[l].slice():dt&r?s[l]=0+t[l]:s[l]=t[l])}else if(qt===i)for(a=t.length,s=new Array(a),l=0;a>l;l++)r=e(t[l]),Ot===r?s[l]=n?o(t[l],u>0?u-1:n):t[l]:qt===r?s[l]=n?o(t[l],u>0?u-1:n):t[l].slice():Lt===r?s[l]=new Date(t[l]):xt&r?s[l]=t[l].slice():dt&r?s[l]=0+t[l]:s[l]=t[l];else s=Lt===i?new Date(t):xt&i?t.slice():dt&i?0+t:t;return s}function s(){var t,n,r,l,a,i,u,c,p,f,m=arguments,k=m.length;if(1>k)return null;for(n=o(m[0]),r=1;k>r;r++)if(t=m[r])for(l in t)if(t[st](l)&&t[lt](l))if(n[st](l)&&n[lt](l)){if(p=e(n[l]),f=e(t[l]),Ot===p&&Ot===f)n[l]=s(n[l],t[l]);else if(qt===p&&qt===f){if(u=n[l],c=t[l],i=c.length,!i)continue;if(u.length)for(a=0;i>a;a++)0>u.indexOf(c[a])&&u.push(c[a]);else n[l]=c.slice()}}else n[l]=o(t[l]);return n}function l(t,n){return n||qt!==e(t)?[t]:t}function a(t,n){return t=l(t),(n||qt!==e(t[0]))&&(t=[t]),t}function i(t,n){return xt&e(n)&&xt&e(t)&&n.length&&n.length<=t.length&&n===t.substr(0,n.length)}function u(e,t,n){return n?e[t]=rt:delete e[t],e}function c(e){return(e||"id_")+ ++At}function p(e){return(e||"uuid")+"_"+ ++At+"_"+(new Date).getTime()}function f(){var t,n,r,o,s,l,a=arguments,i=a.length;for(t=a[0]||{},s=1;i>s;s++)if(n=a[s],Ot===e(n))for(o in n)n[st](o)&&n[lt](o)&&(r=n[o],l=e(r),dt&l?t[o]=0+r:Lt&l?t[o]=new Date(r):Rt&l?t[o]=r.slice():t[o]=r);return t}function m(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[st](o)||(t[o]=function(){}),n=t[o],delete t[o],n[ot]=f(ut(e[ot]),t),n[ot][o]=n,n}function k(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"}function g(e){return"&#"+e.charCodeAt(0)+";"}function h(e,t){return e.replace(Bt,t?k:g)}function $(e){return e.replace(Ct,"\\$1")}function d(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 y(e,t,n,r){var o,s,l,a,i=e.pos,u=e.length,c="",p=!!n;if(p){for(r=!!r,s=!1,a=0;u>i&&(o=e[mt](i++),t!==o||s);)l=n===o,s=!s&&l,r?(l&&a++,(!l||2&a)&&(c+=o,a=0)):c+=o;2&a&&(c+=n)}else for(;u>i&&(o=e[mt](i++),t!==o);)c+=o;return e.pos=i,c}function b(t,n,r,o){var s,l,a,i,u,c=!0===r?0:1,p=o?"\\":"$",f=o?92:36;for(xt&e(n)&&(o&&(n=$(n)),n=[n,n,n],c=0),l=t.length,u="",s=0;l>s;)a=t[mt](s),l>s+1&&p===a?(i=t.charCodeAt(s+1),f===i?(u+=p,s+=2):i>=48&&57>=i?(u+=n[c+i-48]||"",s+=2):(u+=a,s+=1)):(u+=a,s+=1);return u}function v(t,n,r,o){if(!t||(dt|St)&e(t))return t;var s,l=n?n.length||0:0,a="",i={g:0,i:0,x:0,l:0};if(xt&e(o)?a=o:o&&(a=Ut),l&&t.substr(0,l)===n){var u,c,p,s,f,m=t.substr(l),k=m[mt](0);for(s=m.length;s--&&(f=m[mt](s),k!==f);)"i"===f.toLowerCase()?i.i=1:"x"===f.toLowerCase()?i.x=1:"l"===f.toLowerCase()&&(i.l=1);return u=m.substring(1,s),"^"===u.charAt(0)?(i.l=1,c="^("+u.slice(1)+")"):c="^("+u+")",p=c,(i.x||i.l||i.i)&&(c=(i.l?"l":"")+(i.x?"x":"")+(i.i?"i":"")+"::"+c),r[c]||(p=d(p,i),r[c]=p),r[c]}return a?(p=c="^("+$(t)+")"+a,r[c]||(p=d(p,i),r[c]=p),r[c]):t}function x(n,r,o){var s,l="";return xt&e(r)?l=r:r&&(l=Ut),s=t(n.sort(Ft),$).join("|"),[d("^("+s+")"+l,{l:0,x:0,i:o?1:0}),1]}function w(t,n,r,o){var s=e(n);if(dt===s)return n;if(o[t])return o[t];r=r||0;var l,a=0;return n&&n.isCharList&&(a=1,u(n,"isCharList")),l=$t===s?new P(we,t,n,$t,r):wt===s?new P(we,t,n,wt,r):zt&s?new P(we,t,n,St,r):xt&s?new P(we,t,n,a?_t:xt,r):n,o[t]=l}function _(t,n,r,o,s,a,u,c){if(u[t])return u[t];var p,f,m,k,g,h,$,d=0,y=0,b=1,q=xt&e(o)?!0:!!o;if(p=l(n),m=p.length,1===m)$=w(t,v(p[0],r,a,o),0,u);else if(m>1){for(k=(m>>>1)+1,f=0;k>=f;f++)g=e(p[f]),h=e(p[m-1-f]),wt===g&&wt===h||(b=0),qt&g||qt&h?d=1:(St&g||St&h||i(p[f],r)||i(p[m-1-f],r))&&(y=1);if(b&&!q)p=p.slice().join(""),p.isCharList=1,$=w(t,p,0,u);else if(!q||d||y)if(d||y){for(f=0;m>f;f++)qt&e(p[f])?p[f]=_(t+"_"+f,p[f],r,o,s,a,u):p[f]=w(t+"_"+f,v(p[f],r,a),f,u);$=m>1?new P(_e,t,p):p[0]}else{for(c&&(c.keywords=l(n).slice()),p=p.sort(Ft),f=0;m>f;f++)p[f]=w(t+"_"+f,v(p[f],r,a),f,u);$=m>1?new P(_e,t,p):p[0]}else c&&(c.keywords=l(n).slice()),$=w(t,x(p,o,s),0,u)}return u[t]=$}function q(t,n,o,s,l){if(l[t])return l[t];var u=a(n),c=[],p=[];return r(function(n){var r,a,f,m;r=w(t+"_0_"+n,v(u[n][0],o,s),n,l),u[n].length>1?(f=i(u[n][1],o),m=f&&Wt.test(u[n][1]),St!==r.ptype||xt!==e(u[n][1])||!m&&f?a=w(t+"_1_"+n,v(u[n][1],o,s),n,l):m?(a=new String(u[n][1]),a.regex_pattern=o):a=u[n][1]):a=r,c.push(r),p.push(a)},0,u.length-1),l[t]=new P(qe,t,[c,p])}function O(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 E(e,n,r,o){var s=e.meta||r,l=!(!e.caseInsesitive&&!e.ci),a=t(n,function(e){return{word:e,meta:s,ci:l}});return o.autocomplete=(o.autocomplete||[]).concat(a),a}function S(t){t.Lex||(t.Lex={}),t.Syntax||(t.Syntax={});var n,r,o,l,a,i,c,p,f,m,k,g=t.Lex,h=t.Syntax,$=[g,h],d=$.length;for(k=0;d>k;){m=$[k++];for(o in m)m[st](o)&&(n=o.split(":"),r=n[1]&&Pt(n[1]).length?Pt(n[1]):null,n=Pt(n[0]),n.length||(n=o,r=null),n!==o&&(m[n]=m[o],u(m,o),r&&(r=r[ft](),l=m[n],a=e(l),Ot===a?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&&xt===a?m[n][l]=!0:m[n].tokens=l))),g===m&&(Mt&e(m[n])&&(m[n]={type:"simple",tokens:m[n]}),l=m[n],l.type&&(p=l.type=l.type[ft](),"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[st](n))for(l=m[n];l.extend;)i=l.extend,u(l,"extend"),c=g[i],c&&(Mt&e(c)&&(c=g[i]={type:"simple",tokens:c}),l=s(c,l));m=g;for(n in m)m[st](n)&&(l=m[n],l.type?(p=l.type=l.type[ft](),"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"],u(l,"escaped-line-block")):l["escaped-block"]?(l.type="block",l.multiline=!0,l.escape||(l.escape="\\"),l.tokens=l["escaped-block"],u(l,"escaped-block")):l["line-block"]?(l.type="block",l.multiline=!1,l.escape=!1,l.tokens=l["line-block"],u(l,"line-block")):l.comment?(l.type="comment",l.escape=!1,l.tokens=l.comment,u(l,"comment")):l.block?(l.type="block",l.tokens=l.block,u(l,"block")):l.simple?(l.type="simple",l.tokens=l.simple,u(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"]],u(l,"error")):l[st]("context")?(l.type="action",l.action=[l.context?"context-start":"context-end",l.context,!!l["in-context"]],u(l,"context")):l.indent?(l.type="action",l.action=["indent",l.indent,!!l["in-context"]],u(l,"indent")):l.outdent?(l.type="action",l.action=["outdent",l.outdent,!!l["in-context"]],u(l,"outdent")):l.unique?(l.type="action",l.action=["unique",xt&e(l.unique)?["_DEFAULT_",l.unique]:l.unique,!!l["in-context"]],u(l,"unique")):l.push?(l.type="action",l.action=["push",l.push,!!l["in-context"]],u(l,"push")):l[st]("pop")?(l.type="action",l.action=["pop",l.pop,!!l["in-context"]],u(l,"pop")):l.type="simple","action"===l.type?l.ci=!(!l.caseInsesitive&&!l.ci):"block"===l.type||"comment"===l.type?(l.multiline=l[st]("multiline")?!!l.multiline:!0,xt&e(l.escape)||(l.escape=!1)):"simple"===l.type&&(l.meta=l.autocomplete&&xt&e(l.meta)?l.meta:null,l.ci=!(!l.caseInsesitive&&!l.ci)));m=h;for(n in m)m[st](n)&&(l=m[n],Ot!==e(l)||l.type?l.type&&(p=l.type=l.type[ft](),"group"===p&&l.match?(a=e(l.match),xt&a?(f=l.match[ft](),"alternation"===f||"either"===f?(l.type="alternation",u(l,"match")):"sequence"===f||"all"===f?(l.type="sequence",u(l,"match")):"zeroorone"===f?(l.type="zeroOrOne",u(l,"match")):"zeroormore"===f?(l.type="zeroOrMore",u(l,"match")):"oneormore"===f?(l.type="oneOrMore",u(l,"match")):(l.type="sequence",u(l,"match"))):qt&a&&(l.type="repeat",l.repeat=l.match,u(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"]?u(l,"n-gram"):u(l,"ngram")):l.sequence||l.all?(l.type="sequence",l.tokens=l.sequence||l.all,l.all?u(l,"all"):u(l,"sequence")):l.alternation||l.either?(l.type="alternation",l.tokens=l.alternation||l.either,l.either?u(l,"either"):u(l,"alternation")):l.zeroOrOne?(l.type="zeroOrOne",l.tokens=l.zeroOrOne,u(l,"zeroOrOne")):l.zeroOrMore?(l.type="zeroOrMore",l.tokens=l.zeroOrMore,u(l,"zeroOrMore")):l.oneOrMore?(l.type="oneOrMore",l.tokens=l.oneOrMore,u(l,"oneOrMore")):l.positiveLookahead||l.lookahead?(l.type="positiveLookahead",l.tokens=l.positiveLookahead||l.lookahead,l.lookahead?u(l,"lookahead"):u(l,"positiveLookahead")):l.negativeLookahead?(l.type="negativeLookahead",l.tokens=l.negativeLookahead,u(l,"negativeLookahead")):(l.subgrammar||l.grammar)&&(l.type="subgrammar",l.tokens=l.subgrammar||l.grammar,l.subgrammar?u(l,"subgrammar"):u(l,"grammar")));return t}function L(t,n,r){if(r=r||{},n=n||[],!t||!t.length)return n;var o,s,l,a,i,u,c;for(o=0,s=t.length;s>o;o++)if(i=t[o])if(Me===i.type)if(i.autocompletions)for(l=0,a=i.autocompletions.length;a>l;l++)c=i.autocompletions[l],r[st]("w_"+c.word)||(n.push(c),r["w_"+c.word]=1);else xt===i.token.ptype&&xt&e(i.token.pattern)&&i.token.pattern.length>1&&(r[st]("w_"+i.token.pattern)||(n.push({word:""+i.token.pattern,meta:i.name,ci:!!i.ci}),r["w_"+i.token.pattern]=1));else if(Pe===i.type)L(i.token,n,r);else if(Ye&i.type){l=0,a=i.token.length;do L([u=i.token[l++]],n,r);while(a>l&&(Ie&u.type&&1>u.min||Oe===u.type))}else Ie&i.type&&L([i.token[0]],n,r);return n}function j(t,n,r,o){for(var s;xt&e(s=n[t]||r[t]);)t=s;return o?t:n[t]||r[t]||t}function R(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];Ht.test(o)&&Ht.test(r)&&r===o||n.push(o)},1,e.length-1,[e[0]]):e}function z(n,r,s){var l,a,i,u,c,p,f,m,k,g,h,b,v,x,w,_=!1;if(w=n.modifier?n.modifier:null,m=new String(Pt(n)),m.pos=0,1===m.length)b=""+n,r[b]||s[b]||(r[b]={type:"simple",tokens:n}),n=b;else{for(l=[],a=[],i="",v=[];m.posc[0]&&(c[0]=0),2>c.length?c.push(c[0]):c[1].length?c[1]=parseInt(c[1],10)||kt:c[1]=kt,0>c[1]&&(c[1]=0),h=a[a.length-1],b=""+h+["{",c[0],",",isFinite(c[1])?c[1]:"","}"].join(""),s[b]||(s[b]={type:"repeat",repeat:[c[0],c[1]],tokens:[h]}),a[a.length-1]=b):i+=k;else{if("}"===k){i+=k;continue}"&"===k||"!"===k?a.length?(h=a[a.length-1],b=""+h+k,s[b]||(s[b]={type:"!"===k?"negativeLookahead":"positiveLookahead",tokens:[h]}),a[a.length-1]=b):i+=k:"|"===k?(_=!1,a=R(a),a.length>1?(b=""+a.join(" "),s[b]||(s[b]={type:"sequence",tokens:a}),l.push(b)):a.length?l.push(a[0]):i+=k,a=[]):"("===k?(v.push([a,l,i]),a=[],l=[],i=""):")"===k&&(a=R(a),a.length>1?(b=""+a.join(" "),s[b]||(s[b]={type:"sequence",tokens:a}),l.push(b)):a.length&&l.push(a[0]),a=[],l=R(l,1),l.length>1?(b=""+l.join(" | "),s[b]||(s[b]={type:"alternation",tokens:l})):l.length&&(b=l[0]),l=[],x=v.pop(),a=x[0],l=x[1],i=x[2],h=b,b="("+h+")",s[b]||(s[b]=o(j(h,r,s))),a.push(b))}}else i+=k;i.length&&(_?(a.length&&(h=a[a.length-1],b=h+"."+i,p=r[b]||s[b],p||(f=j(h,r,s),s[b]=xt&e(f)?new String(f):o(f),s[b].modifier=i),a[a.length-1]=b),_=!1):"0"===i?(r[tt]||(r[tt]={type:"simple",tokens:0}),a.push(tt)):"^^"===i?(r[Je]||(r[Je]={type:"simple",tokens:Ee}),a.push(Je)):"^^1"===i?(r[Qe]||(r[Qe]={type:"simple",tokens:Se}),a.push(Qe)):"^"===i?(r[Xe]||(r[Xe]={type:"simple",tokens:je}),a.push(Xe)):"$"===i?(r[Ze]||(r[Ze]={type:"simple",tokens:Le}),a.push(Ze)):(r[i]||s[i]||(r[i]={type:"simple",tokens:i}),a.push(i))),i="",a=R(a),a.length>1?(b=""+a.join(" "),s[b]||(s[b]={type:"sequence",tokens:a}),l.push(b)):a.length&&l.push(a[0]),a=[],l=R(l,1),l.length>1?(b=""+l.join(" | "),s[b]||(s[b]={type:"alternation",tokens:l}),n=b):l.length&&(n=l[0]),l=[]}return w&&(r[n]||s[n])&&((r[n]||s[n]).modifier=w),n}function M(o,s,i,u,c,p,f,m,k,g,h){var $,d,y,b,v,x,w,S=null,L=null,R=null;if(Ee===o||Se===o||je===o||Le===o)return new T(o,Ee===o?Je:Se===o?$T_FBNL$:je===o?Xe:Ze,o,L);if(!1===o||0===o)return new T(Re,tt,0,L);if(""===o)return new T(ze,nt,"",L);if(null===o)return new T(Me,et,$t,L,R);if(qt&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=j(o,i,u),xt&e(v)&&(v=z(v,i,u),v=i[v]||u[v]||null),!v)return null;if($=v.type?Ve[v.type[ft]().replace(Tt,"")]||Me:Me,L=v.msg||null,R=v.modifier||null,d=v.tokens,Me&$){if(Ee===d||Se===d||je===d||Le===d||!1===d||0===d)return S=new T(d||Re,o,d||0,L),m[o]=S,S;if(""===d)return S=new T(ze,o,"",L),m[o]=S,S;if(null===d)return S=new T(Me,o,$t,L,R),m[o]=S,S;if(!d)return null}if(Oe&$)v[st]("action")?"nop"===v.action[0]?v.action[0]=ke:"error"===v.action[0]?v.action[0]=ge:"context-start"===v.action[0]?v.action[0]=$e:"context-end"===v.action[0]?v.action[0]=de:"push"===v.action[0]?v.action[0]=ye:"pop"===v.action[0]?v.action[0]=be:"unique"===v.action[0]?v.action[0]=he:"indent"===v.action[0]?v.action[0]=ve:"outdent"===v.action[0]&&(v.action[0]=xe):v[st]("nop")?v.action=[ke,v.nop,!!v["in-context"]]:v[st]("error")?v.action=[ge,v.error,!!v["in-context"]]:v[st]("context")?v.action=[v.context?$e:de,v.context,!!v["in-context"]]:v[st]("context-start")?v.action=[$e,v["context-start"],!!v["in-context"]]:v[st]("context-end")?v.action=[de,v["context-end"],!!v["in-context"]]:v[st]("push")?v.action=[ye,v.push,!!v["in-context"]]:v[st]("pop")?v.action=[be,v.pop,!!v["in-context"]]:v[st]("unique")?v.action=[he,xt&e(v.unique)?["_DEFAULT_",v.unique]:v.unique,!!v["in-context"]]:v[st]("indent")?v.action=[ve,v.indent,!!v["in-context"]]:v[st]("outdent")&&(v.action=[xe,v.outdent,!!v["in-context"]]),v.nop&&(v.action[0]=ke),S=new T(Oe,o,v.action.slice(),L,R),S.ci=!!v.caseInsensitive||v.ci,m[o]=S;else if(d=l(d),Me&$){w=v.autocomplete?E(v,Rt&e(v.autocomplete)?l(v.autocomplete):d,o,h):null;var D={};if(x="undefined"!=typeof v.combine?v.combine:!!(qt&e(v.tokens)),S=new T(Me,o,_(o,d.slice(),s,x,!(!v.caseInsensitive&&!v.ci),p,f,D),L,R,null,w),D.keywords&&(S.keywords=D.keywords.join("|")),m[o]=S,null!=v.except){var N,P,F=l(v.except),I=F.length,A=[];for(N=0;I>N;N++)F[N]&&(P=M(F[N],s,i,u,c,p,f,m,k,g,h),P&&A.push(P));A.length&&(S.except=A)}}else De&$?(Ne===$&&O(v,g),S=new T($,o,q(o,d.slice(),s,p,f),L),S.empty=v[st]("empty")?!!v.empty:!0,S.mline=v[st]("multiline")?!!v.multiline:!0,S.esc=v[st]("escape")?v.escape:!1,S.inter=!!c[o+".inside"],Ne===$&&v.interleave&&k.push(C(S)),R&&(S.modifier=R),m[o]=S):Ke&$&&(He===$?m[o]=new T(He,o,d,L,R):We===$?(b=a(d),S=t(b,function(e,t){return new T(We,o+"_NGRAM_"+t,null,L,R)}),m[o]=S,r(function(e){S[e].token=l(n(b[e],function(e,t){return e.concat(M(t,s,i,u,c,p,f,m,k,g,h))},[]))},0,b.length-1)):(Ge===$||Ue===$?S=new T($,o,null,L,R):Ie&$&&qt&e(v.repeat)?(S=new T(Ie,o,null,L,R),S.min=v.repeat[0],S.max=v.repeat[1]):Te===$?(S=new T(Te,o,null,L,R),S.min=0,S.max=1):Ae===$?(S=new T(Ae,o,null,L,R),S.min=0,S.max=kt):Ce===$?(S=new T(Ce,o,null,L,R),S.min=1,S.max=kt):S=Pe===$?new T(Pe,o,null,L,R):new T(Fe,o,null,L,R),m[o]=S,S.token=l(n(d,function(e,t){return e.concat(M(t,s,i,u,c,p,f,m,k,g,h))},[]))));return m[o]}function D(t){var n={};return t.Lex=t.Lex||{},t.Syntax=t.Syntax||{},t=S(t),t.Parser&&t.Parser.length&&r(function o(s,l){var a,i,u,c=l[s];n[c]||(qt&e(c)&&(a=c,c="NGRAM_"+a.join("_"),t.Syntax[c]||(t.Syntax[c]={type:"ngram",tokens:a})),i=j(c,t.Lex,t.Syntax),xt&e(i)&&(i=z(i,t.Lex,t.Syntax),i=t.Lex[i]||t.Syntax[i]||null),i&&(n[c]=i,u=i.type?Ve[i.type[ft]().replace(Tt,"")]||Me:Me,Ke&u&&r(o,0,i.tokens.length-1,i.tokens)))},0,t.Parser.length-1,t.Parser),t}function N(t){var r,s,l,a,i,u,c,p,f,m,k,g,h,$;return t.__parsed?t:(r=t.RegExpID||null,l=t.Extra?o(t.Extra):{},a=t.Style?o(t.Style):{},i=null,u=null,c=t.Lex?o(t.Lex):{},p=t.Syntax?o(t.Syntax):{},f={},m={},k={},h={},$={},g=[],s=t.Parser?o(t.Parser):[],t=S({Style:a,Fold:i,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=M(n,r,c,p,a,f,m,k,g,h,$)||null;return o&&(qt&e(o)?t=t.concat(o):t.push(o)),t},[]),t.$interleaved=g&&g.length?g:null,t.$comments=h,t.$autocomplete=$&&$.autocomplete&&$.autocomplete.length?$.autocomplete:null,t.__parsed=1,t)}function P(t,n,r,o,s){var l,a,i=this;l=i.type=t,i.name=n,i.pattern=r,a=i.ptype=o||xt,i.key=s||0,_e===l?i.key=!1!==s:qe===l?i.pattern[0]=new P(_e,n+"_Start",r[0],null,!1):$t===a?i.pattern=null:St===a&&(i.pattern=St&e(r)?[r,0]:[r[0],r[1]||0])}function F(t,n,r,o){var s,l,a,i,u,c,p,f,m,k,g,h=t,$=h.type,d=h.pattern,y=h.key;if(qe===$){if(s=h.name,a=d[0],i=d[1],c=F(a,n,r,o))return u=i[c[0]],f=e(u),m=a.pattern[c[0]].ptype,St===m&&jt&f&&(u.regex_pattern?(p=b(u,c[1]),u=new P(we,s+"_End",v(p,u.regex_pattern,{}),St)):(p=dt&f?c[1][u+1]:b(u,c[1]),u=new P(we,s+"_End",p,p.length>1?xt:wt))),u}else if(_e===$){for(k=0,g=d.length;g>k;k++)if(p=F(d[k],n,r,o))return y?[k,p[1]]:p}else{if(l=h.ptype,$t===l)return!1!==r&&n.end(),[y,""];if(St===l){if(p=d[0].xflags.l?n.match(d[0]):n.slice(n.pos).match(d[0]),p&&0===p.index)return!1!==r&&n.mov(p[d[1]||0].length),[y,d[1]>0?p[d[1]]:p]}else if(_t===l){if(!0===o){p=-1;var x,w;for(g=d.length-1;g>=0;g--)x=n.indexOf(d[mt](g),n.pos),x>-1&&(-1===p||p>x)&&(p=x,w=d[mt](g));if(p>-1)return!1!==r&&(n.pos=p+1),[y,w]}else if(p=n[mt](n.pos)||null,p&&-1-1)return!1!==r&&(n.pos=p+1),[y,d]}else if(p=n[mt](n.pos)||null,d===p)return!1!==r&&n.mov(1),[y,p]}else if(xt===l)if(g=d.length,!0===o){if(p=n.indexOf(d,n.pos),p>-1)return!1!==r&&(n.pos=p+g),[y,d]}else if(d===n.substr(n.pos,g))return!1!==r&&n.mov(g),[y,d]}return!1}function I(e,t){this.val=e||null,t?this.prev=t:this.prev=null}function T(e,t,n,r,o,s,l,a){var i=this;i.type=e,i.name=t,i.token=n,i.modifier=o||null,i.except=s||null,i.autocompletions=l||null,i.keywords=a||null,i.pos=null,i.msg=r||null,i.$msg=null,i.status=0,i.empty=!1,i.ci=!1,i.mline=!0,i.esc=!1,i.inter=!1,i.found=0,i.min=0,i.max=1,i.i0=0,i.$id=null}function A(){var e=this;e.T=0,e.id=null,e.type=null,e.match=null,e.str="",e.pos=null,e.block=null}function C(e,t,n,r){var o=new T(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|=ue),n&&(o.modifier=n),r&&(o.$id=r),o}function B(e){var t=e.name;return e.$msg?e.$msg:e.status&ue?'Token "'+t+'"'+(e.keywords?": "+e.keywords:"")+" Expected":'Syntax Error: "'+t+'"'}function G(e,t,n,r,o,s,l){e.status&ae&&(e.err[""+t+"_"+n+"_"+r+"_"+o+"_"+(s?s.name:"ERROR")]=[t,n,r,o,l||B(s)])}function U(e,t,n){if(e.stack===t)t=e.stack=new I(n,e.stack);else{for(var r=e.stack;r&&r.prev!==t;)r=r.prev;t=new I(n,t),r&&(r.prev=t)}return t}function W(e,t){if(null==e)return null;if(t){for(var n=new I(e.val),r=n,o=e;o.prev;)r.prev=new I(o.prev.val),o=o.prev,r=r.prev;return n}return e}function H(e,t,n,r){var o,s,l,a,i,u=1/0,c=null,p=1/0;if(s=t.pos,t.spc(),l=t.pos,o=e.stack,t.post.pos?a.pos:t.pos+1,e.stack=o,t.pos>=t.length)););e.stack=o,t.post.pos?(u=t.pos,c=o,p=i):u===t.pos&&p>i&&(u=t.pos,c=o,p=i),t.pos=l,o=o.prev,i++}u=s&&t.pos===l}function Y(e,t,n,r){if(!e)return!1;var o=e.type,s=Ke&o?Q:De&o?J:Oe&o?K:V;return s(e,t,n,r)}function K(t,n,r,o){var s,l,a,i,u,c,p,f,m,k,g,h,$,d,y,v=t,x=v.token||null,w=v.ci,_=v.name,q=!(r.status&ae);if(v.status=0,v.$msg=null,q||!x||!o||!o.pos)return!0;if(y=!!(De&o.T),ke===x[0]||y&&!o.block)return!0;if(s=x[0],l=x[1],h=x[2],u=v.msg,y?(d=o.block.match||o.block.str,f=o.block.pos[0][0],m=o.block.pos[0][1],k=o.block.pos[0][2],g=o.block.pos[0][3]):(d=o.match||o.str,f=o.pos[0],m=o.pos[1],k=o.pos[2],g=o.pos[3]),ge===s)return!u&&xt&e(l)&&(u=l),v.$msg=u?b(u,d,!0):'Error "'+_+'"',G(r,f,m,k,g,v,B(v)),v.status|=ce,!1;if(de===s)r.ctx=r.ctx?r.ctx.prev:null;else if($e===s)r.ctx=new I({symb:{},queu:null},r.ctx);else if(be===s){if(h){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;if(l){if(l=b(l,d),w&&(l=l[ft]()),!c||l!==c.val[0])return c?(v.$msg=u?b(u,[c.val[0],l],!0):'Tokens do not match "'+c.val[0]+'","'+l+'"',$=B(v),G(r,c.val[1],c.val[2],c.val[3],c.val[4],v,$),G(r,f,m,k,g,v,$),c=c.prev):(v.$msg=u?b(u,["",l],!0):'Token does not match "'+l+'"',$=B(v),G(r,f,m,k,g,v,$)),v.status|=ce,h?r.ctx&&(r.ctx.val.queu=c):r.queu=c,!1;c=c?c.prev:null}else c=c?c.prev:null;h?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(ye===s&&l){if(h){if(!r.ctx)return!0;c=r.ctx.val.queu}else c=r.queu;l=b(l,d),w&&(l=l[ft]()),v.$msg=u?b(u,l,!0):'Token does not match "'+l+'"',c=new I([l,f,m,k,g,B(v)],c),h?r.ctx&&(r.ctx.val.queu=c):r.queu=c}else if(he===s){if(h){if(!r.ctx)return!0;p=r.ctx.val.symb}else p=r.symb;if(a=l[1],i=l[0],a=b(a,d,!0),w&&(a=a[ft]()),p[st](i)||(p[i]={}),p[i][st](a))return v.$msg=u?b(u,a,!0):'Duplicate "'+a+'"',$=B(v),G(r,p[i][a][0],p[i][a][1],p[i][a][2],p[i][a][3],v,$),G(r,f,m,k,g,v,$),v.status|=ce,!1;p[i][a]=[f,m,k,g]}return!0}function V(e,t,n,r,o){var s,l,a=e,i=a.token,u=a.modifier,c=a.type,p=a.name,f=a.except,m=n.line,k=t.pos,g=null,h=!1;if(a.status&=fe,a.$msg=o?null:a.msg||null,a.pos=t.pos,f&&!o){l=Z(n,t);for(var $=0,d=f.length;d>$;$++)if(s=f[$],a!==s&&Me===s.type&&V(s,t,n,r,1))return a.pos=s.pos,Z(n,t,l),!1}return Ee===c?h=0===n.line:Se===c?h=n.bline+1===n.line:je===c?h=t.sol():Le===c?(t.spc(),t.eol()?h=p:(a.pos=t.pos,t.bck(k))):Re===c?(a.status=0,h=!0):ze===c?(a.status&ue&&t.spc()&&!t.eol()?(a.pos=t.pos,t.bck(k),a.status|=ce):h=!0,a.status&=pe):$t===i?(t.end(),h=u||p):(g=F(i,t))&&(g=g[1],h=u||p),o?h:(!1!==h&&(r.T=c,r.id=p,r.type=h,r.str=t.sel(k,t.pos),r.match=g,r.pos=[m,k,m,t.pos]),!h&&a.status&&a.$msg&&(a.$msg=b(a.$msg,p,!0)),h)}function J(e,t,n,r){var o,s,l,a,i,u,c,p,f,m,k,g,h,$,d,y,v,x,w,_,q,O,E=e,S=E.name,L=E.type,j=E.modifier,R=E.token,z=E.mline,M=E.inter,D=M?S+".inside":S,N=E.esc,P=!!N,I="",T="",A="",B="",G=E.$id||S,W=n.outer,H=W&&W[2],K=W&&W[1];if(E.status&=fe,E.$msg=E.msg||null,E.pos=t.pos,_=n.line,q=t.pos,Ne===L&&(E.status&=pe),d=E.status&ue,l=0,a=0,n.block&&n.block.name===S?(a=1,l=1,$=D,o=n.block.end,p=n.block.sp,m=n.block.ip,f=n.block.ep,I=n.block.s,T=n.block.i):!n.block&&(o=F(R,t))&&(a=1,$=S,v=t.pos,p=[_,q],m=[[_,v],[_,v]],f=[_,v],I=t.sel(q,v),T="",B="",n.block={name:S,end:o,sp:p,ip:m,ep:f,s:I,i:T,e:B}),a){if(w=n.stack,s=$t===o.ptype,y=s||E.empty,M){if(s&&l&&t.sol())return E.status&=pe,n.block=null,!1;if(!l)return v=t.pos,r.T=L,r.id=S,r.type=j||$,r.str=t.sel(q,v),r.match=null,r.pos=[_,q,_,v],U(n,w,C(E,d,0,G)),j||$}if(v=t.pos,i=K?s&&t.eol():F(o,t),c=z,u=0,i)$=s?D:S,B=t.sel(v,t.pos);else if(x=t.pos,g=!1,K||P||_t!==o.ptype&&wt!==o.ptype&&xt!==o.ptype){for(;!t.eol();){if(K){if(Y(K,t,H,r)){if(t.pos>x){s&&(i=1);break}return!0}if(s){h=t.nxt(1),A+=h;continue}}if(v=t.pos,!g&&F(o,t)){M&&t.pos>v&&v>x?($=D,t.bck(v),u=1):($=S,i=1),B=t.sel(v,t.pos);break}h=t.nxt(1),A+=h,g=P&&!g&&N===h,v=t.pos}s&&t.eol()&&(i=1)}else(O=F(o,t,!0,!0))?M&&t.pos>v+O[1].length?($=D,t.mov(-O[1].length),u=1,A=t.sel(v,t.pos)):($=S,i=1,A=t.sel(v,t.pos-O[1].length),B=O[1]):(t.end(),$=D,u=1,A=t.sel(v,t.pos));return c=z||P&&g,T+=A,m[1]=[_,v],f=[_,t.pos],i&&!y&&m[0][0]===m[1][0]&&m[0][1]===m[1][1]?(n.block=null,!1):(i||!c&&!u?n.block=null:(n.block.ip=m,n.block.ep=f,n.block.i=T,n.block.e=B,U(n,w,C(E,d,0,G))),r.T=L,r.id=S,r.type=j||$,r.str=t.sel(q,t.pos),r.match=null,r.pos=[_,q,f[0],f[1]],E.pos=t.pos,n.block||(k=I+T+B,r.block={str:k,match:[k,T,I,B],part:[k,I,T,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]]]}),j||$)}return E.status&&E.$msg&&(E.$msg=b(E.$msg,S,!0)),!1}function Q(e,t,n,r){var o,s,l,a,i,u,p,f,m,k,g,h,$,d,y,b=e,v=b.type,x=(b.name,b.token),w=x.length,_=b.modifier;if(b.status&=fe,b.$msg=b.msg||null,f=t.pos,m=n.stack,b.pos=t.pos,u=0,p=0,He===v){b.status&=fe;var q=new String(x[0]),O=n.stack?n.stack.val:null;return q.subgrammar=1,q.next=O?new T(Ge,O.name,[O]):null,q.required=O?O.status&ue:0,q}if(Pe===v){for($=c(),b.status|=ue,h=[],y=Z(n,t),g=0,k=g;w>k;k++){if(o=C(x[k],1,_,$),s=Y(o,t,n,r),b.pos=o.pos,o.status&ue&&(u++,h.push(B(o))),!1!==s)return s;o.status&ce&&(p++,Z(n,t,y))}return u>0?b.status|=ue:b.status&=pe,w===p&&u>0?b.status|=ce:b.status&=fe,b.status&&!b.$msg&&h.length&&(b.$msg=h.join(" | ")),!1}if(Ye&v){d=!!(v&Fe),$=b.$id||c(),d?b.status|=ue:b.status&=pe,y=Z(n,t),g=0;do o=C(x[g++],d,_,$),s=Y(o,t,n,r);while(w>g&&(!0===s&&Be&o.type||!1===s&&!(o.status&ue)));if(b.pos=o.pos,!1!==s){if(!0!==s||Re!==o.type)for(k=w-1;k>=g;k--)m=U(n,m,C(x[k],1,_,$));return s.subgrammar&&w>g&&(s.next=new T(Ge,x[g].name,[x[g]]),s.required=x[g].status&ue),s}return o.status&ce?(d?b.status|=ce:b.status&=fe,Z(n,t,y)):d&&o.status&ue&&(b.status|=ce),b.status&&!b.$msg&&(b.$msg=B(o)),!1}if(Be&v)return He&x[0].type?!0:(y=Z(n,t,null,!1),s=Y(C(x[0],0),t,n,r),Z(n,t,y),Ue===v?!1===s:!1!==s);for($=b.$id||c(),l=b.found,a=b.min,i=b.max,b.status=0,h=[],y=Z(n,t),k=0;w>k;k++){if(o=C(x[k],1,_,$),s=Y(o,t,n,r),b.pos=o.pos,!1!==s){if(++l,i>=l)return b.found=l,U(n,m,C(b,0,0,c())),b.found=0,s;break}o.status&ue&&(u++,h.push(B(o))),o.status&ce&&Z(n,t,y)}return a>l&&(b.status|=ue),(l>i||a>l&&u>0)&&(b.status|=ce),b.status&&!b.$msg&&h.length&&(b.$msg=h.join(" | ")),!1}function X(e,t){var n=this;n.id=e?p("state"):"state",t instanceof X?(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 X(e,t.outer[2])]:null,n.status&ae?(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&ae?(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 Z(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 ee(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 te(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?ct(0,r.pos+e):pt(r.length,r.pos+e),r},r.bck=function(e){return r.pos=ct(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||te.$NONSPC$;r.poso;o++)n.subparser(r[o],new en.Parser(N(t.subgrammars[r[o]])))}else t.tokenize&&re.parser&&postMessage({tokenize:1,tokens:re.parser.parse(t.code,le|ae|ie).tokens})}function oe(e,t){var n=this,r=null,o=[];r=new Worker(Qt.file),r.postMessage({init:1,grammar:e,subgrammars:t}),r.onMessage=function(e){if(o&&o.length){var t,n=e.data||{};n.tokenize&&(t=o.shift())(n.tokens); +}},n.tokenize=function(e,t){return r?(o.push(t),void r.postMessage({tokenize:1,code:e})):t(null)},n.dispose=function(){return o=null,r&&r.terminate(),r=null,n}}function se(t,n){n=n||Xt;var o,s=0,l={"before-highlight":function(e){o.$parser&&o.language===e.language&&(e._code=e.code,e.code="")},"before-insert":function(e){o.$parser&&o.language===e.language&&(e.code=e._code,e._code="",e.highlightedCode=n.Token.stringify(o.tokenize(e.code,o.escapeHtml),e.language))}};return o={$id:p("prism_grammar_highlighter"),$grammar:t,$parser:new en.Parser(N(t)),$worker:null,language:null,escapeHtml:!0,tokenize:function(e,t,n){var o=this;if("function"!=typeof n){var s=o.$parser.parse(e,le|ae|ie).tokens;return t&&r(ne,0,s.length-1,s),s}o.$worker||(o.$worker=new oe(o.$grammar,o.getSubgrammars())),o.$worker.tokenize(e,function(e){e&&t&&r(ne,0,e.length-1,e),n(e)})},hook:function(t,r){var o=this;if(s&&o.unhook(),xt&e(r)){var a=t;t=r,r=a}n=r||n,o.language=t;for(var i in l)l[st](i)&&n.hooks.add(i,l[i]);s=1},unhook:function(e){var t=this;if(n=e||n,s){var r,o,a=n.hooks.all;for(r in l)a[st](r)&&l[st](r)&&(o=a[r].indexOf(l[r]),o>-1&&a[r].splice(o,1));s=0,t.language=null}},getSubgrammars:function(){for(var e=this,t=e.$parser,n=Object.keys(t.$subgrammars),r={},o=0,s=n.length;s>o;o++)r[n[o]]=t.$subgrammars[n[o]].Mode.$grammar;return r},submode:function(e,t){this.$parser.subparser(e,t.$parser)},dispose:function(){var e=this;e.unhook(),e.$worker&&e.$worker.dispose(),e.$parser&&e.$parser.dispose(),e.$parser=e.$worker=e.language=n=null}},o.$parser.Mode=o,o}var le=1,ae=2,ie=32,ue=4,ce=8,pe=~ue,fe=~ce,me=ue|ce,ke=0,ge=4,he=8,$e=16,de=17,ye=32,be=33,ve=128,xe=129,we=2,_e=4,qe=8,Oe=4,Ee=8,Se=9,Le=16,je=32,Re=128,ze=256,Me=512,De=1024,Ne=1025,Pe=2048,Fe=4096,Ie=8192,Te=8193,Ae=8194,Ce=8195,Be=16384,Ge=Be,Ue=16385,We=32768,He=65536,Ye=Fe|We,Ke=Pe|Fe|Ie|Be|We|He,Ve={action:Oe,simple:Me,block:De,comment:Ne,subgrammar:He,alternation:Pe,sequence:Fe,repeat:Ie,zeroorone:Te,zeroormore:Ae,oneormore:Ce,positivelookahead:Ge,negativelookahead:Ue,ngram:We},Je="$|SOF|$",Qe="$|NONBLANK|$",Xe="$|SOL|$",Ze="$|EOL|$",et="$|ENDLINE|$",tt="$|EMPTY|$",nt="$|NONSPACE|$",rt=void 0,ot="prototype",st="hasOwnProperty",lt="propertyIsEnumerable",at=Object[ot],it=at.toString,ut=Object.create,ct=Math.max,pt=Math.min,ft="toLowerCase",mt="charAt",kt=1/0,gt=4,ht=8,$t=16,dt=32,yt=33,bt=34,vt=64,xt=128,wt=129,_t=130,qt=256,Ot=512,Et=1024,St=2048,Lt=4096,jt=xt|dt,Rt=xt|qt,zt=St|qt,Mt=xt|qt|St,Dt={"[object Number]":dt,"[object String]":xt,"[object Array]":qt,"[object RegExp]":St,"[object Date]":Lt,"[object Function]":Et,"[object Object]":Ot},Nt=/^\s+|\s+$/g,Pt=String[ot].trim?function(e){return e.trim()}:function(e){return e.replace(Nt,"")},Ft=function(e,t){return t.length-e.length},It=/\r\n|\r|\n/g,Tt=/[\-_]/g,At=0,Ct=/([.*+?^${}()|[\]\/\\\-])/g,Bt=/[&"'<>]/g,Gt=/^([.!&\[\]{}()*+?\/|'"]|\s)/,Ut="(\\s|\\W|$)",Wt=/(l?i?l?)x(l?i?l?)$/,Ht=/[*+]$/;X.prototype.toString=function(){var e=this;return e.id+"_"+e.line+"_"+e.bline+"_"+(e.block?e.block.name:"0")},te.$SPC$=/^[\s\u00a0]+/,te.$NONSPC$=/[^\s\u00a0]/,te.$NOTEMPTY$=/\S/,te.$SPACE$=/^\s*/;var Yt=m({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,a,i,u,c,p,f,m,k,g,h,$,d,y,b=this,v=b.$grammar,x=v.Style,w=b.DEF,_=b.ERR,q={},O=b.$n$,E=b.$t$,S=b.$v$,L=v.$interleaved,j=v.$parser,R=j.length,z=L?L.length:0,M=t.outer,D=M&&M[2],N=M&&M[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,a=e.pos,f=!1,k=!0,m=!1,g=!1,M&&b===M[0]){if(q[O]=null,q[E]=w,q[S]=null,N){if(s=new A,Y(N,e,D,s))return t.outer=null,{parser:b,state:D};for(e.nxt(1);!e.eol();){if(Y(N,e,D,s)){if(e.pos>a)break;return t.outer=null,{parser:b,state:D}}e.nxt(1)}}else e.spc(),e.eol()?g=!0:e.end();return q[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||t.$eol$),q}if(t.stack&&Le===t.stack.val.type&&e.sol()&&(t.stack=t.stack.prev),(!t.stack||ze!==t.stack.val.type&&null==t.block)&&e.spc()){if(t.stack&&He===t.stack.val.type)return e.bck(a),r=t.stack.val,t.stack=t.stack.prev,f=Y(r,e,t,s),h=""+f,b.$subgrammars[h]?($=b.$subgrammars[h],d=new X(1,n[h]?n[h]:t.status),D=t):($=b,d=new X,D=t),d.outer=[b,f.next,D],{parser:$,state:d,toInner:h};k=!1,g=!0}if(q[O]=null,q[E]=w,q[S]=null,k)for(s=new A,i=0;k&&(t.stack||R>i)&&!e.eol();){if(c=e.pos,p=t.stack,N){if(e.spc(),Y(N,e,D,s))return e.pos>c?(q[S]=e.cur(1),t.$eol$=e.eol(),t.$blank$=t.$blank$&&!0,q):(t.outer=null,{parser:M[0],state:D,fromInner:t});e.bck(c)}if(y=!1,z&&!t.block)for(u=0;z>u;u++)if(r=L[u],f=Y(r,e,t,s),!1!==f){y=!0;break}if(k&&!y){if(!t.stack&&i>=R)break;t.stack?(r=t.stack.val,t.stack=t.stack.prev):r=j[i++],f=Y(r,e,t,s)}if(!1===f){if(r.status&me){t.token=r,g=H(t,e,s,r)||g,m=!0,k=!1;break}}else{if(f.subgrammar)return h=""+f,b.$subgrammars[h]?($=b.$subgrammars[h],d=new X(1,n[h]?n[h]:t.status),D=t):($=b,d=new X,D=t),d.outer=[b,f.next,D],{parser:$,state:d,toInner:h};if(t.stack&&t.stack.prev&&e.eol()&&De&t.stack.val.type&&t.block&&t.block.name===t.stack.val.name)for(u=t.stack.prev;u&&Oe===u.val.type;)o=u,u=u.prev,K(o,e,t,s),o.status&ce&&(t.$actionerr$=!0);else if(t.stack&&Oe===t.stack.val.type)for(;t.stack&&Oe===t.stack.val.type;)o=t.stack.val,t.stack=t.stack.prev,K(o,e,t,s),o.status&ce&&(t.$actionerr$=!0);if(!0!==f){k=!1;break}}}return k&&e.nxt(1),q[S]=e.cur(1),!1!==f?(f=x[f]||w,q[O]=r.name):m?(f=_,t.status&ae&&G(t,l,a,l,e.pos,r)):f=w,q[E]=f,t.$eol$=e.eol(),t.$blank$=t.$blank$&&(g||t.$eol$),q},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,a,i,u=(e||"").split(It),c=u.length,p=null;if(t=t||le,s=!!(t&ae),l=!!(t&le),o={parser:this,state:new X(0,t),inner:{}},o.state.$full_parse$=!0,r(function(e){u[e]+="\n"},0,c-2),l?p=r(t&ie?function(e,t){t._=t._.concat(o.parser.tokenize(te(u[e]),o,e))}:function(e,t){t._.push(o.parser.tokenize(te(u[e]),o,e))},0,c-1,{_:[]})._:r(function(e){var t=te(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;)a=n.queu.shift(),G(n,a[1],a[2],a[3],a[4],null,a[5]);return i=l&&s?{tokens:p,errors:n.err}:l?p:n.err,ee(n),o=n=null,i},autocompletion:function(e,t){var n,r,o=e.stack,s={},l=L([e.token],[],s);for(t=t||0;o;){if(n=o.val,r=n.type,Ie&r){if(l=L([n],l,s),0