Comparing version 1.0.0-alpha.10 to 1.0.0-alpha.11
@@ -0,1 +1,17 @@ | ||
## 1.0.0-alpha.11 (December 17, 2019) | ||
- Reworked parsing to produce AST, other parts reworked to consume AST as well | ||
- Exposed `syntax` interface with 3 methods: `parse(source, tolerantMode)`, `compile(ast, suggestRanges, statMode)` and `stringify(ast)` | ||
- Added slice notation like [proposed](https://github.com/tc39/proposal-slice-notation/blob/master/README.md) for adding to JavaScript, e.g. `$str: '<foo>'; str[1:-1]` (`'foo'`) or `$ar:[1,2,3,4,5,6]; $ar[-3::-1]` (`[6,5,4]`) (#11) | ||
- Added `slice(from, to)` method | ||
- Added `split(pattern)` method | ||
- Added `join(separator)` method | ||
- Added `match(pattern, matchAll)` method | ||
- Fixed method invocation on recursive mapping, i.e. `..method()` doesn't raise an error now and works as expected without surrounding parentheses (#10) | ||
- Allowed definitions to use in parentheses, e.g. `($a: 1; $a + $a)` | ||
- Added a function definition via `=>`, i.e. `=> body` | ||
- Added sorting function definition with `asc` and `desc` keywords, e.g. `sort(foo asc)`, `$sorting: foo desc; sort($sorting)` or `sort(foo desc, bar asc)` | ||
- Changed `sort()` method to use a two argument function as a regular comparator | ||
- Removed `::self` syntax, recusion with a function defined by a variable should be used instead | ||
## 1.0.0-alpha.10 (March 7, 2019) | ||
@@ -2,0 +18,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jora=t()}}(function(){return function(){return function t(e,n,r){function s(a,c){if(!n[a]){if(!e[a]){var o="function"==typeof require&&require;if(!c&&o)return o(a,!0);if(i)return i(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){return s(e[a][1][t]||t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)s(r[a]);return s}}()({1:[function(t,e,n){var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[2,4],n=[1,12],r=[1,30],s=[1,8],i=[1,32],a=[1,20],c=[1,21],o=[1,22],h=[1,15],l=[1,16],u=[1,17],f=[1,18],p=[1,23],y=[1,24],g=[1,25],d=[1,26],b=[1,27],k=[1,31],m=[1,33],_=[1,34],v=[1,35],$=[1,36],O=[1,38],S=[1,37],x=[1,19],A=[5,17,60,70],E=[1,50],N=[1,49],w=[1,42],P=[1,43],I=[1,44],T=[1,45],j=[1,46],R=[1,47],F=[1,48],L=[1,51],U=[1,52],Y=[1,53],D=[1,54],M=[1,55],B=[1,56],z=[1,57],q=[1,58],C=[1,59],H=[1,60],G=[5,10,12,15,16,17,21,22,23,41,42,43,44,47,48,49,50,51,54,55,57,58,59,60,61,63,69,70],W=[5,11,13,17,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,60,62,64,70],X=[1,61],Z=[1,62],V=[1,63],J=[1,64],K=[1,65],Q=[1,66],tt=[5,17,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,54,55,57,58,59,60,61,70],et=[2,49],nt=[5,11,13,17,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,54,55,57,58,59,60,61,62,64,70],rt=[1,72],st=[1,86],it=[1,85],at=[1,87],ct=[1,88],ot=[1,89],ht=[2,50],lt=[5,11,13,17,28,29,30,60,62,64,70],ut=[5,11,13,17,22,23,24,25,26,27,28,29,30,34,35,36,37,38,39,40,60,62,64,70],ft=[62,64],pt=[5,11,13,17,24,25,26,27,28,29,30,60,62,64,70],yt=[5,11,13,17,24,25,26,27,28,29,30,34,35,40,60,62,64,70],gt=[5,11,13,17,24,25,26,27,28,29,30,34,35,36,37,38,39,40,60,62,64,70],dt=[1,150],bt=[17,62],kt={trace:function(){},yy:{},symbols_:{error:2,root:3,block:4,EOF:5,nonEmptyBlock:6,definitions:7,e:8,def:9,$:10,";":11,SYMBOL:12,":":13,query:14,SELF:15,"(":16,")":17,keyword:18,function:19,op:20,NOT:21,"-":22,"+":23,IN:24,HAS:25,NOTIN:26,HASNO:27,AND:28,OR:29,"?":30,"*":31,"/":32,"%":33,"=":34,"!=":35,"<":36,"<=":37,">":38,">=":39,"~=":40,TRUE:41,FALSE:42,NULL:43,UNDEFINED:44,queryRoot:45,relativePath:46,"@":47,"#":48,STRING:49,NUMBER:50,REGEXP:51,object:52,array:53,".":54,".(":55,arguments:56,"..":57,"..(":58,".[":59,"]":60,"[":61,",":62,"{":63,"}":64,properties:65,property:66,"...":67,arrayItems:68,FUNCTION_START:69,FUNCTION_END:70,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",10:"$",11:";",12:"SYMBOL",13:":",15:"SELF",16:"(",17:")",21:"NOT",22:"-",23:"+",24:"IN",25:"HAS",26:"NOTIN",27:"HASNO",28:"AND",29:"OR",30:"?",31:"*",32:"/",33:"%",34:"=",35:"!=",36:"<",37:"<=",38:">",39:">=",40:"~=",41:"TRUE",42:"FALSE",43:"NULL",44:"UNDEFINED",47:"@",48:"#",49:"STRING",50:"NUMBER",51:"REGEXP",54:".",55:".(",57:"..",58:"..(",59:".[",60:"]",61:"[",62:",",63:"{",64:"}",67:"...",69:"FUNCTION_START",70:"FUNCTION_END"},productions_:[0,[3,2],[4,1],[4,1],[4,0],[6,2],[6,1],[7,1],[7,2],[9,2],[9,3],[9,5],[8,1],[8,1],[8,3],[8,4],[8,1],[8,1],[8,1],[20,2],[20,2],[20,2],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,5],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[18,1],[18,1],[18,1],[18,1],[14,1],[14,1],[45,1],[45,1],[45,1],[45,2],[45,1],[45,1],[45,1],[45,1],[45,1],[45,1],[45,2],[45,3],[45,3],[45,3],[45,4],[45,4],[45,5],[45,2],[45,3],[45,3],[46,3],[46,5],[46,6],[46,4],[46,3],[46,4],[46,4],[46,4],[56,1],[56,3],[52,2],[52,3],[65,1],[65,3],[66,1],[66,1],[66,2],[66,3],[66,3],[66,5],[66,1],[66,2],[53,2],[53,3],[68,1],[68,3],[19,3]],performAction:function(t,e,n,r,s,i,a){var c=i.length-1;switch(s){case 1:return this.$={ast:i[c-1],commentRanges:r.commentRanges};case 2:this.$=["/*scope*/",i[c]];break;case 3:this.$=["/*scope*/",i[c],"\nreturn current"];break;case 4:this.$=["/*scope*/","return ","/*sp:"+this._$.range+",*/","current","/**/"];break;case 5:this.$=[i[c-1],"\nreturn ",i[c]];break;case 6:this.$=["return ",i[c]];break;case 7:case 12:case 16:case 17:case 18:case 45:case 46:case 51:case 52:case 53:case 54:case 55:case 75:case 79:case 91:this.$=[i[c]];break;case 8:this.$=[i[c-1],"\n",i[c]];break;case 9:this.$=["/*sp:"+a[c-1].range+",key*/","current","/**/",";"];break;case 10:this.$=["/*define:"+a[c-1].range+"*/","const $",i[c-1]," = fn.map(","/*sp:"+a[c-1].range+",key*/","current","/**/",', "',i[c-1],'");'];break;case 11:this.$=["/*define:"+a[c-3].range+"*/","const $",i[c-3]," = ",i[c-1],";"];break;case 13:this.$=["current => self(current, context)"];break;case 14:this.$=["self(current, context)"];break;case 15:this.$=["self(",i[c-1],", context)"];break;case 19:this.$=["!fn.bool(",i[c],")"];break;case 20:this.$=["-",i[c]];break;case 21:this.$=["+",i[c]];break;case 22:this.$=["fn.in(",i[c-2],", ","/*sp:"+a[c-2].range+",in-value*/",i[c],"/**/",")"];break;case 23:this.$=["fn.in(",i[c],", ","/*sp:"+a[c].range+",in-value*/",i[c-2],"/**/",")"];break;case 24:this.$=["!fn.in(",i[c-2],", ",i[c],")"];break;case 25:this.$=["!fn.in(",i[c],", ",i[c-2],")"];break;case 26:this.$=["fn.bool(tmp = ",i[c-2],") ? ",i[c]," : tmp"];break;case 27:this.$=["fn.bool(tmp = ",i[c-2],") ? tmp : ",i[c]];break;case 28:this.$=["fn.bool(",i[c-4],") ? ",i[c-2]," : ",i[c]];break;case 29:this.$=["fn.add(",i[c-2],", ",i[c],")"];break;case 30:this.$=["fn.sub(",i[c-2],", ",i[c],")"];break;case 31:this.$=["fn.mul(",i[c-2],", ",i[c],")"];break;case 32:this.$=["fn.div(",i[c-2],", ",i[c],")"];break;case 33:this.$=["fn.mod(",i[c-2],", ",i[c],")"];break;case 34:this.$=["fn.eq(","/*sp:"+a[c].range+",value*/",i[c-2],"/**/",", ",i[c],")"];break;case 35:this.$=["fn.ne(","/*sp:"+a[c].range+",value*/",i[c-2],"/**/",", ",i[c],")"];break;case 36:this.$=["fn.lt(",i[c-2],", ",i[c],")"];break;case 37:this.$=["fn.lte(",i[c-2],", ",i[c],")"];break;case 38:this.$=["fn.gt(",i[c-2],", ",i[c],")"];break;case 39:this.$=["fn.gte(",i[c-2],", ",i[c],")"];break;case 40:this.$=["fn.match(",i[c-2],", ",i[c],")"];break;case 41:this.$=["true"];break;case 42:this.$=["false"];break;case 43:this.$=["null"];break;case 44:this.$=["undefined"];break;case 47:this.$=["data"];break;case 48:this.$=["context"];break;case 49:this.$=["/*var:"+a[c].range+"*/","current"];break;case 50:this.$=["/*var:"+this._$.range+"*/","typeof $",i[c]," !== 'undefined' ? $",i[c]," : undefined"];break;case 56:this.$=["/*var:"+a[c].range+"*/","fn.map(","/*sp:"+a[c].range+",*/","current","/**/",', "',i[c],'")'];break;case 57:this.$=["fn.map(","/*sp:"+a[c].range+",*/","current","/**/",', "',i[c],'")'];break;case 58:this.$=["(",i[c-1],")"];break;case 59:this.$=["fn.map(current, current => { ",i[c-1]," })"];break;case 60:case 62:this.$=["method.",i[c-2],"(","/*sp:"+a[c-2].range+",,"+a[c-1].range+",*/","current","/**/",")"];break;case 61:case 63:this.$=["method.",i[c-3],"(","/*sp:"+a[c-3].range+",*/","current","/**/",", ",i[c-1],")"];break;case 64:this.$=["fn.recursive(","/*sp:"+a[c].range+",*/","current","/**/",', "',i[c],'")'];break;case 65:this.$=["fn.recursive(current, current => { ",i[c-1]," })"];break;case 66:this.$=["fn.filter(current, current => { ",i[c-1]," })"];break;case 67:this.$=["fn.map(","/*sp:"+a[c].range+",*/",i[c-2],"/**/",', "',i[c],'")'];break;case 68:this.$=["method.",i[c-2],"((","/*sp:"+a[c-1].range+",*/","current","/**/",", ","/*sp:"+a[c-2].range+",*/",i[c-4],"/**/","))"];break;case 69:this.$=["method.",i[c-3],"(","/*sp:"+a[c-3].range+",*/",i[c-5],"/**/",", ",i[c-1],")"];break;case 70:this.$=["fn.map(",i[c-3],", current => { ",i[c-1]," })"];break;case 71:this.$=["fn.recursive(","/*sp:"+a[c].range+",*/",i[c-2],"/**/",', "',i[c],'")'];break;case 72:this.$=["fn.recursive(",i[c-3],", current => { ",i[c-1]," })"];break;case 73:this.$=["fn.filter(",i[c-3],", current => { ",i[c-1]," })"];break;case 74:this.$=["fn.map(",i[c-3],", ",i[c-1],")"];break;case 76:case 80:case 92:this.$=[i[c-2],", ",i[c]];break;case 77:this.$=["(","/*sp:"+a[c-1].range+",*/","current","/**/",", {})"];break;case 78:this.$=["({ ",i[c-1]," })"];break;case 81:this.$=["/*var:"+a[c].range+"*/",i[c],": fn.map(","/*sp:"+a[c].range+",*/","current","/**/",', "',i[c],'")'];break;case 82:this.$=["[Symbol()]: ","/*var:"+this._$.range+"*/","0"];break;case 83:this.$=["/*var:"+this._$.range+"*/",i[c],": typeof $",i[c]," !== 'undefined' ? $",i[c]," : undefined"];break;case 84:case 85:this.$=[i[c-2],": ",i[c]];break;case 86:this.$=["[",i[c-3],"]: ",i[c]];break;case 87:this.$=["...","/*var:"+a[c].range+"*/","/*sp:"+a[c].range+",*/","current","/**/"];break;case 88:this.$=["...",i[c]];break;case 89:this.$=["(","/*sp:"+a[c-1].range+",*/","current","/**/",", [])"];break;case 90:this.$=["[",i[c-1],"]"];break;case 93:this.$=["current => { ",i[c-1]," }"]}},table:[{3:1,4:2,5:e,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{1:[3]},{5:[1,39]},t(A,[2,2]),t(A,[2,3],{14:7,18:9,19:10,20:11,45:13,46:14,52:28,53:29,8:40,9:41,10:n,12:r,15:s,16:i,21:a,22:c,23:o,41:h,42:l,43:u,44:f,47:p,48:y,49:g,50:d,51:b,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x}),t(A,[2,6],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(G,[2,7]),t(W,[2,12],{54:X,55:Z,57:V,58:J,59:K,61:Q}),t(W,[2,13],{16:[1,67]}),t(W,[2,16]),t(W,[2,17]),t(W,[2,18]),t(tt,et,{11:[1,68],12:[1,69]}),t(nt,[2,45]),t(nt,[2,46]),t(W,[2,41]),t(W,[2,42]),t(W,[2,43]),t(W,[2,44]),{4:70,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x,70:e},{8:71,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:73,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:74,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(nt,[2,47]),t(nt,[2,48]),t(nt,[2,51]),t(nt,[2,52]),t(nt,[2,53]),t(nt,[2,54]),t(nt,[2,55]),t(nt,[2,56],{16:[1,75]}),{12:[1,76]},{8:77,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{4:78,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,17:e,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{12:[1,79]},{4:80,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,17:e,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{4:81,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,60:e,61:O,63:S,69:x},{10:st,12:it,49:at,61:ct,64:[1,82],65:83,66:84,67:ot},{8:92,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,60:[1,90],61:O,63:S,68:91,69:x},{1:[2,1]},t(A,[2,5],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(G,[2,8]),{8:93,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:94,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:95,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:96,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:97,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:98,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:99,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:100,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:101,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:102,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:103,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:104,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:105,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:106,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:107,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:108,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:109,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:110,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:111,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{12:[1,112]},{4:113,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,17:e,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{12:[1,114]},{4:115,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,17:e,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{4:116,6:3,7:4,8:5,9:6,10:n,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,60:e,61:O,63:S,69:x},{8:117,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:119,10:rt,12:r,14:7,15:s,16:i,17:[1,118],18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(G,[2,9]),t(tt,ht,{11:[1,120],13:[1,121]}),{70:[1,122]},t(lt,[2,19],{22:E,23:N,24:w,25:P,26:I,27:T,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(nt,et,{12:[1,123]}),t(ut,[2,20],{31:L,32:U,33:Y}),t(ut,[2,21],{31:L,32:U,33:Y}),{8:126,10:rt,12:r,14:7,15:s,16:i,17:[1,124],18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,56:125,57:_,58:v,59:$,61:O,63:S,69:x},t(nt,[2,57],{16:[1,127]}),{17:[1,128],22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H},{17:[1,129]},t(nt,[2,64]),{17:[1,130]},{60:[1,131]},t(nt,[2,77]),{62:[1,133],64:[1,132]},t(ft,[2,79]),t(ft,[2,81],{13:[1,134]}),t(ft,[2,82],{12:[1,135]}),{13:[1,136]},{8:137,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(ft,[2,87],{45:13,46:14,52:28,53:29,14:138,10:rt,12:r,16:i,47:p,48:y,49:g,50:d,51:b,54:k,55:m,57:_,58:v,59:$,61:O,63:S}),t(nt,[2,89]),{60:[1,139]},{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H,60:[2,91],62:[1,140]},t(pt,[2,22],{22:E,23:N,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(pt,[2,23],{22:E,23:N,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(pt,[2,24],{22:E,23:N,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(pt,[2,25],{22:E,23:N,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(lt,[2,26],{22:E,23:N,24:w,25:P,26:I,27:T,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t([5,11,13,17,29,30,60,62,64,70],[2,27],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),{13:[1,141],22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H},t(ut,[2,29],{31:L,32:U,33:Y}),t(ut,[2,30],{31:L,32:U,33:Y}),t(W,[2,31]),t(W,[2,32]),t(W,[2,33]),t(yt,[2,34],{22:E,23:N,31:L,32:U,33:Y,36:B,37:z,38:q,39:C}),t(yt,[2,35],{22:E,23:N,31:L,32:U,33:Y,36:B,37:z,38:q,39:C}),t(gt,[2,36],{22:E,23:N,31:L,32:U,33:Y}),t(gt,[2,37],{22:E,23:N,31:L,32:U,33:Y}),t(gt,[2,38],{22:E,23:N,31:L,32:U,33:Y}),t(gt,[2,39],{22:E,23:N,31:L,32:U,33:Y}),t(yt,[2,40],{22:E,23:N,31:L,32:U,33:Y,36:B,37:z,38:q,39:C}),t(nt,[2,67],{16:[1,142]}),{17:[1,143]},t(nt,[2,71]),{17:[1,144]},{60:[1,145]},{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H,60:[1,146]},t(W,[2,14]),{17:[1,147],22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H},t(G,[2,10]),{8:148,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(W,[2,93]),t(nt,ht),t(nt,[2,60]),{17:[1,149],62:dt},t(bt,[2,75],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),{8:126,10:rt,12:r,14:7,15:s,16:i,17:[1,151],18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,56:152,57:_,58:v,59:$,61:O,63:S,69:x},t(nt,[2,58]),t(nt,[2,59]),t(nt,[2,65]),t(nt,[2,66]),t(nt,[2,78]),{10:st,12:it,49:at,61:ct,66:153,67:ot},{8:154,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(ft,[2,83]),{8:155,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H,60:[1,156]},t(ft,[2,88],{54:X,55:Z,57:V,58:J,59:K,61:Q}),t(nt,[2,90]),{8:92,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,68:157,69:x},{8:158,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},{8:126,10:rt,12:r,14:7,15:s,16:i,17:[1,159],18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,56:160,57:_,58:v,59:$,61:O,63:S,69:x},t(nt,[2,70]),t(nt,[2,72]),t(nt,[2,73]),t(nt,[2,74]),t(W,[2,15]),{11:[1,161],22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H},t(nt,[2,61]),{8:162,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(nt,[2,62]),{17:[1,163],62:dt},t(ft,[2,80]),t(ft,[2,84],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(ft,[2,85],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),{13:[1,164]},{60:[2,92]},t([5,11,13,17,60,62,64,70],[2,28],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(nt,[2,68]),{17:[1,165],62:dt},t(G,[2,11]),t(bt,[2,76],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H}),t(nt,[2,63]),{8:166,10:rt,12:r,14:7,15:s,16:i,18:9,19:10,20:11,21:a,22:c,23:o,41:h,42:l,43:u,44:f,45:13,46:14,47:p,48:y,49:g,50:d,51:b,52:28,53:29,54:k,55:m,57:_,58:v,59:$,61:O,63:S,69:x},t(nt,[2,69]),t(ft,[2,86],{22:E,23:N,24:w,25:P,26:I,27:T,28:j,29:R,30:F,31:L,32:U,33:Y,34:D,35:M,36:B,37:z,38:q,39:C,40:H})],defaultActions:{39:[2,1],157:[2,92]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[null],s=[],i=this.table,a="",c=0,o=0,h=0,l=s.slice.call(arguments,1),u=Object.create(this.lexer),f={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(f.yy[p]=this.yy[p]);u.setInput(t,f.yy),f.yy.lexer=u,f.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var y=u.yylloc;s.push(y);var g=u.options&&u.options.ranges;"function"==typeof f.yy.parseError?this.parseError=f.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var d,b,k,m,_,v,$,O,S,x=function(){var t;return"number"!=typeof(t=u.lex()||1)&&(t=e.symbols_[t]||t),t},A={};;){if(k=n[n.length-1],this.defaultActions[k]?m=this.defaultActions[k]:(null!==d&&void 0!==d||(d=x()),m=i[k]&&i[k][d]),void 0===m||!m.length||!m[0]){var E="";for(v in S=[],i[k])this.terminals_[v]&&v>2&&S.push("'"+this.terminals_[v]+"'");E=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==d?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(E,{text:u.match,token:this.terminals_[d]||d,line:u.yylineno,loc:y,expected:S})}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+d);switch(m[0]){case 1:n.push(d),r.push(u.yytext),s.push(u.yylloc),n.push(m[1]),d=null,b?(d=b,b=null):(o=u.yyleng,a=u.yytext,c=u.yylineno,y=u.yylloc,h>0&&h--);break;case 2:if($=this.productions_[m[1]][1],A.$=r[r.length-$],A._$={first_line:s[s.length-($||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-($||1)].first_column,last_column:s[s.length-1].last_column},g&&(A._$.range=[s[s.length-($||1)].range[0],s[s.length-1].range[1]]),void 0!==(_=this.performAction.apply(A,[a,o,c,f.yy,m[1],r,s].concat(l))))return _;$&&(n=n.slice(0,-1*$*2),r=r.slice(0,-1*$),s=s.slice(0,-1*$)),n.push(this.productions_[m[1]][0]),r.push(A.$),s.push(A._$),O=i[n[n.length-2]][n[n.length-1]],n.push(O);break;case 3:return!0}}return!0}},mt={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var i in s)this[i]=s[i];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),i=0;i<s.length;i++)if((n=this._input.match(this.rules[s[i]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=i,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,s[i])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{ranges:!0},performAction:function(t,e,n,r){switch(n){case 0:t.commentRanges.push(e.yylloc.range);break;case 1:break;case 2:return this.popState(),"/";case 3:return this.popState(),"<";case 4:this.done=!1,this.popState();break;case 5:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"(";case 6:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),")";case 7:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"[";case 8:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"]";case 9:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"{";case 10:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"}";case 11:return"TRUE";case 12:return"FALSE";case 13:return"NULL";case 14:return"UNDEFINED";case 15:return"AND";case 16:return"OR";case 17:return"HASNO";case 18:return"HAS";case 19:return"IN";case 20:return"NOTIN";case 21:return"NOT";case 22:return this._input&&this.begin("preventPrimitive"),"@";case 23:return this._input&&this.begin("preventPrimitive"),"#";case 24:return this._input&&this.begin("preventPrimitive"),"$";case 25:return"SELF";case 26:return this._input&&this.begin("preventPrimitive"),"NUMBER";case 27:case 28:return this._input&&this.begin("preventPrimitive"),"STRING";case 29:return this._input&&this.begin("preventPrimitive"),"REGEXP";case 30:return this._input&&this.begin("preventPrimitive"),"SYMBOL";case 31:return this.fnOpened++,"FUNCTION_START";case 32:return"=";case 33:return"!=";case 34:return"~=";case 35:return">=";case 36:return"<=";case 37:return"<";case 38:return this.fnOpened?(this.fnOpened--,"FUNCTION_END"):">";case 39:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"..(";case 40:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".(";case 41:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".[";case 42:return"...";case 43:return this._input&&this.begin("preventPrimitive"),"..";case 44:return this._input&&this.begin("preventPrimitive"),".";case 45:return"?";case 46:return",";case 47:return":";case 48:return";";case 49:return"-";case 50:return"+";case 51:return"*";case 52:return"/";case 53:return"%";case 54:return"EOF"}},rules:[/^(?:(\/\/.*?(\r|\n|$)))/,/^(?:(\s+))/,/^(?:\/)/,/^(?:<(?!=))/,/^(?:)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:true(\b))/,/^(?:false(\b))/,/^(?:null(\b))/,/^(?:undefined(\b))/,/^(?:and(\b))/,/^(?:or(\b))/,/^(?:has(\s+)no(\b))/,/^(?:has(\b))/,/^(?:in(\b))/,/^(?:not(\s+)in(\b))/,/^(?:not?(\b))/,/^(?:@)/,/^(?:#)/,/^(?:\$)/,/^(?:::self)/,/^(?:\d+(?:\.\d+)?([eE][-+]?\d+)?(\b))/,/^(?:"(?:\\.|[^"])*")/,/^(?:'(?:\\.|[^'])*')/,/^(?:(\/(?:\\.|[^\/])+\/i?))/,/^(?:[a-zA-Z_][a-zA-Z_$0-9]*)/,/^(?:<(?!=))/,/^(?:=)/,/^(?:!=)/,/^(?:~=)/,/^(?:>=)/,/^(?:<=)/,/^(?:<)/,/^(?:>)/,/^(?:\.\.\()/,/^(?:\.\()/,/^(?:\.\[)/,/^(?:\.\.\.)/,/^(?:\.\.)/,/^(?:\.)/,/^(?:\?)/,/^(?:,)/,/^(?::)/,/^(?:;)/,/^(?:\-)/,/^(?:\+)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:$)/],conditions:{preventPrimitive:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],inclusive:!0},INITIAL:{rules:[0,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54],inclusive:!0}}};function _t(){this.yy={}}return kt.lexer=mt,_t.prototype=kt,kt.Parser=_t,new _t}();e.exports=function(t){function e(t,e){Object.entries(e).forEach(([e,n])=>t[e]=n(t[e]))}const n=new t.Parser;n.lexer=Object.assign({},t.lexer),[t.lexer,n.lexer].forEach(t=>e(t,{setInput:t=>(function(e,n){return n.commentRanges=[],this.fnOpened=0,this.fnOpenedStack=[],this.prevToken=null,this.prevYylloc={first_line:1,last_line:1,first_column:0,last_column:0,range:[0,0]},t.call(this,e,n)})}));const r=["AND","OR","IN","NOTIN","HAS","HASNO"],s=[...r,"NOT"],i=["+","-","*","/","%","=","!=","~=",">=","<=","<",">"],a=[null,":",";",",",".","..",...i,...r,"NOT"],c=new Set([",","?",":",";","EOF","]",")","}",...i,...r]),o=a.reduce((t,e)=>t.set(e,c),new Map);return o.set("{",new Set([","])),o.set("[",new Set([","])),o.set("(",new Set([","])),e(n.lexer,{lex:t=>(function e(){this.lex=t;const n=this._input,r=this.lex(this);if(this.lex=e,o.has(this.prevToken)&&o.get(this.prevToken).has(r)){const t={first_line:this.prevYylloc.last_line,last_line:this.yylloc.first_line,first_column:this.prevYylloc.last_column,last_column:this.yylloc.first_column,range:[this.prevYylloc.range[1],this.yylloc.range[0]]};if(this.unput(this.yytext),this.pushState("preventPrimitive"),this.done=!1,this.yytext="_",this.yylloc=this.prevYylloc=t,n!==this._input&&s.includes(r)){const e=n.length-this._input.length-1;switch(n[e]){case" ":case"\t":t.last_column--,t.range[1]--;break;case"\n":{const r=n.lastIndexOf("\n",e-1);t.last_line--,t.last_column=-1===r?t.last_column-1:e-r,t.range[1]--;break}}}return this.prevToken="SYMBOL"}if(this.prevYylloc=this.yylloc,s.includes(r))switch(this._input[0]){case" ":case"\t":this.prevYylloc=Object.assign({},this.prevYylloc,{last_column:this.prevYylloc.last_column+1,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]});break;case"\n":this.prevYylloc=Object.assign({},this.prevYylloc,{last_line:this.prevYylloc.last_line+1,last_column:0,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]})}return this.prevToken=r})}),t.strict=t,t.tolerant=n,t}(r)},{}],2:[function(t,e,n){e.exports={version:"1.0.0-alpha.10"}},{}],3:[function(t,e,n){const{addToSet:r,getPropertyValue:s,isPlainObject:i,isRegExp:a}=t("./utils");e.exports=Object.freeze({bool:function(t){if(Array.isArray(t))return t.length>0;if(i(t)){for(const e in t)if(hasOwnProperty.call(t,e))return!0;return!1}return Boolean(t)},and:function(t,e){return this.bool(t)?e:t},or:function(t,e){return this.bool(t)?t:e},add:function(t,e){return Array.isArray(t)||Array.isArray(e)?[...new Set([].concat(t,e))]:t+e},sub:function(t,e){if(Array.isArray(t)){const n=new Set(t);return Array.isArray(e)?e.forEach(t=>n.delete(t)):n.delete(e),[...n]}return t-e},mul:function(t,e){return t*e},div:function(t,e){return t/e},mod:function(t,e){return t%e},eq:function(t,e){return t===e},ne:function(t,e){return t!==e},lt:function(t,e){return t<e},lte:function(t,e){return t<=e},gt:function(t,e){return t>e},gte:function(t,e){return t>=e},in:function(t,e){return i(e)?hasOwnProperty.call(e,t):!(!e||"function"!=typeof e.indexOf)&&-1!==e.indexOf(t)},match:function(t,e){return"function"==typeof e?this.filter(t,e):a(e)?this.filter(t,e.test.bind(e)):null===e||void 0===e},map:function(t,e){const n="function"==typeof e?e:t=>s(t,e);return Array.isArray(t)?[...t.reduce((t,e)=>r(t,n(e)),new Set)]:void 0!==t?n(t):t},recursive:function(t,e){const n=new Set;return r(n,this.map(t,e)),n.forEach(t=>r(n,this.map(t,e))),[...n]},filter:function(t,e){return Array.isArray(t)?t.filter(t=>this.bool(e(t))):this.bool(e(t))?t:void 0}})},{"./utils":6}],4:[function(t,e,n){const r=t("./buildin"),s=t("./methods"),{strict:i,tolerant:a}=t("./parser"),{addToSet:c,isPlainObject:o}=t("./utils"),h=new Map,l=new Map,u=new Map,f=new Map,p={path:"property",key:"property",value:"value","in-value":"value",var:"variable"};function y(t,e){const n=t.charCodeAt(e);return 9===n||10===n||13===n||32===n}function g(t,e){return e>=0&&e<t.length&&/[a-zA-Z_$0-9]/.test(t[e])}function d(t,e,n,r){const s=[];for(let i=0;i<n.length;i++){const[a,c,o]=n[i];for(let n=0;n<c.length;n+=2){let i=c[n],h=c[n+1];if(e>=i&&e<=h&&(r||a.size||a.length)){let n=t.substring(i,h);/\S/.test(n)||(n="",i=h=e),s.push({context:o,current:n,from:i,to:h,values:a})}}}return s}e.exports=function(t,e){e=e||{};const n=Boolean(e.debug),b=Boolean(e.stat),k=Boolean(e.tolerant),m=e.methods?Object.assign({},s,e.methods):s,_=b?k?f:l:k?u:h;let v;return t=String(t),_.has(t)?v=_.get(t):(v=function(t,e,n,r){function s(e,n){const r=[];for(let t=0;t<h.length;t++){const[s,i]=h[t];if(s>n)break;s<e||(s===e?r.push(e,e):r.push(e,s),e=i)}return e===t.length&&f||r.push(e,n),r}r&&(console.log("\n== compile ======"),console.log("source:",t));const c=n?a:i,{ast:o,commentRanges:h}=c.parse(t),l=[],u=[],f=h.length&&h[h.length-1][1]===t.length&&!/[\r\n]$/.test(t);let p=[],d=[];return function n(r,i){if(Array.isArray(r)){const e=r[0];let s=!1,a=0;if("/*scope*/"===e)i=i.slice(),a++;else if("string"==typeof e&&e.startsWith("/*define:")){let[n,r]=e.substring(9,e.length-2).split(",");if(s=t.substring(n,r),i.includes(`"${s}"`))throw new Error(`Identifier '$${s}' has already been declared`);a++}for(;a<r.length;a++)n(r[a],i);s&&i.push(`"${s}"`)}else if(e&&r.startsWith("/*"))if(r.startsWith("/*var:")){let[e,n]=r.substring(6,r.length-2).split(",");if(e===n){if(g(t,e-1))return;for(;n<t.length-1&&y(t,n);)n++;if(g(t,n)){if(e===n)return;n--}}u.push(`[[${i}], [${s(e,n)}], "var"]`)}else if(r.startsWith("/*sp:")){const e=p.push("sp"+p.length+" = new Set()")-1,n=r.substring(5,r.length-2).split(",");for(let r=0;r<n.length;r+=3){let i=Number(n[r]),a=Number(n[r+1]),c=n[r+2];const o=t.substring(i,a);if(".["===o||".("===o||"..("===o||"{"===o||"["===o||"("===o||"<"===o||"..."===o||i===a){if(g(t,(i=a)-1))continue;for(;a<t.length-1&&y(t,a);)a++;if(g(t,a)){if(i===a)continue;a--}}u.push(`[sp${e}, [${s(i,a)}], "${c||"path"}"]`)}l.push(`suggestPoint(sp${e}, `)}else"/**/"===r&&l.push(")");else l.push(r)}(o,[]),p.length&&d.push("const "+p.join(", ")+";","const suggestPoint = (set, value) => (set.add(value), value);"),d.push("const $data = undefined, $context = undefined, $ctx = undefined, $array = undefined, $idx = undefined, $index = undefined;","let current = data;","let tmp;",l.join("")),e&&d.push(`,[${u}]`),r&&console.log("== body =========\n"+d.join("\n")+"\n=================\n"),new Function("fn","method","data","context","self",d.join("\n"))}(t,b,k,n),_.set(t,v)),n&&console.log("fn",v.toString()),b?function e(n,s){const i=v(r,m,n,s,e);return{stat(e,n){const r=d(t,e,i,n);return r.forEach(t=>{t.values=[...t.values]}),r.length?r:null},suggestion(e,n){const r=[];return d(t,e,i,n).forEach(t=>{const{context:e,current:n,from:s,to:i,values:a}=t;r.push(...function(t,e){const n=new Set,r=t=>{switch(typeof t){case"string":n.add(JSON.stringify(t));break;case"number":n.add(String(t))}};switch(t){case"":case"path":e.forEach(t=>{Array.isArray(t)?t.forEach(t=>{o(t)&&c(n,Object.keys(t))}):o(t)&&c(n,Object.keys(t))});break;case"key":e.forEach(t=>{o(t)&&c(n,Object.keys(t))});break;case"value":e.forEach(t=>{Array.isArray(t)?t.forEach(r):r(t)});break;case"in-value":e.forEach(t=>{Array.isArray(t)?t.forEach(r):o(t)?Object.keys(t).forEach(r):r(t)});break;case"var":e.forEach(t=>{n.add("$"+t)})}return[...n]}(e,a).map(t=>({current:n,type:p[e],value:t,from:s,to:i})))}),r.length?r:null}}}:function t(e,n){return v(r,m,e,n,t)}},e.exports.version=t("../package.json").version,e.exports.buildin=r,e.exports.methods=s},{"../package.json":2,"./buildin":3,"./methods":5,"./parser":1,"./utils":6}],5:[function(t,e,n){const r=t("./buildin"),{addToSet:s,isPlainObject:i}=t("./utils");function a(){}function c(t){return t}e.exports=Object.freeze({bool:r.bool,filter:r.filter,map:r.map,keys:function(t){return Object.keys(t||{})},values:function(t){const e=new Set;for(const n in t)hasOwnProperty.call(t,n)&&s(e,t[n]);return[...e]},entries:function(t){const e=[];for(const n in t)hasOwnProperty.call(t,n)&&e.push({key:n,value:t[n]});return e},pick:function(t,e){if(t){if("function"!=typeof e)return Array.isArray(t)?t[e||0]:t[e];if(Array.isArray(t))return t.find(t=>e(t));for(const n in t)if(hasOwnProperty.call(t,n)&&e(t[n]))return{key:n,value:t[n]}}},mapToArray:function(t,e="key",n){const r=[];for(const s in t)hasOwnProperty.call(t,s)&&r.push(n?{[e]:s,[n]:t[s]}:Object.assign({[e]:s},t[s]));return r},size:function(t){switch(!0){case Array.isArray(t):return t.length;case i(t):return Object.keys(t).length;default:return t&&t.length||0}},sort:function(t,e){return Array.isArray(t)?"function"==typeof e?t.slice().sort((t,n)=>{if(t=e(t),n=e(n),Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return t.length<n.length?-1:1;for(let e=0;e<t.length;e++){if(t[e]<n[e])return-1;if(t[e]>n[e])return 1}return 0}return t<n?-1:t>n}):t.slice().sort():t},reverse:function(t){return Array.isArray(t)?t.slice().reverse():t},group:function(t,e,n){"function"!=typeof e&&(e=a),"function"!=typeof n&&(n=c),Array.isArray(t)||(t=[t]);const r=new Map,s=[];return t.forEach(t=>{let s=e(t);Array.isArray(s)||(s=[s]),s.forEach(e=>{r.has(e)?r.get(e).add(n(t)):r.set(e,new Set([n(t)]))})}),r.forEach((t,e)=>s.push({key:e,value:[...t]})),s}})},{"./buildin":3,"./utils":6}],6:[function(t,e,n){const r=Object.prototype.toString;e.exports={addToSet:function(t,e){return void 0!==e&&(Array.isArray(e)?e.forEach(e=>t.add(e)):t.add(e)),t},getPropertyValue:function(t,e){return t&&hasOwnProperty.call(t,e)?t[e]:void 0},isPlainObject:function(t){return t&&"object"==typeof t&&t.constructor===Object},isRegExp:function(t){return"[object RegExp]"===r.call(t)}}},{}]},{},[4])(4)}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).jora=t()}(this,(function(){"use strict";var e={version:"1.0.0-alpha.11"},t=Object.freeze({__proto__:null,version:"1.0.0-alpha.11",default:e});const r=Object.prototype.toString;var n={addToSet:function(e,t){return void 0!==t&&(Array.isArray(t)?t.forEach(t=>e.add(t)):e.add(t)),e},getPropertyValue:function(e,t){return e&&hasOwnProperty.call(e,t)?e[t]:void 0},isPlainObject:function(e){return e&&"object"==typeof e&&e.constructor===Object},isRegExp:function(e){return"[object RegExp]"===r.call(e)},isArrayLike:function(e){return e&&hasOwnProperty.call(e,"length")}};const{addToSet:s,getPropertyValue:a,isPlainObject:i,isRegExp:o,isArrayLike:c}=n;var u=Object.freeze({bool:function(e){if(Array.isArray(e))return e.length>0;if(i(e)){for(const t in e)if(hasOwnProperty.call(e,t))return!0;return!1}return Boolean(e)},and:function(e,t){return this.bool(e)?t:e},or:function(e,t){return this.bool(e)?e:t},add:function(e,t){return Array.isArray(e)||Array.isArray(t)?[...new Set([].concat(e,t))]:e+t},sub:function(e,t){if(Array.isArray(e)){const r=new Set(e);return Array.isArray(t)?t.forEach(e=>r.delete(e)):r.delete(t),[...r]}return e-t},mul:function(e,t){return e*t},div:function(e,t){return e/t},mod:function(e,t){return e%t},eq:function(e,t){return e===t},ne:function(e,t){return e!==t},lt:function(e,t){return e<t},lte:function(e,t){return e<=t},gt:function(e,t){return e>t},gte:function(e,t){return e>=t},in:function(e,t){return i(t)?hasOwnProperty.call(t,e):!(!t||"function"!=typeof t.indexOf)&&-1!==t.indexOf(e)},cmp:function(e,t){return e>t?1:e<t?-1:0},match:function(e,t){return"function"==typeof t?this.filter(e,t):o(t)?this.filter(e,t.test.bind(t)):null==t},map:function(e,t){const r="function"==typeof t?t:e=>a(e,t);return Array.isArray(e)?[...e.reduce((e,t)=>s(e,r(t)),new Set)]:void 0!==e?r(e):e},slice:function(e,t=0,r=e&&e.length,n=1){if(!c(e))return[];if(t=parseInt(t,10)||0,r=parseInt(r,10)||e.length,1!==(n=parseInt(n,10)||1)){const s=[];t=t<0?Math.max(0,e.length+t):Math.min(e.length,t),r=r<0?Math.max(0,e.length+r):Math.min(e.length,r);for(let a=n>0?t:r-1;a>=t&&a<r;a+=n)s.push(e[a]);return s}return"string"==typeof e?e.slice(t,r):Array.prototype.slice.call(e,t,r)},recursive:function(e,t){const r=new Set;return s(r,this.map(e,t)),r.forEach(e=>s(r,this.map(e,t))),[...r]},filter:function(e,t){return Array.isArray(e)?e.filter(e=>this.bool(t(e))):this.bool(t(e))?e:void 0}});const{addToSet:h,isPlainObject:l}=n;function p(){}function y(e){return e}function g(e){return{matched:e.slice(),start:e.index,end:e.index+e[0].length,input:e.input,groups:e.groups||null}}var f=Object.freeze({bool:u.bool,filter:u.filter,map:u.map,keys:function(e){return Object.keys(e||{})},values:function(e){const t=new Set;for(const r in e)hasOwnProperty.call(e,r)&&h(t,e[r]);return[...t]},entries:function(e){const t=[];for(const r in e)hasOwnProperty.call(e,r)&&t.push({key:r,value:e[r]});return t},pick:function(e,t){if(e){if("function"!=typeof t)return Array.isArray(e)?e[t||0]:e[t];if(Array.isArray(e))return e.find(e=>t(e));for(const r in e)if(hasOwnProperty.call(e,r)&&t(e[r]))return{key:r,value:e[r]}}},mapToArray:function(e,t="key",r){const n=[];for(const s in e)hasOwnProperty.call(e,s)&&n.push(r?{[t]:s,[r]:e[s]}:Object.assign({[t]:s},e[s]));return n},size:function(e){return l(e)?Object.keys(e).length:e&&e.length||0},sort:function(e,t){let r;return Array.isArray(e)?("function"==typeof t&&(r=2===t.length?t:(e,r)=>{if(e=t(e),r=t(r),Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return e.length<r.length?-1:1;for(let t=0;t<e.length;t++){if(e[t]<r[t])return-1;if(e[t]>r[t])return 1}return 0}return e<r?-1:e>r}),e.slice().sort(r)):e},reverse:function(e){return Array.isArray(e)?e.slice().reverse():e},slice:function(e,t,r){return u.slice(e,t,r)},group:function(e,t,r){"function"!=typeof t&&(t=p),"function"!=typeof r&&(r=y),Array.isArray(e)||(e=[e]);const n=new Map,s=[];return e.forEach(e=>{let s=t(e);Array.isArray(s)||(s=[s]),s.forEach(t=>{n.has(t)?n.get(t).add(r(e)):n.set(t,new Set([r(e)]))})}),n.forEach((e,t)=>s.push({key:t,value:[...e]})),s},split:function(e,t){return String(e).split(t)},join:function(e,t){return Array.isArray(e)?e.join(t):String(e)},match:function(e,t,r){const n=String(e);if(r){const e=[];let r,s=new RegExp(t,t.flags+"g");for(;r=s.exec(n);)e.push(g(r));return e}const s=String(e).match(t);return s&&g(s)}});var b=function(e){function t(e,t){Object.entries(t).forEach(([t,r])=>e[t]=r(e[t]))}function r(e,t){return t>=0&&t<e.length&&/[a-zA-Z_$0-9]/.test(e[t])}function n(e,t){const r=e.charCodeAt(t);return 9===r||10===r||13===r||32===r}function s(e,t,r){for(;t<r;t++)if(!n(e,t))return!1;return!0}function a(e,t,r,n,s){const a=[];for(let r=0;r<n.length;r++){const[s,i]=n[r];if(s>t)break;s<e||(s===e?a.push(e,e):a.push(e,s),e=i)}return e===r.length&&s||a.push(e,t),a}Object.assign(e.lexer,{toStringLiteral:e=>JSON.parse("'"===e[0]?e.replace(/\\?"/g,'\\"').replace(/\\([^"uU])/g,"$1").replace(/^\'|\'$/g,'"'):e),toRegExp:e=>new RegExp(e.substr(1,e.lastIndexOf("/")-1),e.substr(e.lastIndexOf("/")+1))}),t(e.lexer,{setInput:e=>(function(t,i){const o=[],c=[];return i.commentRanges=c,i.suggestRanges=o,i.buildResult=e=>({ast:e,commentRanges:c,get suggestRanges(){return function(e,t,i){const o=[],c=i.length&&i[i.length-1][1]===e.length&&!/[\r\n]$/.test(e);for(let u=0;u<t.length;u++){let[h,l,p,y,g]=t[u];if(null===h)h=l.range[0],l=l.range[0];else if(null===l)l=h.range[1],h=h.range[1];else if(h.range[0]>l.range[0]){const e=h;h=l.range[1],l=e.range[0]}else h=h.range[0],l=l.range[1];if(s(e,h,l)){for(;h>=0&&n(e,h-1);)h--;for(;l<e.length&&n(e,l);)l++;if(r(e,h-1)){if(h===l)continue;h++}if(r(e,l)){if(h===l)continue;l--}}Array.isArray(p)||(p=[p]);const f=a(h,l,e,i,c);for(let e=0;e<f.length;e+=2)p.forEach(t=>o.push([f[e],f[e+1],t,y,g||null]))}return o}(t,o,c)}}),this.fnOpened=0,this.fnOpenedStack=[],this.prevToken=null,this.prevYylloc={first_line:1,last_line:1,first_column:0,last_column:0,range:[0,0]},e.call(this,t,i)})});const i=new e.Parser;i.lexer=Object.assign({},e.lexer);const o=["AND","OR","IN","NOTIN","HAS","HASNO"],c=[...o,"NOT","ASC","DESC"],u=["+","-","*","/","%","=","!=","~=",">=","<=","<",">"],h=[null,":",";",",",".","..",...u,...o,"NOT"],l=new Set([",","?",":",";","EOF","]",")","}",...u,...o,"ASC","DESC"]),p=new Map(h.map(e=>[e,l]));return p.set("{",new Set([","])),p.set("[",new Set([","])),p.set("(",new Set([","])),t(i.lexer,{lex:e=>(function t(){this.lex=e;const r=this._input,n=this.lex(this);if(this.lex=t,p.has(this.prevToken)&&p.get(this.prevToken).has(n)){const e={first_line:this.prevYylloc.last_line,last_line:this.yylloc.first_line,first_column:this.prevYylloc.last_column,last_column:this.yylloc.first_column,range:[this.prevYylloc.range[1],this.yylloc.range[0]]};if(this.unput(this.yytext),this.pushState("preventPrimitive"),this.done=!1,this.yytext="_",this.yylloc=this.prevYylloc=e,r!==this._input&&c.includes(n)){const t=r.length-this._input.length-1;switch(r[t]){case" ":case"\t":e.last_column--,e.range[1]--;break;case"\n":{const n=r.lastIndexOf("\n",t-1);e.last_line--,e.last_column=-1===n?e.last_column-1:t-n,e.range[1]--;break}}}return this.prevToken="SYMBOL"}if(this.prevYylloc=this.yylloc,c.includes(n))switch(this._input[0]){case" ":case"\t":this.prevYylloc=Object.assign({},this.prevYylloc,{last_column:this.prevYylloc.last_column+1,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]});break;case"\n":this.prevYylloc=Object.assign({},this.prevYylloc,{last_line:this.prevYylloc.last_line+1,last_column:0,range:[this.prevYylloc.range[0],this.prevYylloc.range[1]+1]})}return this.prevToken=n})}),e.strict=e,e.tolerant=i,e}(function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[2,4],r=[1,12],n=[1,22],s=[1,23],a=[1,24],i=[1,42],o=[1,15],c=[1,16],u=[1,17],h=[1,18],l=[1,25],p=[1,26],y=[1,27],g=[1,28],f=[1,29],b=[1,32],d=[1,34],k=[1,35],m=[1,36],v=[1,37],_=[1,38],$=[1,39],O=[1,41],S=[1,19],A=[1,20],C=[5,55,57,72],E=[1,53],R=[1,52],x=[1,46],N=[1,47],w=[1,48],P=[1,49],I=[1,50],j=[1,51],T=[1,54],q=[1,55],F=[1,56],M=[1,57],L=[1,58],U=[1,59],D=[1,60],B=[1,61],Y=[1,62],G=[1,63],z=[1,64],J=[5,10,19,20,21,39,40,41,42,43,46,47,48,49,50,53,55,56,57,59,60,61,62,63,65,71,72,73],H=[5,11,13,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,55,57,64,66,72],X=[1,65],Z=[1,66],V=[1,67],K=[1,68],Q=[1,69],W=[1,70],ee=[1,71],te=[1,72],re=[5,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,53,55,57,59,60,61,62,63,72,76,77],ne=[2,48],se=[5,11,13,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,53,55,57,59,60,61,62,63,64,66,72,76,77],ae=[1,77],ie=[1,87],oe=[1,100],ce=[1,101],ue=[1,102],he=[1,103],le=[2,49],pe=[5,11,13,55,57,64,66,72],ye=[5,11,13,26,27,38,55,57,64,66,72],ge=[5,11,13,20,21,22,23,24,25,26,27,31,32,33,34,35,36,37,38,55,57,64,66,72],fe=[55,64],be=[13,55],de=[64,66],ke=[5,11,13,22,23,24,25,26,27,38,55,57,64,66,72],me=[5,11,13,22,23,24,25,26,27,31,32,37,38,55,57,64,66,72],ve=[5,11,13,22,23,24,25,26,27,31,32,33,34,35,36,37,38,55,57,64,66,72],_e=[1,171],$e=[57,64],Oe={trace:function(){},yy:{},symbols_:{error:2,root:3,block:4,EOF:5,nonEmptyBlock:6,definitions:7,e:8,def:9,$:10,";":11,ident:12,":":13,query:14,keyword:15,function:16,sortingFunction:17,op:18,NOT:19,"-":20,"+":21,IN:22,HAS:23,NOTIN:24,HASNO:25,AND:26,OR:27,"*":28,"/":29,"%":30,"=":31,"!=":32,"<":33,"<=":34,">":35,">=":36,"~=":37,"?":38,SYMBOL:39,TRUE:40,FALSE:41,NULL:42,UNDEFINED:43,queryRoot:44,relativePath:45,"@":46,"#":47,STRING:48,NUMBER:49,REGEXP:50,object:51,array:52,"[":53,sliceNotation:54,"]":55,"(":56,")":57,arguments:58,".":59,".(":60,".[":61,"..":62,"..(":63,",":64,"{":65,"}":66,properties:67,property:68,"...":69,arrayItems:70,FUNCTION_START:71,FUNCTION_END:72,FUNCTION:73,sortingCompareList:74,sortingCompare:75,ASC:76,DESC:77,sliceNotationComponent:78,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",10:"$",11:";",13:":",19:"NOT",20:"-",21:"+",22:"IN",23:"HAS",24:"NOTIN",25:"HASNO",26:"AND",27:"OR",28:"*",29:"/",30:"%",31:"=",32:"!=",33:"<",34:"<=",35:">",36:">=",37:"~=",38:"?",39:"SYMBOL",40:"TRUE",41:"FALSE",42:"NULL",43:"UNDEFINED",46:"@",47:"#",48:"STRING",49:"NUMBER",50:"REGEXP",53:"[",55:"]",56:"(",57:")",59:".",60:".(",61:".[",62:"..",63:"..(",64:",",65:"{",66:"}",69:"...",71:"FUNCTION_START",72:"FUNCTION_END",73:"FUNCTION",76:"ASC",77:"DESC"},productions_:[0,[3,2],[4,1],[4,1],[4,0],[6,2],[6,1],[7,1],[7,2],[9,2],[9,3],[9,5],[8,1],[8,1],[8,1],[8,1],[8,1],[18,2],[18,2],[18,2],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,5],[12,1],[15,1],[15,1],[15,1],[15,1],[14,1],[14,1],[44,1],[44,1],[44,1],[44,2],[44,1],[44,1],[44,1],[44,1],[44,1],[44,3],[44,1],[44,3],[44,4],[44,3],[44,4],[44,2],[44,4],[44,5],[44,3],[44,3],[44,2],[44,4],[44,5],[44,3],[45,4],[45,4],[45,3],[45,5],[45,6],[45,4],[45,4],[45,3],[45,5],[45,6],[45,4],[58,1],[58,3],[51,2],[51,3],[67,1],[67,3],[68,1],[68,1],[68,2],[68,3],[68,3],[68,5],[68,1],[68,2],[52,2],[52,3],[70,1],[70,3],[16,3],[16,2],[17,1],[74,1],[74,3],[75,2],[75,2],[54,1],[54,2],[54,2],[54,3],[78,1],[78,2]],performAction:function(e,t,r,n,s,a,i){var o=a.length-1;switch(s){case 1:return n.buildResult(a[o-1]);case 2:case 12:case 13:case 14:case 15:case 16:case 44:case 45:case 53:case 54:break;case 3:this.$={type:"Block",definitions:a[o],body:{type:"Current"},range:this._$.range};break;case 4:this.$={type:"Block",definitions:[],body:{type:"Current"},range:this._$.range},n.suggestRanges.push([this._$,null,["var","path"],"current",this.$]);break;case 5:this.$={type:"Block",definitions:a[o-1],body:a[o],range:this._$.range};break;case 6:this.$={type:"Block",definitions:[],body:a[o],range:this._$.range};break;case 7:case 81:case 85:case 97:case 102:this.$=[a[o]];break;case 8:a[o-1].push(a[o]);break;case 9:this.$={type:"Definition",name:null,value:{type:"Current"},range:this._$.range},n.suggestRanges.push([i[o-1],i[o-1],"path","current",this.$]);break;case 10:this.$={type:"Definition",name:a[o-1],value:{type:"GetProperty",value:{type:"Current"},property:a[o-1]},range:this._$.range},n.suggestRanges.push([i[o-1],i[o-1],"path","current",this.$]);break;case 11:this.$={type:"Definition",name:a[o-3],value:a[o-1],range:this._$.range};break;case 17:this.$={type:"Unary",operator:"not",argument:a[o],range:this._$.range};break;case 18:this.$={type:"Unary",operator:"-",argument:a[o],range:this._$.range};break;case 19:this.$={type:"Unary",operator:"+",argument:a[o],range:this._$.range};break;case 20:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range},n.suggestRanges.push([i[o-2],i[o-2],"in-value",a[o]]);break;case 21:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"in-value",a[o-2]]);break;case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 33:case 34:case 35:case 36:case 37:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range};break;case 31:case 32:this.$={type:"Binary",operator:a[o-1],left:a[o-2],right:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"value",a[o-2]]);break;case 38:this.$={type:"Conditional",test:a[o-4],consequent:a[o-2],alternate:a[o],range:this._$.range};break;case 39:this.$={type:"Identifier",name:a[o],range:this._$.range};break;case 40:this.$={type:"Literal",value:!0,range:this._$.range};break;case 41:this.$={type:"Literal",value:!1,range:this._$.range};break;case 42:this.$={type:"Literal",value:null,range:this._$.range};break;case 43:this.$={type:"Literal",value:void 0,range:this._$.range};break;case 46:this.$={type:"Data",range:this._$.range};break;case 47:this.$={type:"Context",range:this._$.range};break;case 48:this.$={type:"Current",range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$]);break;case 49:this.$={type:"Reference",name:a[o],range:this._$.range},n.suggestRanges.push([i[o-1],i[o],"var","current",this.$]);break;case 50:case 51:case 52:this.$={type:"Literal",value:a[o],range:this._$.range};break;case 55:this.$={type:"SliceNotation",value:{type:"Current"},arguments:a[o-1],range:this._$.range};break;case 56:this.$={type:"GetProperty",value:{type:"Current"},property:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$],[i[o],i[o],"path","current",this.$]);break;case 57:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[],range:this._$.range},n.suggestRanges.push([i[o],i[o-1],["var","path"],"current",this.$]);break;case 58:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1],range:this._$.range},n.suggestRanges.push();break;case 59:this.$={type:"Parentheses",body:a[o-1],range:this._$.range};break;case 60:this.$={type:"Parentheses",body:{type:"Block",definitions:a[o-2],body:a[o-1]},range:this._$.range};break;case 61:this.$={type:"GetProperty",value:{type:"Current"},property:a[o],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o],i[o],"path","current",this.$]);break;case 62:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-2],i[o-2],"path","current",this.$],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 63:this.$={type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-3],i[o-3],"path","current",this.$]);break;case 64:this.$={type:"Map",value:{type:"Current"},query:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$]);break;case 65:this.$={type:"Filter",value:{type:"Current"},query:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$]);break;case 66:this.$={type:"Recursive",value:{type:"Current"},query:{type:"GetProperty",value:{type:"Current"},property:a[o]},range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o],i[o],"path","current",this.$]);break;case 67:this.$={type:"Recursive",value:{type:"Current"},query:{type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[]},range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-2],i[o-2],"path","current",this.$],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 68:this.$={type:"Recursive",value:{type:"Current"},query:{type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1]},range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$],[i[o-3],i[o-3],"path","current",this.$]);break;case 69:this.$={type:"Recursive",value:{type:"Current"},query:a[o-1],range:this._$.range},n.suggestRanges.push([null,this._$,["var","path"],"current",this.$]);break;case 70:this.$={type:"GetProperty",value:a[o-3],property:a[o-1],range:this._$.range};break;case 71:this.$={type:"SliceNotation",value:a[o-3],arguments:a[o-1],range:this._$.range};break;case 72:this.$={type:"GetProperty",value:a[o-2],property:a[o],range:this._$.range},n.suggestRanges.push([i[o],i[o],"path",a[o-2]]);break;case 73:this.$={type:"MethodCall",value:a[o-4],method:a[o-2],arguments:[],range:this._$.range},n.suggestRanges.push([i[o-2],i[o-2],"path",a[o-4]],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 74:this.$={type:"MethodCall",value:a[o-5],method:a[o-3],arguments:a[o-1],range:this._$.range},n.suggestRanges.push([i[o-3],i[o-3],"path",a[o-5]]);break;case 75:this.$={type:"Map",value:a[o-3],query:a[o-1],range:this._$.range};break;case 76:this.$={type:"Filter",value:a[o-3],query:a[o-1],range:this._$.range};break;case 77:this.$={type:"Recursive",value:a[o-2],query:{type:"GetProperty",value:{type:"Current"},property:a[o]},range:this._$.range},n.suggestRanges.push([i[o],i[o],"path",a[o-2]]);break;case 78:this.$={type:"Recursive",value:a[o-4],query:{type:"MethodCall",value:{type:"Current"},method:a[o-2],arguments:[]},range:this._$.range},n.suggestRanges.push([i[o-2],i[o-2],"path",a[o-4]],[i[o],i[o-1],["var","path"],"current",this.$]);break;case 79:this.$={type:"Recursive",value:a[o-5],query:{type:"MethodCall",value:{type:"Current"},method:a[o-3],arguments:a[o-1]},range:this._$.range},n.suggestRanges.push([i[o-3],i[o-3],"path",a[o-5]]);break;case 80:this.$={type:"Recursive",value:a[o-3],query:a[o-1],range:this._$.range};break;case 82:case 86:case 98:case 103:a[o-2].push(a[o]);break;case 83:this.$={type:"Object",properties:[],range:this._$.range},n.suggestRanges.push([i[o],i[o-1],["var","path"],"current",this.$]);break;case 84:this.$={type:"Object",properties:a[o-1],range:this._$.range};break;case 87:this.$={type:"Property",key:a[o],value:{type:"GetProperty",value:{type:"Current"},property:a[o]},range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$],[i[o],i[o],"path","current",this.$]);break;case 88:this.$={type:"Property",key:null,value:{type:"Current"},range:this._$.range},n.suggestRanges.push([i[o],i[o],"var","current",this.$]);break;case 89:this.$={type:"Property",key:a[o],value:{type:"Reference",name:a[o]},range:this._$.range},n.suggestRanges.push([i[o-1],i[o],"var","current",this.$]);break;case 90:this.$={type:"Property",key:a[o-2],value:a[o],range:this._$.range};break;case 91:this.$={type:"Property",key:{type:"Literal",value:a[o-2]},value:a[o],range:this._$.range};break;case 92:this.$={type:"Property",key:a[o-3],value:a[o],range:this._$.range};break;case 93:this.$={type:"Spread",query:{type:"Current"},range:this._$.range},n.suggestRanges.push([i[o],null,["var","path"],"current",this.$]);break;case 94:this.$={type:"Spread",query:a[o],range:this._$.range};break;case 95:this.$={type:"Array",elements:[],range:this._$.range},n.suggestRanges.push([i[o],i[o-1],["var","path"],"current",this.$]);break;case 96:this.$={type:"Array",elements:a[o-1],range:this._$.range};break;case 99:this.$={type:"Function",arguments:[],body:a[o-1],range:this._$.range};break;case 100:this.$={type:"Function",arguments:[],body:a[o],range:this._$.range};break;case 101:this.$={type:"SortingFunction",compares:a[o],range:this._$.range};break;case 104:this.$={type:"Compare",query:a[o-1],reverse:!1,range:this._$.range};break;case 105:this.$={type:"Compare",query:a[o-1],reverse:!0,range:this._$.range};break;case 106:this.$=[null,a[o]];break;case 107:this.$=[null,a[o-1],a[o]];break;case 108:this.$=[a[o-1],a[o]];break;case 109:this.$=[a[o-2],a[o-1],a[o]];break;case 110:this.$=null;break;case 111:this.$=a[o]}},table:[{3:1,4:2,5:t,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{1:[3]},{5:[1,43]},e(C,[2,2]),e(C,[2,3],{14:7,15:8,16:9,17:10,18:11,44:13,45:14,74:21,51:30,52:31,12:33,75:40,8:44,9:45,10:r,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,46:l,47:p,48:y,49:g,50:f,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A}),e(C,[2,6],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(J,[2,7]),e(H,[2,12],{53:X,59:Z,60:V,61:K,62:Q,63:W,76:ee,77:te}),e(H,[2,13]),e(H,[2,14]),e(H,[2,15]),e(H,[2,16]),e(re,ne,{12:74,11:[1,73],39:i}),e(se,[2,44]),e(se,[2,45]),e(H,[2,40]),e(H,[2,41]),e(H,[2,42]),e(H,[2,43]),{4:75,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,72:t,73:A,74:21,75:40},{8:76,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e([5,11,13,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,55,57,66,72],[2,101],{64:[1,78]}),{8:79,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:80,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:81,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,46]),e(se,[2,47]),e(se,[2,50]),e(se,[2,51]),e(se,[2,52]),e(se,[2,53]),e(se,[2,54]),{8:86,10:ae,12:33,13:ie,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,54:82,55:[1,83],56:d,59:k,60:m,61:v,62:_,63:$,65:O,70:84,71:S,73:A,74:21,75:40,78:85},e(se,[2,56],{56:[1,88]}),{7:90,8:89,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{12:91,39:i},{4:92,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:t,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{4:93,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,55:t,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{12:94,39:i},{4:95,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:t,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(H,[2,102]),{10:oe,12:99,39:i,48:ce,53:ue,66:[1,96],67:97,68:98,69:he},e([5,11,13,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,53,55,56,57,59,60,61,62,63,64,66,72,76,77],[2,39]),{1:[2,1]},e(C,[2,5],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(J,[2,8]),{8:104,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:105,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:106,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:107,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:108,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:109,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:110,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:111,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:112,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:113,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:114,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:115,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:116,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:117,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:118,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:119,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:120,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:121,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:122,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{8:123,10:ae,12:33,13:ie,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,54:124,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40,78:85},{12:125,39:i},{4:126,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:t,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{4:127,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,55:t,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{12:128,39:i},{4:129,6:3,7:4,8:5,9:6,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:t,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(H,[2,104]),e(H,[2,105]),e(J,[2,9]),e(re,le,{11:[1,130],13:[1,131]}),{72:[1,132]},e(pe,[2,100],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(se,ne,{12:133,39:i}),{10:ae,12:33,14:135,39:i,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,75:134},e(ye,[2,17],{20:E,21:R,22:x,23:N,24:w,25:P,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e(ge,[2,18],{28:T,29:q,30:F}),e(ge,[2,19],{28:T,29:q,30:F}),{55:[1,136]},e(se,[2,95]),{55:[1,137],64:[1,138]},{13:ie,55:[2,106],78:139},e(fe,[2,97],{78:140,13:ie,20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(be,[2,110],{14:7,15:8,16:9,17:10,18:11,44:13,45:14,74:21,51:30,52:31,12:33,75:40,8:141,10:ae,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,46:l,47:p,48:y,49:g,50:f,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A}),{8:144,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:[1,142],58:143,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z,57:[1,145]},{8:146,9:45,10:r,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,61],{56:[1,147]}),{57:[1,148]},{55:[1,149]},e(se,[2,66],{56:[1,150]}),{57:[1,151]},e(se,[2,83]),{64:[1,153],66:[1,152]},e(de,[2,85]),e(de,[2,87],{13:[1,154]}),e(de,[2,88],{12:155,39:i}),{13:[1,156]},{8:157,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(de,[2,93],{44:13,45:14,51:30,52:31,12:33,14:158,10:ae,39:i,46:l,47:p,48:y,49:g,50:f,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O}),e(ke,[2,20],{20:E,21:R,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e(ke,[2,21],{20:E,21:R,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e(ke,[2,22],{20:E,21:R,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e(ke,[2,23],{20:E,21:R,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e(ye,[2,24],{20:E,21:R,22:x,23:N,24:w,25:P,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e([5,11,13,27,38,55,57,64,66,72],[2,25],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G}),e(ge,[2,26],{28:T,29:q,30:F}),e(ge,[2,27],{28:T,29:q,30:F}),e(H,[2,28]),e(H,[2,29]),e(H,[2,30]),e(me,[2,31],{20:E,21:R,28:T,29:q,30:F,33:U,34:D,35:B,36:Y}),e(me,[2,32],{20:E,21:R,28:T,29:q,30:F,33:U,34:D,35:B,36:Y}),e(ve,[2,33],{20:E,21:R,28:T,29:q,30:F}),e(ve,[2,34],{20:E,21:R,28:T,29:q,30:F}),e(ve,[2,35],{20:E,21:R,28:T,29:q,30:F}),e(ve,[2,36],{20:E,21:R,28:T,29:q,30:F}),e(me,[2,37],{20:E,21:R,28:T,29:q,30:F,33:U,34:D,35:B,36:Y}),{13:[1,159],20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z},{13:ie,20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z,55:[1,160],78:140},{55:[1,161]},e(se,[2,72],{56:[1,162]}),{57:[1,163]},{55:[1,164]},e(se,[2,77],{56:[1,165]}),{57:[1,166]},e(J,[2,10]),{8:167,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(H,[2,99]),e(se,le),e(H,[2,103]),{53:X,59:Z,60:V,61:K,62:Q,63:W,76:ee,77:te},e(se,[2,55]),e(se,[2,96]),{8:168,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{55:[2,107]},{13:ie,55:[2,108],78:169},e(be,[2,111],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(se,[2,57]),{57:[1,170],64:_e},e($e,[2,81],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(se,[2,59]),{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z,57:[1,172]},{8:144,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:[1,173],58:174,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,64]),e(se,[2,65]),{8:144,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:[1,175],58:176,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,69]),e(se,[2,84]),{10:oe,12:99,39:i,48:ce,53:ue,68:177,69:he},{8:178,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(de,[2,89]),{8:179,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z,55:[1,180]},e(de,[2,94],{53:X,59:Z,60:V,61:K,62:Q,63:W}),{8:181,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,70]),e(se,[2,71]),{8:144,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:[1,182],58:183,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,75]),e(se,[2,76]),{8:144,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,57:[1,184],58:185,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,80]),{11:[1,186],20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z},e(fe,[2,98],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),{55:[2,109]},e(se,[2,58]),{8:187,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,60]),e(se,[2,62]),{57:[1,188],64:_e},e(se,[2,67]),{57:[1,189],64:_e},e(de,[2,86]),e(de,[2,90],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(de,[2,91],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),{13:[1,190]},e(pe,[2,38],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(se,[2,73]),{57:[1,191],64:_e},e(se,[2,78]),{57:[1,192],64:_e},e(J,[2,11]),e($e,[2,82],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z}),e(se,[2,63]),e(se,[2,68]),{8:193,10:ae,12:33,14:7,15:8,16:9,17:10,18:11,19:n,20:s,21:a,39:i,40:o,41:c,42:u,43:h,44:13,45:14,46:l,47:p,48:y,49:g,50:f,51:30,52:31,53:b,56:d,59:k,60:m,61:v,62:_,63:$,65:O,71:S,73:A,74:21,75:40},e(se,[2,74]),e(se,[2,79]),e(de,[2,92],{20:E,21:R,22:x,23:N,24:w,25:P,26:I,27:j,28:T,29:q,30:F,31:M,32:L,33:U,34:D,35:B,36:Y,37:G,38:z})],defaultActions:{43:[2,1],139:[2,107],169:[2,109]},parseError:function(e,t){if(!t.recoverable){var r=new Error(e);throw r.hash=t,r}this.trace(e)},parse:function(e){var t=this,r=[0],n=[null],s=[],a=this.table,i="",o=0,c=0,u=2,h=1,l=s.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);p.setInput(e,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;s.push(f);var b=p.options&&p.options.ranges;"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var d,k,m,v,_,$,O,S,A,C=function(){var e;return"number"!=typeof(e=p.lex()||h)&&(e=t.symbols_[e]||e),e},E={};;){if(m=r[r.length-1],this.defaultActions[m]?v=this.defaultActions[m]:(null==d&&(d=C()),v=a[m]&&a[m][d]),void 0===v||!v.length||!v[0]){var R="";for($ in A=[],a[m])this.terminals_[$]&&$>u&&A.push("'"+this.terminals_[$]+"'");R=p.showPosition?"Parse error on line "+(o+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(o+1)+": Unexpected "+(d==h?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(R,{text:p.match,token:this.terminals_[d]||d,line:p.yylineno,loc:f,expected:A})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+d);switch(v[0]){case 1:r.push(d),n.push(p.yytext),s.push(p.yylloc),r.push(v[1]),d=null,k?(d=k,k=null):(c=p.yyleng,i=p.yytext,o=p.yylineno,f=p.yylloc);break;case 2:if(O=this.productions_[v[1]][1],E.$=n[n.length-O],E._$={first_line:s[s.length-(O||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(O||1)].first_column,last_column:s[s.length-1].last_column},b&&(E._$.range=[s[s.length-(O||1)].range[0],s[s.length-1].range[1]]),void 0!==(_=this.performAction.apply(E,[i,c,o,y.yy,v[1],n,s].concat(l))))return _;O&&(r=r.slice(0,-1*O*2),n=n.slice(0,-1*O),s=s.slice(0,-1*O)),r.push(this.productions_[v[1]][0]),n.push(E.$),s.push(E._$),S=a[r[r.length-2]][r[r.length-1]],r.push(S);break;case 3:return!0}}return!0}},Se={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(n=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var a in s)this[a]=s[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),a=0;a<s.length;a++)if((r=this._input.match(this.rules[s[a]]))&&(!t||r[0].length>t[0].length)){if(t=r,n=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,s[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,s[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{ranges:!0},performAction:function(e,t,r,n){switch(r){case 0:e.commentRanges.push(t.yylloc.range);break;case 1:break;case 2:return this.popState(),"/";case 3:return this.popState(),"<";case 4:this.done=!1,this.popState();break;case 5:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"(";case 6:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),")";case 7:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"[";case 8:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"]";case 9:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"{";case 10:return this.fnOpened=this.fnOpenedStack.pop()||0,this._input&&this.begin("preventPrimitive"),"}";case 11:return"TRUE";case 12:return"FALSE";case 13:return"NULL";case 14:return"UNDEFINED";case 15:return"AND";case 16:return"OR";case 17:return"HASNO";case 18:return"HAS";case 19:return"IN";case 20:return"NOTIN";case 21:return"NOT";case 22:return"ASC";case 23:return"DESC";case 24:return this._input&&this.begin("preventPrimitive"),"@";case 25:return this._input&&this.begin("preventPrimitive"),"#";case 26:return this._input&&this.begin("preventPrimitive"),"$";case 27:return this._input&&this.begin("preventPrimitive"),t.yytext=Number(t.yytext),"NUMBER";case 28:case 29:return this._input&&this.begin("preventPrimitive"),t.yytext=this.toStringLiteral(t.yytext),"STRING";case 30:return this._input&&this.begin("preventPrimitive"),"SYMBOL";case 31:return this._input&&this.begin("preventPrimitive"),t.yytext=this.toRegExp(t.yytext),"REGEXP";case 32:return"FUNCTION";case 33:return this.fnOpened++,"FUNCTION_START";case 34:return"=";case 35:return"!=";case 36:return"~=";case 37:return">=";case 38:return"<=";case 39:return"<";case 40:return this.fnOpened?(this.fnOpened--,"FUNCTION_END"):">";case 41:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,"..(";case 42:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".(";case 43:return this.fnOpenedStack.push(this.fnOpened),this.fnOpened=0,".[";case 44:return"...";case 45:return this._input&&this.begin("preventPrimitive"),"..";case 46:return this._input&&this.begin("preventPrimitive"),".";case 47:return"?";case 48:return",";case 49:return":";case 50:return";";case 51:return"-";case 52:return"+";case 53:return"*";case 54:return"/";case 55:return"%";case 56:return"EOF"}},rules:[/^(?:(\/\/.*?(\r|\n|$)))/,/^(?:(\s+))/,/^(?:\/)/,/^(?:<(?!=))/,/^(?:)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:true(\b))/,/^(?:false(\b))/,/^(?:null(\b))/,/^(?:undefined(\b))/,/^(?:and(\b))/,/^(?:or(\b))/,/^(?:has(\s+)no(\b))/,/^(?:has(\b))/,/^(?:in(\b))/,/^(?:not(\s+)in(\b))/,/^(?:not?(\b))/,/^(?:asc(\b))/,/^(?:desc(\b))/,/^(?:@)/,/^(?:#)/,/^(?:\$)/,/^(?:\d+(?:\.\d+)?([eE][-+]?\d+)?(\b))/,/^(?:"(?:\\.|[^"])*")/,/^(?:'(?:\\.|[^'])*')/,/^(?:[a-zA-Z_][a-zA-Z_$0-9]*)/,/^(?:(\/(?:\\.|[^/])+\/i?))/,/^(?:=>)/,/^(?:<(?!=))/,/^(?:=)/,/^(?:!=)/,/^(?:~=)/,/^(?:>=)/,/^(?:<=)/,/^(?:<)/,/^(?:>)/,/^(?:\.\.\()/,/^(?:\.\()/,/^(?:\.\[)/,/^(?:\.\.\.)/,/^(?:\.\.)/,/^(?:\.)/,/^(?:\?)/,/^(?:,)/,/^(?::)/,/^(?:;)/,/^(?:\-)/,/^(?:\+)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:$)/],conditions:{preventPrimitive:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56],inclusive:!0},INITIAL:{rules:[0,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56],inclusive:!0}}};function Ae(){this.yy={}}return Oe.lexer=Se,Ae.prototype=Oe,Oe.Parser=Ae,new Ae}());function d(e,t){return"GetProperty"===e.type&&("Current"===e.value.type&&("Identifier"===e.property.type&&e.property.name===t))}var k=function(e){function t(e){switch(e.type){case"Data":n("@");break;case"Context":n("#");break;case"Current":n("$");break;case"Literal":n("string"==typeof e.value?JSON.stringify(e.value):String(e.value));break;case"Identifier":n(e.name);break;case"Unary":n(e.operator),"-"!==e.operator&&"+"!==e.operator&&n(" "),t(e.argument);break;case"Binary":t(e.left),/^[a-z]/i.test(e.operator)?(n(" "),n(e.operator),n(" ")):n(e.operator),t(e.right);break;case"Conditional":t(e.test),n("?"),t(e.consequent),n(":"),t(e.alternate);break;case"Object":n("{"),a(e.properties,","),n("}");break;case"Property":if(!e.key||(r=e.key,i=e.value,"Identifier"===r.type&&"Reference"===i.type&&"Identifier"===i.name.type&&r.name===i.name.name)){t(e.value);break}"Literal"===e.key.type||"Identifier"===e.key.type?t(e.key):(n("["),t(e.key),n("]")),"Identifier"===e.key.type&&d(e.value,e.key.name)||(n(":"),t(e.value));break;case"Spread":n("..."),s(e.query);break;case"Array":n("["),a(e.elements,","),n("]");break;case"Function":n("<"),t(e.body),n(">");break;case"Compare":t(e.query),n(e.reverse?" desc":" asc");break;case"SortingFunction":a(e.compares,",");break;case"MethodCall":s(e.value)&&n("."),t(e.method),n("("),a(e.arguments,","),n(")");break;case"Definition":e.name?(n("$"),t(e.name),"Identifier"===e.name.type&&d(e.value,e.name.name)||(n(":"),t(e.value))):t(e.value),n(";");break;case"Parentheses":n("("),t(e.body),n(")");break;case"Block":e.definitions.forEach(t),t(e.body);break;case"Reference":n("$"),t(e.name);break;case"Map":s(e.value),n(".("),t(e.query),n(")");break;case"Filter":s(e.value),n(".["),t(e.query),n("]");break;case"Recursive":s(e.value),n("..("),t(e.query),n(")");break;case"GetProperty":"Identifier"===e.property.type?(s(e.value)&&n("."),t(e.property)):(t(e.value),n("["),t(e.property),n("]"));break;case"SliceNotation":{const[r,a,i]=e.arguments;s(e.value),n("["),r&&t(r),n(":"),a&&t(a),i&&(n(":"),t(i)),n("]");break}default:throw new Error("Unknown node type `"+e.type+"`")}var r,i}const r=[],n=e=>r.push(e),s=e=>{if("Current"!==e.type)return t(e),!0},a=(e,r)=>{e.forEach((e,s)=>{s>0&&n(r),t(e)})};return t(e),r.join("")};const m={"-":"-","+":"+",no:"!",not:"!"},v={in:"in","not in":"in",has:"-","has no":"-",and:"and",or:"or","+":"add","-":"sub","*":"mul","/":"div","%":"mod","=":"eq","!=":"ne","<":"lt","<=":"lte",">":"gt",">=":"gte","~=":"match"};var _=function(e,t=[],r=!1){function n(e,t,r){let n;return"var"===r?n=JSON.stringify(c):(e||(e="v"+f++),n=e),"[]"!==n&&b.push([n,JSON.stringify([t[0],t[1]]),JSON.stringify(r)].join(",")),e}function s(e){return e.reduce((e,t)=>n(e,t,t[2])||e,void 0)}function a(e,t){const r=c,n=h.length;if((c=c.slice()).firstCurrent=null,c.captureCurrent=[],e(),c.captureCurrent.length){const e=s(c.captureCurrent);if(e){const r="stat("+e+",current)";c.firstCurrent?h[c.firstCurrent]=r:h[n]=t(h[n],r)}}c=r}function i(e){const t=r&&g.has(e);if(t){const t=s(g.get(e));t&&l("stat("+t+","),g.delete()}switch(r&&y.has(e)&&c.captureCurrent.push(...y.get(e).filter(e=>{if("var"!==e[2])return!0;n(null,e,e[2])})),e.type){case"Data":l("data");break;case"Context":l("context");break;case"Current":null!==c.firstCurrent||c.captureCurrent.disabled||(c.firstCurrent=h.length),l("current");break;case"Literal":l("string"==typeof e.value?JSON.stringify(e.value):String(e.value));break;case"Identifier":l(e.name);break;case"Unary":if(e.operator in m==!1)throw new Error("Unknown operator `"+e.operator+"`");"not"===e.operator||"no"===e.operator?(l("!f.bool("),i(e.argument),l(")")):(l(m[e.operator]),i(e.argument));break;case"Binary":if(e.operator in v==!1)throw new Error("Unknown operator `"+e.operator+"`");switch("not in"!==e.operator&&"has no"!==e.operator||l("!"),e.operator){case"has":case"has no":l("f.in("),i(e.right),l(","),i(e.left),l(")");break;case"or":u=!0,l("f.bool(tmp="),i(e.left),l(")?tmp:"),c.captureCurrent.disabled=!0,i(e.right),c.captureCurrent.disabled=!1;break;case"and":u=!0,l("f.bool(tmp="),i(e.left),l(")?"),c.captureCurrent.disabled=!0,i(e.right),c.captureCurrent.disabled=!1,l(":tmp");break;default:l("f."),l(v[e.operator]),l("("),i(e.left),l(","),i(e.right),l(")")}break;case"Conditional":l("f.bool("),i(e.test),c.captureCurrent.disabled=!0,l(")?"),i(e.consequent),l(":"),i(e.alternate),c.captureCurrent.disabled=!1;break;case"Object":l("{"),p(e.properties,","),l("}");break;case"Property":if(!e.key)break;"Literal"===e.key.type||"Identifier"===e.key.type?i(e.key):(l("["),i(e.key),l("]")),l(":"),i(e.value);break;case"Spread":l("..."),i(e.query);break;case"Array":l("["),p(e.elements,","),l("]");break;case"Function":a(()=>{l("current=>("),i(e.body),l(")")},(e,t)=>e+t+",");break;case"Compare":e.reverse&&l("-"),a(()=>{l("f.cmp((_q=current=>("),i(e.query),l("))(a),_q(b))")},(e,t)=>e+t+",");break;case"SortingFunction":l("(a, b)=>{let _q;return "),p(e.compares,"||"),l("||0}");break;case"MethodCall":l("m."),i(e.method),l("("),i(e.value),e.arguments.length&&(l(","),p(e.arguments,",")),l(")");break;case"Definition":if(!e.name)break;if(c.includes(e.name.name))throw new Error(`Identifier '$${e.name.name}' has already been declared`);if(o.includes(e.name.name))throw new Error(`Identifier '$${e.name.name}' is reserved for future use`);l("const $"),i(e.name),l("="),i(e.value),l(";"),c.push(e.name.name);break;case"Parentheses":l("("),i(e.body),l(")");break;case"Block":e.definitions.length?a(()=>{l("(()=>{"),p(e.definitions),l("return "),i(e.body),l("})()")},(e,t)=>e+t+";"):"Object"===e.body.type?(l("("),i(e.body),l(")")):i(e.body);break;case"Reference":c.includes(e.name.name)?(l("$"),i(e.name)):(l("typeof $"),i(e.name),l('!=="undefined"?$'),i(e.name),l(":undefined"));break;case"Map":l("f.map("),i(e.value),a(()=>{l(",current=>"),i(e.query)},(e,t)=>(l(")"),e+"("+t+",")),l(")");break;case"Filter":l("f.filter("),i(e.value),a(()=>{l(",current=>"),i(e.query)},(e,t)=>(l(")"),e+"("+t+",")),l(")");break;case"Recursive":l("f.recursive("),i(e.value),a(()=>{l(",current=>"),i(e.query)},(e,t)=>(l(")"),e+"("+t+",")),l(")");break;case"GetProperty":l("f.map("),i(e.value),l(","),"Identifier"===e.property.type?l(JSON.stringify(e.property.name)):i(e.property),l(")");break;case"SliceNotation":l("f.slice("),i(e.value),e.arguments.slice(0,3).forEach(e=>{l(","),e?i(e):l("undefined")}),l(")")}t&&l(")")}const o=["data","context","ctx","array","idx","index"];let c=[],u=!1;const h=["const current=data;","return "],l=e=>h.push(e),p=(e,t)=>{e.forEach((e,r)=>{r>0&&l(t),i(e)})},y=t.reduce((e,t)=>("current"===t[3]&&(e.has(t[4])?e.get(t[4]).push(t):e.set(t[4],[t])),e),new Map),g=t.reduce((e,t)=>(t[3]&&"current"!==t[3]&&(e.has(t[3])?e.get(t[3]).push(t):e.set(t[3],[t])),e),new Map);let f=0;const b=[];return a(()=>i(e),(e,t)=>(l(")"),e+"("+t+",")),u&&h.unshift("let tmp;"),r&&(f>0&&(h.unshift("const "+Array.from(Array(f),(e,t)=>"v"+t+"=new Set()")+";\n"),h.unshift("const stat=(values,v)=>(values.add(v),v);\n")),l("\n,["+b.map(e=>"["+e+"]")+"]")),new Function("f","m","data","context",h.join(""))};var $,O=($=t)&&$.default||$;const{version:S}=O,{strict:A,tolerant:C}=b,{addToSet:E,isPlainObject:R}=n,x=new Map,N=new Map,w=new Map,P=new Map,I={path:"property",key:"property",value:"value","in-value":"value",var:"variable"};function j(e,t,r,n){const s=[];for(let a=0;a<r.length;a++){const[i,o,c]=r[a];for(let r=0;r<o.length;r+=2){let a=o[r],u=o[r+1];if(t>=a&&t<=u&&(n||i.size||i.length)){let r=e.substring(a,u);/\S/.test(r)||(r="",a=u=t),s.push({context:c,current:r,from:a,to:u,values:i})}}}return s}return Object.assign((function(e,t){t=t||{};const r=Boolean(t.debug),n=Boolean(t.stat),s=Boolean(t.tolerant),a=t.methods?Object.assign({},f,t.methods):f,i=n?s?P:N:s?w:x;let o;return e=String(e),i.has(e)?o=i.get(e):(o=function(e,t,r,n){n&&(console.log("\n== compile query ======"),console.log("[Source]"),console.log(e),console.log());const s=(r?C:A).parse(e);if(n){const t=e=>JSON.stringify(e).slice(1,-1);console.log("[AST]"),console.dir(s.ast,{depth:null}),console.log(),console.log("[Restored source]"),console.log(k(s.ast)),console.log(),console.log("[Suggest ranges]"),s.suggestRanges.sort((e,t)=>e[0]-t[0]).forEach(r=>{console.log(t(e));const n=t(e.slice(0,r[0])).length,s=t(e.substring(r[0],r[1])).length;console.log(" ".repeat(n)+(s?"~".repeat(s):"\\")+" "+r[0]+":"+r[1]+" ["+r[2]+"] from "+r[3])}),console.log()}const a=t?_(s.ast,s.suggestRanges,t):_(s.ast);return n&&(console.log("[Function]"),console.log(a.toString()),console.log()),a}(e,n,s,r),i.set(e,o)),n?function(t,r){const n=o(u,a,t,r);return{stat(t,r){const s=j(e,t,n,r);return s.forEach(e=>{e.values=[...e.values]}),s.length?s:null},suggestion(t,r){const s=[];return j(e,t,n,r).forEach(e=>{const{context:t,current:r,from:n,to:a,values:i}=e;s.push(...function(e,t){const r=new Set,n=e=>{switch(typeof e){case"string":r.add(JSON.stringify(e));break;case"number":r.add(String(e))}};switch(e){case"":case"path":t.forEach(e=>{Array.isArray(e)?e.forEach(e=>{R(e)&&E(r,Object.keys(e))}):R(e)&&E(r,Object.keys(e))});break;case"key":t.forEach(e=>{R(e)&&E(r,Object.keys(e))});break;case"value":t.forEach(e=>{Array.isArray(e)?e.forEach(n):n(e)});break;case"in-value":t.forEach(e=>{Array.isArray(e)?e.forEach(n):R(e)?Object.keys(e).forEach(n):n(e)});break;case"var":t.forEach(e=>{r.add("$"+e)})}return[...r]}(t,i).map(e=>({current:r,type:I[t],value:e,from:n,to:a})))}),s.length?s:null}}}:function e(t,r){return o(u,a,t,r,e)}}),{version:S,buildin:u,methods:f,syntax:{parse:(e,t)=>(t?C:A).parse(e),compile:_,stringify:k}})})); |
{ | ||
"name": "jora", | ||
"version": "1.0.0-alpha.10", | ||
"version": "1.0.0-alpha.11", | ||
"description": "JavaScript object query engine", | ||
"keywords": [], | ||
"homepage": "https://github.com/lahmatiy/jora", | ||
"author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)", | ||
"maintainers": [ | ||
{ | ||
"name": "Roman Dvornov", | ||
"email": "rdvornov@gmail.com", | ||
"github-username": "lahmatiy" | ||
} | ||
"repository": "discoveryjs/jora", | ||
"license": "MIT", | ||
"keywords": [ | ||
"query", | ||
"data", | ||
"path", | ||
"language", | ||
"javascript", | ||
"json" | ||
], | ||
"license": "MIT", | ||
"repository": "lahmatiy/jora", | ||
"bugs": { | ||
"url": "https://github.com/lahmatiy/jora/issues" | ||
}, | ||
"main": "./src/index", | ||
"main": "src/index", | ||
"unpkg": "dist/jora.min.js", | ||
"jsdelivr": "dist/jora.min.js", | ||
"browser": { | ||
"./src/parser.js": "./dist/parser.js" | ||
"./src/parser.js": "./dist/parser.js", | ||
"./package.json": "./dist/package.json" | ||
}, | ||
@@ -28,4 +27,4 @@ "scripts": { | ||
"test": "mocha --reporter progress", | ||
"build": "npm run build:parser && browserify -t package-json-versionify --standalone jora src/index.js > dist/jora.js && uglifyjs dist/jora.js --compress --mangle -o dist/jora.min.js", | ||
"build:parser": "node scripts/build > dist/parser.js", | ||
"build": "npm run build:prerequisites && rollup --config && terser dist/jora.js --compress --mangle -o dist/jora.min.js", | ||
"build:prerequisites": "node scripts/build", | ||
"prepublishOnly": "npm run build", | ||
@@ -40,20 +39,19 @@ "coverage": "nyc npm test", | ||
"devDependencies": { | ||
"browserify": "^16.2.3", | ||
"coveralls": "^3.0.3", | ||
"eslint": "^5.15.1", | ||
"coveralls": "^3.0.7", | ||
"eslint": "^6.5.1", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.3.0", | ||
"package-json-versionify": "^1.0.4", | ||
"uglify-es": "^3.3.9" | ||
"nyc": "^14.1.0", | ||
"rollup": "^1.23.1", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"terser": "^4.3.8" | ||
}, | ||
"engines": { | ||
"node": "^8.0.0" | ||
"node": ">=8.0.0" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"README.md" | ||
"src" | ||
] | ||
} |
# Jora | ||
[![NPM version](https://img.shields.io/npm/v/jora.svg)](https://www.npmjs.com/package/jora) | ||
[![Build Status](https://travis-ci.org/lahmatiy/jora.svg?branch=master)](https://travis-ci.org/lahmatiy/jora) | ||
[![Coverage Status](https://coveralls.io/repos/github/lahmatiy/jora/badge.svg?branch=master)](https://coveralls.io/github/lahmatiy/jora?branch=master) | ||
[![Build Status](https://travis-ci.org/discoveryjs/jora.svg?branch=master)](https://travis-ci.org/discoveryjs/jora) | ||
[![Coverage Status](https://coveralls.io/repos/github/discoveryjs/jora/badge.svg?branch=master)](https://coveralls.io/github/discoveryjs/jora?branch=master) | ||
@@ -23,8 +23,10 @@ JavaScript object query engine | ||
- [jora-cli](https://github.com/discoveryjs/jora-cli) – Command line interface for Jora | ||
- [Jora sandbox](https://discoveryjs.github.io/jora-sandbox/) – A Web interface where you can play with jora syntax or transform some JSON with zero setup | ||
- [Discovery](https://github.com/discoveryjs/discovery) – Hackable JSON discovery tool. Uses jora to query a data for views | ||
- [JsonDiscovery](https://github.com/discoveryjs/browser-extension-json-discovery) – Chrome extension built on Discovery which allows you to discover a JSON documents and make beautiful reports on the fly | ||
- [JsonDiscovery](https://github.com/discoveryjs/browser-extension-json-discovery) – a browser’s extension for viewing JSON built on Discovery, available for [Chrome](https://chrome.google.com/webstore/detail/jsondiscovery/pamhglogfolfbmlpnenhpeholpnlcclo) and [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/jsondiscovery/) (read more in the article [Changing a way we’re viewing JSON in a browser](https://medium.com/@rdvornov/changing-a-way-were-viewing-json-in-a-browser-51eda9103fa2)) | ||
TODO: | ||
- [ ] AST | ||
- [x] AST | ||
- [ ] Immutable paths hoisting (reduce computations -> performance) | ||
@@ -54,4 +56,4 @@ - [ ] Smart computation caching across queries | ||
- [Boolean logic](#boolean-logic) | ||
- [Block, scope and variables](#block-scope-and-variables) | ||
- [Special variables](#special-variables) | ||
- [Block & definitions](#block--definitions) | ||
- [Special references](#special-references) | ||
- [Path chaining](#path-chaining) | ||
@@ -134,21 +136,23 @@ - [Build-in methods](#build-in-methods) | ||
const npmTree = JSON.parse(stdout); | ||
const multipleVersionPackages = jora(` | ||
..(dependencies.mapToArray("name")) | ||
.group(<name>, <version>) | ||
.({ name: key, versions: value }) | ||
[versions.size() > 1] | ||
`)(npmTree); | ||
const tree = JSON.parse(stdout); | ||
const depsPathsToMultipleVersionPackages = jora(` | ||
$multiVersionPackages: | ||
..(dependencies.mapToArray("name")) | ||
.group(<name>, <version>) | ||
.({ name: key, versions: value.sort() }) | ||
.[versions.size() > 1]; | ||
const depsPathsToMultipleVersionPackages = jora(` | ||
.({ | ||
$pathToMultiVersionPackages: => .($name; { | ||
name, | ||
version, | ||
otherVersions: #[name=@.name].versions - version, | ||
otherVersions: $multiVersionPackages.pick(<name=$name>).versions - version, | ||
dependencies: dependencies | ||
.mapToArray("name") | ||
.map(::self) | ||
[name in #.name or dependencies] | ||
}) | ||
`)(npmTree, multipleVersionPackages); | ||
.map($pathToMultiVersionPackages) | ||
.[name in $multiVersionPackages.name or dependencies] | ||
}); | ||
map($pathToMultiVersionPackages) | ||
`)(tree); | ||
printTree(depsPathsToMultipleVersionPackages); | ||
@@ -189,3 +193,4 @@ }); | ||
[ ] | Array initializer/literal syntax | ||
< block > | A function<br>NOTE: Syntax will be changed | ||
< block ><br>=> e | A function<br>NOTE: Syntax will be changed | ||
query asc<br>query desc<br>query asc, query desc, ... | A sorting function that takes two arguments and compare query result for each in specified order (`asc` – ascending, `desc` – descending) | ||
@@ -227,3 +232,3 @@ ### Keywords | ||
--- | --- | ||
( x ) | Explicity operator precedence | ||
( x ) | Explicity operator precedence. Definitions are allowed (i.e. `($a: 1; $a + $a)` see bellow) | ||
x or y | Boolean `or`.<br>Equivalent to `\|\|` in JS, but `x` tests with `bool()` method | ||
@@ -236,5 +241,5 @@ x and y | Boolean `and`.<br>Equivalent to `&&` in JS, but `x` tests with `bool()` method | ||
### Block, scope and variables | ||
### Block & definitions | ||
A block contains of a definition list (should comes first) and an expression. Both are optional. When an expression is empty a current value (i.e. `$`) returns. | ||
Some constructions suppose to use a block, which may consists of a definition list (should comes first) and an expression. Both are optional. When an expression is empty, a current value (i.e. `$`) returns. | ||
@@ -251,17 +256,19 @@ The syntax of definition (white spaces between any part are optional): | ||
``` | ||
$foo:123; // Define `$foo` variable | ||
$foo:123; // Define `$foo` | ||
$bar; // The same as `$bar:$.bar;` or `$a:bar;` | ||
$baz: $foo + $bar; // Variables can be used inside an expression after its definition | ||
$baz: $foo + $bar; // Definitions may be used in following expressions | ||
``` | ||
A block creates a new scope. Variables can't be redefined in the same and nested scopes, otherwise it cause to error. | ||
In terms of JavaScript, a block creates a new scope. Variables can't be redefined or change a value in the same or nested scopes, otherwise it cause to error. | ||
### Special variables | ||
### Special references | ||
Jora | Description | ||
--- | --- | ||
@ | The root data object | ||
$ | The current data object, depends on scope | ||
\# | The context | ||
$ | A scope input data (current value). On top level scope it's the same as `@`. In most cases it may be omitted. Used implicitly an input for subquery when no other subjects is defined (e.g. `foo()` and `.foo()` are equivalent for `$.foo()`). | ||
@ | A query input data | ||
\# | A query context | ||
Since Jora's query performs as `query(data, context)`, in terms of Jora it looks like `query(@, #)`. | ||
### Path chaining | ||
@@ -276,4 +283,5 @@ | ||
.( block ) | Map a current data. Equivalent to a `.map(<block>)` | ||
.method() | Invoke a method to current data, or each element of current data if it is an array | ||
.method()<br> ..method() | Invoke a method to current data, or each element of current data if it is an array | ||
path[e] | Array-like notation to access properties. It works like in JS for everything with exception for arrays, where it equivalents to `array.map(e => e[key])`. Use `pick()` method to get an element by index in array. | ||
[from:to]<br>[from:to:step] | [Slice notation](https://github.com/tc39/proposal-slice-notation/blob/master/README.md). Examples: `$str: '<foo>'; str[1:-1]` (`'foo'`) or `$ar:[1,2,3,4,5,6]; $ar[-3::-1]` (`[6,5,4]`) | ||
@@ -291,3 +299,3 @@ ### Build-in methods | ||
size() | Returns count of keys if current data is object, otherwise returns `length` value or `0` when field is absent | ||
sort(\<fn>) | Sort an array by a value fetched with getter | ||
sort(\<fn>) | Sort an array by a value fetched with getter (`<fn>`). Keep in mind, you can use sorting function definition syntax using `asc` and `desc` keywords, qhich is more effective in many ways. In case of sorting function definition usage, `<` and `>` are not needed and you can specify sorting order for each component. Following queries are equivalents:<br>`sort(<foo.bar>)` and `sort(foo.bar asc)`<br>`sort(<foo>).reverse()` and `sort(foo desc)`<br>`sort(<[a, b]>)` and `sort(a asc, b asc)` | ||
reverse() | Reverse order of items | ||
@@ -297,2 +305,6 @@ group(\<fn>[, \<fn>]) | Group an array items by a value fetched with first getter. | ||
map(\<fn>) | The same as `Array#map()` in JS | ||
split(pattern) | The same as `String#split()` in JS. `pattern` may be a string or regexp | ||
join(separator) | The same as `Array#join()` in JS. When `separator` is undefined then `","` is using | ||
slice(from, to) | The same as `Array#slice()` or `String#slice()` in JS | ||
match(pattern, matchAll) | The same as `String#match()`. Since regexp'es in jora doesn't support for `g` flag, use `matchAll` argument to get all matches, i.e. `'abcabc'.match(/ab/, true)` (jora) instead of `'abcabc'.match(/ab/g)` (JS) | ||
@@ -299,0 +311,0 @@ ## License |
@@ -5,3 +5,4 @@ const { | ||
isPlainObject, | ||
isRegExp | ||
isRegExp, | ||
isArrayLike | ||
} = require('./utils'); | ||
@@ -90,12 +91,15 @@ | ||
}, | ||
match: function(value, tester) { | ||
if (typeof tester === 'function') { | ||
return this.filter(value, tester); | ||
cmp: function(a, b) { | ||
return a > b ? 1 : a < b ? -1 : 0; | ||
}, | ||
match: function(value, pattern) { | ||
if (typeof pattern === 'function') { | ||
return this.filter(value, pattern); | ||
} | ||
if (isRegExp(tester)) { | ||
return this.filter(value, tester.test.bind(tester)); | ||
if (isRegExp(pattern)) { | ||
return this.filter(value, pattern.test.bind(pattern)); | ||
} | ||
if (tester === null || tester === undefined) { | ||
if (pattern === null || pattern === undefined) { | ||
return true; | ||
@@ -122,2 +126,34 @@ } | ||
}, | ||
slice: function(value, from = 0, to = value && value.length, step = 1) { | ||
if (!isArrayLike(value)) { | ||
return []; | ||
} | ||
from = parseInt(from, 10) || 0; | ||
to = parseInt(to, 10) || value.length; | ||
step = parseInt(step, 10) || 1; | ||
if (step !== 1) { | ||
const result = []; | ||
from = from < 0 | ||
? Math.max(0, value.length + from) | ||
: Math.min(value.length, from); | ||
to = to < 0 | ||
? Math.max(0, value.length + to) | ||
: Math.min(value.length, to); | ||
for (let i = step > 0 ? from : to - 1; i >= from && i < to; i += step) { | ||
result.push(value[i]); | ||
} | ||
return result; | ||
} | ||
if (typeof value === 'string') { | ||
return value.slice(from, to); | ||
} | ||
return Array.prototype.slice.call(value, from, to); | ||
}, | ||
recursive: function(value, getter) { | ||
@@ -124,0 +160,0 @@ const result = new Set(); |
236
src/index.js
@@ -0,1 +1,2 @@ | ||
const { version } = require('../package.json'); | ||
const buildin = require('./buildin'); | ||
@@ -7,3 +8,5 @@ const methods = require('./methods'); | ||
} = require('./parser'); | ||
const { addToSet, isPlainObject} = require('./utils'); | ||
const stringify = require('./stringify'); | ||
const compile = require('./compile'); | ||
const { addToSet, isPlainObject } = require('./utils'); | ||
@@ -22,15 +25,2 @@ const cacheStrict = new Map(); | ||
function isWhiteSpace(str, offset) { | ||
const code = str.charCodeAt(offset); | ||
return code === 9 || code === 10 || code === 13 || code === 32; | ||
} | ||
function suggestProhitedChar(str, offset) { | ||
return ( | ||
offset >= 0 && | ||
offset < str.length && | ||
/[a-zA-Z_$0-9]/.test(str[offset]) | ||
); | ||
} | ||
function valuesToSuggestions(context, values) { | ||
@@ -139,181 +129,47 @@ const suggestions = new Set(); | ||
function compileFunction(source, statMode, tolerantMode, debug) { | ||
function getSuggestRanges(from, to) { | ||
const ranges = []; | ||
for (let i = 0; i < commentRanges.length; i++) { | ||
const [commentFrom, commentTo] = commentRanges[i]; | ||
if (commentFrom > to) { | ||
break; | ||
} | ||
if (commentFrom < from) { | ||
continue; | ||
} | ||
if (commentFrom === from) { | ||
ranges.push(from, from); | ||
} else { | ||
ranges.push(from, commentFrom); | ||
} | ||
from = commentTo; | ||
} | ||
if (from !== source.length || !noSuggestOnEofPos) { | ||
ranges.push(from, to); | ||
} | ||
return ranges; | ||
} | ||
function astToCode(node, scopeVars) { | ||
if (Array.isArray(node)) { | ||
const first = node[0]; | ||
let varName = false; | ||
let i = 0; | ||
if (first === '/*scope*/') { | ||
// create new scope | ||
scopeVars = scopeVars.slice(); | ||
i++; | ||
} else if (typeof first === 'string' && first.startsWith('/*define:')) { | ||
let [from, to] = first.substring(9, first.length - 2).split(','); | ||
varName = source.substring(from, to); | ||
if (scopeVars.includes(`"${varName}"`)) { | ||
throw new Error(`Identifier '$${varName}' has already been declared`); | ||
} | ||
i++; | ||
} | ||
for (; i < node.length; i++) { | ||
astToCode(node[i], scopeVars); | ||
} | ||
if (varName) { | ||
scopeVars.push(`"${varName}"`); | ||
} | ||
} else if (statMode && node.startsWith('/*')) { | ||
if (node.startsWith('/*var:')) { | ||
let [from, to] = node.substring(6, node.length - 2).split(','); | ||
if (from === to) { | ||
// when starts on keyword/number/var end | ||
if (suggestProhitedChar(source, from - 1)) { | ||
return; | ||
} | ||
// extend a range by white spaces | ||
while (to < source.length - 1 && isWhiteSpace(source, to)) { | ||
to++; | ||
} | ||
// when ends on keyword/number/var start | ||
if (suggestProhitedChar(source, to)) { | ||
if (from === to) { | ||
return; | ||
} | ||
to--; | ||
} | ||
} | ||
suggestPoints.push(`[[${scopeVars}], [${getSuggestRanges(from, to)}], "var"]`); | ||
} else if (node.startsWith('/*sp:')) { | ||
const pointId = suggestSets.push('sp' + suggestSets.length + ' = new Set()') - 1; | ||
const items = node.substring(5, node.length - 2).split(','); | ||
// FIXME: position correction should be in parser | ||
for (let i = 0; i < items.length; i += 3) { | ||
let from = Number(items[i]); | ||
let to = Number(items[i + 1]); | ||
let context = items[i + 2]; | ||
const frag = source.substring(from, to); | ||
if (frag === '.[' || frag === '.(' || frag === '..(' || | ||
frag === '{' || frag === '[' || frag === '(' || frag === '<' || | ||
frag === '...' || | ||
from === to) { | ||
from = to; | ||
// when starts on keyword/number/var end | ||
if (suggestProhitedChar(source, from - 1)) { | ||
continue; | ||
} | ||
// extend a range by white spaces | ||
while (to < source.length - 1 && isWhiteSpace(source, to)) { | ||
to++; | ||
} | ||
// when ends on keyword/number/var start | ||
if (suggestProhitedChar(source, to)) { | ||
if (from === to) { | ||
continue; | ||
} | ||
to--; | ||
} | ||
} | ||
suggestPoints.push(`[sp${pointId}, [${getSuggestRanges(from, to)}], "${context || 'path'}"]`); | ||
} | ||
code.push(`suggestPoint(sp${pointId}, `); | ||
} else if (node === '/**/') { | ||
code.push(')'); | ||
} | ||
} else { | ||
code.push(node); | ||
} | ||
} | ||
if (debug) { | ||
console.log('\n== compile ======'); | ||
console.log('source:', source); | ||
console.log('\n== compile query ======'); | ||
console.log('[Source]'); | ||
console.log(source); | ||
console.log(); | ||
} | ||
const parser = tolerantMode ? tolerantParser : strictParser; | ||
const { ast, commentRanges } = parser.parse(source); | ||
const code = []; | ||
const suggestPoints = []; | ||
const noSuggestOnEofPos = // edge case when source ends with a comment with no newline | ||
commentRanges.length && | ||
commentRanges[commentRanges.length - 1][1] === source.length && | ||
!/[\r\n]$/.test(source); | ||
let suggestSets = []; | ||
let body = []; | ||
const parseResult = parser.parse(source); | ||
// if (debug) { | ||
// console.log('ast:', JSON.stringify(ast, null, 4)); | ||
// } | ||
if (debug) { | ||
const esc = s => JSON.stringify(s).slice(1, -1); | ||
console.log('[AST]'); | ||
console.dir(parseResult.ast, { depth: null }); | ||
console.log(); | ||
astToCode(ast, []); | ||
console.log('[Restored source]'); | ||
console.log(stringify(parseResult.ast)); | ||
console.log(); | ||
if (suggestSets.length) { | ||
body.push( | ||
'const ' + suggestSets.join(', ') + ';', | ||
'const suggestPoint = (set, value) => (set.add(value), value);' | ||
); | ||
console.log('[Suggest ranges]'); | ||
// console.dir(parseResult.suggestRanges, { depth: null }); | ||
parseResult.suggestRanges.sort((a, b) => a[0] - b[0]).forEach(r => { | ||
console.log(esc(source)); | ||
const pre = esc(source.slice(0, r[0])).length; | ||
const long = esc(source.substring(r[0], r[1])).length; | ||
console.log(' '.repeat(pre) + (!long ? '\\' : '~'.repeat(long)) + ' ' + r[0] + ':' + r[1] + ' [' + r[2] + '] from ' + r[3]); | ||
}); | ||
console.log(); | ||
} | ||
body.push( | ||
// preserved variables | ||
'const $data = undefined, $context = undefined, $ctx = undefined, $array = undefined, $idx = undefined, $index = undefined;', | ||
'let current = data;', | ||
'let tmp;', | ||
code.join('') | ||
); | ||
const fn = statMode | ||
? compile(parseResult.ast, parseResult.suggestRanges, statMode) | ||
: compile(parseResult.ast); | ||
if (statMode) { | ||
body.push(`,[${suggestPoints}]`); | ||
} | ||
if (debug) { | ||
console.log('== body =========\n' + body.join('\n') + '\n=================\n'); | ||
console.log('[Function]'); | ||
console.log(fn.toString()); | ||
console.log(); | ||
} | ||
return new Function('fn', 'method', 'data', 'context', 'self', body.join('\n')); | ||
return fn; | ||
} | ||
module.exports = function createQuery(source, options) { | ||
function createQuery(source, options) { | ||
options = options || {}; | ||
@@ -339,9 +195,5 @@ | ||
if (debug) { | ||
console.log('fn', fn.toString()); | ||
} | ||
if (statMode) { | ||
return function query(data, context) { | ||
const points = fn(buildin, localMethods, data, context, query); | ||
return function(data, context) { | ||
const points = fn(buildin, localMethods, data, context); | ||
@@ -388,4 +240,14 @@ return { | ||
module.exports.version = require('../package.json').version; | ||
module.exports.buildin = buildin; | ||
module.exports.methods = methods; | ||
module.exports = Object.assign(createQuery, { | ||
version, | ||
buildin, | ||
methods, | ||
syntax: { | ||
parse(source, tolerantMode) { | ||
const parser = tolerantMode ? tolerantParser : strictParser; | ||
return parser.parse(source); | ||
}, | ||
compile, | ||
stringify | ||
} | ||
}); |
@@ -13,2 +13,12 @@ const buildin = require('./buildin'); | ||
function matchEntry(match) { | ||
return { | ||
matched: match.slice(), | ||
start: match.index, | ||
end: match.index + match[0].length, | ||
input: match.input, | ||
groups: match.groups || null | ||
}; | ||
} | ||
module.exports = Object.freeze({ | ||
@@ -82,14 +92,11 @@ bool: buildin.bool, | ||
size: function(current) { | ||
switch (true) { | ||
case Array.isArray(current): | ||
return current.length; | ||
if (isPlainObject(current)) { | ||
return Object.keys(current).length; | ||
} | ||
case isPlainObject(current): | ||
return Object.keys(current).length; | ||
default: | ||
return (current && current.length) || 0; | ||
} | ||
return (current && current.length) || 0; | ||
}, | ||
sort: function(current, fn) { | ||
let sorter; | ||
if (!Array.isArray(current)) { | ||
@@ -100,3 +107,3 @@ return current; | ||
if (typeof fn === 'function') { | ||
return current.slice().sort((a, b) => { | ||
sorter = fn.length === 2 ? fn : (a, b) => { | ||
a = fn(a); | ||
@@ -122,6 +129,6 @@ b = fn(b); | ||
return a < b ? -1 : a > b; | ||
}); | ||
}; | ||
} | ||
return current.slice().sort(); | ||
return current.slice().sort(sorter); | ||
}, | ||
@@ -135,2 +142,5 @@ reverse: function(current) { | ||
}, | ||
slice: function(current, from, to) { | ||
return buildin.slice(current, from, to); | ||
}, | ||
group: function(current, keyGetter, valueGetter) { | ||
@@ -173,3 +183,29 @@ if (typeof keyGetter !== 'function') { | ||
return result; | ||
}, | ||
split: function(current, pattern) { | ||
return String(current).split(pattern); | ||
}, | ||
join: function(current, separator) { | ||
return Array.isArray(current) | ||
? current.join(separator) | ||
: String(current); | ||
}, | ||
match: function(current, pattern, matchAll) { | ||
const input = String(current); | ||
if (matchAll) { | ||
const result = []; | ||
let cursor = new RegExp(pattern, pattern.flags + 'g'); | ||
let match; | ||
while (match = cursor.exec(input)) { | ||
result.push(matchEntry(match)); | ||
} | ||
return result; | ||
} | ||
const match = String(current).match(pattern); | ||
return match && matchEntry(match); | ||
} | ||
}); |
@@ -9,31 +9,178 @@ // temporary file with parser extension | ||
const tolerantParser = new strictParser.Parser(); | ||
tolerantParser.lexer = Object.assign({}, strictParser.lexer); | ||
function isSuggestProhibitedChar(str, offset) { | ||
return ( | ||
offset >= 0 && | ||
offset < str.length && | ||
/[a-zA-Z_$0-9]/.test(str[offset]) | ||
); | ||
} | ||
// patch setInput method to add additional lexer fields on init | ||
[strictParser.lexer, tolerantParser.lexer].forEach(subject => | ||
patch(subject, { | ||
setInput: orig => function(input, yy) { | ||
yy.commentRanges = []; | ||
this.fnOpened = 0; | ||
this.fnOpenedStack = []; | ||
this.prevToken = null; | ||
this.prevYylloc = { | ||
first_line: 1, | ||
last_line: 1, | ||
first_column: 0, | ||
last_column: 0, | ||
range: [0, 0] | ||
}; | ||
function isWhiteSpace(str, offset) { | ||
const code = str.charCodeAt(offset); | ||
return code === 9 || code === 10 || code === 13 || code === 32; | ||
} | ||
return orig.call(this, input, yy); | ||
function onlyWsInRange(str, start, end) { | ||
for (; start < end; start++) { | ||
if (!isWhiteSpace(str, start)) { | ||
return false; | ||
} | ||
}) | ||
); | ||
} | ||
// patch lex method | ||
return true; | ||
} | ||
function getSuggestRanges(from, to, input, commentRanges, noSuggestOnEofPos) { | ||
const ranges = []; | ||
for (let i = 0; i < commentRanges.length; i++) { | ||
const [commentFrom, commentTo] = commentRanges[i]; | ||
if (commentFrom > to) { | ||
break; | ||
} | ||
if (commentFrom < from) { | ||
continue; | ||
} | ||
if (commentFrom === from) { | ||
ranges.push(from, from); | ||
} else { | ||
ranges.push(from, commentFrom); | ||
} | ||
from = commentTo; | ||
} | ||
if (from !== input.length || !noSuggestOnEofPos) { | ||
ranges.push(from, to); | ||
} | ||
return ranges; | ||
} | ||
function processSuggestRanges(input, suggestRanges, commentRanges) { | ||
const result = []; | ||
const noSuggestOnEofPos = // edge case when source ends with a comment with no newline | ||
commentRanges.length && | ||
commentRanges[commentRanges.length - 1][1] === input.length && | ||
!/[\r\n]$/.test(input); | ||
for (let i = 0; i < suggestRanges.length; i++) { | ||
let [start, end, types, context, ref] = suggestRanges[i]; | ||
if (start === null) { | ||
start = end.range[0]; | ||
end = end.range[0]; | ||
} else if (end === null) { | ||
end = start.range[1]; | ||
start = start.range[1]; | ||
} else if (start.range[0] > end.range[0]) { | ||
const tmp = start; | ||
start = end.range[1]; | ||
end = tmp.range[0]; | ||
} else { | ||
start = start.range[0]; | ||
end = end.range[1]; | ||
} | ||
if (onlyWsInRange(input, start, end)) { | ||
while (start >= 0 && isWhiteSpace(input, start - 1)) { | ||
start--; | ||
} | ||
while (end < input.length && isWhiteSpace(input, end)) { | ||
end++; | ||
} | ||
// when starts on keyword/number/var end | ||
if (isSuggestProhibitedChar(input, start - 1)) { | ||
if (start === end) { | ||
continue; | ||
} | ||
start++; | ||
} | ||
// when ends on keyword/number/var start | ||
if (isSuggestProhibitedChar(input, end)) { | ||
if (start === end) { | ||
continue; | ||
} | ||
end--; | ||
} | ||
} | ||
if (!Array.isArray(types)) { | ||
types = [types]; | ||
} | ||
const ranges = getSuggestRanges(start, end, input, commentRanges, noSuggestOnEofPos); | ||
for (let j = 0; j < ranges.length; j += 2) { | ||
types.forEach(type => | ||
result.push([ranges[j], ranges[j + 1], type, context, ref || null]) | ||
); | ||
} | ||
} | ||
return result; | ||
} | ||
// add new helpers to lexer | ||
Object.assign(strictParser.lexer, { | ||
toStringLiteral: value => JSON.parse( | ||
value[0] === '\'' | ||
? value.replace(/\\?"/g, '\\"') | ||
.replace(/\\([^"uU])/g, '$1') | ||
.replace(/^\'|\'$/g, '"') | ||
: value | ||
), | ||
toRegExp: value => new RegExp( | ||
value.substr(1, value.lastIndexOf('/') - 1), | ||
value.substr(value.lastIndexOf('/') + 1) | ||
) | ||
}); | ||
// patch setInput method to add additional lexer fields on init | ||
patch(strictParser.lexer, { | ||
setInput: origSetInput => function(input, yy) { | ||
const suggestRanges = []; | ||
const commentRanges = []; | ||
yy.commentRanges = commentRanges; | ||
yy.suggestRanges = suggestRanges; | ||
yy.buildResult = ast => ({ | ||
ast, | ||
commentRanges, | ||
get suggestRanges() { | ||
return processSuggestRanges(input, suggestRanges, commentRanges); | ||
} | ||
}); | ||
this.fnOpened = 0; | ||
this.fnOpenedStack = []; | ||
this.prevToken = null; | ||
this.prevYylloc = { | ||
first_line: 1, | ||
last_line: 1, | ||
first_column: 0, | ||
last_column: 0, | ||
range: [0, 0] | ||
}; | ||
return origSetInput.call(this, input, yy); | ||
} | ||
}); | ||
// | ||
// tolerant parser | ||
// | ||
const tolerantParser = new strictParser.Parser(); | ||
tolerantParser.lexer = Object.assign({}, strictParser.lexer); | ||
// patch tolerant parser lexer | ||
const keywords = [ | ||
'AND', 'OR', 'IN', 'NOTIN', 'HAS', 'HASNO' | ||
]; | ||
const words = [...keywords, 'NOT']; | ||
const words = [...keywords, 'NOT', 'ASC', 'DESC']; | ||
const operators = [ | ||
@@ -53,8 +200,6 @@ '+', '-', '*', '/', '%', | ||
...operators, | ||
...keywords | ||
...keywords, | ||
'ASC', 'DESC' | ||
]); | ||
const tokenPair = prev.reduce( | ||
(map, prevToken) => map.set(prevToken, defaultNext), | ||
new Map() | ||
); | ||
const tokenPair = new Map(prev.map(token => [token, defaultNext])); | ||
// special cases | ||
@@ -66,75 +211,74 @@ tokenPair.set('{', new Set([','])); | ||
patch(tolerantParser.lexer, { | ||
lex: origLex => | ||
function patchedLex() { | ||
this.lex = origLex; | ||
const prevInput = this._input; | ||
const nextToken = this.lex(this); | ||
this.lex = patchedLex; | ||
lex: origLex => function patchedLex() { | ||
this.lex = origLex; | ||
const prevInput = this._input; | ||
const nextToken = this.lex(this); | ||
this.lex = patchedLex; | ||
if (tokenPair.has(this.prevToken) && tokenPair.get(this.prevToken).has(nextToken)) { | ||
const yylloc = { | ||
first_line: this.prevYylloc.last_line, | ||
last_line: this.yylloc.first_line, | ||
first_column: this.prevYylloc.last_column, | ||
last_column: this.yylloc.first_column, | ||
range: [this.prevYylloc.range[1], this.yylloc.range[0]] | ||
}; | ||
this.unput(this.yytext); | ||
this.pushState('preventPrimitive'); | ||
this.done = false; | ||
this.yytext = '_'; | ||
this.yylloc = this.prevYylloc = yylloc; | ||
if (tokenPair.has(this.prevToken) && tokenPair.get(this.prevToken).has(nextToken)) { | ||
const yylloc = { | ||
first_line: this.prevYylloc.last_line, | ||
last_line: this.yylloc.first_line, | ||
first_column: this.prevYylloc.last_column, | ||
last_column: this.yylloc.first_column, | ||
range: [this.prevYylloc.range[1], this.yylloc.range[0]] | ||
}; | ||
this.unput(this.yytext); | ||
this.pushState('preventPrimitive'); | ||
this.done = false; | ||
this.yytext = '_'; | ||
this.yylloc = this.prevYylloc = yylloc; | ||
// position correction for a white space before a keyword | ||
if (prevInput !== this._input && words.includes(nextToken)) { | ||
const prevChIndex = prevInput.length - this._input.length - 1; | ||
// position correction for a white space before a keyword | ||
if (prevInput !== this._input && words.includes(nextToken)) { | ||
const prevChIndex = prevInput.length - this._input.length - 1; | ||
switch (prevInput[prevChIndex]) { | ||
case ' ': | ||
case '\t': | ||
yylloc.last_column--; | ||
yylloc.range[1]--; | ||
break; | ||
switch (prevInput[prevChIndex]) { | ||
case ' ': | ||
case '\t': | ||
yylloc.last_column--; | ||
yylloc.range[1]--; | ||
break; | ||
case '\n': { | ||
const lastN = prevInput.lastIndexOf('\n', prevChIndex - 1); | ||
case '\n': { | ||
const lastN = prevInput.lastIndexOf('\n', prevChIndex - 1); | ||
yylloc.last_line--; | ||
yylloc.last_column = lastN === -1 | ||
? yylloc.last_column - 1 | ||
: prevChIndex - lastN; | ||
yylloc.range[1]--; | ||
break; | ||
} | ||
yylloc.last_line--; | ||
yylloc.last_column = lastN === -1 | ||
? yylloc.last_column - 1 | ||
: prevChIndex - lastN; | ||
yylloc.range[1]--; | ||
break; | ||
} | ||
} | ||
return this.prevToken = 'SYMBOL'; | ||
} | ||
this.prevYylloc = this.yylloc; | ||
return this.prevToken = 'SYMBOL'; | ||
} | ||
// position correction for a white space after a keyword | ||
if (words.includes(nextToken)) { | ||
switch (this._input[0]) { | ||
case ' ': | ||
case '\t': | ||
this.prevYylloc = Object.assign({}, this.prevYylloc, { | ||
last_column: this.prevYylloc.last_column + 1, | ||
range: [this.prevYylloc.range[0], this.prevYylloc.range[1] + 1] | ||
}); | ||
break; | ||
this.prevYylloc = this.yylloc; | ||
case '\n': | ||
this.prevYylloc = Object.assign({}, this.prevYylloc, { | ||
last_line: this.prevYylloc.last_line + 1, | ||
last_column: 0, | ||
range: [this.prevYylloc.range[0], this.prevYylloc.range[1] + 1] | ||
}); | ||
break; | ||
} | ||
// position correction for a white space after a keyword | ||
if (words.includes(nextToken)) { | ||
switch (this._input[0]) { | ||
case ' ': | ||
case '\t': | ||
this.prevYylloc = Object.assign({}, this.prevYylloc, { | ||
last_column: this.prevYylloc.last_column + 1, | ||
range: [this.prevYylloc.range[0], this.prevYylloc.range[1] + 1] | ||
}); | ||
break; | ||
case '\n': | ||
this.prevYylloc = Object.assign({}, this.prevYylloc, { | ||
last_line: this.prevYylloc.last_line + 1, | ||
last_column: 0, | ||
range: [this.prevYylloc.range[0], this.prevYylloc.range[1] + 1] | ||
}); | ||
break; | ||
} | ||
} | ||
return this.prevToken = nextToken; | ||
} | ||
return this.prevToken = nextToken; | ||
} | ||
}); | ||
@@ -141,0 +285,0 @@ |
const { Parser } = require('jison'); | ||
const patchParsers = require('./parser-patch'); | ||
function code(s) { | ||
return '$$ = [' + | ||
s[0].split(/(\$[\da-zA-Z_]+|\/\*(?:scope|define:\S+?|var:\S+?)\*\/|\/\*\S*@[\da-zA-Z_$]+(?:\/\S*@[\da-zA-Z_$]+)*\*\/\$?[\da-zA-Z_]+)/g).map( | ||
(m, i) => { | ||
if (i % 2 === 0 || m === '/*scope*/') { | ||
return JSON.stringify(m); | ||
} | ||
const isArray = [].constructor.isArray; | ||
const keys = {}.constructor.keys; | ||
const $0 = { name: '$0' }; | ||
const $1 = { name: '$1' }; | ||
const $2 = { name: '$2' }; | ||
const $3 = { name: '$3' }; | ||
const $4 = { name: '$4' }; | ||
const $5 = { name: '$5' }; | ||
const $r0 = { name: '@0.range' }; | ||
const refs = new Set([$0, $1, $2, $3, $4, $5, $r0]); | ||
const asis = ''; | ||
if (m.startsWith('/*define:')) { | ||
return '"/*define:" + ' + m.substring(9, m.length - 2) + '.range + "*/"'; | ||
} | ||
function stringify(value) { | ||
switch (typeof value) { | ||
case 'string': | ||
return JSON.stringify(value); | ||
if (m.startsWith('/*var:')) { | ||
return '"/*var:" + ' + m.substring(6, m.length - 2) + '.range + "*/"'; | ||
} | ||
case 'undefined': | ||
case 'boolean': | ||
case 'number': | ||
return String(value); | ||
if (m.startsWith('/*')) { | ||
const content = m.substring(2, m.indexOf('*/')); | ||
const expr = m.substr(content.length + 4); | ||
const ranges = content.split('/').map(range => { | ||
const [context, loc] = range.split('@'); | ||
return '" + @' + loc + '.range + ",' + context; | ||
}); | ||
case 'object': | ||
if (value === null) { | ||
return value; | ||
} | ||
return ( | ||
'"/*sp:' + ranges + '*/",' + | ||
(expr[0] === '$' ? expr : '"' + expr + '"') + | ||
',"/**/"' | ||
); | ||
} | ||
if (refs.has(value)) { | ||
return value.name; | ||
} | ||
return m; | ||
if (value instanceof RegExp) { | ||
return String(value); | ||
} | ||
).filter(term => term !== '""') + | ||
'];'; | ||
if (isArray(value)) { | ||
return '[' + value.map(stringify) + ']'; | ||
} | ||
return '{' + keys(value).map(k => k + ':' + stringify(value[k])).join(',') + '}'; | ||
} | ||
} | ||
function $$(node, ...suggestions) { | ||
node.range = $r0; | ||
suggestions = suggestions.length | ||
? '; yy.suggestRanges.push(' + suggestions.filter(Boolean) + ')' | ||
: ''; | ||
return '$$ = ' + stringify(node) + suggestions; | ||
} | ||
function Suggestion(start, end, types, context) { | ||
return `[${[ | ||
start ? start.name.replace(/\$/, '@') : 'null', | ||
end ? end.name.replace(/\$/, '@') : 'null', | ||
stringify(types), | ||
stringify(context) || null | ||
].concat(context === 'current' ? '$$' : [])}]`; | ||
} | ||
function SuggestQueryRoot() { | ||
return Suggestion(null, $0, ['var', 'path'], 'current'); | ||
} | ||
function SuggestIdent(ref, from) { | ||
return Suggestion(ref, ref, 'path', from); | ||
} | ||
function SuggestMethod() { | ||
return undefined ; // Suggestion(ref, ref, 'method', null); | ||
} | ||
function Data() { | ||
return { | ||
type: 'Data' | ||
}; | ||
} | ||
function Context() { | ||
return { | ||
type: 'Context' | ||
}; | ||
} | ||
function Current() { | ||
return { | ||
type: 'Current' | ||
}; | ||
} | ||
function Literal(value) { | ||
return { | ||
type: 'Literal', | ||
value | ||
}; | ||
} | ||
function Unary(operator, argument) { | ||
return { | ||
type: 'Unary', | ||
operator, | ||
argument | ||
}; | ||
} | ||
function Binary(operator, left, right) { | ||
return { | ||
type: 'Binary', | ||
operator, | ||
left, | ||
right | ||
}; | ||
} | ||
function Conditional(test, consequent, alternate) { | ||
return { | ||
type: 'Conditional', | ||
test, | ||
consequent, | ||
alternate | ||
}; | ||
} | ||
function Object(properties) { | ||
return { | ||
type: 'Object', | ||
properties | ||
}; | ||
} | ||
function Property(key, value) { | ||
return { | ||
type: 'Property', | ||
key, | ||
value | ||
}; | ||
} | ||
function Spread(query) { | ||
return { | ||
type: 'Spread', | ||
query | ||
}; | ||
} | ||
function Array(elements) { | ||
return { | ||
type: 'Array', | ||
elements | ||
}; | ||
} | ||
function Function(arguments, body) { | ||
return { | ||
type: 'Function', | ||
arguments, | ||
body | ||
}; | ||
} | ||
function Compare(query, reverse) { | ||
return { | ||
type: 'Compare', | ||
query, | ||
reverse | ||
}; | ||
} | ||
function SortingFunction(compares) { | ||
return { | ||
type: 'SortingFunction', | ||
compares | ||
}; | ||
} | ||
function MethodCall(value, method, arguments) { | ||
return { | ||
type: 'MethodCall', | ||
value, | ||
method, | ||
arguments | ||
}; | ||
} | ||
function Definition(name, value) { | ||
return { | ||
type: 'Definition', | ||
name, | ||
value | ||
}; | ||
} | ||
function Block(definitions, body) { | ||
return { | ||
type: 'Block', | ||
definitions, | ||
body | ||
}; | ||
} | ||
function Parentheses(body) { | ||
return { | ||
type: 'Parentheses', | ||
body | ||
}; | ||
} | ||
function Reference(name) { | ||
return { | ||
type: 'Reference', | ||
name | ||
}; | ||
} | ||
function Identifier(name) { | ||
return { | ||
type: 'Identifier', | ||
name | ||
}; | ||
} | ||
function Map(value, query) { | ||
return { | ||
type: 'Map', | ||
value, | ||
query | ||
}; | ||
} | ||
function Filter(value, query) { | ||
return { | ||
type: 'Filter', | ||
value, | ||
query | ||
}; | ||
} | ||
function Recursive(value, query) { | ||
return { | ||
type: 'Recursive', | ||
value, | ||
query | ||
}; | ||
} | ||
function GetProperty(value, property) { | ||
return { | ||
type: 'GetProperty', | ||
value, | ||
property | ||
}; | ||
} | ||
function SliceNotation(value, arguments) { | ||
return { | ||
type: 'SliceNotation', | ||
value, | ||
arguments | ||
}; | ||
} | ||
function createCommaList(name, element) { | ||
return [ | ||
[`${element}`, '$$=[$1]'], | ||
[`${name} , ${element}`, '$1.push($3)'] | ||
]; | ||
} | ||
const switchToPreventPrimitiveState = 'if (this._input) this.begin("preventPrimitive"); '; | ||
@@ -81,3 +312,3 @@ const openScope = 'this.fnOpenedStack.push(this.fnOpened); this.fnOpened = 0; '; | ||
// keywords (should goes before SYMBOL) | ||
// keywords (should goes before ident) | ||
['true{wb}', 'return "TRUE";'], | ||
@@ -96,2 +327,4 @@ ['false{wb}', 'return "FALSE";'], | ||
['not?{wb}', 'return "NOT";'], | ||
['asc{wb}', 'return "ASC";'], | ||
['desc{wb}', 'return "DESC";'], | ||
@@ -102,10 +335,12 @@ // special vars | ||
['\\$', switchToPreventPrimitiveState + 'return "$";'], | ||
['::self', 'return "SELF";'], | ||
// primitives | ||
['\\d+(?:\\.\\d+)?([eE][-+]?\\d+)?{wb}', switchToPreventPrimitiveState + 'return "NUMBER";'], // 212.321 | ||
['"(?:\\\\.|[^"])*"', switchToPreventPrimitiveState + 'return "STRING";'], // "foo" "with \" escaped" | ||
["'(?:\\\\.|[^'])*'", switchToPreventPrimitiveState + 'return "STRING";'], // 'foo' 'with \' escaped' | ||
['{rx}', switchToPreventPrimitiveState + 'return "REGEXP"'], // /foo/i | ||
['\\d+(?:\\.\\d+)?([eE][-+]?\\d+)?{wb}', switchToPreventPrimitiveState + 'yytext = Number(yytext); return "NUMBER";'], // 212.321 | ||
['"(?:\\\\.|[^"])*"', switchToPreventPrimitiveState + 'yytext = this.toStringLiteral(yytext); return "STRING";'], // "foo" "with \" escaped" | ||
["'(?:\\\\.|[^'])*'", switchToPreventPrimitiveState + 'yytext = this.toStringLiteral(yytext); return "STRING";'], // 'foo' 'with \' escaped' | ||
['[a-zA-Z_][a-zA-Z_$0-9]*', switchToPreventPrimitiveState + 'return "SYMBOL";'], // foo123 | ||
['{rx}', switchToPreventPrimitiveState + 'yytext = this.toRegExp(yytext); return "REGEXP";'], // /foo/i | ||
// functions | ||
['=>', 'return "FUNCTION";'], | ||
['<(?!=)', 'this.fnOpened++; return "FUNCTION_START"'], | ||
@@ -147,6 +382,8 @@ | ||
}, | ||
// Operator precedence - lowest precedence first. | ||
// Binary precedence - lowest precedence first. | ||
// See http://www.gnu.org/software/bison/manual/html_node/Precedence.html | ||
operators: [ | ||
['left', 'FUNCTION'], | ||
['right', '?', ':'], | ||
['left', 'sortingCompareList', 'sortingCompare'], | ||
['left', ','], | ||
@@ -168,148 +405,171 @@ ['left', 'OR'], | ||
root: [ | ||
['block EOF', 'return $$ = { ast: $1, commentRanges: yy.commentRanges };'] | ||
['block EOF', 'return yy.buildResult($1)'] | ||
], | ||
block: [ | ||
['nonEmptyBlock', code`/*scope*/$1`], | ||
['definitions', code`/*scope*/$1\nreturn current`], | ||
['', code`/*scope*/return /*@$*/current`] | ||
['nonEmptyBlock', asis], | ||
['definitions', $$(Block($1, Current()))], | ||
['', $$(Block([], Current()), Suggestion($0, null, ['var', 'path'], 'current'))] | ||
], | ||
nonEmptyBlock: [ | ||
['definitions e', code`$1\nreturn $2`], | ||
['e', code`return $1`] | ||
['definitions e', $$(Block($1, $2))], | ||
['e', $$(Block([], $1))] | ||
], | ||
definitions: [ | ||
['def', code`$1`], | ||
['definitions def', code`$1\n$2`] | ||
['def', '$$=[$1]'], | ||
['definitions def', '$1.push($2)'] | ||
], | ||
def: [ | ||
['$ ;', code`/*key@1*/current;`], // do nothing, but collect stat (suggestions) | ||
['$ SYMBOL ;', code`/*define:@2*/const $$2 = fn.map(/*key@2*/current, "$2");`], | ||
['$ SYMBOL : e ;', code`/*define:@2*/const $$2 = $4;`] | ||
['$ ;', $$(Definition(null, Current()), Suggestion($1, $1, 'path', 'current'))], // do nothing, but collect stat (suggestions) | ||
['$ ident ;', $$(Definition($2, GetProperty(Current(), $2)), SuggestIdent($2, 'current'))], | ||
['$ ident : e ;', $$(Definition($2, $4))] | ||
], | ||
e: [ | ||
['query', code`$1`], | ||
['query', asis], | ||
['SELF', code`current => self(current, context)`], | ||
['SELF ( )', code`self(current, context)`], | ||
['SELF ( e )', code`self($3, context)`], | ||
['keyword', code`$1`], | ||
['function', code`$1`], | ||
['op', code`$1`] | ||
['keyword', asis], | ||
['function', asis], | ||
['sortingFunction', asis], | ||
['op', asis] | ||
], | ||
op: [ | ||
['NOT e', code`!fn.bool($2)`], | ||
['- e', code`-$2`], | ||
['+ e', code`+$2`], | ||
['e IN e', code`fn.in($1, /*in-value@1*/$3)`], | ||
['e HAS e', code`fn.in($3, /*in-value@3*/$1)`], | ||
['e NOTIN e', code`!fn.in($1, $3)`], | ||
['e HASNO e', code`!fn.in($3, $1)`], | ||
['e AND e', code`fn.bool(tmp = $1) ? $3 : tmp`], | ||
['e OR e', code`fn.bool(tmp = $1) ? tmp : $3`], | ||
['e ? e : e', code`fn.bool($1) ? $3 : $5`], | ||
['e + e', code`fn.add($1, $3)`], | ||
['e - e', code`fn.sub($1, $3)`], | ||
['e * e', code`fn.mul($1, $3)`], | ||
['e / e', code`fn.div($1, $3)`], | ||
['e % e', code`fn.mod($1, $3)`], | ||
['e = e', code`fn.eq(/*value@3*/$1, $3)`], | ||
['e != e', code`fn.ne(/*value@3*/$1, $3)`], | ||
['e < e', code`fn.lt($1, $3)`], | ||
['e <= e', code`fn.lte($1, $3)`], | ||
['e > e', code`fn.gt($1, $3)`], | ||
['e >= e', code`fn.gte($1, $3)`], | ||
['e ~= e', code`fn.match($1, $3)`] | ||
['NOT e', $$(Unary('not', $2))], | ||
['- e', $$(Unary('-', $2))], | ||
['+ e', $$(Unary('+', $2))], | ||
['e IN e', $$(Binary($2, $1, $3), Suggestion($1, $1, 'in-value', $3))], | ||
['e HAS e', $$(Binary($2, $1, $3), Suggestion($3, $3, 'in-value', $1))], | ||
['e NOTIN e', $$(Binary($2, $1, $3))], | ||
['e HASNO e', $$(Binary($2, $1, $3))], | ||
['e AND e', $$(Binary($2, $1, $3))], | ||
['e OR e', $$(Binary($2, $1, $3))], | ||
['e + e', $$(Binary($2, $1, $3))], | ||
['e - e', $$(Binary($2, $1, $3))], | ||
['e * e', $$(Binary($2, $1, $3))], | ||
['e / e', $$(Binary($2, $1, $3))], | ||
['e % e', $$(Binary($2, $1, $3))], | ||
['e = e', $$(Binary($2, $1, $3), Suggestion($3, $3, 'value', $1))], | ||
['e != e', $$(Binary($2, $1, $3), Suggestion($3, $3, 'value', $1))], | ||
['e < e', $$(Binary($2, $1, $3))], | ||
['e <= e', $$(Binary($2, $1, $3))], | ||
['e > e', $$(Binary($2, $1, $3))], | ||
['e >= e', $$(Binary($2, $1, $3))], | ||
['e ~= e', $$(Binary($2, $1, $3))], | ||
['e ? e : e', $$(Conditional($1, $3, $5))] | ||
], | ||
ident: [ | ||
['SYMBOL', $$(Identifier($1))] | ||
], | ||
keyword: [ | ||
['TRUE', code`true`], | ||
['FALSE', code`false`], | ||
['NULL', code`null`], | ||
['UNDEFINED', code`undefined`] | ||
['TRUE', $$(Literal(true))], | ||
['FALSE', $$(Literal(false))], | ||
['NULL', $$(Literal(null))], | ||
['UNDEFINED', $$(Literal(undefined))] | ||
], | ||
query: [ | ||
['queryRoot', code`$1`], | ||
['relativePath', code`$1`] | ||
['queryRoot', asis], | ||
['relativePath', asis] | ||
], | ||
queryRoot: [ | ||
['@', code`data`], | ||
['#', code`context`], | ||
['$', code`/*var:@1*/current`], | ||
['$ SYMBOL', code`/*var:@$*/typeof $$2 !== 'undefined' ? $$2 : undefined`], | ||
['STRING', code`$1`], | ||
['NUMBER', code`$1`], | ||
['REGEXP', code`$1`], | ||
['object', code`$1`], | ||
['array', code`$1`], | ||
['SYMBOL', code`/*var:@1*/fn.map(/*@1*/current, "$1")`], | ||
['. SYMBOL', code`fn.map(/*@2*/current, "$2")`], | ||
['( e )', code`($2)`], | ||
['.( block )', code`fn.map(current, current => { $2 })`], | ||
['SYMBOL ( )', code`method.$1(/*@1/@2*/current)`], | ||
['SYMBOL ( arguments )', code`method.$1(/*@1*/current, $3)`], | ||
['. SYMBOL ( )', code`method.$2(/*@2/@3*/current)`], | ||
['. SYMBOL ( arguments )', code`method.$2(/*@2*/current, $4)`], | ||
['.. SYMBOL', code`fn.recursive(/*@2*/current, "$2")`], | ||
['..( block )', code`fn.recursive(current, current => { $2 })`], | ||
['.[ block ]', code`fn.filter(current, current => { $2 })`] | ||
['@', $$(Data())], | ||
['#', $$(Context())], | ||
['$', $$(Current(), Suggestion($1, $1, 'var', 'current'))], | ||
['$ ident', $$(Reference($2), Suggestion($1, $2, 'var', 'current'))], | ||
['STRING', $$(Literal($1))], | ||
['NUMBER', $$(Literal($1))], | ||
['REGEXP', $$(Literal($1))], | ||
['object', asis], | ||
['array', asis], | ||
['[ sliceNotation ]', $$(SliceNotation(Current(), $2))], | ||
['ident', $$(GetProperty(Current(), $1), Suggestion($1, $1, 'var', 'current'), SuggestIdent($1, 'current'))], | ||
['ident ( )', $$(MethodCall(Current(), $1, []), SuggestMethod($1), Suggestion($3, $2, ['var', 'path'], 'current'))], | ||
['ident ( arguments )', $$(MethodCall(Current(), $1, $3), SuggestMethod($1))], | ||
['( e )', $$(Parentheses($2))], // NOTE: using e instead of block for preventing a callback creation | ||
['( definitions e )', $$(Parentheses(Block($2, $3)))], | ||
['. ident', $$(GetProperty(Current(), $2), SuggestQueryRoot(), SuggestIdent($2, 'current'))], | ||
['. ident ( )', $$(MethodCall(Current(), $2, []), SuggestQueryRoot(), SuggestIdent($2, 'current'), SuggestMethod($2), Suggestion($4, $3, ['var', 'path'], 'current'))], | ||
['. ident ( arguments )', $$(MethodCall(Current(), $2, $4), SuggestQueryRoot(), SuggestIdent($2, 'current'), SuggestMethod($2))], | ||
['.( block )', $$(Map(Current(), $2), SuggestQueryRoot())], | ||
['.[ block ]', $$(Filter(Current(), $2), SuggestQueryRoot())], | ||
['.. ident', $$(Recursive(Current(), GetProperty(Current(), $2)), SuggestQueryRoot(), SuggestIdent($2, 'current'))], | ||
['.. ident ( )', $$(Recursive(Current(), MethodCall(Current(), $2, [])), SuggestQueryRoot(), SuggestIdent($2, 'current'), Suggestion($4, $3, ['var', 'path'], 'current'))], | ||
['.. ident ( arguments )', $$(Recursive(Current(), MethodCall(Current(), $2, $4)), SuggestQueryRoot(), SuggestIdent($2, 'current'))], | ||
['..( block )', $$(Recursive(Current(), $2), SuggestQueryRoot())] | ||
], | ||
relativePath: [ | ||
['query . SYMBOL', code`fn.map(/*@3*/$1, "$3")`], | ||
['query . SYMBOL ( )', code`method.$3((/*@4*/current, /*@3*/$1))`], | ||
['query . SYMBOL ( arguments )', code`method.$3(/*@3*/$1, $5)`], | ||
['query .( block )', code`fn.map($1, current => { $3 })`], | ||
['query .. SYMBOL', code`fn.recursive(/*@3*/$1, "$3")`], | ||
['query ..( block )', code`fn.recursive($1, current => { $3 })`], | ||
['query .[ block ]', code`fn.filter($1, current => { $3 })`], | ||
['query [ e ]', code`fn.map($1, $3)`] | ||
['query [ e ]', $$(GetProperty($1, $3))], | ||
['query [ sliceNotation ]', $$(SliceNotation($1, $3))], | ||
['query . ident', $$(GetProperty($1, $3), SuggestIdent($3, $1))], | ||
['query . ident ( )', $$(MethodCall($1, $3, []), SuggestIdent($3, $1), SuggestMethod($3), Suggestion($5, $4, ['var', 'path'], 'current'))], | ||
['query . ident ( arguments )', $$(MethodCall($1, $3, $5), SuggestIdent($3, $1), SuggestMethod($3))], | ||
['query .( block )', $$(Map($1, $3))], | ||
['query .[ block ]', $$(Filter($1, $3))], | ||
['query .. ident', $$(Recursive($1, GetProperty(Current(), $3)), SuggestIdent($3, $1))], | ||
['query .. ident ( )', $$(Recursive($1, MethodCall(Current(), $3, [])), SuggestIdent($3, $1), SuggestMethod($3), Suggestion($5, $4, ['var', 'path'], 'current'))], | ||
['query .. ident ( arguments )', $$(Recursive($1, MethodCall(Current(), $3, $5)), SuggestIdent($3, $1), SuggestMethod($3))], | ||
['query ..( block )', $$(Recursive($1, $3))] | ||
], | ||
arguments: [ | ||
['e', code`$1`], | ||
['arguments , e', code`$1, $3`] | ||
], | ||
arguments: createCommaList('arguments', 'e'), | ||
object: [ | ||
['{ }', code`(/*@1*/current, {})`], | ||
['{ properties }', code`({ $2 })`] | ||
['{ }', $$(Object([]), Suggestion($2, $1, ['var', 'path'], 'current'))], | ||
['{ properties }', $$(Object($2))] | ||
], | ||
properties: [ | ||
['property', code`$1`], | ||
['properties , property', code`$1, $3`] | ||
], | ||
properties: createCommaList('properties', 'property'), | ||
property: [ | ||
['SYMBOL', code`/*var:@1*/$1: fn.map(/*@1*/current, "$1")`], | ||
['$', code`[Symbol()]: /*var:@$*/0`], // do nothing, but collect stat (suggestions) | ||
['$ SYMBOL', code`/*var:@$*/$2: typeof $$2 !== 'undefined' ? $$2 : undefined`], | ||
['SYMBOL : e', code`$1: $3`], | ||
['STRING : e', code`$1: $3`], | ||
['[ e ] : e', code`[$2]: $5`], | ||
['...', code`.../*var:@1*//*@1*/current`], | ||
['... query', code`...$2`] | ||
['ident', $$(Property($1, GetProperty(Current(), $1)), Suggestion($1, $1, 'var', 'current'), SuggestIdent($1, 'current'))], | ||
['$', $$(Property(null, Current()), Suggestion($1, $1, 'var', 'current'))], // do nothing, but collect stat (suggestions) | ||
['$ ident', $$(Property($2, Reference($2)), Suggestion($1, $2, 'var', 'current'))], | ||
['ident : e', $$(Property($1, $3))], | ||
['STRING : e', $$(Property(Literal($1), $3))], // TODO: make the same for NUMBER | ||
['[ e ] : e', $$(Property($2, $5))], | ||
['...', $$(Spread(Current()), Suggestion($1, null, ['var', 'path'], 'current'))], | ||
['... query', $$(Spread($2))] | ||
], | ||
array: [ | ||
['[ ]', code`(/*@1*/current, [])`], | ||
['[ arrayItems ]', code`[$2]`] | ||
['[ ]', $$(Array([]), Suggestion($2, $1, ['var', 'path'], 'current'))], | ||
['[ arrayItems ]', $$(Array($2))] | ||
], | ||
arrayItems: [ | ||
['e', code`$1`], | ||
['e , arrayItems', code`$1, $3`] | ||
arrayItems: createCommaList('arrayItems', 'e'), | ||
function: [ | ||
['FUNCTION_START block FUNCTION_END', $$(Function([], $2))], | ||
['FUNCTION e', $$(Function([], $2))] // TODO: e -> nonEmptyBlock | ||
], | ||
function: [ | ||
['FUNCTION_START block FUNCTION_END', code`current => { $2 }`] | ||
sortingFunction: [ | ||
['sortingCompareList', $$(SortingFunction($1))] | ||
], | ||
sortingCompareList: createCommaList('sortingCompareList', 'sortingCompare'), | ||
sortingCompare: [ | ||
['query ASC', $$(Compare($1, false))], | ||
['query DESC', $$(Compare($1, true))] | ||
], | ||
sliceNotation: [ | ||
['sliceNotationComponent', '$$=[null, $1]'], | ||
['sliceNotationComponent sliceNotationComponent', '$$=[null, $1, $2]'], | ||
['e sliceNotationComponent', '$$=[$1, $2]'], | ||
['e sliceNotationComponent sliceNotationComponent', '$$=[$1, $2, $3]'] | ||
], | ||
sliceNotationComponent: [ | ||
[':', '$$=null'], | ||
[': e', '$$=$2'] | ||
] | ||
@@ -316,0 +576,0 @@ } |
@@ -27,2 +27,6 @@ const toString = Object.prototype.toString; | ||
function isArrayLike(value) { | ||
return value && hasOwnProperty.call(value, 'length'); | ||
} | ||
module.exports = { | ||
@@ -32,3 +36,4 @@ addToSet, | ||
isPlainObject, | ||
isRegExp | ||
isRegExp, | ||
isArrayLike | ||
}; |
Sorry, the diff of this file is too big to display
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
257535
15
4392
304
1
2
9
1