diff --git a/README.md b/README.md index 6589dd9..896af77 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Code Indentation is Codemirror default, see [Modularity and Future Directions](h * [`Grammar.Syntax Model`](https://github.com/foo123/editor-grammar/blob/master/grammar-reference.md#syntax-model) can enable highlight in a more *context-specific* way, plus detect possible *syntax errors* and display appropriate *error messages* (see below) * [`Grammar.Syntax Model`](https://github.com/foo123/editor-grammar/blob/master/grammar-reference.md#syntax-model) can contain **recursive references** (see `/test/grammar-js-recursion.html`) * [`Grammar.Syntax Model`](https://github.com/foo123/editor-grammar/blob/master/grammar-reference.md#syntax-pegbnf-like-notations) can be (fully) specificed using [`PEG`](https://en.wikipedia.org/wiki/Parsing_expression_grammar)-like notation or [`BNF`](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form)-like notation (**NEW feature**) +* [`Grammar.Syntax Model`](https://github.com/foo123/editor-grammar/blob/master/grammar-reference.md#syntax-pegbnf-like-notations) implements **positive / negative lookahead tokens** (analogous to `PEG` `and-`/`not-` entities) (**NEW feature**) * `Grammar` can define [*action* tokens](https://github.com/foo123/editor-grammar/blob/master/grammar-reference.md#action-tokens) to perform *complex context-specific* parsing functionality, including **associated tag matching** and **duplicate identifiers** (see for example `xml.grammar` example) (**NEW feature**) * Generated highlight modes can support **toggle comments** and **keyword autocompletion** functionality if defined in the grammar * **Context-sensitive autocompletion** extracted directly from the grammar specification (**NEW feature**) diff --git a/beeld.config b/beeld.config index 95505de..27b3b04 100644 --- a/beeld.config +++ b/beeld.config @@ -50,7 +50,7 @@ tasks =[{}] "@@ROOT@@" = "this" "@@EXPORTS@@" = "exports" - "@@VERSION@@" = "3.0.0" + "@@VERSION@@" = "3.1.0" "@@MODULE_NAME@@" = "CodeMirrorGrammar" @ diff --git a/build/codemirror_grammar.js b/build/codemirror_grammar.js index 601596e..3121c8e 100644 --- a/build/codemirror_grammar.js +++ b/build/codemirror_grammar.js @@ -1,7 +1,7 @@ /** * * CodeMirrorGrammar -* @version: 3.0.0 +* @version: 3.1.0 * * Transform a grammar specification in JSON format, into a syntax-highlight parser mode for CodeMirror * https://github.com/foo123/codemirror-grammar @@ -26,7 +26,7 @@ else if ( !(name in root) ) /* Browser/WebWorker/.. */ "use strict"; /** * EditorGrammar Codebase -* @version: 3.0.0 +* @version: 3.1.0 * * https://github.com/foo123/editor-grammar **/ @@ -60,7 +60,7 @@ T_BLOCK = 1024, T_COMMENT = 1025, T_ALTERNATION = 2048, T_SEQUENCE = 4096, T_REPEATED = 8192, T_ZEROORONE = 8193, T_ZEROORMORE = 8194, T_ONEORMORE = 8195, -T_LOOKAHEAD = 16384, T_POSITIVE_LOOKAHEAD = T_LOOKAHEAD, T_NEGATIVE_LOOKAHEAD = 16385, /*TODO*/ +T_LOOKAHEAD = 16384, T_POSITIVE_LOOKAHEAD = T_LOOKAHEAD, T_NEGATIVE_LOOKAHEAD = 16385, T_NGRAM = 32768, T_SEQUENCE_OR_NGRAM = T_SEQUENCE|T_NGRAM, T_COMPOSITE = T_ALTERNATION|T_SEQUENCE|T_REPEATED|T_LOOKAHEAD|T_NGRAM, @@ -1528,20 +1528,19 @@ function parse_peg_bnf_notation( tok, Lex, Syntax ) else if ( '&' === c || '!' === c ) { - // TODO // lookahead modifier, applies to token that comes before - /*if ( sequence.length ) + if ( sequence.length ) { prev_token = sequence[sequence.length-1]; curr_token = '' + prev_token + c; if ( !Syntax[ curr_token ] ) Syntax[ curr_token ] = { - type:'&' === c ? 'positiveLookahead' : 'negativeLookahead', + type:'!' === c ? 'negativeLookahead' : 'positiveLookahead', tokens:[prev_token] } sequence[sequence.length-1] = curr_token; } - else*/ token += c; + else token += c; } else if ( '|' === c ) @@ -1858,7 +1857,7 @@ function get_tokenizer( tokenID, RegExpID, Lex, Syntax, Style, { autocompletions = get_autocomplete( token, - make_array( T_STR_OR_ARRAY & get_type(token.autocomplete) ? token.autocomplete : token.tokens ), + T_STR_OR_ARRAY&get_type(token.autocomplete) ? make_array( token.autocomplete ) : $tokens$, tokenID, keywords ); @@ -1941,7 +1940,6 @@ function get_tokenizer( tokenID, RegExpID, Lex, Syntax, Style, { if ( T_POSITIVE_LOOKAHEAD === $type$ || T_NEGATIVE_LOOKAHEAD === $type$ ) { - // TODO $token$ = new tokenizer( $type$, tokenID, null, $msg$, $modifier$ ); } else if ( (T_REPEATED & $type$) && (T_ARRAY & get_type( token.repeat )) ) @@ -2877,8 +2875,13 @@ function t_composite( t, stream, state, token ) do { tokenizer = t_clone( tokens[ i0++ ], is_sequence, modifier, $id ); style = tokenize( tokenizer, stream, state, token ); - // bypass failed but optional tokens in the sequence and get to the next ones - } while (/*is_sequence &&*/ i0 < n && false === style && !(tokenizer.status & REQUIRED/*_OR_ERROR*/)); + // bypass failed but optional tokens in the sequence + // or successful lookahead tokens + // and get to the next ones + } while (/*is_sequence &&*/ i0 < n && ( + ((true === style) && (T_LOOKAHEAD & tokenizer.type)) || + ((false === style) && !(tokenizer.status & REQUIRED/*_OR_ERROR*/)) + )); if ( false !== style ) { @@ -2907,16 +2910,13 @@ function t_composite( t, stream, state, token ) return false; } - else if ( T_POSITIVE_LOOKAHEAD === type ) - { - // TODO - self.status = 0; return false; - } - - else if ( T_NEGATIVE_LOOKAHEAD === type ) + else if ( T_LOOKAHEAD & type ) { - // TODO - self.status = 0; return false; + tokenizer = t_clone( tokens[ 0 ], 1, modifier, $id ); + style = tokenize( tokenizer, stream, state, token ); + if ( stream.pos > stream_pos ) stream.bck( stream_pos ); + if ( stack.length > stack_pos ) stack.length = stack_pos; + return T_NEGATIVE_LOOKAHEAD === type ? false === style : false !== style; } else //if ( T_REPEATED & type ) @@ -3250,8 +3250,9 @@ var Parser = Class({ // error if ( tokenizer.status & REQUIRED_OR_ERROR ) { - // empty the stack of the syntax rule group of this tokenizer + // keep it for autocompletion, if needed state.token = tokenizer; + // empty the stack of the syntax rule group of this tokenizer empty( stack, tokenizer.$id /*|| true*/ ); // skip this if ( !stream.nxt( true ) ) { stream.spc( ); just_space = true; } @@ -3269,18 +3270,8 @@ var Parser = Class({ // found token else { - // action token(s) follow, execute action(s) on current token - if ( stack.length && T_ACTION === stack[stack.length-1].type ) - { - while ( stack.length && T_ACTION === stack[stack.length-1].type ) - { - action = stack.pop(); t_action( action, stream, state, token ); - // action error - if ( action.status & ERROR ) state.$actionerr$ = true; - } - } // partial block, apply maybe any action(s) following it - else if ( stack.length > 1 && stream.eol() && + if ( stack.length > 1 && stream.eol() && (T_BLOCK & stack[stack.length-1].type) && state.block && state.block.name === stack[stack.length-1].name ) @@ -3293,6 +3284,17 @@ var Parser = Class({ if ( action.status & ERROR ) state.$actionerr$ = true; } } + // action token(s) follow, execute action(s) on current token + else if ( stack.length && (T_ACTION === stack[stack.length-1].type) ) + { + while ( stack.length && (T_ACTION === stack[stack.length-1].type) ) + { + action = stack.pop(); + t_action( action, stream, state, token ); + // action error + if ( action.status & ERROR ) state.$actionerr$ = true; + } + } // not empty if ( true !== type ) { notfound = false; break; } } @@ -3328,21 +3330,22 @@ var Parser = Class({ return T; } - ,autocompletion: function( state ) { + ,autocompletion: function( state, min_found ) { var stack = state.stack, i, token, type, hash = {}, follows = generate_autocompletion( [ state.token ], [], hash ); + min_found = min_found || 0; for(i=stack.length-1; i>=0; i--) { token = stack[ i ]; type = token.type; if ( T_REPEATED & type ) { follows = generate_autocompletion( [ token ], follows, hash ); - if ( (0 < token.min) && follows.length ) break; + if ( (0 < token.min) && (min_found < follows.length) ) break; } else if ( (T_SIMPLE === type) || (T_ALTERNATION === type) || (T_SEQUENCE_OR_NGRAM & type) ) { follows = generate_autocompletion( [ token ], follows, hash ); - if ( follows.length ) break; + if ( min_found < follows.length ) break; } } return follows; @@ -3640,7 +3643,7 @@ var Folder = { /** * * CodeMirrorGrammar -* @version: 3.0.0 +* @version: 3.1.0 * * Transform a grammar specification in JSON format, into a syntax-highlight parser mode for CodeMirror * https://github.com/foo123/codemirror-grammar @@ -4007,7 +4010,7 @@ function get_mode( grammar, DEFAULT, CodeMirror ) [/DOC_MARKDOWN]**/ var CodeMirrorGrammar = exports['CodeMirrorGrammar'] = { - VERSION: "3.0.0", + VERSION: "3.1.0", // clone a grammar /**[DOC_MARKDOWN] diff --git a/build/codemirror_grammar.min.js b/build/codemirror_grammar.min.js index fe3d65c..d5489f8 100644 --- a/build/codemirror_grammar.min.js +++ b/build/codemirror_grammar.min.js @@ -1,11 +1,11 @@ /** * * CodeMirrorGrammar -* @version: 3.0.0 +* @version: 3.1.0 * * 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";var o;"object"==typeof module&&module.exports?module.exports=n.call(e,{}):"undefined"!=typeof System&&"function"==typeof System.register&&"function"==typeof System["import"]?System.register(t,[],function(o){o(t,n.call(e,{}))}):"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified(t)?define(t,["require","exports","module"],function(){return n.call(e,{})}):t in e||(e[t]=o=n.call(e,{}))&&"function"==typeof define&&define.amd&&define(function(){return o})}(this,"CodeMirrorGrammar",function(e){"use strict";function t(e){var t=0;return null===e?t=yn:!0===e||!1===e||e instanceof Boolean?t=wn:rn===e?t=$n:(t=jn[cn.call(e)]||kn,t=bn===t||e instanceof Number?isNaN(e)?vn:isFinite(e)?bn:xn:Cn===t||e instanceof String?1===e.length?On:Cn:_n===t||e instanceof Array?_n:qn===t||e instanceof RegExp?qn:Mn===t||e instanceof Date?Mn:Ln===t||e instanceof Function?Ln:En===t?En:kn),t}function n(e,t,n,o){var r,l,i,s,u,a,c=e.length;if(arguments.length<4&&(o=c-1),0>o&&(o+=c),arguments.length<3&&(n=0),n>o)return[];if(n===o)return[t(e[n],n,n,o)];for(i=o-n+1,s=15&i,u=1&s,a=new Array(i),u&&(a[0]=t(e[n],n,n,o)),r=u;s>r;r+=2)l=n+r,a[r]=t(e[l],l,n,o),a[r+1]=t(e[l+1],l+1,n,o);for(r=s;i>r;r+=16)l=n+r,a[r]=t(e[l],l,n,o),a[r+1]=t(e[l+1],l+1,n,o),a[r+2]=t(e[l+2],l+2,n,o),a[r+3]=t(e[l+3],l+3,n,o),a[r+4]=t(e[l+4],l+4,n,o),a[r+5]=t(e[l+5],l+5,n,o),a[r+6]=t(e[l+6],l+6,n,o),a[r+7]=t(e[l+7],l+7,n,o),a[r+8]=t(e[l+8],l+8,n,o),a[r+9]=t(e[l+9],l+9,n,o),a[r+10]=t(e[l+10],l+10,n,o),a[r+11]=t(e[l+11],l+11,n,o),a[r+12]=t(e[l+12],l+12,n,o),a[r+13]=t(e[l+13],l+13,n,o),a[r+14]=t(e[l+14],l+14,n,o),a[r+15]=t(e[l+15],l+15,n,o);return a}function o(e,t,n,o,r){var l,i,s,u,a,c=e.length,p=n;if(arguments.length<5&&(r=c-1),0>r&&(r+=c),arguments.length<4&&(o=0),o>r)return p;if(o===r)return t(p,e[o],o);for(s=r-o+1,u=15&s,a=1&u,a&&(p=t(p,e[o],o)),l=a;u>l;l+=2)i=o+l,p=t(t(p,e[i],i),e[i+1],i+1);for(l=u;s>l;l+=16)i=o+l,p=t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(p,e[i],i),e[i+1],i+1),e[i+2],i+2),e[i+3],i+3),e[i+4],i+4),e[i+5],i+5),e[i+6],i+6),e[i+7],i+7),e[i+8],i+8),e[i+9],i+9),e[i+10],i+10),e[i+11],i+11),e[i+12],i+12),e[i+13],i+13),e[i+14],i+14),e[i+15],i+15);return p}function r(e,t,n,o){if(t>n)return o;if(t===n)return e(t,o,t,n),o;var r,l,i=n-t+1,s=15&i,u=1&s;for(u&&e(t,o,t,n),r=u;s>r;r+=2)l=t+r,e(l,o,t,n),e(++l,o,t,n);for(r=s;i>r;r+=16)l=t+r,e(l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n);return o}function l(e,n){var o,r,i,s,u=t(e),a=0;if(bn===t(n)?n>0?(a=n,n=!0):n=!1:n=!1!==n,En===u){r={};for(i in e)e[sn](i)&&e[un](i)&&(o=t(e[i]),r[i]=En===o?n?l(e[i],a>0?a-1:n):e[i]:_n===o?n?l(e[i],a>0?a-1:n):e[i].slice():Mn===o?new Date(e[i]):Cn&o?e[i].slice():bn&o?0+e[i]:e[i])}else if(_n===u)for(s=e.length,r=new Array(s),i=0;s>i;i++)o=t(e[i]),r[i]=En===o?n?l(e[i],a>0?a-1:n):e[i]:_n===o?n?l(e[i],a>0?a-1:n):e[i].slice():Mn===o?new Date(e[i]):Cn&o?e[i].slice():bn&o?0+e[i]:e[i];else r=Mn===u?new Date(e):Cn&u?e.slice():bn&u?0+e:e;return r}function i(){var e,n,o,r,s,u,a,c,p,f,m=arguments,h=m.length;if(1>h)return null;for(n=l(m[0]),o=1;h>o;o++)if(e=m[o])for(r in e)if(e[sn](r)&&e[un](r))if(n[sn](r)&&n[un](r)){if(p=t(n[r]),f=t(e[r]),En===p&&En===f)n[r]=i(n[r],e[r]);else if(_n===p&&_n===f){if(a=n[r],c=e[r],u=c.length,!u)continue;if(a.length)for(s=0;u>s;s++)0>a.indexOf(c[s])&&a.push(c[s]);else n[r]=c.slice()}}else n[r]=l(e[r]);return n}function s(){return!0}function u(e,n){return n||_n!==t(e)?[e]:e}function a(e,n){return e=u(e),(n||_n!==t(e[0]))&&(e=[e]),e}function c(e,n){return Cn&t(n)&&Cn&t(e)&&n.length&&n.length<=e.length&&n===e.substr(0,n.length)}function p(e,t,n){return tn&&e[o-n-1].$id===t;)n++;n&&(e.length=o-n)}return e}function m(e,t,n){return n?e[t]=rn:delete e[t],e}function h(e){return(e||"id_")+ ++Bn}function g(e){return(e||"uuid")+"_"+ ++Bn+"_"+(new Date).getTime()}function d(){var e,n,o,r,l,i,s=arguments,u=s.length;for(e=s[0]||{},l=1;u>l;l++)if(n=s[l],En===t(n))for(r in n)n[sn](r)&&n[un](r)&&(o=n[r],i=t(o),e[r]=bn&i?0+o:Mn&i?new Date(o):Pn&i?o.slice():o);return e}function k(e,t){var n,o=arguments.length,r="constructor";return 0===o?(e=Object,t={}):1===o?(t=e||{},e=Object):(e=e||Object,t=t||{}),t[sn](r)||(t[r]=function(){}),n=t[r],delete t[r],n[ln]=d(pn(e[ln]),t),n[ln][r]=n,n}function $(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"}function y(e){return"&#"+e.charCodeAt(0)+";"}function b(e,t){return e.replace(Un,t?$:y)}function x(e){return e.replace(Gn,"\\$1")}function v(e,t){return new RegExp(e,t||"")}function w(e,t,n,o){var r,l,i,s,u=e.pos,a=e.length,c="",p=!!n;if(p){for(o=!!o,l=!1,s=0;a>u&&(r=e[gn](u++),t!==r||l);)i=n===r,l=!l&&i,o?(i&&s++,(!i||2&s)&&(c+=r,s=0)):c+=r;2&s&&(c+=n)}else for(;a>u&&(r=e[gn](u++),t!==r);)c+=r;return e.pos=u,c}function C(e,n,o){var r,l,i,s,u,a=!0===o?0:1;for(Cn&t(n)&&(n=[n,n,n],a=0),l=e.length,u="",r=0;l>r;)i=e[gn](r),l>r+1&&"$"===i?(s=e.charCodeAt(r+1),36===s?(u+="$",r+=2):s>=48&&57>=s?(u+=n[a+s-48]||"",r+=2):(u+=i,r+=1)):(u+=i,r+=1);return u}function O(e,n,o,r){if(!e||(bn|qn)&t(e))return e;var l,i=n?n.length||0:0,s="";if(Cn&t(r)?s=r:r&&(s=Wn),i&&n===e.substr(0,i)){var u,a,c,l,p,f=e.substr(i),m=f[gn](0),h="";for(l=f.length;l--&&(p=f[gn](l),m!==p);)"i"===p.toLowerCase()&&(h="i");return u=f.substring(1,l),a="^("+u+")",o[a]||(c=v(a,h),o[a]=c),o[a]}return s?(a="^("+x(e)+")"+s,o[a]||(c=v(a,h),o[a]=c),o[a]):e}function S(e,o,r){var l,i="";return Cn&t(o)?i=o:o&&(i=Wn),l=n(e.sort(An),x).join("|"),[v("^("+l+")"+i,r?"i":""),1]}function _(e,n,o,r){var l=t(n);if(bn===l)return n;if(r[e])return r[e];o=o||0;var i,s=0;return n&&n.isCharList&&(s=1,m(n,"isCharList")),i=yn===l?new I(Ot,e,n,yn,o):On===l?new I(Ot,e,n,On,o):Fn&l?new I(Ot,e,n,qn,o):Cn&l?new I(Ot,e,n,s?Sn:Cn,o):n,r[e]=i}function E(e,n,o,r,l,i,s){if(s[e])return s[e];var a,p,f,m,h,g,d,k=0,$=0,y=1,b=Cn&t(r)?!0:!!r;if(a=u(n),f=a.length,1===f)d=_(e,O(a[0],o,i,r),0,s);else if(f>1){for(m=(f>>>1)+1,p=0;m>=p;p++)h=t(a[p]),g=t(a[f-1-p]),(On!==h||On!==g)&&(y=0),_n&h||_n&g?k=1:(qn&h||qn&g||c(a[p],o)||c(a[f-1-p],o))&&($=1);if(y&&!b)a=a.slice().join(""),a.isCharList=1,d=_(e,a,0,s);else if(!b||k||$)if(k||$){for(p=0;f>p;p++)a[p]=_n&t(a[p])?E(e+"_"+p,a[p],o,r,l,i,s):_(e+"_"+p,O(a[p],o,i),p,s);d=f>1?new I(St,e,a):a[0]}else{for(a=a.sort(An),p=0;f>p;p++)a[p]=_(e+"_"+p,O(a[p],o,i),p,s);d=f>1?new I(St,e,a):a[0]}else d=_(e,S(a,r,l),0,s)}return s[e]=d}function L(e,n,o,l,i){if(i[e])return i[e];var s=a(n),u=[],p=[];return r(function(n){var r,a;r=_(e+"_0_"+n,O(s[n][0],o,l),n,i),a=s[n].length>1?qn!==r.ptype||Cn!==t(s[n][1])||c(s[n][1],o)?_(e+"_1_"+n,O(s[n][1],o,l),n,i):s[n][1]:r,u.push(r),p.push(a)},0,s.length-1),i[e]=new I(_t,e,[u,p])}function q(e,t){var n=a(e.tokens.slice());r(function(e){var o=n[e][0],r=n[e].length>1?n[e][1]:n[e][0],l=n[e].length>2?n[e][2]:"";null===r?(t.line=t.line||[],t.line.push(o)):(t.block=t.block||[],t.block.push([o,r,l]))},0,n.length-1)}function M(e,t,o,r){var l=e.meta||o,i=!(!e.caseInsesitive&&!e.ci),s=n(t,function(e){return{word:e,meta:l,ci:i}});return r.autocomplete=(r.autocomplete||[]).concat(s),s}function T(e){e.Lex||(e.Lex={}),e.Syntax||(e.Syntax={});var n,o,r,l,s,u,a,c,p,f,h,g=e.Lex,d=e.Syntax,k=[g,d],$=k.length;for(h=0;$>h;){f=k[h++];for(r in f)f[sn](r)&&(n=r.split(":"),o=n[1]&&Dn(n[1]).length?Dn(n[1]):null,n=Dn(n[0]),n.length||(n=r,o=null),n!==r&&(f[n]=f[r],m(f,r),o&&(o=o[hn](),l=f[n],s=t(l),En===s?f[n].type||(f[n].type=o):(f[n]={type:o},"error"===o?(f[n].type="action",f[n].error=l):"nop"===o?(f[n].type="action",f[n].nop=!0):"group"===o?(f[n].type="sequence",f[n].tokens=l):"action"===o&&Cn===s?f[n][l]=!0:f[n].tokens=l))),g===f&&(Rn&t(f[n])&&(f[n]={type:"simple",tokens:f[n]}),l=f[n],l.type&&(c=l.type=l.type[hn](),"line-block"===c?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===c?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===c&&(l.type="block",l.multiline=!0,l.escape="\\"))))}f=g;for(n in f)if(f[sn](n))for(l=f[n];l.extend;)u=l.extend,m(l,"extend"),a=g[u],a&&(Rn&t(a)&&(a=g[u]={type:"simple",tokens:a}),l=i(a,l));f=g;for(n in f)f[sn](n)&&(l=f[n],l.type?(c=l.type=l.type[hn](),"line-block"===c?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===c?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===c&&(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"],m(l,"escaped-line-block")):l["escaped-block"]?(l.type="block",l.multiline=!0,l.escape||(l.escape="\\"),l.tokens=l["escaped-block"],m(l,"escaped-block")):l["line-block"]?(l.type="block",l.multiline=!1,l.escape=!1,l.tokens=l["line-block"],m(l,"line-block")):l.comment?(l.type="comment",l.escape=!1,l.tokens=l.comment,m(l,"comment")):l.block?(l.type="block",l.tokens=l.block,m(l,"block")):l.simple?(l.type="simple",l.tokens=l.simple,m(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"]],m(l,"error")):l[sn]("context")?(l.type="action",l.action=[l.context?"context-start":"context-end",l.context,!!l["in-context"]],m(l,"context")):l.indent?(l.type="action",l.action=["indent",l.indent,!!l["in-context"]],m(l,"indent")):l.outdent?(l.type="action",l.action=["outdent",l.outdent,!!l["in-context"]],m(l,"outdent")):l.unique?(l.type="action",l.action=["unique",Cn&t(l.unique)?["_DEFAULT_",l.unique]:l.unique,!!l["in-context"]],m(l,"unique")):l.push?(l.type="action",l.action=["push",l.push,!!l["in-context"]],m(l,"push")):l[sn]("pop")?(l.type="action",l.action=["pop",l.pop,!!l["in-context"]],m(l,"pop")):l.type="simple","action"===l.type?l.ci=!(!l.caseInsesitive&&!l.ci):"block"===l.type||"comment"===l.type?(l.multiline=l[sn]("multiline")?!!l.multiline:!0,Cn&t(l.escape)||(l.escape=!1)):"simple"===l.type&&(l.meta=l.autocomplete&&Cn&t(l.meta)?l.meta:null,l.ci=!(!l.caseInsesitive&&!l.ci)));f=d;for(n in f)f[sn](n)&&(l=f[n],En!==t(l)||l.type?l.type&&(c=l.type=l.type[hn](),"group"===c&&l.match?(s=t(l.match),Cn&s?(p=l.match[hn](),"alternation"===p||"either"===p?(l.type="alternation",m(l,"match")):"sequence"===p||"all"===p?(l.type="sequence",m(l,"match")):"zeroorone"===p?(l.type="zeroOrOne",m(l,"match")):"zeroormore"===p?(l.type="zeroOrMore",m(l,"match")):"oneormore"===p?(l.type="oneOrMore",m(l,"match")):(l.type="sequence",m(l,"match"))):_n&s&&(l.type="repeat",l.repeat=l.match,m(l,"match"))):"either"===c?l.type="alternation":"all"===c?l.type="sequence":"lookahead"===c&&(l.type="positiveLookahead")):l.ngram||l["n-gram"]?(l.type="ngram",l.tokens=l.ngram||l["n-gram"],l["n-gram"]?m(l,"n-gram"):m(l,"ngram")):l.sequence||l.all?(l.type="sequence",l.tokens=l.sequence||l.all,l.all?m(l,"all"):m(l,"sequence")):l.alternation||l.either?(l.type="alternation",l.tokens=l.alternation||l.either,l.either?m(l,"either"):m(l,"alternation")):l.zeroOrOne?(l.type="zeroOrOne",l.tokens=l.zeroOrOne,m(l,"zeroOrOne")):l.zeroOrMore?(l.type="zeroOrMore",l.tokens=l.zeroOrMore,m(l,"zeroOrMore")):l.oneOrMore?(l.type="oneOrMore",l.tokens=l.oneOrMore,m(l,"oneOrMore")):l.positiveLookahead||l.lookahead?(l.type="positiveLookahead",l.tokens=l.positiveLookahead||l.lookahead,l.lookahead?m(l,"lookahead"):m(l,"positiveLookahead")):l.negativeLookahead&&(l.type="negativeLookahead",l.tokens=l.negativeLookahead,m(l,"negativeLookahead")));return e}function P(e,n,o){if(o=o||{},n=n||[],!e||!e.length)return n;var r,l,i,s,u,a,c;for(r=0,l=e.length;l>r;r++)if(u=e[r])if(Rt===u.type)if(u.autocompletions)for(i=0,s=u.autocompletions.length;s>i;i++)c=u.autocompletions[i],o[sn]("w_"+c.word)||(n.push(c),o["w_"+c.word]=1);else Cn===u.token.ptype&&Cn&t(u.token.pattern)&&u.token.pattern.length>1&&(o[sn]("w_"+u.token.pattern)||(n.push({word:""+u.token.pattern,meta:u.name,ci:!!u.ci}),o["w_"+u.token.pattern]=1));else if(Dt===u.type)P(u.token,n,o);else if(Ht&u.type){i=0,s=u.token.length;do P([a=u.token[i++]],n,o);while(s>i&&(zt&a.type&&1>a.min||Et===a.type))}else zt&u.type&&P([u.token[0]],n,o);return n}function F(e,n,o,r){for(var l;Cn&t(l=n[e]||o[e]);)e=l;return r?e:n[e]||o[e]||e}function R(e,t){return e.length>1?r(t?function(t,n){var o=n[n.length-1],r=e[t];o===r||n.push(r)}:function(t,n){var o=n[n.length-1],r=e[t];Zn.test(r)&&Zn.test(o)&&o===r||n.push(r)},1,e.length-1,[e[0]]):e}function j(e,o,r){var i,s,u,a,c,p,f,m,h,g,d,k,$,y,b,C=!1;if(b=e.modifier?e.modifier:null,m=new String(Dn(e)),m.pos=0,1===m.length)k=""+e,o[k]||r[k]||(o[k]={type:"simple",tokens:e}),e=k;else{for(i=[],s=[],u="",$=[];m.posc[0]&&(c[0]=0),2>c.length?c.push(c[0]):c[1]=c[1].length?parseInt(c[1],10)||dn:dn,0>c[1]&&(c[1]=0),d=s[s.length-1],k=""+d+["{",c[0],",",isFinite(c[1])?c[1]:"","}"].join(""),r[k]||(r[k]={type:"repeat",repeat:[c[0],c[1]],tokens:[d]}),s[s.length-1]=k):u+=h;else{if("}"===h){u+=h;continue}"&"===h||"!"===h?u+=h:"|"===h?(C=!1,s=R(s),s.length>1?(k=""+s.join(" "),r[k]||(r[k]={type:"sequence",tokens:s}),i.push(k)):s.length?i.push(s[0]):u+=h,s=[]):"("===h?($.push([s,i,u]),s=[],i=[],u=""):")"===h&&(s=R(s),s.length>1?(k=""+s.join(" "),r[k]||(r[k]={type:"sequence",tokens:s}),i.push(k)):s.length&&i.push(s[0]),s=[],i=R(i,1),i.length>1?(k=""+i.join(" | "),r[k]||(r[k]={type:"alternation",tokens:i})):i.length&&(k=i[0]),i=[],y=$.pop(),s=y[0],i=y[1],u=y[2],d=k,k="("+d+")",r[k]||(r[k]=l(F(d,o,r))),s.push(k))}}else u+=h;u.length&&(C?(s.length&&(d=s[s.length-1],k=d+"."+u,p=o[k]||r[k],p||(f=F(d,o,r),r[k]=Cn&t(f)?new String(f):l(f),r[k].modifier=u),s[s.length-1]=k),C=!1):"0"===u?(o[nn]||(o[nn]={type:"simple",tokens:0}),s.push(nn)):"^^"===u?(o[Jt]||(o[Jt]={type:"simple",tokens:Lt}),s.push(Jt)):"^^1"===u?(o[Qt]||(o[Qt]={type:"simple",tokens:qt}),s.push(Qt)):"^"===u?(o[Xt]||(o[Xt]={type:"simple",tokens:Tt}),s.push(Xt)):"$"===u?(o[en]||(o[en]={type:"simple",tokens:Mt}),s.push(en)):(o[u]||r[u]||(o[u]={type:"simple",tokens:u}),s.push(u))),u="",s=R(s),s.length>1?(k=""+s.join(" "),r[k]||(r[k]={type:"sequence",tokens:s}),i.push(k)):s.length&&i.push(s[0]),s=[],i=R(i,1),i.length>1?(k=""+i.join(" | "),r[k]||(r[k]={type:"alternation",tokens:i}),e=k):i.length&&(e=i[0]),i=[]}return b&&(o[e]||r[e])&&((o[e]||r[e]).modifier=b),e}function N(e,l,i,s,c,p,f,m,h,g,d){var k,$,y,b,x,v,w,C=null,O=null,S=null;if(Lt===e||qt===e||Tt===e||Mt===e)return new G(e,Lt===e?Jt:qt===e?$T_FBNL$:Tt===e?Xt:en,e,O);if(!1===e||0===e)return new G(Pt,nn,0,O);if(""===e)return new G(Ft,on,"",O);if(null===e)return new G(Rt,tn,yn,O,S);if(_n&t(e)&&(y=e,e="NGRAM_"+y.join("_"),s[e]||(s[e]={type:"ngram",tokens:y})),e=""+e,m[e])return m[e];if(x=F(e,i,s),Cn&t(x)&&(x=j(x,i,s),x=i[x]||s[x]||null),!x)return null;if(k=x.type?Vt[x.type[hn]().replace(In,"")]||Rt:Rt,O=x.msg||null,S=x.modifier||null,$=x.tokens,Rt&k){if(Lt===$||qt===$||Tt===$||Mt===$||!1===$||0===$)return C=new G($||Pt,e,$||0,O),m[e]=C,C;if(""===$)return C=new G(Ft,e,"",O),m[e]=C,C;if(null===$)return C=new G(Rt,e,yn,O,S),m[e]=C,C;if(!$)return null}if(Et&k)x[sn]("action")?"nop"===x.action[0]?x.action[0]=dt:"error"===x.action[0]?x.action[0]=kt:"context-start"===x.action[0]?x.action[0]=yt:"context-end"===x.action[0]?x.action[0]=bt:"push"===x.action[0]?x.action[0]=xt:"pop"===x.action[0]?x.action[0]=vt:"unique"===x.action[0]?x.action[0]=$t:"indent"===x.action[0]?x.action[0]=wt:"outdent"===x.action[0]&&(x.action[0]=Ct):x[sn]("nop")?x.action=[dt,x.nop,!!x["in-context"]]:x[sn]("error")?x.action=[kt,x.error,!!x["in-context"]]:x[sn]("context")?x.action=[x.context?yt:bt,x.context,!!x["in-context"]]:x[sn]("context-start")?x.action=[yt,x["context-start"],!!x["in-context"]]:x[sn]("context-end")?x.action=[bt,x["context-end"],!!x["in-context"]]:x[sn]("push")?x.action=[xt,x.push,!!x["in-context"]]:x[sn]("pop")?x.action=[vt,x.pop,!!x["in-context"]]:x[sn]("unique")?x.action=[$t,Cn&t(x.unique)?["_DEFAULT_",x.unique]:x.unique,!!x["in-context"]]:x[sn]("indent")?x.action=[wt,x.indent,!!x["in-context"]]:x[sn]("outdent")&&(x.action=[Ct,x.outdent,!!x["in-context"]]),x.nop&&(x.action[0]=dt),C=new G(Et,e,x.action.slice(),O,S),C.ci=!!x.caseInsensitive||x.ci,m[e]=C;else if($=u($),Rt&k){if(w=x.autocomplete?M(x,u(Pn&t(x.autocomplete)?x.autocomplete:x.tokens),e,d):null,v="undefined"!=typeof x.combine?x.combine:_n&t(x.tokens)?!0:!1,C=new G(Rt,e,E(e,$.slice(),l,v,!(!x.caseInsensitive&&!x.ci),p,f),O,S,null,w),m[e]=C,null!=x.except){var _,T,P=u(x.except),R=P.length,D=[];for(_=0;R>_;_++)P[_]&&(T=N(P[_],l,i,s,c,p,f,m,h,g,d),T&&D.push(T));D.length&&(C.except=D)}}else jt&k?(Nt===k&&q(x,g),C=new G(k,e,L(e,$.slice(),l,p,f),O),C.mline=x[sn]("multiline")?!!x.multiline:!0,C.esc=x[sn]("escape")?x.escape:!1,C.inter=!!c[e+".inside"],Nt===k&&x.interleave&&h.push(Y(C)),S&&(C.modifier=S),m[e]=C):Kt&k&&(Zt===k?(b=a($),C=n(b,function(t,n){return new G(Zt,e+"_NGRAM_"+n,null,O,S)}),m[e]=C,r(function(e){C[e].token=u(o(b[e],function(e,t){return e.concat(N(t,l,i,s,c,p,f,m,h,g,d))},[]))},0,b.length-1)):(Yt===k||Wt===k?C=new G(k,e,null,O,S):zt&k&&_n&t(x.repeat)?(C=new G(zt,e,null,O,S),C.min=x.repeat[0],C.max=x.repeat[1]):It===k?(C=new G(It,e,null,O,S),C.min=0,C.max=1):Bt===k?(C=new G(Bt,e,null,O,S),C.min=0,C.max=dn):Gt===k?(C=new G(Gt,e,null,O,S),C.min=1,C.max=dn):C=Dt===k?new G(Dt,e,null,O,S):new G(At,e,null,O,S),m[e]=C,C.token=u(o($,function(e,t){return e.concat(N(t,l,i,s,c,p,f,m,h,g,d))},[]))));return m[e]}function D(e,t){var n,o,r=e.Style,l=e.Lex,i=e.Syntax,s=[],u={};for(n in r)r[sn](n)&&(o=l[n]||i[n],!o||"block"!=o.type&&"comment"!==o.type||(t&&(r[n+".inside"]||r[n])?(n=r[n+".inside"]||r[n],u[sn](n)||(s.push(n),u[n]=1)):t||u[sn](n)||(s.push(n),u[n]=1)));return s}function A(e){var n={};return e.Lex=e.Lex||{},e.Syntax=e.Syntax||{},e=T(e),e.Parser&&e.Parser.length&&r(function o(l,i){var s,u,a,c=i[l];n[c]||(_n&t(c)&&(s=c,c="NGRAM_"+s.join("_"),e.Syntax[c]||(e.Syntax[c]={type:"ngram",tokens:s})),u=F(c,e.Lex,e.Syntax),Cn&t(u)&&(u=j(u,e.Lex,e.Syntax),u=e.Lex[u]||e.Syntax[u]||null),u&&(n[c]=u,a=u.type?Vt[u.type[hn]().replace(In,"")]||Rt:Rt,Kt&a&&r(o,0,u.tokens.length-1,u.tokens)))},0,e.Parser.length-1,e.Parser),e}function z(e){var n,r,i,s,u,a,c,p,f,m,h,g,d;return e.__parsed?e:(n=e.RegExpID||null,i=e.Extra?l(e.Extra):{},s=e.Style?l(e.Style):{},u=null,a=e.Lex?l(e.Lex):{},c=e.Syntax?l(e.Syntax):{},p={},f={},m={},g={},d={},h=[],r=e.Parser?l(e.Parser):[],e=T({Style:s,Fold:u,Lex:a,Syntax:c,$parser:null,$interleaved:null,$comments:null,$autocomplete:null,$extra:i,__parsed:0}),e.$parser=o(r,function(e,o){var r=N(o,n,a,c,s,p,f,m,h,g,d)||null;return r&&(_n&t(r)?e=e.concat(r):e.push(r)),e},[]),e.$interleaved=h&&h.length?h:null,e.$comments=g,e.$autocomplete=d&&d.autocomplete&&d.autocomplete.length?d.autocomplete:null,e.__parsed=1,e)}function I(e,n,o,r,l){var i,s,u=this;i=u.type=e,u.name=n,u.pattern=o,s=u.ptype=r||Cn,u.key=l||0,St===i?u.key=!1!==l:_t===i?u.pattern[0]=new I(St,n+"_Start",o[0],null,!1):yn===s?u.pattern=null:qn===s&&(u.pattern=qn&t(o)?[o,0]:[o[0],o[1]||0])}function B(e,n,o,r){var l,i,s,u,a,c,p,f,m,h,g,d=e,k=d.type,$=d.pattern,y=d.key;if(_t===k){if(l=d.name,s=$[0],u=$[1],c=B(s,n,o,r))return a=u[c[0]],f=t(a),m=s.pattern[c[0]].ptype,qn===m&&Tn&f&&(p=bn&f?c[1][a+1]:C(a,c[1]),a=new I(Ot,l+"_End",p,p.length>1?Cn:On)),a}else if(St===k){for(h=0,g=$.length;g>h;h++)if(p=B($[h],n,o,r))return y?[h,p[1]]:p}else{if(i=d.ptype,yn===i)return!1!==o&&n.end(),[y,""];if(qn===i){if(p=n.slice(n.pos).match($[0]),p&&0===p.index)return!1!==o&&n.mov(p[$[1]||0].length),[y,$[1]>0?p[$[1]]:p]}else if(Sn===i){if(!0===r){p=-1;var b,x;for(g=$.length-1;g>=0;g--)b=n.indexOf($[gn](g),n.pos),b>-1&&(-1===p||p>b)&&(p=b,x=$[gn](g));if(p>-1)return!1!==o&&(n.pos=p+1),[y,x]}else if(p=n[gn](n.pos)||null,p&&-1<$.indexOf(p))return!1!==o&&n.mov(1),[y,p]}else if(On===i){if(!0===r){if(p=n.indexOf($,n.pos),p>-1)return!1!==o&&(n.pos=p+1),[y,$]}else if(p=n[gn](n.pos)||null,$===p)return!1!==o&&n.mov(1),[y,p]}else if(Cn===i)if(g=$.length,!0===r){if(p=n.indexOf($,n.pos),p>-1)return!1!==o&&(n.pos=p+g),[y,$]}else if($===n.substr(n.pos,g))return!1!==o&&n.mov(g),[y,$]}return!1}function G(e,t,n,o,r,l,i){var s=this;s.type=e,s.name=t,s.token=n,s.modifier=r||null,s.except=l||null,s.autocompletions=i||null,s.pos=null,s.msg=o||null,s.$msg=null,s.status=0,s.ci=!1,s.mline=!0,s.esc=!1,s.inter=!1,s.found=0,s.min=0,s.max=1,s.$id=null}function U(){var e=this;e.T=0,e.id=null,e.type=null,e.match=null,e.str="",e.pos=null,e.block=null}function Y(e,t,n,o){var r=new G(e.type,e.name,e.token,e.msg,e.modifier,e.except,e.autocompletions);return r.ci=e.ci,r.mline=e.mline,r.esc=e.esc,r.inter=e.inter,r.found=e.found,r.min=e.min,r.max=e.max,t&&(r.status|=pt),n&&(r.modifier=n),o&&(r.$id=o),r}function W(e){var t=e.name;return e.$msg?e.$msg:e.status&pt?'Token "'+t+'" Expected':'Syntax Error: "'+t+'"'}function Z(e,t,n,o,r,l,i){e.err[t+"_"+n+"_"+o+"_"+r+"_"+(l?l.name:"ERROR")]=[t,n,o,r,i||W(l)]}function H(e,t,n,o){if(!e)return!1;var r=e.type,l=Kt&r?Q:jt&r?J:Et&r?K:V;return l(e,t,n,o)}function K(e,n,o,r){var l,i,s,u,a,c,p,f,m,h,g,d,k,$,y,b,x=e,v=x.token||null,w=x.ci,O=x.name,S=!(o.status&at);if(x.status=0,x.$msg=null,S||!v||!r||!r.pos)return!0;if(b=!!(jt&r.T),dt===v[0]||b&&!r.block)return!0;if(l=v[0],i=v[1],k=v[2],a=x.msg,c=o.queu,p=o.symb,f=o.ctx,b?(y=r.block.match||r.block.str,m=r.block.pos[0][0],h=r.block.pos[0][1],g=r.block.pos[0][2],d=r.block.pos[0][3]):(y=r.match||r.str,m=r.pos[0],h=r.pos[1],g=r.pos[2],d=r.pos[3]),kt===l)return!a&&Cn&t(i)&&(a=i),x.$msg=a?C(a,y,!0):'Error "'+O+'"',Z(o,m,h,g,d,x,W(x)),x.status|=ft,!1;if(bt===l)f.length&&f.shift();else if(yt===l)f.unshift({symb:{},queu:[]});else if(vt===l){if(k){if(!f.length)return!0;c=f[0].queu}if(i){if(i=C(i,y),w&&(i=i[hn]()),!c.length||i!==c[0][0])return c.length?(x.$msg=a?C(a,[c[0][0],i],!0):'Tokens do not match "'+c[0][0]+'","'+i+'"',$=W(x),Z(o,c[0][1],c[0][2],c[0][3],c[0][4],x,$),Z(o,m,h,g,d,x,$),c.shift()):(x.$msg=a?C(a,["",i],!0):'Token does not match "'+i+'"',$=W(x),Z(o,m,h,g,d,x,$)),x.status|=ft,!1;c.shift()}else c.shift()}else if(xt===l&&i){if(k){if(!f.length)return!0;c=f[0].queu}i=C(i,y),w&&(i=i[hn]()),x.$msg=a?C(a,i,!0):'Token does not match "'+i+'"',c.unshift([i,m,h,g,d,W(x)])}else if($t===l){if(k){if(!f.length)return!0;p=f[0].symb}if(s=i[1],u=i[0],s=C(s,y,!0),w&&(s=s[hn]()),p[sn](u)||(p[u]={}),p[u][sn](s))return x.$msg=a?C(a,s,!0):'Duplicate "'+s+'"',$=W(x),Z(o,p[u][s][0],p[u][s][1],p[u][s][2],p[u][s][3],x,$),Z(o,m,h,g,d,x,$),x.status|=ft,!1;p[u][s]=[m,h,g,d]}return!0}function V(e,t,n,o,r){var l,i=e,s=i.token,u=i.modifier,a=i.type,c=i.name,p=i.except,f=n.line,m=t.pos,h=null,g=!1;if(i.status&=ht,i.$msg=r?null:i.msg||null,p)for(var d=0,k=p.length;k>d;d++)if(l=p[d],i!==l&&Rt===l.type&&V(l,t,n,o,1))return t.bck(m),!1;return Lt===a?g=0===n.line:qt===a?g=n.bline+1===n.line:Tt===a?g=t.sol():Mt===a?(t.spc(),t.eol()?g=c:t.bck(m)):Pt===a?(i.status=0,g=!0):Ft===a?(i.status&pt&&t.spc()&&!t.eol()?(t.bck(m),i.status|=ft):g=!0,i.status&=mt):yn===s?(t.end(),g=u||c):(h=B(s,t))&&(h=h[1],g=u||c),r?g:(!1!==g&&(o.T=a,o.id=c,o.type=g,o.str=t.sel(m,t.pos),o.match=h,o.pos=[f,m,f,t.pos]),!g&&i.status&&i.$msg&&(i.$msg=C(i.$msg,c,!0)),g)}function J(e,t,n,o){var r,l,i,s,u,a,c,f,m,h,g,d,k,$,y,b,x,v,w,O,S,_=e,E=_.name,L=_.type,q=_.modifier,M=_.token,T=_.mline,P=_.inter,F=P?E+".inside":E,R=_.esc,j=!!R,N="",D="",A="",z="",I=_.$id||E,G=n.stack;if(_.status&=ht,_.$msg=_.msg||null,w=n.line,O=t.pos,Nt===L&&(_.status&=mt),y=_.status&pt,i=0,s=0,n.block&&n.block.name===E?(s=1,i=1,$=F,r=n.block.end,f=n.block.sp,h=n.block.ip,m=n.block.ep,N=n.block.s,D=n.block.i):!n.block&&(r=B(M,t))&&(s=1,$=E,b=t.pos,f=[w,O],h=[[w,b],[w,b]],m=[w,b],N=t.sel(O,b),D="",z="",n.block={name:E,end:r,sp:f,ip:h,ep:m,s:N,i:D,e:z}),s){if(v=G.length,l=yn===r.type,P){if(l&&i&&t.sol())return _.status&=mt,n.block=null,!1;if(!i)return b=t.pos,o.T=L,o.id=E,o.type=q||$,o.str=t.sel(O,b),o.match=null,o.pos=[w,O,w,b],p(G,v,Y(_,y,0,I)),q||$}if(b=t.pos,u=B(r,t),c=T,a=0,u)$=l?F:E,z=t.sel(b,t.pos);else if(x=t.pos,d=!1,j||Sn!==r.ptype&&On!==r.ptype&&Cn!==r.ptype)for(;!t.eol();){if(b=t.pos,!d&&B(r,t)){P&&t.pos>b&&b>x?($=F,t.bck(b),a=1):($=E,u=1),z=t.sel(b,t.pos);break}k=t.nxt(1),A+=k,d=j&&!d&&R===k,b=t.pos}else(S=B(r,t,!0,!0))?(P&&t.pos>b+S[1].length?($=F,t.mov(-S[1].length),a=1):($=E,u=1),z=t.sel(b,t.pos)):(t.end(),$=F,a=1,A=t.sel(b,t.pos));return c=T||j&&d,D+=A,h[1]=[w,b],m=[w,t.pos],u||!c&&!a?n.block=null:(n.block.ip=h,n.block.ep=m,n.block.i=D,n.block.e=z,p(G,v,Y(_,y,0,I))),o.T=L,o.id=E,o.type=q||$,o.str=t.sel(O,t.pos),o.match=null,o.pos=[w,O,m[0],m[1]],n.block||(g=N+D+z,o.block={str:g,match:[g,D,N,z],part:[g,N,D,z],pos:[[f[0],f[1],m[0],m[1]],[f[0],f[1],h[0][0],h[0][1]],[h[0][0],h[0][1],h[1][0],h[1][1]],[h[1][0],h[1][1],m[0],m[1]]]}),q||$}return _.status&&_.$msg&&(_.$msg=C(_.$msg,E,!0)),!1}function Q(e,t,n,o){var r,l,i,s,u,a,c,f,m,g,d,k,$,y,b,x=e,v=x.type,w=(x.name,x.token),C=w.length,O=x.modifier;if(x.status&=ht,x.$msg=x.msg||null,k=n.stack,f=t.pos,m=k.length,a=0,c=0,y=x.$id||h(),Dt===v){for(x.status|=pt,$=[],g=0;C>g;g++){if(r=Y(w[g],1,O,y),l=H(r,t,n,o),r.status&pt&&(a++,$.push(W(r))),!1!==l)return l;r.status&ft&&(c++,t.pos>f&&t.bck(f),k.length>m&&(k.length=m))}return a>0?x.status|=pt:x.status&=mt,C===c&&a>0?x.status|=ft:x.status&=ht,x.status&&!x.$msg&&$.length&&(x.$msg=$.join(" | ")),!1}if(Ht&v){b=!!(v&At),b?x.status|=pt:x.status&=mt,d=0;do r=Y(w[d++],b,O,y),l=H(r,t,n,o);while(C>d&&!1===l&&!(r.status&pt));if(!1!==l){if(!0!==l||Pt!==r.type)for(g=C-1;g>=d;g--)p(k,m+C-g-1,Y(w[g],1,O,y));return l}return r.status&ft?(b?x.status|=ft:x.status&=ht,t.pos>f&&t.bck(f),k.length>m&&(k.length=m)):b&&r.status&pt&&(x.status|=ft),x.status&&!x.$msg&&(x.$msg=W(r)),!1}if(Yt===v)return x.status=0,!1;if(Wt===v)return x.status=0,!1;for(i=x.found,s=x.min,u=x.max,x.status=0,$=[],g=0;C>g;g++){if(r=Y(w[g],1,O,y),l=H(r,t,n,o),!1!==l){if(++i,u>=i)return x.found=i,p(k,m,Y(x,0,0,y)),x.found=0,l;break}r.status&pt&&(a++,$.push(W(r))),r.status&ft&&(t.pos>f&&t.bck(f),k.length>m&&(k.length=m))}return s>i&&(x.status|=pt),(i>u||s>i&&a>0)&&(x.status|=ft),x.status&&!x.$msg&&$.length&&(x.$msg=$.join(" | ")),!1}function X(e,t){var n=this;n.id=e?g("state"):"state",t instanceof X?(n.line=t.line,n.bline=t.bline,n.status=t.status,n.stack=t.stack.slice(),n.token=t.token,n.block=t.block,n.status&at?(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=[],n.token=null,n.block=null,n.status&at?(n.queu=[],n.symb={},n.ctx=[],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 et(e){e.id=null,e.line=null,e.bline=null,e.status=null,e.stack=null,e.token=null,e.block=null,e.queu=null,e.symb=null,e.ctx=null,e.err=null}function tt(e,t,n){var o=new String(e);return o.start=t||0,o.pos=n||0,o.sol=function(){return 0===o.pos},o.eol=function(){return o.pos>=o.length},o.end=function(){return o.pos=o.length,o},o.mov=function(e){return o.pos=0>e?fn(0,o.pos+e):mn(o.length,o.pos+e),o},o.bck=function(e){return o.pos=fn(0,e),o},o.sft=function(){return o.start=o.pos,o},o.nxt=function(e,t){var n,r,l="";if(!0===e){for(t=t||tt.$NONSPC$;o.poss||s>=t)return i+(t-l);i+=s-l,i+=n-i%n,l=s+1}}function ot(e,o){return Pn&t(e)&&(e=v("\\b("+n(u(e).sort(An),x).join("|")+")\\b")),!1===o?function(t){return!t||!e.test(t)}:function(t){return!!t&&e.test(t)}}function rt(e,t,n){for(;;){n.lastIndex=e.col;var o=n.exec(e.text);if(!o){if(e.next()){e.text=e.line(e.row);continue}return}{if(t(e.token(e.row,o.index+1)))return e.col=o.index+o[0].length,o;e.col=o.index+1}}}function lt(e,t,n,o,r,l){for(var i,s,u;;){if(i=e.text.indexOf(r,e.col),-1===i){if(e.next()){e.text=e.line(e.row);continue}return}if(t(e.token(e.row,i+1)))return s=e.text.lastIndexOf(l,i),u=s>-1&&!tt.$NOTEMPTY$.test(e.text.slice(s+1,i)),e.col=i+1,u?"autoclosed":"regular";e.col=i+1}}function it(e,t,n){var o=n.text,r=n.meta,l=n.start,i=n.end,s=t.list.maxlen-o.length-r.length+5;e.innerHTML=['',b(o.slice(0,l)),'',b(o.slice(l,i)),"",b(o.slice(i)),"",new Array(1+s).join(" "),'',b(r),""," "].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 st(e,t,n){function o(e,t){return{startState:function(){return new X},copyState:function(e){return new X(0,e)},token:function(e,t){var n=tt(e.string,e.start,e.pos),r=o.$parser.token(n,t).type;return e.pos=n.pos,r},indent:function(r,l,i){return o.$parser.indent(r,l,i,e,t,n)},lineComment:o.$parser.LC,blockCommentStart:o.$parser.BCS,blockCommentEnd:o.$parser.BCE,blockCommentContinue:o.$parser.BCC,blockCommentLead:o.$parser.BCL,electricInput:o.$parser.$grammar.$extra.electricInput||!1,electricChars:o.$parser.$grammar.$extra.electricChars||!1,fold:o.foldType}}return n=n||Vn,o.$id=g("codemirror_grammar_mode"),o.$parser=new eo.Parser(z(e),t),o.supportGrammarAnnotations=!1,o.validator=function r(e,t){return o.supportGrammarAnnotations&&o.$parser&&e&&e.length?o.$parser.validate(e,r.options||t||{},n):[]},o.linter=o.validator,o.supportCodeFolding=!0,o.foldType="fold_"+o.$id,o.folder=function(e,t){var r;return o.supportCodeFolding&&o.$parser&&(r=o.$parser.fold(e,t,n))?{from:n.Pos(r[0],r[1]),to:n.Pos(r[2],r[3])}:void 0},o.supportAutoCompletion=!0,o.autocompleter=function l(e,t){return o.supportAutoCompletion&&o.$parser?(t=l.options||t||{},t[sn]("renderer")||(t.renderer=l.renderer||it),o.$parser.autocomplete(e,t,n)):void 0},o.autocompleter.renderer=it,o.autocomplete=o.autocompleter,o.dispose=function(){o.$parser&&o.$parser.dispose(),o.$parser=o.validator=o.linter=o.autocompleter=o.autocomplete=o.folder=null},o}var ut=1,at=2,ct=32,pt=4,ft=8,mt=~pt,ht=~ft,gt=pt|ft,dt=0,kt=4,$t=8,yt=16,bt=17,xt=32,vt=33,wt=128,Ct=129,Ot=2,St=4,_t=8,Et=4,Lt=8,qt=9,Mt=16,Tt=32,Pt=128,Ft=256,Rt=512,jt=1024,Nt=1025,Dt=2048,At=4096,zt=8192,It=8193,Bt=8194,Gt=8195,Ut=16384,Yt=Ut,Wt=16385,Zt=32768,Ht=At|Zt,Kt=Dt|At|zt|Ut|Zt,Vt={action:Et,simple:Rt,block:jt,comment:Nt,alternation:Dt,sequence:At,repeat:zt,zeroorone:It,zeroormore:Bt,oneormore:Gt,positivelookahead:Yt,negativelookahead:Wt,ngram:Zt},Jt="$|SOF|$",Qt="$|NONBLANK|$",Xt="$|SOL|$",en="$|EOL|$",tn="$|ENDLINE|$",nn="$|EMPTY|$",on="$|NONSPACE|$",rn=void 0,ln="prototype",sn="hasOwnProperty",un="propertyIsEnumerable",an=Object[ln],cn=an.toString,pn=Object.create,fn=Math.max,mn=Math.min,hn="toLowerCase",gn="charAt",dn=1/0,kn=4,$n=8,yn=16,bn=32,xn=33,vn=34,wn=64,Cn=128,On=129,Sn=130,_n=256,En=512,Ln=1024,qn=2048,Mn=4096,Tn=Cn|bn,Pn=Cn|_n,Fn=qn|_n,Rn=Cn|_n|qn,jn={"[object Number]":bn,"[object String]":Cn,"[object Array]":_n,"[object RegExp]":qn,"[object Date]":Mn,"[object Function]":Ln,"[object Object]":En},Nn=/^\s+|\s+$/g,Dn=String[ln].trim?function(e){return e.trim() -}:function(e){return e.replace(Nn,"")},An=function(e,t){return t.length-e.length},zn=/\r\n|\r|\n/g,In=/[\-_]/g,Bn=0,Gn=/([.*+?^${}()|[\]\/\\\-])/g,Un=/[&"'<>]/g,Yn=/^([.!&\[\]{}()*+?\/|'"]|\s)/,Wn="(\\s|\\W|$)",Zn=/[*+]$/;tt.$SPC$=/^[\s\u00a0]+/,tt.$NONSPC$=/[^\s\u00a0]/,tt.$NOTEMPTY$=/\S/,tt.$SPACE$=/^\s*/;var Hn=k({constructor:function(e,t,n){var o=this;o.$grammar=e,o.$DEF=t||null,o.$ERR=n||null,o.DEF=o.$DEF,o.ERR=o.$ERR,o.$folders=[]},$grammar:null,$folders:null,$n$:"name",$t$:"type",$v$:"token",$DEF:null,$ERR:null,DEF:null,ERR:null,dispose:function(){var e=this;return e.$grammar=null,e.$folders=null,e.$n$=e.$t$=e.$v$=null,e.$DEF=e.$ERR=e.DEF=e.ERR=null,e},token:function(e,t){var n,o,r,l,i,s,u,a,c,p,m,h,g,d,k,$=this,y=$.$grammar,b=y.Style,x=$.DEF,v=$.ERR,w={},C=$.$n$,O=$.$t$,S=$.$v$,_=y.$interleaved,E=y.$parser,L=E.length,q=_?_.length:0;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.stack,i=t.line,s=e.pos,m=!1,g=!0,h=!1,d=!1,k=t.block?t.block.name:rn,l.length&&Mt===l[l.length-1].type&&e.sol()&&l.pop(),(!l.length||Ft!==l[l.length-1].type&&k!==l[l.length-1].name)&&e.spc()&&(g=!1,d=!0),w[C]=null,w[O]=x,w[S]=null,g)for(r=new U,u=0;g&&(l.length||L>u)&&!e.eol();){if(c=e.pos,p=l.length,q&&!t.block){for(a=0;q>a;a++)if(n=_[a],m=H(n,e,t,r),!1!==m){g=!1;break}if(!g)break}if(!l.length&&u>=L)break;if(n=l.length?l.pop():E[u++],m=H(n,e,t,r),!1===m){if(n.status>){t.token=n,f(l,n.$id),e.nxt(!0)||(e.spc(),d=!0),h=!0,g=!1;break}}else{if(l.length&&Et===l[l.length-1].type)for(;l.length&&Et===l[l.length-1].type;)o=l.pop(),K(o,e,t,r),o.status&ft&&(t.$actionerr$=!0);else if(l.length>1&&e.eol()&&jt&l[l.length-1].type&&t.block&&t.block.name===l[l.length-1].name)for(a=l.length-2;a>=0&&Et===l[a].type;)o=l[a--],K(o,e,t,r),o.status&ft&&(t.$actionerr$=!0);if(!0!==m){g=!1;break}}}return g&&e.nxt(1),w[S]=e.cur(1),!1!==m?(m=b[m]||x,w[C]=n.name):h?(m=v,t.status&at&&Z(t,i,s,i,e.pos,n)):m=x,w[O]=m,t.$eol$=e.eol(),t.$blank$=t.$blank$&&(d||t.$eol$),w},autocompletion:function(e){var t,n,o,r=e.stack,l={},i=P([e.token],[],l);for(t=r.length-1;t>=0;t--)if(n=r[t],o=n.type,zt&o){if(i=P([n],i,l),0=a;++a)if(r=t.line(a),l=t.indentation(r),l>o)s=a,u=r.length;else if(e.test(r))break;return s?[p,i,s,u]:void 0}}},Delimited:function(e,t,n){return e&&t?(n=n||s,function(o){var r,l,i,s,u,a,c,p,f,m,h,g,d,k,$,y=o.row,b=o.col;for(r=o.line(y),i=b,s=0;;){var u=0>=i?-1:r.lastIndexOf(e,i-1);if(-1!==u){if(1===s&&b>u)return;if(n(a=o.token(y,u+1))){l=u+e.length;break}i=u-1}else{if(1===s)return;s=1,i=r.length}}c=1,p=o.last();e:for(h=y;p>=h;++h)for(g=o.line(h),d=h===y?l:0;k=g.indexOf(e,d),$=g.indexOf(t,d),0>k&&(k=g.length),0>$&&($=g.length),d=mn(k,$),!(d>=g.length);){if(o.token(h,d+1)==a)if(d===k)++c;else if(!--c){f=h,m=d;break e}++d}return null==f||y===f&&m===l?void 0:[y,l,f,m]}):function(){}},MarkedUp:function(e,t,n,o,r){return e=e||s,t=t||"<",n=n||">",o=o||"/",r=r||v(x(t)+"("+x(o)+"?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)","g"),function(l){l.col=0,l.min=l.first(),l.max=l.last(),l.text=l.line(l.row);for(var i,s,u,a,c,p,f,m,h,g=l.row;;){if(i=rt(l,e,r,t,n,o),!i||l.row!==g||!(s=lt(l,e,r,t,n,o)))return;if(!i[1]&&"autoclosed"!==s)for(u=[l.row,l.col],c=i[2],a=null,p=[];;){if(f=rt(l,e,r,t,n,o),g=l.row,m=l.col-(f?f[0].length:0),!f||!(s=lt(l,e,r,t,n,o)))return;if("autoclosed"!==s)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[u[0],u[1],g,m]}else p.push(f[2])}}}}},Vn="undefined"!=typeof CodeMirror?CodeMirror:{Pass:{toString:function(){return"CodeMirror.Pass"}}},Jn=/[\w$]/,Qn=function(e,t){return t.score-e.score},Xn=k(Hn,{constructor:function to(e,n){var o,l=this,i=null;if(Hn.call(l,e,null,"error"),l.DEF=n||l.$DEF,l.ERR=e.Style.error||l.$ERR,l.LC=e.$comments.line?e.$comments.line[0]:null,l.BCS=e.$comments.block?e.$comments.block[0][0]:null,l.BCE=e.$comments.block?e.$comments.block[0][1]:null,l.BCC=l.BCL=e.$comments.block?e.$comments.block[0][2]:null,e.$comments.block&&e.$comments.block.length){o=to.Type("comment");for(var u=0,a=e.$comments.block.length;a>u;u++)l.$folders.push(to.Fold.Delimited(e.$comments.block[u][0],e.$comments.block[u][1],o))}e.Fold&&Cn&t(e.Fold)?i=e.Fold[hn]():e.$extra.fold&&(i=e.$extra.fold[hn]()),i&&(i=i.split("+"),r(function(t,n){var r=Dn(n[t]);if("brace"===r||"cstyle"===r){var i=D(e,1);o=i.length?to.Type(i,!1):s,l.$folders.push(to.Fold.Delimited("{","}",o)),l.$folders.push(to.Fold.Delimited("[","]",o))}else"indent"===r||"indentation"===r?l.$folders.push(to.Fold.Indented()):("markup"===r||"html"===r||"xml"===r)&&(l.$folders.push(to.Fold.Delimited("",to.Type(["comment","tag"],!1))),l.$folders.push(to.Fold.MarkedUp(to.Type("tag"),"<",">","/")))},0,i.length-1,i))},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,Hn[ln].dispose.call(e)},validate:function(e,t,n){if(!e||!e.length)return[];var o,r,l,i,s=this,u=[],a=s.parse(e,at);if(!a)return u;t=t||{},l=t[sn]("type")?t.type:"error",i=t[sn]("msg")?t.msg:"Syntax Error";for(o in a)a[sn](o)&&(r=a[o],u.push({message:r[4]||i,severity:l,from:n.Pos(r[0],r[1]),to:n.Pos(r[2],r[3])}));return u},autocomplete:function(e,t,n){var r,l,i,s,u,a,c,p,f,m,h,g=this,d=[],k=e.getCursor(),$=k.ch,y=$,b=$,x=b,v=0;if(g.$grammar.$autocomplete){for(t=t||{},u=t.word||Jn,r=e.getLine(k.line),p=t[sn]("prefixMatch")?!!t.prefixMatch:!0,f=t[sn]("inContext")?!!t.inContext:!1,c=t[sn]("caseInsensitiveMatch")?!!t.caseInsensitiveMatch:!1;y&&u.test(r[gn](y-1));)--y;if(!p)for(;x=s&&(n=t.meta,o=!!k.ci,d=c||o,d?(f=k[hn](),g=i):(f=k,g=l),(u=f.indexOf(g))>=0&&(!p||0===u)&&(r=d?k.indexOf(l):u,$+n.length>v&&(v=$+n.length),e.push({text:k,name:k,meta:n,start:0>r?u:r,end:(0>r?u:r)+l.length,match:l,displayText:k+" ["+n+"]",render:a,score:1e3-10*($-s)-5*(0>r?u+3:r)}))):(n=t.meta,$+n.length>v&&(v=$+n.length),e.push({text:k,name:k,meta:n,start:0,end:0,match:"",displayText:k+" ["+n+"]",render:a,score:m?1e3-10*$:h--})),e};f?(m=!1,d=o(g.autocompletion(e.getTokenAt(n.Pos(k.line,y),!0).state),w,d),d.length||(m=!0,d=o(g.$grammar.$autocomplete,w,d))):(m=!0,d=o(g.$grammar.$autocomplete,w,d)),d.length&&(d=d.sort(Qn)),d.maxlen=v}return{list:d,from:n.Pos(k.line,y),to:n.Pos(k.line,x)}},indent:function(e,t,n,o,r,l){return l.Pass},iterator:function(e,t){var n=e.getOption("tabSize");return{row:0,col:0,min:0,max:0,line:function(t){return e.getLine(t)},first:function(){return e.firstLine()},last:function(){return e.lastLine()},next:function(){var e=this;if(!(e.row>=e.max))return e.col=0,e.row++,!0},prev:function(){var e=this;if(!(e.row<=e.min))return e.col=0,e.row--,!0},indentation:function(e){return nt(e,null,n)},token:function(n,o){return e.getTokenTypeAt(t.Pos(n,o))}}},fold:function(e,t,n){var o,r,l,i=this,s=i.$folders,u=s.length;if(u)for(r=i.iterator(e,n),r.row=t.line,r.col=t.ch||0,o=0;u>o;o++)if(l=s[o](r))return l}});Xn.Type=ot,Xn.Fold=Kn;var eo=e.CodeMirrorGrammar={VERSION:"3.0.0",clone:l,extend:i,pre_process:A,parse:z,getMode:st,Parser:Xn};return e.CodeMirrorGrammar}); \ No newline at end of file +**/!function(e,t,n){"use strict";var o;"object"==typeof module&&module.exports?module.exports=n.call(e,{}):"undefined"!=typeof System&&"function"==typeof System.register&&"function"==typeof System["import"]?System.register(t,[],function(o){o(t,n.call(e,{}))}):"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified(t)?define(t,["require","exports","module"],function(){return n.call(e,{})}):t in e||(e[t]=o=n.call(e,{}))&&"function"==typeof define&&define.amd&&define(function(){return o})}(this,"CodeMirrorGrammar",function(e){"use strict";function t(e){var t=0;return null===e?t=yn:!0===e||!1===e||e instanceof Boolean?t=wn:rn===e?t=$n:(t=jn[cn.call(e)]||kn,t=bn===t||e instanceof Number?isNaN(e)?vn:isFinite(e)?bn:xn:Cn===t||e instanceof String?1===e.length?On:Cn:_n===t||e instanceof Array?_n:qn===t||e instanceof RegExp?qn:Mn===t||e instanceof Date?Mn:Ln===t||e instanceof Function?Ln:En===t?En:kn),t}function n(e,t,n,o){var r,l,i,s,u,a,c=e.length;if(arguments.length<4&&(o=c-1),0>o&&(o+=c),arguments.length<3&&(n=0),n>o)return[];if(n===o)return[t(e[n],n,n,o)];for(i=o-n+1,s=15&i,u=1&s,a=new Array(i),u&&(a[0]=t(e[n],n,n,o)),r=u;s>r;r+=2)l=n+r,a[r]=t(e[l],l,n,o),a[r+1]=t(e[l+1],l+1,n,o);for(r=s;i>r;r+=16)l=n+r,a[r]=t(e[l],l,n,o),a[r+1]=t(e[l+1],l+1,n,o),a[r+2]=t(e[l+2],l+2,n,o),a[r+3]=t(e[l+3],l+3,n,o),a[r+4]=t(e[l+4],l+4,n,o),a[r+5]=t(e[l+5],l+5,n,o),a[r+6]=t(e[l+6],l+6,n,o),a[r+7]=t(e[l+7],l+7,n,o),a[r+8]=t(e[l+8],l+8,n,o),a[r+9]=t(e[l+9],l+9,n,o),a[r+10]=t(e[l+10],l+10,n,o),a[r+11]=t(e[l+11],l+11,n,o),a[r+12]=t(e[l+12],l+12,n,o),a[r+13]=t(e[l+13],l+13,n,o),a[r+14]=t(e[l+14],l+14,n,o),a[r+15]=t(e[l+15],l+15,n,o);return a}function o(e,t,n,o,r){var l,i,s,u,a,c=e.length,p=n;if(arguments.length<5&&(r=c-1),0>r&&(r+=c),arguments.length<4&&(o=0),o>r)return p;if(o===r)return t(p,e[o],o);for(s=r-o+1,u=15&s,a=1&u,a&&(p=t(p,e[o],o)),l=a;u>l;l+=2)i=o+l,p=t(t(p,e[i],i),e[i+1],i+1);for(l=u;s>l;l+=16)i=o+l,p=t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(t(p,e[i],i),e[i+1],i+1),e[i+2],i+2),e[i+3],i+3),e[i+4],i+4),e[i+5],i+5),e[i+6],i+6),e[i+7],i+7),e[i+8],i+8),e[i+9],i+9),e[i+10],i+10),e[i+11],i+11),e[i+12],i+12),e[i+13],i+13),e[i+14],i+14),e[i+15],i+15);return p}function r(e,t,n,o){if(t>n)return o;if(t===n)return e(t,o,t,n),o;var r,l,i=n-t+1,s=15&i,u=1&s;for(u&&e(t,o,t,n),r=u;s>r;r+=2)l=t+r,e(l,o,t,n),e(++l,o,t,n);for(r=s;i>r;r+=16)l=t+r,e(l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n),e(++l,o,t,n);return o}function l(e,n){var o,r,i,s,u=t(e),a=0;if(bn===t(n)?n>0?(a=n,n=!0):n=!1:n=!1!==n,En===u){r={};for(i in e)e[sn](i)&&e[un](i)&&(o=t(e[i]),r[i]=En===o?n?l(e[i],a>0?a-1:n):e[i]:_n===o?n?l(e[i],a>0?a-1:n):e[i].slice():Mn===o?new Date(e[i]):Cn&o?e[i].slice():bn&o?0+e[i]:e[i])}else if(_n===u)for(s=e.length,r=new Array(s),i=0;s>i;i++)o=t(e[i]),r[i]=En===o?n?l(e[i],a>0?a-1:n):e[i]:_n===o?n?l(e[i],a>0?a-1:n):e[i].slice():Mn===o?new Date(e[i]):Cn&o?e[i].slice():bn&o?0+e[i]:e[i];else r=Mn===u?new Date(e):Cn&u?e.slice():bn&u?0+e:e;return r}function i(){var e,n,o,r,s,u,a,c,p,f,m=arguments,h=m.length;if(1>h)return null;for(n=l(m[0]),o=1;h>o;o++)if(e=m[o])for(r in e)if(e[sn](r)&&e[un](r))if(n[sn](r)&&n[un](r)){if(p=t(n[r]),f=t(e[r]),En===p&&En===f)n[r]=i(n[r],e[r]);else if(_n===p&&_n===f){if(a=n[r],c=e[r],u=c.length,!u)continue;if(a.length)for(s=0;u>s;s++)0>a.indexOf(c[s])&&a.push(c[s]);else n[r]=c.slice()}}else n[r]=l(e[r]);return n}function s(){return!0}function u(e,n){return n||_n!==t(e)?[e]:e}function a(e,n){return e=u(e),(n||_n!==t(e[0]))&&(e=[e]),e}function c(e,n){return Cn&t(n)&&Cn&t(e)&&n.length&&n.length<=e.length&&n===e.substr(0,n.length)}function p(e,t,n){return tn&&e[o-n-1].$id===t;)n++;n&&(e.length=o-n)}return e}function m(e,t,n){return n?e[t]=rn:delete e[t],e}function h(e){return(e||"id_")+ ++Bn}function g(e){return(e||"uuid")+"_"+ ++Bn+"_"+(new Date).getTime()}function d(){var e,n,o,r,l,i,s=arguments,u=s.length;for(e=s[0]||{},l=1;u>l;l++)if(n=s[l],En===t(n))for(r in n)n[sn](r)&&n[un](r)&&(o=n[r],i=t(o),e[r]=bn&i?0+o:Mn&i?new Date(o):Pn&i?o.slice():o);return e}function k(e,t){var n,o=arguments.length,r="constructor";return 0===o?(e=Object,t={}):1===o?(t=e||{},e=Object):(e=e||Object,t=t||{}),t[sn](r)||(t[r]=function(){}),n=t[r],delete t[r],n[ln]=d(pn(e[ln]),t),n[ln][r]=n,n}function $(e){return"&"===e?"&":"<"===e?"<":">"===e?">":'"'===e?""":"'"}function y(e){return"&#"+e.charCodeAt(0)+";"}function b(e,t){return e.replace(Un,t?$:y)}function x(e){return e.replace(Gn,"\\$1")}function v(e,t){return new RegExp(e,t||"")}function w(e,t,n,o){var r,l,i,s,u=e.pos,a=e.length,c="",p=!!n;if(p){for(o=!!o,l=!1,s=0;a>u&&(r=e[gn](u++),t!==r||l);)i=n===r,l=!l&&i,o?(i&&s++,(!i||2&s)&&(c+=r,s=0)):c+=r;2&s&&(c+=n)}else for(;a>u&&(r=e[gn](u++),t!==r);)c+=r;return e.pos=u,c}function C(e,n,o){var r,l,i,s,u,a=!0===o?0:1;for(Cn&t(n)&&(n=[n,n,n],a=0),l=e.length,u="",r=0;l>r;)i=e[gn](r),l>r+1&&"$"===i?(s=e.charCodeAt(r+1),36===s?(u+="$",r+=2):s>=48&&57>=s?(u+=n[a+s-48]||"",r+=2):(u+=i,r+=1)):(u+=i,r+=1);return u}function O(e,n,o,r){if(!e||(bn|qn)&t(e))return e;var l,i=n?n.length||0:0,s="";if(Cn&t(r)?s=r:r&&(s=Wn),i&&n===e.substr(0,i)){var u,a,c,l,p,f=e.substr(i),m=f[gn](0),h="";for(l=f.length;l--&&(p=f[gn](l),m!==p);)"i"===p.toLowerCase()&&(h="i");return u=f.substring(1,l),a="^("+u+")",o[a]||(c=v(a,h),o[a]=c),o[a]}return s?(a="^("+x(e)+")"+s,o[a]||(c=v(a,h),o[a]=c),o[a]):e}function S(e,o,r){var l,i="";return Cn&t(o)?i=o:o&&(i=Wn),l=n(e.sort(An),x).join("|"),[v("^("+l+")"+i,r?"i":""),1]}function _(e,n,o,r){var l=t(n);if(bn===l)return n;if(r[e])return r[e];o=o||0;var i,s=0;return n&&n.isCharList&&(s=1,m(n,"isCharList")),i=yn===l?new I(Ot,e,n,yn,o):On===l?new I(Ot,e,n,On,o):Fn&l?new I(Ot,e,n,qn,o):Cn&l?new I(Ot,e,n,s?Sn:Cn,o):n,r[e]=i}function E(e,n,o,r,l,i,s){if(s[e])return s[e];var a,p,f,m,h,g,d,k=0,$=0,y=1,b=Cn&t(r)?!0:!!r;if(a=u(n),f=a.length,1===f)d=_(e,O(a[0],o,i,r),0,s);else if(f>1){for(m=(f>>>1)+1,p=0;m>=p;p++)h=t(a[p]),g=t(a[f-1-p]),(On!==h||On!==g)&&(y=0),_n&h||_n&g?k=1:(qn&h||qn&g||c(a[p],o)||c(a[f-1-p],o))&&($=1);if(y&&!b)a=a.slice().join(""),a.isCharList=1,d=_(e,a,0,s);else if(!b||k||$)if(k||$){for(p=0;f>p;p++)a[p]=_n&t(a[p])?E(e+"_"+p,a[p],o,r,l,i,s):_(e+"_"+p,O(a[p],o,i),p,s);d=f>1?new I(St,e,a):a[0]}else{for(a=a.sort(An),p=0;f>p;p++)a[p]=_(e+"_"+p,O(a[p],o,i),p,s);d=f>1?new I(St,e,a):a[0]}else d=_(e,S(a,r,l),0,s)}return s[e]=d}function L(e,n,o,l,i){if(i[e])return i[e];var s=a(n),u=[],p=[];return r(function(n){var r,a;r=_(e+"_0_"+n,O(s[n][0],o,l),n,i),a=s[n].length>1?qn!==r.ptype||Cn!==t(s[n][1])||c(s[n][1],o)?_(e+"_1_"+n,O(s[n][1],o,l),n,i):s[n][1]:r,u.push(r),p.push(a)},0,s.length-1),i[e]=new I(_t,e,[u,p])}function q(e,t){var n=a(e.tokens.slice());r(function(e){var o=n[e][0],r=n[e].length>1?n[e][1]:n[e][0],l=n[e].length>2?n[e][2]:"";null===r?(t.line=t.line||[],t.line.push(o)):(t.block=t.block||[],t.block.push([o,r,l]))},0,n.length-1)}function M(e,t,o,r){var l=e.meta||o,i=!(!e.caseInsesitive&&!e.ci),s=n(t,function(e){return{word:e,meta:l,ci:i}});return r.autocomplete=(r.autocomplete||[]).concat(s),s}function T(e){e.Lex||(e.Lex={}),e.Syntax||(e.Syntax={});var n,o,r,l,s,u,a,c,p,f,h,g=e.Lex,d=e.Syntax,k=[g,d],$=k.length;for(h=0;$>h;){f=k[h++];for(r in f)f[sn](r)&&(n=r.split(":"),o=n[1]&&Dn(n[1]).length?Dn(n[1]):null,n=Dn(n[0]),n.length||(n=r,o=null),n!==r&&(f[n]=f[r],m(f,r),o&&(o=o[hn](),l=f[n],s=t(l),En===s?f[n].type||(f[n].type=o):(f[n]={type:o},"error"===o?(f[n].type="action",f[n].error=l):"nop"===o?(f[n].type="action",f[n].nop=!0):"group"===o?(f[n].type="sequence",f[n].tokens=l):"action"===o&&Cn===s?f[n][l]=!0:f[n].tokens=l))),g===f&&(Rn&t(f[n])&&(f[n]={type:"simple",tokens:f[n]}),l=f[n],l.type&&(c=l.type=l.type[hn](),"line-block"===c?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===c?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===c&&(l.type="block",l.multiline=!0,l.escape="\\"))))}f=g;for(n in f)if(f[sn](n))for(l=f[n];l.extend;)u=l.extend,m(l,"extend"),a=g[u],a&&(Rn&t(a)&&(a=g[u]={type:"simple",tokens:a}),l=i(a,l));f=g;for(n in f)f[sn](n)&&(l=f[n],l.type?(c=l.type=l.type[hn](),"line-block"===c?(l.type="block",l.multiline=!1,l.escape=!1):"escaped-line-block"===c?(l.type="block",l.multiline=!1,l.escape="\\"):"escaped-block"===c&&(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"],m(l,"escaped-line-block")):l["escaped-block"]?(l.type="block",l.multiline=!0,l.escape||(l.escape="\\"),l.tokens=l["escaped-block"],m(l,"escaped-block")):l["line-block"]?(l.type="block",l.multiline=!1,l.escape=!1,l.tokens=l["line-block"],m(l,"line-block")):l.comment?(l.type="comment",l.escape=!1,l.tokens=l.comment,m(l,"comment")):l.block?(l.type="block",l.tokens=l.block,m(l,"block")):l.simple?(l.type="simple",l.tokens=l.simple,m(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"]],m(l,"error")):l[sn]("context")?(l.type="action",l.action=[l.context?"context-start":"context-end",l.context,!!l["in-context"]],m(l,"context")):l.indent?(l.type="action",l.action=["indent",l.indent,!!l["in-context"]],m(l,"indent")):l.outdent?(l.type="action",l.action=["outdent",l.outdent,!!l["in-context"]],m(l,"outdent")):l.unique?(l.type="action",l.action=["unique",Cn&t(l.unique)?["_DEFAULT_",l.unique]:l.unique,!!l["in-context"]],m(l,"unique")):l.push?(l.type="action",l.action=["push",l.push,!!l["in-context"]],m(l,"push")):l[sn]("pop")?(l.type="action",l.action=["pop",l.pop,!!l["in-context"]],m(l,"pop")):l.type="simple","action"===l.type?l.ci=!(!l.caseInsesitive&&!l.ci):"block"===l.type||"comment"===l.type?(l.multiline=l[sn]("multiline")?!!l.multiline:!0,Cn&t(l.escape)||(l.escape=!1)):"simple"===l.type&&(l.meta=l.autocomplete&&Cn&t(l.meta)?l.meta:null,l.ci=!(!l.caseInsesitive&&!l.ci)));f=d;for(n in f)f[sn](n)&&(l=f[n],En!==t(l)||l.type?l.type&&(c=l.type=l.type[hn](),"group"===c&&l.match?(s=t(l.match),Cn&s?(p=l.match[hn](),"alternation"===p||"either"===p?(l.type="alternation",m(l,"match")):"sequence"===p||"all"===p?(l.type="sequence",m(l,"match")):"zeroorone"===p?(l.type="zeroOrOne",m(l,"match")):"zeroormore"===p?(l.type="zeroOrMore",m(l,"match")):"oneormore"===p?(l.type="oneOrMore",m(l,"match")):(l.type="sequence",m(l,"match"))):_n&s&&(l.type="repeat",l.repeat=l.match,m(l,"match"))):"either"===c?l.type="alternation":"all"===c?l.type="sequence":"lookahead"===c&&(l.type="positiveLookahead")):l.ngram||l["n-gram"]?(l.type="ngram",l.tokens=l.ngram||l["n-gram"],l["n-gram"]?m(l,"n-gram"):m(l,"ngram")):l.sequence||l.all?(l.type="sequence",l.tokens=l.sequence||l.all,l.all?m(l,"all"):m(l,"sequence")):l.alternation||l.either?(l.type="alternation",l.tokens=l.alternation||l.either,l.either?m(l,"either"):m(l,"alternation")):l.zeroOrOne?(l.type="zeroOrOne",l.tokens=l.zeroOrOne,m(l,"zeroOrOne")):l.zeroOrMore?(l.type="zeroOrMore",l.tokens=l.zeroOrMore,m(l,"zeroOrMore")):l.oneOrMore?(l.type="oneOrMore",l.tokens=l.oneOrMore,m(l,"oneOrMore")):l.positiveLookahead||l.lookahead?(l.type="positiveLookahead",l.tokens=l.positiveLookahead||l.lookahead,l.lookahead?m(l,"lookahead"):m(l,"positiveLookahead")):l.negativeLookahead&&(l.type="negativeLookahead",l.tokens=l.negativeLookahead,m(l,"negativeLookahead")));return e}function P(e,n,o){if(o=o||{},n=n||[],!e||!e.length)return n;var r,l,i,s,u,a,c;for(r=0,l=e.length;l>r;r++)if(u=e[r])if(Rt===u.type)if(u.autocompletions)for(i=0,s=u.autocompletions.length;s>i;i++)c=u.autocompletions[i],o[sn]("w_"+c.word)||(n.push(c),o["w_"+c.word]=1);else Cn===u.token.ptype&&Cn&t(u.token.pattern)&&u.token.pattern.length>1&&(o[sn]("w_"+u.token.pattern)||(n.push({word:""+u.token.pattern,meta:u.name,ci:!!u.ci}),o["w_"+u.token.pattern]=1));else if(Dt===u.type)P(u.token,n,o);else if(Ht&u.type){i=0,s=u.token.length;do P([a=u.token[i++]],n,o);while(s>i&&(zt&a.type&&1>a.min||Et===a.type))}else zt&u.type&&P([u.token[0]],n,o);return n}function F(e,n,o,r){for(var l;Cn&t(l=n[e]||o[e]);)e=l;return r?e:n[e]||o[e]||e}function R(e,t){return e.length>1?r(t?function(t,n){var o=n[n.length-1],r=e[t];o===r||n.push(r)}:function(t,n){var o=n[n.length-1],r=e[t];Zn.test(r)&&Zn.test(o)&&o===r||n.push(r)},1,e.length-1,[e[0]]):e}function j(e,o,r){var i,s,u,a,c,p,f,m,h,g,d,k,$,y,b,C=!1;if(b=e.modifier?e.modifier:null,m=new String(Dn(e)),m.pos=0,1===m.length)k=""+e,o[k]||r[k]||(o[k]={type:"simple",tokens:e}),e=k;else{for(i=[],s=[],u="",$=[];m.posc[0]&&(c[0]=0),2>c.length?c.push(c[0]):c[1]=c[1].length?parseInt(c[1],10)||dn:dn,0>c[1]&&(c[1]=0),d=s[s.length-1],k=""+d+["{",c[0],",",isFinite(c[1])?c[1]:"","}"].join(""),r[k]||(r[k]={type:"repeat",repeat:[c[0],c[1]],tokens:[d]}),s[s.length-1]=k):u+=h;else{if("}"===h){u+=h;continue}"&"===h||"!"===h?s.length?(d=s[s.length-1],k=""+d+h,r[k]||(r[k]={type:"!"===h?"negativeLookahead":"positiveLookahead",tokens:[d]}),s[s.length-1]=k):u+=h:"|"===h?(C=!1,s=R(s),s.length>1?(k=""+s.join(" "),r[k]||(r[k]={type:"sequence",tokens:s}),i.push(k)):s.length?i.push(s[0]):u+=h,s=[]):"("===h?($.push([s,i,u]),s=[],i=[],u=""):")"===h&&(s=R(s),s.length>1?(k=""+s.join(" "),r[k]||(r[k]={type:"sequence",tokens:s}),i.push(k)):s.length&&i.push(s[0]),s=[],i=R(i,1),i.length>1?(k=""+i.join(" | "),r[k]||(r[k]={type:"alternation",tokens:i})):i.length&&(k=i[0]),i=[],y=$.pop(),s=y[0],i=y[1],u=y[2],d=k,k="("+d+")",r[k]||(r[k]=l(F(d,o,r))),s.push(k))}}else u+=h;u.length&&(C?(s.length&&(d=s[s.length-1],k=d+"."+u,p=o[k]||r[k],p||(f=F(d,o,r),r[k]=Cn&t(f)?new String(f):l(f),r[k].modifier=u),s[s.length-1]=k),C=!1):"0"===u?(o[nn]||(o[nn]={type:"simple",tokens:0}),s.push(nn)):"^^"===u?(o[Jt]||(o[Jt]={type:"simple",tokens:Lt}),s.push(Jt)):"^^1"===u?(o[Qt]||(o[Qt]={type:"simple",tokens:qt}),s.push(Qt)):"^"===u?(o[Xt]||(o[Xt]={type:"simple",tokens:Tt}),s.push(Xt)):"$"===u?(o[en]||(o[en]={type:"simple",tokens:Mt}),s.push(en)):(o[u]||r[u]||(o[u]={type:"simple",tokens:u}),s.push(u))),u="",s=R(s),s.length>1?(k=""+s.join(" "),r[k]||(r[k]={type:"sequence",tokens:s}),i.push(k)):s.length&&i.push(s[0]),s=[],i=R(i,1),i.length>1?(k=""+i.join(" | "),r[k]||(r[k]={type:"alternation",tokens:i}),e=k):i.length&&(e=i[0]),i=[]}return b&&(o[e]||r[e])&&((o[e]||r[e]).modifier=b),e}function N(e,l,i,s,c,p,f,m,h,g,d){var k,$,y,b,x,v,w,C=null,O=null,S=null;if(Lt===e||qt===e||Tt===e||Mt===e)return new G(e,Lt===e?Jt:qt===e?$T_FBNL$:Tt===e?Xt:en,e,O);if(!1===e||0===e)return new G(Pt,nn,0,O);if(""===e)return new G(Ft,on,"",O);if(null===e)return new G(Rt,tn,yn,O,S);if(_n&t(e)&&(y=e,e="NGRAM_"+y.join("_"),s[e]||(s[e]={type:"ngram",tokens:y})),e=""+e,m[e])return m[e];if(x=F(e,i,s),Cn&t(x)&&(x=j(x,i,s),x=i[x]||s[x]||null),!x)return null;if(k=x.type?Vt[x.type[hn]().replace(In,"")]||Rt:Rt,O=x.msg||null,S=x.modifier||null,$=x.tokens,Rt&k){if(Lt===$||qt===$||Tt===$||Mt===$||!1===$||0===$)return C=new G($||Pt,e,$||0,O),m[e]=C,C;if(""===$)return C=new G(Ft,e,"",O),m[e]=C,C;if(null===$)return C=new G(Rt,e,yn,O,S),m[e]=C,C;if(!$)return null}if(Et&k)x[sn]("action")?"nop"===x.action[0]?x.action[0]=dt:"error"===x.action[0]?x.action[0]=kt:"context-start"===x.action[0]?x.action[0]=yt:"context-end"===x.action[0]?x.action[0]=bt:"push"===x.action[0]?x.action[0]=xt:"pop"===x.action[0]?x.action[0]=vt:"unique"===x.action[0]?x.action[0]=$t:"indent"===x.action[0]?x.action[0]=wt:"outdent"===x.action[0]&&(x.action[0]=Ct):x[sn]("nop")?x.action=[dt,x.nop,!!x["in-context"]]:x[sn]("error")?x.action=[kt,x.error,!!x["in-context"]]:x[sn]("context")?x.action=[x.context?yt:bt,x.context,!!x["in-context"]]:x[sn]("context-start")?x.action=[yt,x["context-start"],!!x["in-context"]]:x[sn]("context-end")?x.action=[bt,x["context-end"],!!x["in-context"]]:x[sn]("push")?x.action=[xt,x.push,!!x["in-context"]]:x[sn]("pop")?x.action=[vt,x.pop,!!x["in-context"]]:x[sn]("unique")?x.action=[$t,Cn&t(x.unique)?["_DEFAULT_",x.unique]:x.unique,!!x["in-context"]]:x[sn]("indent")?x.action=[wt,x.indent,!!x["in-context"]]:x[sn]("outdent")&&(x.action=[Ct,x.outdent,!!x["in-context"]]),x.nop&&(x.action[0]=dt),C=new G(Et,e,x.action.slice(),O,S),C.ci=!!x.caseInsensitive||x.ci,m[e]=C;else if($=u($),Rt&k){if(w=x.autocomplete?M(x,Pn&t(x.autocomplete)?u(x.autocomplete):$,e,d):null,v="undefined"!=typeof x.combine?x.combine:_n&t(x.tokens)?!0:!1,C=new G(Rt,e,E(e,$.slice(),l,v,!(!x.caseInsensitive&&!x.ci),p,f),O,S,null,w),m[e]=C,null!=x.except){var _,T,P=u(x.except),R=P.length,D=[];for(_=0;R>_;_++)P[_]&&(T=N(P[_],l,i,s,c,p,f,m,h,g,d),T&&D.push(T));D.length&&(C.except=D)}}else jt&k?(Nt===k&&q(x,g),C=new G(k,e,L(e,$.slice(),l,p,f),O),C.mline=x[sn]("multiline")?!!x.multiline:!0,C.esc=x[sn]("escape")?x.escape:!1,C.inter=!!c[e+".inside"],Nt===k&&x.interleave&&h.push(Y(C)),S&&(C.modifier=S),m[e]=C):Kt&k&&(Zt===k?(b=a($),C=n(b,function(t,n){return new G(Zt,e+"_NGRAM_"+n,null,O,S)}),m[e]=C,r(function(e){C[e].token=u(o(b[e],function(e,t){return e.concat(N(t,l,i,s,c,p,f,m,h,g,d))},[]))},0,b.length-1)):(Yt===k||Wt===k?C=new G(k,e,null,O,S):zt&k&&_n&t(x.repeat)?(C=new G(zt,e,null,O,S),C.min=x.repeat[0],C.max=x.repeat[1]):It===k?(C=new G(It,e,null,O,S),C.min=0,C.max=1):Bt===k?(C=new G(Bt,e,null,O,S),C.min=0,C.max=dn):Gt===k?(C=new G(Gt,e,null,O,S),C.min=1,C.max=dn):C=Dt===k?new G(Dt,e,null,O,S):new G(At,e,null,O,S),m[e]=C,C.token=u(o($,function(e,t){return e.concat(N(t,l,i,s,c,p,f,m,h,g,d))},[]))));return m[e]}function D(e,t){var n,o,r=e.Style,l=e.Lex,i=e.Syntax,s=[],u={};for(n in r)r[sn](n)&&(o=l[n]||i[n],!o||"block"!=o.type&&"comment"!==o.type||(t&&(r[n+".inside"]||r[n])?(n=r[n+".inside"]||r[n],u[sn](n)||(s.push(n),u[n]=1)):t||u[sn](n)||(s.push(n),u[n]=1)));return s}function A(e){var n={};return e.Lex=e.Lex||{},e.Syntax=e.Syntax||{},e=T(e),e.Parser&&e.Parser.length&&r(function o(l,i){var s,u,a,c=i[l];n[c]||(_n&t(c)&&(s=c,c="NGRAM_"+s.join("_"),e.Syntax[c]||(e.Syntax[c]={type:"ngram",tokens:s})),u=F(c,e.Lex,e.Syntax),Cn&t(u)&&(u=j(u,e.Lex,e.Syntax),u=e.Lex[u]||e.Syntax[u]||null),u&&(n[c]=u,a=u.type?Vt[u.type[hn]().replace(In,"")]||Rt:Rt,Kt&a&&r(o,0,u.tokens.length-1,u.tokens)))},0,e.Parser.length-1,e.Parser),e}function z(e){var n,r,i,s,u,a,c,p,f,m,h,g,d;return e.__parsed?e:(n=e.RegExpID||null,i=e.Extra?l(e.Extra):{},s=e.Style?l(e.Style):{},u=null,a=e.Lex?l(e.Lex):{},c=e.Syntax?l(e.Syntax):{},p={},f={},m={},g={},d={},h=[],r=e.Parser?l(e.Parser):[],e=T({Style:s,Fold:u,Lex:a,Syntax:c,$parser:null,$interleaved:null,$comments:null,$autocomplete:null,$extra:i,__parsed:0}),e.$parser=o(r,function(e,o){var r=N(o,n,a,c,s,p,f,m,h,g,d)||null;return r&&(_n&t(r)?e=e.concat(r):e.push(r)),e},[]),e.$interleaved=h&&h.length?h:null,e.$comments=g,e.$autocomplete=d&&d.autocomplete&&d.autocomplete.length?d.autocomplete:null,e.__parsed=1,e)}function I(e,n,o,r,l){var i,s,u=this;i=u.type=e,u.name=n,u.pattern=o,s=u.ptype=r||Cn,u.key=l||0,St===i?u.key=!1!==l:_t===i?u.pattern[0]=new I(St,n+"_Start",o[0],null,!1):yn===s?u.pattern=null:qn===s&&(u.pattern=qn&t(o)?[o,0]:[o[0],o[1]||0])}function B(e,n,o,r){var l,i,s,u,a,c,p,f,m,h,g,d=e,k=d.type,$=d.pattern,y=d.key;if(_t===k){if(l=d.name,s=$[0],u=$[1],c=B(s,n,o,r))return a=u[c[0]],f=t(a),m=s.pattern[c[0]].ptype,qn===m&&Tn&f&&(p=bn&f?c[1][a+1]:C(a,c[1]),a=new I(Ot,l+"_End",p,p.length>1?Cn:On)),a}else if(St===k){for(h=0,g=$.length;g>h;h++)if(p=B($[h],n,o,r))return y?[h,p[1]]:p}else{if(i=d.ptype,yn===i)return!1!==o&&n.end(),[y,""];if(qn===i){if(p=n.slice(n.pos).match($[0]),p&&0===p.index)return!1!==o&&n.mov(p[$[1]||0].length),[y,$[1]>0?p[$[1]]:p]}else if(Sn===i){if(!0===r){p=-1;var b,x;for(g=$.length-1;g>=0;g--)b=n.indexOf($[gn](g),n.pos),b>-1&&(-1===p||p>b)&&(p=b,x=$[gn](g));if(p>-1)return!1!==o&&(n.pos=p+1),[y,x]}else if(p=n[gn](n.pos)||null,p&&-1<$.indexOf(p))return!1!==o&&n.mov(1),[y,p]}else if(On===i){if(!0===r){if(p=n.indexOf($,n.pos),p>-1)return!1!==o&&(n.pos=p+1),[y,$]}else if(p=n[gn](n.pos)||null,$===p)return!1!==o&&n.mov(1),[y,p]}else if(Cn===i)if(g=$.length,!0===r){if(p=n.indexOf($,n.pos),p>-1)return!1!==o&&(n.pos=p+g),[y,$]}else if($===n.substr(n.pos,g))return!1!==o&&n.mov(g),[y,$]}return!1}function G(e,t,n,o,r,l,i){var s=this;s.type=e,s.name=t,s.token=n,s.modifier=r||null,s.except=l||null,s.autocompletions=i||null,s.pos=null,s.msg=o||null,s.$msg=null,s.status=0,s.ci=!1,s.mline=!0,s.esc=!1,s.inter=!1,s.found=0,s.min=0,s.max=1,s.$id=null}function U(){var e=this;e.T=0,e.id=null,e.type=null,e.match=null,e.str="",e.pos=null,e.block=null}function Y(e,t,n,o){var r=new G(e.type,e.name,e.token,e.msg,e.modifier,e.except,e.autocompletions);return r.ci=e.ci,r.mline=e.mline,r.esc=e.esc,r.inter=e.inter,r.found=e.found,r.min=e.min,r.max=e.max,t&&(r.status|=pt),n&&(r.modifier=n),o&&(r.$id=o),r}function W(e){var t=e.name;return e.$msg?e.$msg:e.status&pt?'Token "'+t+'" Expected':'Syntax Error: "'+t+'"'}function Z(e,t,n,o,r,l,i){e.err[t+"_"+n+"_"+o+"_"+r+"_"+(l?l.name:"ERROR")]=[t,n,o,r,i||W(l)]}function H(e,t,n,o){if(!e)return!1;var r=e.type,l=Kt&r?Q:jt&r?J:Et&r?K:V;return l(e,t,n,o)}function K(e,n,o,r){var l,i,s,u,a,c,p,f,m,h,g,d,k,$,y,b,x=e,v=x.token||null,w=x.ci,O=x.name,S=!(o.status&at);if(x.status=0,x.$msg=null,S||!v||!r||!r.pos)return!0;if(b=!!(jt&r.T),dt===v[0]||b&&!r.block)return!0;if(l=v[0],i=v[1],k=v[2],a=x.msg,c=o.queu,p=o.symb,f=o.ctx,b?(y=r.block.match||r.block.str,m=r.block.pos[0][0],h=r.block.pos[0][1],g=r.block.pos[0][2],d=r.block.pos[0][3]):(y=r.match||r.str,m=r.pos[0],h=r.pos[1],g=r.pos[2],d=r.pos[3]),kt===l)return!a&&Cn&t(i)&&(a=i),x.$msg=a?C(a,y,!0):'Error "'+O+'"',Z(o,m,h,g,d,x,W(x)),x.status|=ft,!1;if(bt===l)f.length&&f.shift();else if(yt===l)f.unshift({symb:{},queu:[]});else if(vt===l){if(k){if(!f.length)return!0;c=f[0].queu}if(i){if(i=C(i,y),w&&(i=i[hn]()),!c.length||i!==c[0][0])return c.length?(x.$msg=a?C(a,[c[0][0],i],!0):'Tokens do not match "'+c[0][0]+'","'+i+'"',$=W(x),Z(o,c[0][1],c[0][2],c[0][3],c[0][4],x,$),Z(o,m,h,g,d,x,$),c.shift()):(x.$msg=a?C(a,["",i],!0):'Token does not match "'+i+'"',$=W(x),Z(o,m,h,g,d,x,$)),x.status|=ft,!1;c.shift()}else c.shift()}else if(xt===l&&i){if(k){if(!f.length)return!0;c=f[0].queu}i=C(i,y),w&&(i=i[hn]()),x.$msg=a?C(a,i,!0):'Token does not match "'+i+'"',c.unshift([i,m,h,g,d,W(x)])}else if($t===l){if(k){if(!f.length)return!0;p=f[0].symb}if(s=i[1],u=i[0],s=C(s,y,!0),w&&(s=s[hn]()),p[sn](u)||(p[u]={}),p[u][sn](s))return x.$msg=a?C(a,s,!0):'Duplicate "'+s+'"',$=W(x),Z(o,p[u][s][0],p[u][s][1],p[u][s][2],p[u][s][3],x,$),Z(o,m,h,g,d,x,$),x.status|=ft,!1;p[u][s]=[m,h,g,d]}return!0}function V(e,t,n,o,r){var l,i=e,s=i.token,u=i.modifier,a=i.type,c=i.name,p=i.except,f=n.line,m=t.pos,h=null,g=!1;if(i.status&=ht,i.$msg=r?null:i.msg||null,p)for(var d=0,k=p.length;k>d;d++)if(l=p[d],i!==l&&Rt===l.type&&V(l,t,n,o,1))return t.bck(m),!1;return Lt===a?g=0===n.line:qt===a?g=n.bline+1===n.line:Tt===a?g=t.sol():Mt===a?(t.spc(),t.eol()?g=c:t.bck(m)):Pt===a?(i.status=0,g=!0):Ft===a?(i.status&pt&&t.spc()&&!t.eol()?(t.bck(m),i.status|=ft):g=!0,i.status&=mt):yn===s?(t.end(),g=u||c):(h=B(s,t))&&(h=h[1],g=u||c),r?g:(!1!==g&&(o.T=a,o.id=c,o.type=g,o.str=t.sel(m,t.pos),o.match=h,o.pos=[f,m,f,t.pos]),!g&&i.status&&i.$msg&&(i.$msg=C(i.$msg,c,!0)),g)}function J(e,t,n,o){var r,l,i,s,u,a,c,f,m,h,g,d,k,$,y,b,x,v,w,O,S,_=e,E=_.name,L=_.type,q=_.modifier,M=_.token,T=_.mline,P=_.inter,F=P?E+".inside":E,R=_.esc,j=!!R,N="",D="",A="",z="",I=_.$id||E,G=n.stack;if(_.status&=ht,_.$msg=_.msg||null,w=n.line,O=t.pos,Nt===L&&(_.status&=mt),y=_.status&pt,i=0,s=0,n.block&&n.block.name===E?(s=1,i=1,$=F,r=n.block.end,f=n.block.sp,h=n.block.ip,m=n.block.ep,N=n.block.s,D=n.block.i):!n.block&&(r=B(M,t))&&(s=1,$=E,b=t.pos,f=[w,O],h=[[w,b],[w,b]],m=[w,b],N=t.sel(O,b),D="",z="",n.block={name:E,end:r,sp:f,ip:h,ep:m,s:N,i:D,e:z}),s){if(v=G.length,l=yn===r.type,P){if(l&&i&&t.sol())return _.status&=mt,n.block=null,!1;if(!i)return b=t.pos,o.T=L,o.id=E,o.type=q||$,o.str=t.sel(O,b),o.match=null,o.pos=[w,O,w,b],p(G,v,Y(_,y,0,I)),q||$}if(b=t.pos,u=B(r,t),c=T,a=0,u)$=l?F:E,z=t.sel(b,t.pos);else if(x=t.pos,d=!1,j||Sn!==r.ptype&&On!==r.ptype&&Cn!==r.ptype)for(;!t.eol();){if(b=t.pos,!d&&B(r,t)){P&&t.pos>b&&b>x?($=F,t.bck(b),a=1):($=E,u=1),z=t.sel(b,t.pos);break}k=t.nxt(1),A+=k,d=j&&!d&&R===k,b=t.pos}else(S=B(r,t,!0,!0))?(P&&t.pos>b+S[1].length?($=F,t.mov(-S[1].length),a=1):($=E,u=1),z=t.sel(b,t.pos)):(t.end(),$=F,a=1,A=t.sel(b,t.pos));return c=T||j&&d,D+=A,h[1]=[w,b],m=[w,t.pos],u||!c&&!a?n.block=null:(n.block.ip=h,n.block.ep=m,n.block.i=D,n.block.e=z,p(G,v,Y(_,y,0,I))),o.T=L,o.id=E,o.type=q||$,o.str=t.sel(O,t.pos),o.match=null,o.pos=[w,O,m[0],m[1]],n.block||(g=N+D+z,o.block={str:g,match:[g,D,N,z],part:[g,N,D,z],pos:[[f[0],f[1],m[0],m[1]],[f[0],f[1],h[0][0],h[0][1]],[h[0][0],h[0][1],h[1][0],h[1][1]],[h[1][0],h[1][1],m[0],m[1]]]}),q||$}return _.status&&_.$msg&&(_.$msg=C(_.$msg,E,!0)),!1}function Q(e,t,n,o){var r,l,i,s,u,a,c,f,m,g,d,k,$,y,b,x=e,v=x.type,w=(x.name,x.token),C=w.length,O=x.modifier;if(x.status&=ht,x.$msg=x.msg||null,k=n.stack,f=t.pos,m=k.length,a=0,c=0,y=x.$id||h(),Dt===v){for(x.status|=pt,$=[],g=0;C>g;g++){if(r=Y(w[g],1,O,y),l=H(r,t,n,o),r.status&pt&&(a++,$.push(W(r))),!1!==l)return l;r.status&ft&&(c++,t.pos>f&&t.bck(f),k.length>m&&(k.length=m))}return a>0?x.status|=pt:x.status&=mt,C===c&&a>0?x.status|=ft:x.status&=ht,x.status&&!x.$msg&&$.length&&(x.$msg=$.join(" | ")),!1}if(Ht&v){b=!!(v&At),b?x.status|=pt:x.status&=mt,d=0;do r=Y(w[d++],b,O,y),l=H(r,t,n,o);while(C>d&&(!0===l&&Ut&r.type||!1===l&&!(r.status&pt)));if(!1!==l){if(!0!==l||Pt!==r.type)for(g=C-1;g>=d;g--)p(k,m+C-g-1,Y(w[g],1,O,y));return l}return r.status&ft?(b?x.status|=ft:x.status&=ht,t.pos>f&&t.bck(f),k.length>m&&(k.length=m)):b&&r.status&pt&&(x.status|=ft),x.status&&!x.$msg&&(x.$msg=W(r)),!1}if(Ut&v)return r=Y(w[0],1,O,y),l=H(r,t,n,o),t.pos>f&&t.bck(f),k.length>m&&(k.length=m),Wt===v?!1===l:!1!==l;for(i=x.found,s=x.min,u=x.max,x.status=0,$=[],g=0;C>g;g++){if(r=Y(w[g],1,O,y),l=H(r,t,n,o),!1!==l){if(++i,u>=i)return x.found=i,p(k,m,Y(x,0,0,y)),x.found=0,l;break}r.status&pt&&(a++,$.push(W(r))),r.status&ft&&(t.pos>f&&t.bck(f),k.length>m&&(k.length=m))}return s>i&&(x.status|=pt),(i>u||s>i&&a>0)&&(x.status|=ft),x.status&&!x.$msg&&$.length&&(x.$msg=$.join(" | ")),!1}function X(e,t){var n=this;n.id=e?g("state"):"state",t instanceof X?(n.line=t.line,n.bline=t.bline,n.status=t.status,n.stack=t.stack.slice(),n.token=t.token,n.block=t.block,n.status&at?(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=[],n.token=null,n.block=null,n.status&at?(n.queu=[],n.symb={},n.ctx=[],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 et(e){e.id=null,e.line=null,e.bline=null,e.status=null,e.stack=null,e.token=null,e.block=null,e.queu=null,e.symb=null,e.ctx=null,e.err=null}function tt(e,t,n){var o=new String(e);return o.start=t||0,o.pos=n||0,o.sol=function(){return 0===o.pos},o.eol=function(){return o.pos>=o.length},o.end=function(){return o.pos=o.length,o},o.mov=function(e){return o.pos=0>e?fn(0,o.pos+e):mn(o.length,o.pos+e),o},o.bck=function(e){return o.pos=fn(0,e),o},o.sft=function(){return o.start=o.pos,o},o.nxt=function(e,t){var n,r,l="";if(!0===e){for(t=t||tt.$NONSPC$;o.poss||s>=t)return i+(t-l);i+=s-l,i+=n-i%n,l=s+1}}function ot(e,o){return Pn&t(e)&&(e=v("\\b("+n(u(e).sort(An),x).join("|")+")\\b")),!1===o?function(t){return!t||!e.test(t)}:function(t){return!!t&&e.test(t)}}function rt(e,t,n){for(;;){n.lastIndex=e.col;var o=n.exec(e.text);if(!o){if(e.next()){e.text=e.line(e.row);continue}return}{if(t(e.token(e.row,o.index+1)))return e.col=o.index+o[0].length,o;e.col=o.index+1}}}function lt(e,t,n,o,r,l){for(var i,s,u;;){if(i=e.text.indexOf(r,e.col),-1===i){if(e.next()){e.text=e.line(e.row);continue}return}if(t(e.token(e.row,i+1)))return s=e.text.lastIndexOf(l,i),u=s>-1&&!tt.$NOTEMPTY$.test(e.text.slice(s+1,i)),e.col=i+1,u?"autoclosed":"regular";e.col=i+1}}function it(e,t,n){var o=n.text,r=n.meta,l=n.start,i=n.end,s=t.list.maxlen-o.length-r.length+5;e.innerHTML=['',b(o.slice(0,l)),'',b(o.slice(l,i)),"",b(o.slice(i)),"",new Array(1+s).join(" "),'',b(r),""," "].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 st(e,t,n){function o(e,t){return{startState:function(){return new X},copyState:function(e){return new X(0,e)},token:function(e,t){var n=tt(e.string,e.start,e.pos),r=o.$parser.token(n,t).type;return e.pos=n.pos,r},indent:function(r,l,i){return o.$parser.indent(r,l,i,e,t,n)},lineComment:o.$parser.LC,blockCommentStart:o.$parser.BCS,blockCommentEnd:o.$parser.BCE,blockCommentContinue:o.$parser.BCC,blockCommentLead:o.$parser.BCL,electricInput:o.$parser.$grammar.$extra.electricInput||!1,electricChars:o.$parser.$grammar.$extra.electricChars||!1,fold:o.foldType}}return n=n||Vn,o.$id=g("codemirror_grammar_mode"),o.$parser=new eo.Parser(z(e),t),o.supportGrammarAnnotations=!1,o.validator=function r(e,t){return o.supportGrammarAnnotations&&o.$parser&&e&&e.length?o.$parser.validate(e,r.options||t||{},n):[]},o.linter=o.validator,o.supportCodeFolding=!0,o.foldType="fold_"+o.$id,o.folder=function(e,t){var r;return o.supportCodeFolding&&o.$parser&&(r=o.$parser.fold(e,t,n))?{from:n.Pos(r[0],r[1]),to:n.Pos(r[2],r[3])}:void 0},o.supportAutoCompletion=!0,o.autocompleter=function l(e,t){return o.supportAutoCompletion&&o.$parser?(t=l.options||t||{},t[sn]("renderer")||(t.renderer=l.renderer||it),o.$parser.autocomplete(e,t,n)):void 0},o.autocompleter.renderer=it,o.autocomplete=o.autocompleter,o.dispose=function(){o.$parser&&o.$parser.dispose(),o.$parser=o.validator=o.linter=o.autocompleter=o.autocomplete=o.folder=null +},o}var ut=1,at=2,ct=32,pt=4,ft=8,mt=~pt,ht=~ft,gt=pt|ft,dt=0,kt=4,$t=8,yt=16,bt=17,xt=32,vt=33,wt=128,Ct=129,Ot=2,St=4,_t=8,Et=4,Lt=8,qt=9,Mt=16,Tt=32,Pt=128,Ft=256,Rt=512,jt=1024,Nt=1025,Dt=2048,At=4096,zt=8192,It=8193,Bt=8194,Gt=8195,Ut=16384,Yt=Ut,Wt=16385,Zt=32768,Ht=At|Zt,Kt=Dt|At|zt|Ut|Zt,Vt={action:Et,simple:Rt,block:jt,comment:Nt,alternation:Dt,sequence:At,repeat:zt,zeroorone:It,zeroormore:Bt,oneormore:Gt,positivelookahead:Yt,negativelookahead:Wt,ngram:Zt},Jt="$|SOF|$",Qt="$|NONBLANK|$",Xt="$|SOL|$",en="$|EOL|$",tn="$|ENDLINE|$",nn="$|EMPTY|$",on="$|NONSPACE|$",rn=void 0,ln="prototype",sn="hasOwnProperty",un="propertyIsEnumerable",an=Object[ln],cn=an.toString,pn=Object.create,fn=Math.max,mn=Math.min,hn="toLowerCase",gn="charAt",dn=1/0,kn=4,$n=8,yn=16,bn=32,xn=33,vn=34,wn=64,Cn=128,On=129,Sn=130,_n=256,En=512,Ln=1024,qn=2048,Mn=4096,Tn=Cn|bn,Pn=Cn|_n,Fn=qn|_n,Rn=Cn|_n|qn,jn={"[object Number]":bn,"[object String]":Cn,"[object Array]":_n,"[object RegExp]":qn,"[object Date]":Mn,"[object Function]":Ln,"[object Object]":En},Nn=/^\s+|\s+$/g,Dn=String[ln].trim?function(e){return e.trim()}:function(e){return e.replace(Nn,"")},An=function(e,t){return t.length-e.length},zn=/\r\n|\r|\n/g,In=/[\-_]/g,Bn=0,Gn=/([.*+?^${}()|[\]\/\\\-])/g,Un=/[&"'<>]/g,Yn=/^([.!&\[\]{}()*+?\/|'"]|\s)/,Wn="(\\s|\\W|$)",Zn=/[*+]$/;tt.$SPC$=/^[\s\u00a0]+/,tt.$NONSPC$=/[^\s\u00a0]/,tt.$NOTEMPTY$=/\S/,tt.$SPACE$=/^\s*/;var Hn=k({constructor:function(e,t,n){var o=this;o.$grammar=e,o.$DEF=t||null,o.$ERR=n||null,o.DEF=o.$DEF,o.ERR=o.$ERR,o.$folders=[]},$grammar:null,$folders:null,$n$:"name",$t$:"type",$v$:"token",$DEF:null,$ERR:null,DEF:null,ERR:null,dispose:function(){var e=this;return e.$grammar=null,e.$folders=null,e.$n$=e.$t$=e.$v$=null,e.$DEF=e.$ERR=e.DEF=e.ERR=null,e},token:function(e,t){var n,o,r,l,i,s,u,a,c,p,m,h,g,d,k,$=this,y=$.$grammar,b=y.Style,x=$.DEF,v=$.ERR,w={},C=$.$n$,O=$.$t$,S=$.$v$,_=y.$interleaved,E=y.$parser,L=E.length,q=_?_.length:0;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.stack,i=t.line,s=e.pos,m=!1,g=!0,h=!1,d=!1,k=t.block?t.block.name:rn,l.length&&Mt===l[l.length-1].type&&e.sol()&&l.pop(),(!l.length||Ft!==l[l.length-1].type&&k!==l[l.length-1].name)&&e.spc()&&(g=!1,d=!0),w[C]=null,w[O]=x,w[S]=null,g)for(r=new U,u=0;g&&(l.length||L>u)&&!e.eol();){if(c=e.pos,p=l.length,q&&!t.block){for(a=0;q>a;a++)if(n=_[a],m=H(n,e,t,r),!1!==m){g=!1;break}if(!g)break}if(!l.length&&u>=L)break;if(n=l.length?l.pop():E[u++],m=H(n,e,t,r),!1===m){if(n.status>){t.token=n,f(l,n.$id),e.nxt(!0)||(e.spc(),d=!0),h=!0,g=!1;break}}else{if(l.length>1&&e.eol()&&jt&l[l.length-1].type&&t.block&&t.block.name===l[l.length-1].name)for(a=l.length-2;a>=0&&Et===l[a].type;)o=l[a--],K(o,e,t,r),o.status&ft&&(t.$actionerr$=!0);else if(l.length&&Et===l[l.length-1].type)for(;l.length&&Et===l[l.length-1].type;)o=l.pop(),K(o,e,t,r),o.status&ft&&(t.$actionerr$=!0);if(!0!==m){g=!1;break}}}return g&&e.nxt(1),w[S]=e.cur(1),!1!==m?(m=b[m]||x,w[C]=n.name):h?(m=v,t.status&at&&Z(t,i,s,i,e.pos,n)):m=x,w[O]=m,t.$eol$=e.eol(),t.$blank$=t.$blank$&&(d||t.$eol$),w},autocompletion:function(e,t){var n,o,r,l=e.stack,i={},s=P([e.token],[],i);for(t=t||0,n=l.length-1;n>=0;n--)if(o=l[n],r=o.type,zt&r){if(s=P([o],s,i),0=a;++a)if(r=t.line(a),l=t.indentation(r),l>o)s=a,u=r.length;else if(e.test(r))break;return s?[p,i,s,u]:void 0}}},Delimited:function(e,t,n){return e&&t?(n=n||s,function(o){var r,l,i,s,u,a,c,p,f,m,h,g,d,k,$,y=o.row,b=o.col;for(r=o.line(y),i=b,s=0;;){var u=0>=i?-1:r.lastIndexOf(e,i-1);if(-1!==u){if(1===s&&b>u)return;if(n(a=o.token(y,u+1))){l=u+e.length;break}i=u-1}else{if(1===s)return;s=1,i=r.length}}c=1,p=o.last();e:for(h=y;p>=h;++h)for(g=o.line(h),d=h===y?l:0;k=g.indexOf(e,d),$=g.indexOf(t,d),0>k&&(k=g.length),0>$&&($=g.length),d=mn(k,$),!(d>=g.length);){if(o.token(h,d+1)==a)if(d===k)++c;else if(!--c){f=h,m=d;break e}++d}return null==f||y===f&&m===l?void 0:[y,l,f,m]}):function(){}},MarkedUp:function(e,t,n,o,r){return e=e||s,t=t||"<",n=n||">",o=o||"/",r=r||v(x(t)+"("+x(o)+"?)([a-zA-Z_\\-][a-zA-Z0-9_\\-:]*)","g"),function(l){l.col=0,l.min=l.first(),l.max=l.last(),l.text=l.line(l.row);for(var i,s,u,a,c,p,f,m,h,g=l.row;;){if(i=rt(l,e,r,t,n,o),!i||l.row!==g||!(s=lt(l,e,r,t,n,o)))return;if(!i[1]&&"autoclosed"!==s)for(u=[l.row,l.col],c=i[2],a=null,p=[];;){if(f=rt(l,e,r,t,n,o),g=l.row,m=l.col-(f?f[0].length:0),!f||!(s=lt(l,e,r,t,n,o)))return;if("autoclosed"!==s)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[u[0],u[1],g,m]}else p.push(f[2])}}}}},Vn="undefined"!=typeof CodeMirror?CodeMirror:{Pass:{toString:function(){return"CodeMirror.Pass"}}},Jn=/[\w$]/,Qn=function(e,t){return t.score-e.score},Xn=k(Hn,{constructor:function to(e,n){var o,l=this,i=null;if(Hn.call(l,e,null,"error"),l.DEF=n||l.$DEF,l.ERR=e.Style.error||l.$ERR,l.LC=e.$comments.line?e.$comments.line[0]:null,l.BCS=e.$comments.block?e.$comments.block[0][0]:null,l.BCE=e.$comments.block?e.$comments.block[0][1]:null,l.BCC=l.BCL=e.$comments.block?e.$comments.block[0][2]:null,e.$comments.block&&e.$comments.block.length){o=to.Type("comment");for(var u=0,a=e.$comments.block.length;a>u;u++)l.$folders.push(to.Fold.Delimited(e.$comments.block[u][0],e.$comments.block[u][1],o))}e.Fold&&Cn&t(e.Fold)?i=e.Fold[hn]():e.$extra.fold&&(i=e.$extra.fold[hn]()),i&&(i=i.split("+"),r(function(t,n){var r=Dn(n[t]);if("brace"===r||"cstyle"===r){var i=D(e,1);o=i.length?to.Type(i,!1):s,l.$folders.push(to.Fold.Delimited("{","}",o)),l.$folders.push(to.Fold.Delimited("[","]",o))}else"indent"===r||"indentation"===r?l.$folders.push(to.Fold.Indented()):("markup"===r||"html"===r||"xml"===r)&&(l.$folders.push(to.Fold.Delimited("",to.Type(["comment","tag"],!1))),l.$folders.push(to.Fold.MarkedUp(to.Type("tag"),"<",">","/")))},0,i.length-1,i))},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,Hn[ln].dispose.call(e)},validate:function(e,t,n){if(!e||!e.length)return[];var o,r,l,i,s=this,u=[],a=s.parse(e,at);if(!a)return u;t=t||{},l=t[sn]("type")?t.type:"error",i=t[sn]("msg")?t.msg:"Syntax Error";for(o in a)a[sn](o)&&(r=a[o],u.push({message:r[4]||i,severity:l,from:n.Pos(r[0],r[1]),to:n.Pos(r[2],r[3])}));return u},autocomplete:function(e,t,n){var r,l,i,s,u,a,c,p,f,m,h,g=this,d=[],k=e.getCursor(),$=k.ch,y=$,b=$,x=b,v=0;if(g.$grammar.$autocomplete){for(t=t||{},u=t.word||Jn,r=e.getLine(k.line),p=t[sn]("prefixMatch")?!!t.prefixMatch:!0,f=t[sn]("inContext")?!!t.inContext:!1,c=t[sn]("caseInsensitiveMatch")?!!t.caseInsensitiveMatch:!1;y&&u.test(r[gn](y-1));)--y;if(!p)for(;x=s&&(n=t.meta,o=!!k.ci,d=c||o,d?(f=k[hn](),g=i):(f=k,g=l),(u=f.indexOf(g))>=0&&(!p||0===u)&&(r=d?k.indexOf(l):u,$+n.length>v&&(v=$+n.length),e.push({text:k,name:k,meta:n,start:0>r?u:r,end:(0>r?u:r)+l.length,match:l,displayText:k+" ["+n+"]",render:a,score:1e3-10*($-s)-5*(0>r?u+3:r)}))):(n=t.meta,$+n.length>v&&(v=$+n.length),e.push({text:k,name:k,meta:n,start:0,end:0,match:"",displayText:k+" ["+n+"]",render:a,score:m?1e3-10*$:h--})),e};f?(m=!1,d=o(g.autocompletion(e.getTokenAt(n.Pos(k.line,y),!0).state),w,d),d.length||(m=!0,d=o(g.$grammar.$autocomplete,w,d))):(m=!0,d=o(g.$grammar.$autocomplete,w,d)),d.length&&(d=d.sort(Qn)),d.maxlen=v}return{list:d,from:n.Pos(k.line,y),to:n.Pos(k.line,x)}},indent:function(e,t,n,o,r,l){return l.Pass},iterator:function(e,t){var n=e.getOption("tabSize");return{row:0,col:0,min:0,max:0,line:function(t){return e.getLine(t)},first:function(){return e.firstLine()},last:function(){return e.lastLine()},next:function(){var e=this;if(!(e.row>=e.max))return e.col=0,e.row++,!0},prev:function(){var e=this;if(!(e.row<=e.min))return e.col=0,e.row--,!0},indentation:function(e){return nt(e,null,n)},token:function(n,o){return e.getTokenTypeAt(t.Pos(n,o))}}},fold:function(e,t,n){var o,r,l,i=this,s=i.$folders,u=s.length;if(u)for(r=i.iterator(e,n),r.row=t.line,r.col=t.ch||0,o=0;u>o;o++)if(l=s[o](r))return l}});Xn.Type=ot,Xn.Fold=Kn;var eo=e.CodeMirrorGrammar={VERSION:"3.1.0",clone:l,extend:i,pre_process:A,parse:z,getMode:st,Parser:Xn};return e.CodeMirrorGrammar}); \ No newline at end of file diff --git a/editor-grammar b/editor-grammar index 6ebe9e3..12187a2 160000 --- a/editor-grammar +++ b/editor-grammar @@ -1 +1 @@ -Subproject commit 6ebe9e38c9d8201c9172ba64386b5447574cc4fb +Subproject commit 12187a2eb088ff60b9dc822edeac8a478737a99d