@networkteam/eel
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.networkteamEel=e():t.networkteamEel=e()}(global,(function(){return function(t){var e={};function n(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(s,r,function(e){return t[e]}.bind(null,r));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){var s,r;s=this,r=function(){function t(e,n,s){return this.id=++t.highestId,this.name=e,this.symbols=n,this.postprocess=s,this}function e(t,e,n,s){this.rule=t,this.dot=e,this.reference=n,this.data=[],this.wantedBy=s,this.isComplete=this.dot===t.symbols.length}function n(t,e){this.grammar=t,this.index=e,this.states=[],this.wants={},this.scannable=[],this.completed={}}function s(t,e){this.rules=t,this.start=e||this.rules[0].name;var n=this.byName={};this.rules.forEach((function(t){n.hasOwnProperty(t.name)||(n[t.name]=[]),n[t.name].push(t)}))}function r(){this.reset("")}function o(t,e,o){if(t instanceof s){var i=t;o=e}else i=s.fromCompiled(t,e);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new r},o||{})this.options[a]=o[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(i,0);this.table=[l],l.wants[i.start]=[],l.predict(i.start),l.process(),this.current=0}return t.highestId=0,t.prototype.toString=function(t){function e(t){return t.literal?JSON.stringify(t.literal):t.type?"%"+t.type:t.toString()}var n=void 0===t?this.symbols.map(e).join(" "):this.symbols.slice(0,t).map(e).join(" ")+" ● "+this.symbols.slice(t).map(e).join(" ");return this.name+" → "+n},e.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},e.prototype.nextState=function(t){var n=new e(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=t,n.isComplete&&(n.data=n.build()),n},e.prototype.build=function(){var t=[],e=this;do{t.push(e.right.data),e=e.left}while(e.left);return t.reverse(),t},e.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,o.fail))},n.prototype.process=function(t){for(var e=this.states,n=this.wants,s=this.completed,r=0;r<e.length;r++){var i=e[r];if(i.isComplete){if(i.finish(),i.data!==o.fail){for(var a=i.wantedBy,l=a.length;l--;){var c=a[l];this.complete(c,i)}if(i.reference===this.index){var u=i.rule.name;(this.completed[u]=this.completed[u]||[]).push(i)}}}else{if("string"!=typeof(u=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(n[u]){if(n[u].push(i),s.hasOwnProperty(u)){var p=s[u];for(l=0;l<p.length;l++){var f=p[l];this.complete(i,f)}}}else n[u]=[i],this.predict(u)}}},n.prototype.predict=function(t){for(var n=this.grammar.byName[t]||[],s=0;s<n.length;s++){var r=n[s],o=this.wants[t],i=new e(r,0,this.index,o);this.states.push(i)}},n.prototype.complete=function(t,e){var n=t.nextState(e);this.states.push(n)},s.fromCompiled=function(e,n){var r=e.Lexer;e.ParserStart&&(n=e.ParserStart,e=e.ParserRules);var o=new s(e=e.map((function(e){return new t(e.name,e.symbols,e.postprocess)})),n);return o.lexer=r,o},r.prototype.reset=function(t,e){this.buffer=t,this.index=0,this.line=e?e.line:1,this.lastLineBreak=e?-e.col:0},r.prototype.next=function(){if(this.index<this.buffer.length){var t=this.buffer[this.index++];return"\n"===t&&(this.line+=1,this.lastLineBreak=this.index),{value:t}}},r.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},r.prototype.formatError=function(t,e){var n=this.buffer;if("string"==typeof n){var s=n.indexOf("\n",this.index);-1===s&&(s=n.length);var r=n.substring(this.lastLineBreak,s),o=this.index-this.lastLineBreak;return e+=" at line "+this.line+" col "+o+":\n\n",e+=" "+r+"\n",e+=" "+Array(o).join(" ")+"^"}return e+" at index "+(this.index-1)},o.fail={},o.prototype.feed=function(t){var e,s=this.lexer;for(s.reset(t,this.lexerState);e=s.next();){var o=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var i=this.current+1,a=new n(this.grammar,i);this.table.push(a);for(var l=void 0!==e.text?e.text:e.value,c=s.constructor===r?e.value:e,u=o.scannable,p=u.length;p--;){var f=u[p],m=f.rule.symbols[f.dot];if(m.test?m.test(c):m.type?m.type===e.type:m.literal===l){var h=f.nextState({data:c,token:e,isToken:!0,reference:i-1});a.states.push(h)}}if(a.process(),0===a.states.length){var b=new Error(this.reportError(e));throw b.offset=this.current,b.token=e,b}this.options.keepHistory&&(o.lexerState=s.save()),this.current++}return o&&(this.lexerState=s.save()),this.results=this.finish(),this},o.prototype.reportError=function(t){var e=[],n=(t.type?t.type+" token: ":"")+JSON.stringify(void 0!==t.value?t.value:t);e.push(this.lexer.formatError(t,"Syntax error")),e.push("Unexpected "+n+". Instead, I was expecting to see one of the following:\n");var s=this.table.length-2;return this.table[s].states.filter((function(t){var e=t.rule.symbols[t.dot];return e&&"string"!=typeof e})).map((function(t){return this.buildStateStacks(t,[])[0]}),this).forEach((function(t){var n=t[0],s=n.rule.symbols[n.dot],r=this.getSymbolDisplay(s);e.push("A "+r+" based on:"),this.displayStateStack(t,e)}),this),e.push(""),e.join("\n")},o.prototype.displayStateStack=function(t,e){for(var n,s=0,r=0;r<t.length;r++){var o=t[r],i=o.rule.toString(o.dot);i===n?s++:(s>0&&e.push(" ⬆ ︎"+s+" more lines identical to this"),s=0,e.push(" "+i)),n=i}},o.prototype.getSymbolDisplay=function(t){var e=typeof t;if("string"===e)return t;if("object"===e&&t.literal)return JSON.stringify(t.literal);if("object"===e&&t instanceof RegExp)return"character matching "+t;if("object"===e&&t.type)return t.type+" token";throw new Error("Unknown symbol type: "+t)},o.prototype.buildStateStacks=function(t,e){if(-1!==e.indexOf(t))return[];if(0===t.wantedBy.length)return[[t]];var n=this;return t.wantedBy.reduce((function(s,r){return s.concat(n.buildStateStacks(r,[t].concat(e)).map((function(e){return[t].concat(e)})))}),[])},o.prototype.save=function(){var t=this.table[this.current];return t.lexerState=this.lexerState,t},o.prototype.restore=function(t){var e=t.index;this.current=e,this.table[e]=t,this.table.splice(e+1),this.lexerState=t.lexerState,this.results=this.finish()},o.prototype.rewind=function(t){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[t])},o.prototype.finish=function(){var t=[],e=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(n){n.rule.name===e&&n.dot===n.rule.symbols.length&&0===n.reference&&n.data!==o.fail&&t.push(n)})),t.map((function(t){return t.data}))},{Parser:o,Grammar:s,Rule:t}},t.exports?t.exports=r():s.nearley=r()},function(t,e,n){function s(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}!function(){function e(t){return t[0]}var n={Lexer:void 0,ParserRules:[{name:"expression",symbols:["conditional"],postprocess:function(t){return t[0]}},{name:"conditional",symbols:["disjunction","_",{literal:"?"},"_","expression","_",{literal:":"},"_","expression"],postprocess:function(t){return t[0]+"?"+t[4]+":"+t[8]}},{name:"conditional",symbols:["disjunction"],postprocess:function(t){return t[0]}},{name:"parens",symbols:[{literal:"("},"_","expression","_",{literal:")"}],postprocess:function(t){return"("+t[2]+")"}},{name:"parens",symbols:["atom"],postprocess:function(t){return t[0]}},{name:"disjunction$string$1",symbols:[{literal:"|"},{literal:"|"}],postprocess:function(t){return t.join("")}},{name:"disjunction",symbols:["disjunction","_","disjunction$string$1","_","conjunction"],postprocess:function(t){return t[0]+"||"+t[4]}},{name:"disjunction",symbols:["conjunction"],postprocess:function(t){return t[0]}},{name:"conjunction$string$1",symbols:[{literal:"&"},{literal:"&"}],postprocess:function(t){return t.join("")}},{name:"conjunction",symbols:["conjunction","_","conjunction$string$1","_","comparison"],postprocess:function(t){return t[0]+"&&"+t[4]}},{name:"conjunction",symbols:["comparison"],postprocess:function(t){return t[0]}},{name:"comparison",symbols:["comparison","_","COMPARISON_OP","_","sumcalc"],postprocess:function(t){return t[0]+t[2]+t[4]}},{name:"comparison",symbols:["sumcalc"],postprocess:function(t){return t[0]}},{name:"sumcalc",symbols:["sumcalc","_","SUM_OP","_","prodcalc"],postprocess:function(t){return t[0]+t[2]+t[4]}},{name:"sumcalc",symbols:["prodcalc"],postprocess:function(t){return t[0]}},{name:"prodcalc",symbols:["prodcalc","_","PROD_OP","_","negation"],postprocess:function(t){return t[0]+t[2]+t[4]}},{name:"prodcalc",symbols:["negation"],postprocess:function(t){return t[0]}},{name:"negation",symbols:[{literal:"!"},"_","negation"],postprocess:function(t){return"!"+t[2]}},{name:"negation",symbols:["parens"],postprocess:function(t){return t[0]}},{name:"offsetaccess",symbols:[{literal:"["},"_","expression","_",{literal:"]"}],postprocess:function(t){return"helper.val("+t[2]+")"}},{name:"methodcall$ebnf$1",symbols:["expression"],postprocess:e},{name:"methodcall$ebnf$1",symbols:[],postprocess:function(t){return null}},{name:"methodcall$ebnf$2",symbols:[]},{name:"methodcall$ebnf$2$subexpression$1",symbols:[{literal:","},"_","expression"]},{name:"methodcall$ebnf$2",symbols:["methodcall$ebnf$2","methodcall$ebnf$2$subexpression$1"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"methodcall",symbols:["IDENTIFIER","_",{literal:"("},"_","methodcall$ebnf$1","_","methodcall$ebnf$2","_",{literal:")"}],postprocess:function(t){return'helper.call("'+t[0]+'", ['+(t[4]?[t[4]].concat(s(t[6].map((function(t){return t[2]})))).join(","):"")+"])"}},{name:"objectpath$ebnf$1",symbols:[]},{name:"objectpath$ebnf$1$subexpression$1",symbols:["nested_methodcall_or_identifier"]},{name:"objectpath$ebnf$1$subexpression$1",symbols:["offsetaccess"]},{name:"objectpath$ebnf$1",symbols:["objectpath$ebnf$1","objectpath$ebnf$1$subexpression$1"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"objectpath",symbols:["methodcall_or_identifier","objectpath$ebnf$1"],postprocess:function(t){var e=t[0]+"(ctx)",n=!0,s=!1,r=void 0;try{for(var o,i=t[1][Symbol.iterator]();!(n=(o=i.next()).done);n=!0){e=o.value[0]+"("+e+")"}}catch(t){s=!0,r=t}finally{try{n||null==i.return||i.return()}finally{if(s)throw r}}return e}},{name:"nested_methodcall_or_identifier",symbols:[{literal:"."},"methodcall_or_identifier"],postprocess:function(t){return t[1]}},{name:"methodcall_or_identifier",symbols:["methodcall"],postprocess:function(t){return t[0]}},{name:"methodcall_or_identifier",symbols:["identifier"],postprocess:function(t){return t[0]}},{name:"identifier",symbols:["IDENTIFIER"],postprocess:function(t){return'helper.val("'+t[0]+'")'}},{name:"atom",symbols:["objectpath"],postprocess:function(t){return t[0]}},{name:"atom",symbols:["NUMBER"],postprocess:function(t){return t[0]}},{name:"atom",symbols:["dqstring"],postprocess:function(t){return t[0]}},{name:"atom",symbols:["sqstring"],postprocess:function(t){return t[0]}},{name:"IDENTIFIER$ebnf$1",symbols:[]},{name:"IDENTIFIER$ebnf$1",symbols:["IDENTIFIER$ebnf$1",/[a-zA-Z_0-9]/],postprocess:function(t){return t[0].concat([t[1]])}},{name:"IDENTIFIER",symbols:[/[a-zA-Z_]/,"IDENTIFIER$ebnf$1"],postprocess:function(t){return t[0]+t[1].join("")}},{name:"NUMBER$ebnf$1",symbols:[{literal:"-"}],postprocess:e},{name:"NUMBER$ebnf$1",symbols:[],postprocess:function(t){return null}},{name:"NUMBER$ebnf$2",symbols:[/[0-9]/]},{name:"NUMBER$ebnf$2",symbols:["NUMBER$ebnf$2",/[0-9]/],postprocess:function(t){return t[0].concat([t[1]])}},{name:"NUMBER",symbols:["NUMBER$ebnf$1","NUMBER$ebnf$2"],postprocess:function(t){return(t[0]||"")+t[1].join("")}},{name:"COMPARISON_OP$string$1",symbols:[{literal:"="},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$1"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP$string$2",symbols:[{literal:"!"},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$2"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP$string$3",symbols:[{literal:"<"},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$3"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP$string$4",symbols:[{literal:">"},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$4"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP",symbols:[{literal:"<"}],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP",symbols:[{literal:">"}],postprocess:function(t){return t[0]}},{name:"SUM_OP",symbols:[{literal:"+"}],postprocess:function(t){return t[0]}},{name:"SUM_OP",symbols:[{literal:"-"}],postprocess:function(t){return t[0]}},{name:"PROD_OP",symbols:[{literal:"*"}],postprocess:function(t){return t[0]}},{name:"PROD_OP",symbols:[{literal:"/"}],postprocess:function(t){return t[0]}},{name:"PROD_OP",symbols:[{literal:"%"}],postprocess:function(t){return t[0]}},{name:"dqstring$ebnf$1",symbols:[]},{name:"dqstring$ebnf$1",symbols:["dqstring$ebnf$1","dstrchar"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"dqstring",symbols:[{literal:'"'},"dqstring$ebnf$1",{literal:'"'}],postprocess:function(t){return'"'+t[1].join("")+'"'}},{name:"dstrchar",symbols:[/[^\\"\n]/],postprocess:e},{name:"dstrchar",symbols:[{literal:"\\"},"strescape"],postprocess:function(t){return t.join("")}},{name:"sqstring$ebnf$1",symbols:[]},{name:"sqstring$ebnf$1",symbols:["sqstring$ebnf$1","sstrchar"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"sqstring",symbols:[{literal:"'"},"sqstring$ebnf$1",{literal:"'"}],postprocess:function(t){return"'"+t[1].join("")+"'"}},{name:"sstrchar",symbols:[/[^\\'\n]/],postprocess:e},{name:"sstrchar",symbols:[{literal:"\\"},"strescape"],postprocess:function(t){return t.join("")}},{name:"strescape",symbols:[/["'\\\/bfnrt]/],postprocess:e},{name:"strescape",symbols:[{literal:"u"},/[a-fA-F0-9]/,/[a-fA-F0-9]/,/[a-fA-F0-9]/,/[a-fA-F0-9]/],postprocess:function(t){return t.join("")}},{name:"_$ebnf$1",symbols:[]},{name:"_$ebnf$1",symbols:["_$ebnf$1",/[\s]/],postprocess:function(t){return t[0].concat([t[1]])}},{name:"_",symbols:["_$ebnf$1"],postprocess:function(t){return null}}],ParserStart:"expression"};void 0!==t.exports?t.exports=n:window.grammar=n}()},function(t,e,n){"use strict";n.r(e);var s=n(0),r=n.n(s),o=n(1),i=n.n(o),a=r.a.Grammar.fromCompiled(i.a),l={val:function(t){return function(e){return e&&e[t]}},call:function(t,e){var n=this;return function(s){return s&&"function"==typeof s[t]?s[t].apply(n,e):void 0}}};function c(t){var e=function(t){var e=new r.a.Parser(a);if(e.feed(t),!e.results||0===e.results.length)throw new Error("empty expression");return e.results[0]}(t),n="return ".concat(e,";"),s=new Function("helper","ctx",n);return function(t){return s(l,t)}}n.d(e,"compile",(function(){return c}))}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.networkteamEel=e():t.networkteamEel=e()}(global,(()=>(()=>{var t={515:function(t){var e;e=function(){function t(e,n,r){return this.id=++t.highestId,this.name=e,this.symbols=n,this.postprocess=r,this}function e(t,e,n,r){this.rule=t,this.dot=e,this.reference=n,this.data=[],this.wantedBy=r,this.isComplete=this.dot===t.symbols.length}function n(t,e){this.grammar=t,this.index=e,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(t,e){this.rules=t,this.start=e||this.rules[0].name;var n=this.byName={};this.rules.forEach((function(t){n.hasOwnProperty(t.name)||(n[t.name]=[]),n[t.name].push(t)}))}function s(){this.reset("")}function o(t,e,o){if(t instanceof r){var i=t;o=e}else i=r.fromCompiled(t,e);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new s},o||{})this.options[a]=o[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(i,0);this.table=[l],l.wants[i.start]=[],l.predict(i.start),l.process(),this.current=0}function i(t){var e=typeof t;if("string"===e)return t;if("object"===e){if(t.literal)return JSON.stringify(t.literal);if(t instanceof RegExp)return t.toString();if(t.type)return"%"+t.type;if(t.test)return"<"+String(t.test)+">";throw new Error("Unknown symbol type: "+t)}}return t.highestId=0,t.prototype.toString=function(t){var e=void 0===t?this.symbols.map(i).join(" "):this.symbols.slice(0,t).map(i).join(" ")+" ● "+this.symbols.slice(t).map(i).join(" ");return this.name+" → "+e},e.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},e.prototype.nextState=function(t){var n=new e(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=t,n.isComplete&&(n.data=n.build(),n.right=void 0),n},e.prototype.build=function(){var t=[],e=this;do{t.push(e.right.data),e=e.left}while(e.left);return t.reverse(),t},e.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,o.fail))},n.prototype.process=function(t){for(var e=this.states,n=this.wants,r=this.completed,s=0;s<e.length;s++){var i=e[s];if(i.isComplete){if(i.finish(),i.data!==o.fail){for(var a=i.wantedBy,l=a.length;l--;){var c=a[l];this.complete(c,i)}if(i.reference===this.index){var u=i.rule.name;(this.completed[u]=this.completed[u]||[]).push(i)}}}else{if("string"!=typeof(u=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(n[u]){if(n[u].push(i),r.hasOwnProperty(u)){var p=r[u];for(l=0;l<p.length;l++){var f=p[l];this.complete(i,f)}}}else n[u]=[i],this.predict(u)}}},n.prototype.predict=function(t){for(var n=this.grammar.byName[t]||[],r=0;r<n.length;r++){var s=n[r],o=this.wants[t],i=new e(s,0,this.index,o);this.states.push(i)}},n.prototype.complete=function(t,e){var n=t.nextState(e);this.states.push(n)},r.fromCompiled=function(e,n){var s=e.Lexer;e.ParserStart&&(n=e.ParserStart,e=e.ParserRules);var o=new r(e=e.map((function(e){return new t(e.name,e.symbols,e.postprocess)})),n);return o.lexer=s,o},s.prototype.reset=function(t,e){this.buffer=t,this.index=0,this.line=e?e.line:1,this.lastLineBreak=e?-e.col:0},s.prototype.next=function(){if(this.index<this.buffer.length){var t=this.buffer[this.index++];return"\n"===t&&(this.line+=1,this.lastLineBreak=this.index),{value:t}}},s.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},s.prototype.formatError=function(t,e){var n=this.buffer;if("string"==typeof n){var r=n.split("\n").slice(Math.max(0,this.line-5),this.line),s=n.indexOf("\n",this.index);-1===s&&(s=n.length);var o=this.index-this.lastLineBreak,i=String(this.line).length;return e+=" at line "+this.line+" col "+o+":\n\n",(e+=r.map((function(t,e){return a(this.line-r.length+e+1,i)+" "+t}),this).join("\n"))+"\n"+a("",i+o)+"^\n"}return e+" at index "+(this.index-1);function a(t,e){var n=String(t);return Array(e-n.length+1).join(" ")+n}},o.fail={},o.prototype.feed=function(t){var e,r=this.lexer;for(r.reset(t,this.lexerState);;){try{if(!(e=r.next()))break}catch(t){var o=new n(this.grammar,this.current+1);throw this.table.push(o),(l=new Error(this.reportLexerError(t))).offset=this.current,l.token=t.token,l}var i=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;o=new n(this.grammar,a),this.table.push(o);for(var l,c=void 0!==e.text?e.text:e.value,u=r.constructor===s?e.value:e,p=i.scannable,f=p.length;f--;){var m=p[f],h=m.rule.symbols[m.dot];if(h.test?h.test(u):h.type?h.type===e.type:h.literal===c){var b=m.nextState({data:u,token:e,isToken:!0,reference:a-1});o.states.push(b)}}if(o.process(),0===o.states.length)throw(l=new Error(this.reportError(e))).offset=this.current,l.token=e,l;this.options.keepHistory&&(i.lexerState=r.save()),this.current++}return i&&(this.lexerState=r.save()),this.results=this.finish(),this},o.prototype.reportLexerError=function(t){var e,n,r=t.token;return r?(e="input "+JSON.stringify(r.text[0])+" (lexer error)",n=this.lexer.formatError(r,"Syntax error")):(e="input (lexer error)",n=t.message),this.reportErrorCommon(n,e)},o.prototype.reportError=function(t){var e=(t.type?t.type+" token: ":"")+JSON.stringify(void 0!==t.value?t.value:t),n=this.lexer.formatError(t,"Syntax error");return this.reportErrorCommon(n,e)},o.prototype.reportErrorCommon=function(t,e){var n=[];n.push(t);var r=this.table.length-2,s=this.table[r],o=s.states.filter((function(t){var e=t.rule.symbols[t.dot];return e&&"string"!=typeof e}));return 0===o.length?(n.push("Unexpected "+e+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(s.states,n)):(n.push("Unexpected "+e+". Instead, I was expecting to see one of the following:\n"),o.map((function(t){return this.buildFirstStateStack(t,[])||[t]}),this).forEach((function(t){var e=t[0],r=e.rule.symbols[e.dot],s=this.getSymbolDisplay(r);n.push("A "+s+" based on:"),this.displayStateStack(t,n)}),this)),n.push(""),n.join("\n")},o.prototype.displayStateStack=function(t,e){for(var n,r=0,s=0;s<t.length;s++){var o=t[s],i=o.rule.toString(o.dot);i===n?r++:(r>0&&e.push(" ^ "+r+" more lines identical to this"),r=0,e.push(" "+i)),n=i}},o.prototype.getSymbolDisplay=function(t){return function(t){var e=typeof t;if("string"===e)return t;if("object"===e){if(t.literal)return JSON.stringify(t.literal);if(t instanceof RegExp)return"character matching "+t;if(t.type)return t.type+" token";if(t.test)return"token matching "+String(t.test);throw new Error("Unknown symbol type: "+t)}}(t)},o.prototype.buildFirstStateStack=function(t,e){if(-1!==e.indexOf(t))return null;if(0===t.wantedBy.length)return[t];var n=t.wantedBy[0],r=[t].concat(e),s=this.buildFirstStateStack(n,r);return null===s?null:[t].concat(s)},o.prototype.save=function(){var t=this.table[this.current];return t.lexerState=this.lexerState,t},o.prototype.restore=function(t){var e=t.index;this.current=e,this.table[e]=t,this.table.splice(e+1),this.lexerState=t.lexerState,this.results=this.finish()},o.prototype.rewind=function(t){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[t])},o.prototype.finish=function(){var t=[],e=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(n){n.rule.name===e&&n.dot===n.rule.symbols.length&&0===n.reference&&n.data!==o.fail&&t.push(n)})),t.map((function(t){return t.data}))},{Parser:o,Grammar:r,Rule:t}},t.exports?t.exports=e():this.nearley=e()},441:t=>{function e(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}!function(){function r(t){return t[0]}var s={Lexer:void 0,ParserRules:[{name:"expression",symbols:["conditional"],postprocess:function(t){return t[0]}},{name:"conditional",symbols:["disjunction","_",{literal:"?"},"_","expression","_",{literal:":"},"_","expression"],postprocess:function(t){return t[0]+"?"+t[4]+":"+t[8]}},{name:"conditional",symbols:["disjunction"],postprocess:function(t){return t[0]}},{name:"parens",symbols:[{literal:"("},"_","expression","_",{literal:")"}],postprocess:function(t){return"("+t[2]+")"}},{name:"parens",symbols:["atom"],postprocess:function(t){return t[0]}},{name:"disjunction$string$1",symbols:[{literal:"|"},{literal:"|"}],postprocess:function(t){return t.join("")}},{name:"disjunction",symbols:["disjunction","_","disjunction$string$1","_","conjunction"],postprocess:function(t){return t[0]+"||"+t[4]}},{name:"disjunction",symbols:["conjunction"],postprocess:function(t){return t[0]}},{name:"conjunction$string$1",symbols:[{literal:"&"},{literal:"&"}],postprocess:function(t){return t.join("")}},{name:"conjunction",symbols:["conjunction","_","conjunction$string$1","_","comparison"],postprocess:function(t){return t[0]+"&&"+t[4]}},{name:"conjunction",symbols:["comparison"],postprocess:function(t){return t[0]}},{name:"comparison",symbols:["comparison","_","COMPARISON_OP","_","sumcalc"],postprocess:function(t){return t[0]+t[2]+t[4]}},{name:"comparison",symbols:["sumcalc"],postprocess:function(t){return t[0]}},{name:"sumcalc",symbols:["sumcalc","_","SUM_OP","_","prodcalc"],postprocess:function(t){return t[0]+t[2]+t[4]}},{name:"sumcalc",symbols:["prodcalc"],postprocess:function(t){return t[0]}},{name:"prodcalc",symbols:["prodcalc","_","PROD_OP","_","negation"],postprocess:function(t){return t[0]+t[2]+t[4]}},{name:"prodcalc",symbols:["negation"],postprocess:function(t){return t[0]}},{name:"negation",symbols:[{literal:"!"},"_","negation"],postprocess:function(t){return"!"+t[2]}},{name:"negation",symbols:["parens"],postprocess:function(t){return t[0]}},{name:"offsetaccess",symbols:[{literal:"["},"_","expression","_",{literal:"]"}],postprocess:function(t){return"helper.val("+t[2]+")"}},{name:"methodcall$ebnf$1",symbols:["expression"],postprocess:r},{name:"methodcall$ebnf$1",symbols:[],postprocess:function(t){return null}},{name:"methodcall$ebnf$2",symbols:[]},{name:"methodcall$ebnf$2$subexpression$1",symbols:[{literal:","},"_","expression"]},{name:"methodcall$ebnf$2",symbols:["methodcall$ebnf$2","methodcall$ebnf$2$subexpression$1"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"methodcall",symbols:["IDENTIFIER","_",{literal:"("},"_","methodcall$ebnf$1","_","methodcall$ebnf$2","_",{literal:")"}],postprocess:function(t){return'helper.call("'+t[0]+'", ['+(t[4]?[t[4]].concat((r=t[6].map((function(t){return t[2]})),function(t){if(Array.isArray(t))return n(t)}(r)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||e(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())).join(","):"")+"])";var r}},{name:"objectpath$ebnf$1",symbols:[]},{name:"objectpath$ebnf$1$subexpression$1",symbols:["nested_methodcall_or_identifier"]},{name:"objectpath$ebnf$1$subexpression$1",symbols:["offsetaccess"]},{name:"objectpath$ebnf$1",symbols:["objectpath$ebnf$1","objectpath$ebnf$1$subexpression$1"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"objectpath",symbols:["methodcall_or_identifier","objectpath$ebnf$1"],postprocess:function(t){var n,r=t[0]+"(ctx)",s=function(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=e(t))){r&&(t=r);var s=0,o=function(){};return{s:o,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}(t[1]);try{for(s.s();!(n=s.n()).done;)r=n.value[0]+"("+r+")"}catch(t){s.e(t)}finally{s.f()}return r}},{name:"nested_methodcall_or_identifier",symbols:[{literal:"."},"methodcall_or_identifier"],postprocess:function(t){return t[1]}},{name:"methodcall_or_identifier",symbols:["methodcall"],postprocess:function(t){return t[0]}},{name:"methodcall_or_identifier",symbols:["identifier"],postprocess:function(t){return t[0]}},{name:"identifier",symbols:["IDENTIFIER"],postprocess:function(t){return'helper.val("'+t[0]+'")'}},{name:"atom",symbols:["objectpath"],postprocess:function(t){return t[0]}},{name:"atom",symbols:["NUMBER"],postprocess:function(t){return t[0]}},{name:"atom",symbols:["dqstring"],postprocess:function(t){return t[0]}},{name:"atom",symbols:["sqstring"],postprocess:function(t){return t[0]}},{name:"IDENTIFIER$ebnf$1",symbols:[]},{name:"IDENTIFIER$ebnf$1",symbols:["IDENTIFIER$ebnf$1",/[a-zA-Z_0-9]/],postprocess:function(t){return t[0].concat([t[1]])}},{name:"IDENTIFIER",symbols:[/[a-zA-Z_]/,"IDENTIFIER$ebnf$1"],postprocess:function(t){return t[0]+t[1].join("")}},{name:"NUMBER$ebnf$1",symbols:[{literal:"-"}],postprocess:r},{name:"NUMBER$ebnf$1",symbols:[],postprocess:function(t){return null}},{name:"NUMBER$ebnf$2",symbols:[/[0-9]/]},{name:"NUMBER$ebnf$2",symbols:["NUMBER$ebnf$2",/[0-9]/],postprocess:function(t){return t[0].concat([t[1]])}},{name:"NUMBER",symbols:["NUMBER$ebnf$1","NUMBER$ebnf$2"],postprocess:function(t){return(t[0]||"")+t[1].join("")}},{name:"COMPARISON_OP$string$1",symbols:[{literal:"="},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$1"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP$string$2",symbols:[{literal:"!"},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$2"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP$string$3",symbols:[{literal:"<"},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$3"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP$string$4",symbols:[{literal:">"},{literal:"="}],postprocess:function(t){return t.join("")}},{name:"COMPARISON_OP",symbols:["COMPARISON_OP$string$4"],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP",symbols:[{literal:"<"}],postprocess:function(t){return t[0]}},{name:"COMPARISON_OP",symbols:[{literal:">"}],postprocess:function(t){return t[0]}},{name:"SUM_OP",symbols:[{literal:"+"}],postprocess:function(t){return t[0]}},{name:"SUM_OP",symbols:[{literal:"-"}],postprocess:function(t){return t[0]}},{name:"PROD_OP",symbols:[{literal:"*"}],postprocess:function(t){return t[0]}},{name:"PROD_OP",symbols:[{literal:"/"}],postprocess:function(t){return t[0]}},{name:"PROD_OP",symbols:[{literal:"%"}],postprocess:function(t){return t[0]}},{name:"dqstring$ebnf$1",symbols:[]},{name:"dqstring$ebnf$1",symbols:["dqstring$ebnf$1","dstrchar"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"dqstring",symbols:[{literal:'"'},"dqstring$ebnf$1",{literal:'"'}],postprocess:function(t){return'"'+t[1].join("")+'"'}},{name:"dstrchar",symbols:[/[^\\"\n]/],postprocess:r},{name:"dstrchar",symbols:[{literal:"\\"},"strescape"],postprocess:function(t){return t.join("")}},{name:"sqstring$ebnf$1",symbols:[]},{name:"sqstring$ebnf$1",symbols:["sqstring$ebnf$1","sstrchar"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"sqstring",symbols:[{literal:"'"},"sqstring$ebnf$1",{literal:"'"}],postprocess:function(t){return"'"+t[1].join("")+"'"}},{name:"sstrchar",symbols:[/[^\\'\n]/],postprocess:r},{name:"sstrchar",symbols:[{literal:"\\"},"strescape"],postprocess:function(t){return t.join("")}},{name:"strescape",symbols:[/["'\\/bfnrt]/],postprocess:r},{name:"strescape",symbols:[{literal:"u"},/[a-fA-F0-9]/,/[a-fA-F0-9]/,/[a-fA-F0-9]/,/[a-fA-F0-9]/],postprocess:function(t){return t.join("")}},{name:"_$ebnf$1",symbols:[]},{name:"_$ebnf$1",symbols:["_$ebnf$1",/[\s]/],postprocess:function(t){return t[0].concat([t[1]])}},{name:"_",symbols:["_$ebnf$1"],postprocess:function(t){return null}}],ParserStart:"expression"};void 0!==t.exports?t.exports=s:window.grammar=s}()}},e={};function n(r){var s=e[r];if(void 0!==s)return s.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{compile:()=>l});var t=n(515),e=n.n(t),s=n(441),o=n.n(s),i=e().Grammar.fromCompiled(o()),a={val:function(t){return function(e){return e&&e[t]}},call:function(t,e){var n=this;return function(r){return r&&"function"==typeof r[t]?r[t].apply(n,e):void 0}}};function l(t){var n=function(t){var n=new(e().Parser)(i);if(n.feed(t),!n.results||0===n.results.length)throw new Error("empty expression");return n.results[0]}(t),r="return ".concat(n,";"),s=new Function("helper","ctx",r);return function(t){return s(a,t)}}})(),r})())); |
@@ -9,3 +9,2 @@ { | ||
}, | ||
"type": "module", | ||
"main": "dist/main.js", | ||
@@ -17,7 +16,7 @@ "module": "src/main.js", | ||
"build:webpack": "webpack", | ||
"test-grammar": "nearley-test src/grammar.js", | ||
"test-grammar": "nearley-test src/grammar.cjs", | ||
"test": "mocha 'test/*.spec.js' --require esm" | ||
}, | ||
"dependencies": { | ||
"nearley": "^2.16.0" | ||
"nearley": "^2.20.1" | ||
}, | ||
@@ -27,9 +26,9 @@ "devDependencies": { | ||
"@babel/preset-env": "^7.4.4", | ||
"babel-loader": "^8.0.5", | ||
"babel-loader": "^8.2.2", | ||
"esm": "^3.2.25", | ||
"mocha": "^6.1.4", | ||
"webpack": "^4.30.0", | ||
"webpack-cli": "^3.3.2" | ||
"mocha": "^7.1.0", | ||
"webpack": "^5.0.0", | ||
"webpack-cli": "^5.0.0" | ||
}, | ||
"version": "2.0.1" | ||
"version": "3.0.0" | ||
} |
@@ -312,2 +312,1 @@ import compile, { parse } from '../src/compile.js'; | ||
}); | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45333
10
2
No
Updatednearley@^2.20.1