"use strict" ; import { Ast , AstLocation } from "sqrl" ; export interface IFilePosition { offset : number ; line : number ; column : number ; } export interface IFileRange { start : IFilePosition ; end : IFilePosition ; } export interface ILiteralExpectation { type : "literal" ; text : string ; ignoreCase : boolean ; } export interface IClassParts extends Array < string | IClassParts > { } export interface IClassExpectation { type : "class" ; parts : IClassParts ; inverted : boolean ; ignoreCase : boolean ; } export interface IAnyExpectation { type : "any" ; } export interface IEndExpectation { type : "end" ; } export interface IOtherExpectation { type : "other" ; description : string ; } export type Expectation = ILiteralExpectation | IClassExpectation | IAnyExpectation | IEndExpectation | IOtherExpectation ; export class SyntaxError extends Error { public static buildMessage ( expected , found ) { function hex ( ch ) { return ch . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) ; } function literalEscape ( s ) { return s . replace ( /\\/g , "\\\\" ) . replace ( /"/g , '\\"' ) . replace ( /\0/g , "\\0" ) . replace ( /\t/g , "\\t" ) . replace ( /\n/g , "\\n" ) . replace ( /\r/g , "\\r" ) . replace ( /[\x00-\x0F]/g , ( ch ) => "\\x0" + hex ( ch ) ) . replace ( /[\x10-\x1F\x7F-\x9F]/g , ( ch ) => "\\x" + hex ( ch ) ) ; } function classEscape ( s ) { return s . replace ( /\\/g , "\\\\" ) . replace ( /\]/g , "\\]" ) . replace ( /\^/g , "\\^" ) . replace ( /-/g , "\\-" ) . replace ( /\0/g , "\\0" ) . replace ( /\t/g , "\\t" ) . replace ( /\n/g , "\\n" ) . replace ( /\r/g , "\\r" ) . replace ( /[\x00-\x0F]/g , ( ch ) => "\\x0" + hex ( ch ) ) . replace ( /[\x10-\x1F\x7F-\x9F]/g , ( ch ) => "\\x" + hex ( ch ) ) ; } function describeExpectation ( expectation ) { switch ( expectation . type ) { case "literal" : return '"' + literalEscape ( expectation . text ) + '"' ; case "class" : const escapedParts = expectation . parts . map ( ( part ) => { return Array . isArray ( part ) ? classEscape ( part [ 0 ] as string ) + "-" + classEscape ( part [ 1 ] as string ) : classEscape ( part ) ; } ) ; return "[" + ( expectation . inverted ? "^" : "" ) + escapedParts + "]" ; case "any" : return "any character" ; case "end" : return "end of input" ; case "other" : return expectation . description ; } } function describeExpected ( expected1 ) { const descriptions = expected1 . map ( describeExpectation ) ; let i ; let j ; descriptions . sort ( ) ; if ( descriptions . length > 0 ) { for ( i = 1 , j = 1 ; i < descriptions . length ; i ++ ) { if ( descriptions [ i - 1 ] !== descriptions [ i ] ) { descriptions [ j ] = descriptions [ i ] ; j ++ ; } } descriptions . length = j ; } switch ( descriptions . length ) { case 1 : return descriptions [ 0 ] ; case 2 : return descriptions [ 0 ] + " or " + descriptions [ 1 ] ; default : return ( descriptions . slice ( 0 , - 1 ) . join ( ", " ) + ", or " + descriptions [ descriptions . length - 1 ] ) ; } } function describeFound ( found1 ) { return found1 ? '"' + literalEscape ( found1 ) + '"' : "end of input" ; } return ( "Expected " + describeExpected ( expected ) + " but " + describeFound ( found ) + " found." ) ; } public message : string ; public expected : Expectation [ ] ; public found : string | null ; public location : IFileRange ; public name : string ; constructor ( message , expected , found , location ) { super ( ) ; this . message = message ; this . expected = expected ; this . found = found ; this . location = location ; this . name = "SyntaxError" ; if ( typeof ( Error as any ) . captureStackTrace === "function" ) { ( Error as any ) . captureStackTrace ( this , SyntaxError ) ; } } } export interface ICached { nextPos : number ; result : any ; } function peg$parse ( input , options ? ) { options = options !== undefined ? options : { } ; const peg$FAILED = { } ; const peg$startRuleFunctions = { CountArguments : peg$parseCountArguments , TrendingArguments : peg$parseTrendingArguments , RateLimitArguments : peg$parseRateLimitArguments , PercentileArguments : peg$parsePercentileArguments , PercentileForCallArguments : peg$parsePercentileForCallArguments , CountPreviousArguments : peg$parseCountPreviousArguments , StreamingStatsArguments : peg$parseStreamingStatsArguments , CountUniqueArguments : peg$parseCountUniqueArguments , SumArguments : peg$parseSumArguments , } ; let peg$startRuleFunction = peg$parseCountArguments ; const peg$c0 = "by" ; const peg$c1 = peg$literalExpectation ( "BY" , true ) ; const peg$c2 = function ( sumFeature , features , where , timespan ) { where = where || { type : "constant" , value : true } ; return { features , sumFeature , timespan : timespan || "total" , where , } ; } ; const peg$c3 = function ( features , where , timespan ) { where = where || { type : "constant" , value : true } ; return { features , sumFeature : null , timespan : timespan || { type : "total" , } , where , } ; } ; const peg$c4 = "day over day" ; const peg$c5 = peg$literalExpectation ( "DAY OVER DAY" , true ) ; const peg$c6 = "day over full week" ; const peg$c7 = peg$literalExpectation ( "DAY OVER FULL WEEK" , true ) ; const peg$c8 = "week over week" ; const peg$c9 = peg$literalExpectation ( "WEEK OVER WEEK" , true ) ; const peg$c10 = function ( timespan ) { return { type : camelCase ( timespan ) , } ; } ; const peg$c11 = function ( features , where , minEvents , timespan ) { where = where || { type : "constant" , value : true } ; return { features , minEvents : minEvents || 1 , timespan , where , } ; } ; const peg$c12 = "day over week" ; const peg$c13 = peg$literalExpectation ( "DAY OVER WEEK" , true ) ; const peg$c14 = "total" ; const peg$c15 = peg$literalExpectation ( "TOTAL" , true ) ; const peg$c16 = function ( ms ) { return { type : "duration" , durationMs : ms , } ; } ; const peg$c17 = "last day" ; const peg$c18 = peg$literalExpectation ( "LAST DAY" , true ) ; const peg$c19 = "LAST WEEK" ; const peg$c20 = peg$literalExpectation ( "LAST WEEK" , false ) ; const peg$c21 = function ( features , where , previousTimespan ) { where = where || { type : "constant" , value : true } ; return { features , sumFeature : null , timespan : camelCase ( "previous " + previousTimespan ) , where , } ; } ; const peg$c22 = "intersect" ; const peg$c23 = peg$literalExpectation ( "INTERSECT" , true ) ; const peg$c24 = "union" ; const peg$c25 = peg$literalExpectation ( "UNION" , true ) ; const peg$c26 = function ( uniques , groups , setOperation , where , windowMs , beforeAction ) { where = where || { type : "constant" , value : true } ; return { uniques , groups : groups ? groups [ 3 ] : [ ] , setOperation : setOperation ? { operation : setOperation [ 1 ] . toLowerCase ( ) , features : setOperation [ 3 ] , } : null , windowMs : windowMs || null , beforeAction : beforeAction === true , where , } ; } ; const peg$c27 = "max" ; const peg$c28 = peg$literalExpectation ( "MAX" , true ) ; const peg$c29 = "every" ; const peg$c30 = peg$literalExpectation ( "EVERY" , true ) ; const peg$c31 = function ( features , max , refillTimeMs , refillAmount , tokenAmount , strict , where ) { const maxAmount = max ? max [ 2 ] : 1 ; refillAmount = refillAmount || maxAmount ; tokenAmount = tokenAmount || { type : "constant" , value : 1 } ; strict = strict || false ; where = where || { type : "constant" , value : true } ; return { features , maxAmount , refillTimeMs , refillAmount , tokenAmount , strict , where , } ; } ; const peg$c32 = "refill" ; const peg$c33 = peg$literalExpectation ( "REFILL" , true ) ; const peg$c34 = function ( value ) { return value ; } ; const peg$c35 = "take" ; const peg$c36 = peg$literalExpectation ( "TAKE" , true ) ; const peg$c37 = "strict" ; const peg$c38 = peg$literalExpectation ( "STRICT" , true ) ; const peg$c39 = function ( ) { return true ; } ; const peg$c40 = function ( feature , groupFeatures , where ) { where = where || { type : "constant" , value : true } ; return { groupFeatures : groupFeatures ? groupFeatures [ 3 ] : [ ] , feature , where , } ; } ; const peg$c41 = "," ; const peg$c42 = peg$literalExpectation ( "," , false ) ; const peg$c43 = function ( percentile , percentileArgs ) { return { ... percentileArgs , percentile , } ; } ; const peg$c44 = function ( percentileArgs ) { return percentileArgs ; } ; const peg$c45 = function ( feature , group , where ) { where = where || { type : "constant" , value : true } ; return { feature , group : group ? group [ 3 ] : null , where , } ; } ; const peg$c46 = "(" ; const peg$c47 = peg$literalExpectation ( "(" , false ) ; const peg$c48 = ")" ; const peg$c49 = peg$literalExpectation ( ")" , false ) ; const peg$c50 = function ( expr ) { return expr ; } ; const peg$c51 = "where" ; const peg$c52 = peg$literalExpectation ( "WHERE" , true ) ; const peg$c53 = "with min" ; const peg$c54 = peg$literalExpectation ( "WITH MIN" , true ) ; const peg$c55 = "events" ; const peg$c56 = peg$literalExpectation ( "EVENTS" , true ) ; const peg$c57 = function ( numEvents ) { return numEvents ; } ; const peg$c58 = "last" ; const peg$c59 = peg$literalExpectation ( "LAST" , true ) ; const peg$c60 = function ( lastMs ) { return lastMs ; } ; const peg$c61 = "before action" ; const peg$c62 = peg$literalExpectation ( "BEFORE ACTION" , true ) ; const peg$c63 = "seconds" ; const peg$c64 = peg$literalExpectation ( "SECONDS" , true ) ; const peg$c65 = "second" ; const peg$c66 = peg$literalExpectation ( "SECOND" , true ) ; const peg$c67 = "minutes" ; const peg$c68 = peg$literalExpectation ( "MINUTES" , true ) ; const peg$c69 = "minute" ; const peg$c70 = peg$literalExpectation ( "MINUTE" , true ) ; const peg$c71 = "hours" ; const peg$c72 = peg$literalExpectation ( "HOURS" , true ) ; const peg$c73 = "hour" ; const peg$c74 = peg$literalExpectation ( "HOUR" , true ) ; const peg$c75 = "days" ; const peg$c76 = peg$literalExpectation ( "DAYS" , true ) ; const peg$c77 = "day" ; const peg$c78 = peg$literalExpectation ( "DAY" , true ) ; const peg$c79 = "weeks" ; const peg$c80 = peg$literalExpectation ( "WEEKS" , true ) ; const peg$c81 = "week" ; const peg$c82 = peg$literalExpectation ( "WEEK" , true ) ; const peg$c83 = "months" ; const peg$c84 = peg$literalExpectation ( "MONTHS" , true ) ; const peg$c85 = "month" ; const peg$c86 = peg$literalExpectation ( "MONTH" , true ) ; const peg$c87 = function ( timespan ) { return { second : 1 , seconds : 1 , minute : 60 , minutes : 60 , hour : 60 * 60 , hours : 60 * 60 , day : 60 * 60 * 24 , days : 60 * 60 * 24 , week : 60 * 60 * 24 * 7 , weeks : 60 * 60 * 24 * 7 , month : 60 * 60 * 24 * 30 , months : 60 * 60 * 24 * 30 , } [ timespan . toLowerCase ( ) ] ; } ; const peg$c88 = function ( quantity , timespanSeconds ) { quantity = quantity ? quantity [ 0 ] : 1 ; return quantity * timespanSeconds * 1000 ; } ; const peg$c89 = "[" ; const peg$c90 = peg$literalExpectation ( "[" , false ) ; const peg$c91 = "]" ; const peg$c92 = peg$literalExpectation ( "]" , false ) ; const peg$c93 = function ( ) { return { type : "list" , exprs : [ ] , location : loc ( ) , } ; } ; const peg$c94 = function ( firstExpr , restExprs ) { return { type : "list" , exprs : [ firstExpr ] . concat ( restExprs . map ( ( e ) => e [ 3 ] ) ) , location : loc ( ) , } ; } ; const peg$c95 = "and" ; const peg$c96 = peg$literalExpectation ( "AND" , true ) ; const peg$c97 = "or" ; const peg$c98 = peg$literalExpectation ( "OR" , true ) ; const peg$c99 = function ( left , op , right ) { return { type : "boolean_expr" , left : left , operator : op . toLowerCase ( ) , right : right , location : loc ( ) , } ; } ; const peg$c100 = "not" ; const peg$c101 = peg$literalExpectation ( "NOT" , true ) ; const peg$c102 = function ( expr ) { return { type : "not" , expr : expr , location : loc ( ) } ; } ; const peg$c103 = "is not" ; const peg$c104 = peg$literalExpectation ( "IS NOT" , true ) ; const peg$c105 = "is" ; const peg$c106 = peg$literalExpectation ( "IS" , true ) ; const peg$c107 = function ( left , op , right ) { return { type : "binary_expr" , left : left , operator : op . toLowerCase ( ) , right : right , location : loc ( ) , } ; } ; const peg$c108 = "=" ; const peg$c109 = peg$literalExpectation ( "=" , false ) ; const peg$c110 = "!=" ; const peg$c111 = peg$literalExpectation ( "!=" , false ) ; const peg$c112 = ">=" ; const peg$c113 = peg$literalExpectation ( ">=" , false ) ; const peg$c114 = "<=" ; const peg$c115 = peg$literalExpectation ( "<=" , false ) ; const peg$c116 = ">" ; const peg$c117 = peg$literalExpectation ( ">" , false ) ; const peg$c118 = "<" ; const peg$c119 = peg$literalExpectation ( "<" , false ) ; const peg$c120 = "contains" ; const peg$c121 = peg$literalExpectation ( "CONTAINS" , true ) ; const peg$c122 = "in" ; const peg$c123 = peg$literalExpectation ( "IN" , true ) ; const peg$c124 = "+" ; const peg$c125 = peg$literalExpectation ( "+" , false ) ; const peg$c126 = "-" ; const peg$c127 = peg$literalExpectation ( "-" , false ) ; const peg$c128 = "*" ; const peg$c129 = peg$literalExpectation ( "*" , false ) ; const peg$c130 = "/" ; const peg$c131 = peg$literalExpectation ( "/" , false ) ; const peg$c132 = "%" ; const peg$c133 = peg$literalExpectation ( "%" , false ) ; const peg$c134 = function ( first , rest ) { return [ first ] . concat ( rest . map ( ( item ) => item [ 3 ] ) ) ; } ; const peg$c135 = "as" ; const peg$c136 = peg$literalExpectation ( "AS" , true ) ; const peg$c137 = function ( feature , alias ) { return { type : "aliasedFeature" , feature , alias : alias ? alias [ 3 ] : feature . value , location : loc ( ) , } ; } ; const peg$c138 = function ( feature ) { return { type : "feature" , value : feature , location : loc ( ) } ; } ; const peg$c139 = peg$otherExpectation ( "feature name" ) ; const peg$c140 = "." ; const peg$c141 = peg$literalExpectation ( "." , false ) ; const peg$c142 = function ( ) { return text ( ) ; } ; const peg$c143 = /^[A-Za-z0-9_]/ ; const peg$c144 = peg$classExpectation ( [ [ "A" , "Z" ] , [ "a" , "z" ] , [ "0" , "9" ] , "_" ] , false , false ) ; const peg$c145 = "group" ; const peg$c146 = peg$literalExpectation ( "GROUP" , true ) ; const peg$c147 = function ( ) { } ; const peg$c148 = function ( value ) { return { type : "constant" , value : value , location : loc ( ) } ; } ; const peg$c149 = "null" ; const peg$c150 = peg$literalExpectation ( "NULL" , true ) ; const peg$c151 = function ( ) { return { type : "constant" , value : null , location : loc ( ) } ; } ; const peg$c152 = peg$otherExpectation ( "null" ) ; const peg$c153 = peg$literalExpectation ( "null" , false ) ; const peg$c154 = function ( ) { return null ; } ; const peg$c155 = peg$otherExpectation ( "true" ) ; const peg$c156 = "true" ; const peg$c157 = peg$literalExpectation ( "true" , false ) ; const peg$c158 = peg$otherExpectation ( "false" ) ; const peg$c159 = "false" ; const peg$c160 = peg$literalExpectation ( "false" , false ) ; const peg$c161 = function ( ) { return false ; } ; const peg$c162 = peg$otherExpectation ( "literal number" ) ; const peg$c163 = /^[\-]/ ; const peg$c164 = peg$classExpectation ( [ "-" ] , false , false ) ; const peg$c165 = /^[1-9]/ ; const peg$c166 = peg$classExpectation ( [ [ "1" , "9" ] ] , false , false ) ; const peg$c167 = /^[0-9]/ ; const peg$c168 = peg$classExpectation ( [ [ "0" , "9" ] ] , false , false ) ; const peg$c169 = function ( ) { return parseInt ( text ( ) , 10 ) ; } ; const peg$c170 = "0" ; const peg$c171 = peg$literalExpectation ( "0" , false ) ; const peg$c172 = function ( ) { return 0 ; } ; const peg$c173 = function ( ) { return parseFloat ( text ( ) ) ; } ; const peg$c174 = function ( first , rest ) { return first . concat ( ... rest . map ( ( item ) => item [ 1 ] ) ) ; } ; const peg$c175 = peg$otherExpectation ( "whitespace" ) ; const peg$c176 = /^[ \t\n\r]/ ; const peg$c177 = peg$classExpectation ( [ " " , "\t" , "\n" , "\r" ] , false , false ) ; const peg$c178 = /^[\n]/ ; const peg$c179 = peg$classExpectation ( [ "\n" ] , false , false ) ; const peg$c180 = "#" ; const peg$c181 = peg$literalExpectation ( "#" , false ) ; const peg$c182 = "--" ; const peg$c183 = peg$literalExpectation ( "--" , false ) ; const peg$c184 = /^[^\n]/ ; const peg$c185 = peg$classExpectation ( [ "\n" ] , true , false ) ; const peg$c186 = peg$otherExpectation ( "string" ) ; const peg$c187 = "'" ; const peg$c188 = peg$literalExpectation ( "'" , false ) ; const peg$c189 = function ( chars ) { return chars . join ( "" ) ; } ; const peg$c190 = '"' ; const peg$c191 = peg$literalExpectation ( '"' , false ) ; const peg$c192 = "\\" ; const peg$c193 = peg$literalExpectation ( "\\" , false ) ; const peg$c194 = "b" ; const peg$c195 = peg$literalExpectation ( "b" , false ) ; const peg$c196 = function ( ) { return "\b" ; } ; const peg$c197 = "f" ; const peg$c198 = peg$literalExpectation ( "f" , false ) ; const peg$c199 = function ( ) { return "\f" ; } ; const peg$c200 = "n" ; const peg$c201 = peg$literalExpectation ( "n" , false ) ; const peg$c202 = function ( ) { return "\n" ; } ; const peg$c203 = "r" ; const peg$c204 = peg$literalExpectation ( "r" , false ) ; const peg$c205 = function ( ) { return "\r" ; } ; const peg$c206 = "t" ; const peg$c207 = peg$literalExpectation ( "t" , false ) ; const peg$c208 = function ( ) { return "\t" ; } ; const peg$c209 = "u" ; const peg$c210 = peg$literalExpectation ( "u" , false ) ; const peg$c211 = function ( digits ) { return String . fromCharCode ( parseInt ( digits , 16 ) ) ; } ; const peg$c212 = function ( sequence ) { return sequence ; } ; const peg$c213 = /^[^\0-\x1F"\\]/ ; const peg$c214 = peg$classExpectation ( [ [ "\0" , "\x1F" ] , '"' , "\\" ] , true , false ) ; const peg$c215 = /^[^\0-\x1F'\\]/ ; const peg$c216 = peg$classExpectation ( [ [ "\0" , "\x1F" ] , "'" , "\\" ] , true , false ) ; const peg$c217 = /^[0-9a-f]/i ; const peg$c218 = peg$classExpectation ( [ [ "0" , "9" ] , [ "a" , "f" ] , ] , false , true ) ; let peg$currPos = 0 ; let peg$savedPos = 0 ; const peg$posDetailsCache = [ { line : 1 , column : 1 } ] ; let peg$maxFailPos = 0 ; let peg$maxFailExpected = [ ] ; let peg$silentFails = 0 ; const peg$resultsCache = { } ; let peg$result ; if ( options . startRule !== undefined ) { if ( ! ( options . startRule in peg$startRuleFunctions ) ) { throw new Error ( "Can't start parsing from rule \"" + options . startRule + '".' ) ; } peg$startRuleFunction = peg$startRuleFunctions [ options . startRule ] ; } function text ( ) { return input . substring ( peg$savedPos , peg$currPos ) ; } function location ( ) { return peg$computeLocation ( peg$savedPos , peg$currPos ) ; } function expected ( description , location1 ? ) { location1 = location1 !== undefined ? location1 : peg$computeLocation ( peg$savedPos , peg$currPos ) ; throw peg$buildStructuredError ( [ peg$otherExpectation ( description ) ] , input . substring ( peg$savedPos , peg$currPos ) , location1 ) ; } function error ( message , location1 ? ) { location1 = location1 !== undefined ? location1 : peg$computeLocation ( peg$savedPos , peg$currPos ) ; throw peg$buildSimpleError ( message , location1 ) ; } function peg$literalExpectation ( text1 , ignoreCase ) { return { type : "literal" , text : text1 , ignoreCase : ignoreCase } ; } function peg$classExpectation ( parts , inverted , ignoreCase ) { return { type : "class" , parts : parts , inverted : inverted , ignoreCase : ignoreCase , } ; } function peg$anyExpectation ( ) { return { type : "any" } ; } function peg$endExpectation ( ) { return { type : "end" } ; } function peg$otherExpectation ( description ) { return { type : "other" , description : description } ; } function peg$computePosDetails ( pos ) { let details = peg$posDetailsCache [ pos ] ; let p ; if ( details ) { return details ; } else { p = pos - 1 ; while ( ! peg$posDetailsCache [ p ] ) { p -- ; } details = peg$posDetailsCache [ p ] ; details = { line : details . line , column : details . column , } ; while ( p < pos ) { if ( input . charCodeAt ( p ) === 10 ) { details . line ++ ; details . column = 1 ; } else { details . column ++ ; } p ++ ; } peg$posDetailsCache [ pos ] = details ; return details ; } } function peg$computeLocation ( startPos , endPos ) { const startPosDetails = peg$computePosDetails ( startPos ) ; const endPosDetails = peg$computePosDetails ( endPos ) ; return { start : { offset : startPos , line : startPosDetails . line , column : startPosDetails . column , } , end : { offset : endPos , line : endPosDetails . line , column : endPosDetails . column , } , } ; } function peg$fail ( expected1 ) { if ( peg$currPos < peg$maxFailPos ) { return ; } if ( peg$currPos > peg$maxFailPos ) { peg$maxFailPos = peg$currPos ; peg$maxFailExpected = [ ] ; } peg$maxFailExpected . push ( expected1 ) ; } function peg$buildSimpleError ( message , location1 ) { return new SyntaxError ( message , [ ] , "" , location1 ) ; } function peg$buildStructuredError ( expected1 , found , location1 ) { return new SyntaxError ( SyntaxError . buildMessage ( expected1 , found ) , expected1 , found , location1 ) ; } function peg$parseSumArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ; const key = peg$currPos * 71 + 0 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseFeatureExpr ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c0 ) { s4 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c1 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$parseAliasFeatureList ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parseWhereClause ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { s8 = peg$parseCountTimespanClause ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { s9 = peg$parse_ ( ) ; if ( s9 === peg$FAILED ) { s9 = null ; } if ( s9 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c2 ( s2 , s6 , s7 , s8 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCountArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 71 + 1 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c0 ) { s2 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c1 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseAliasFeatureList ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseWhereClause ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parseCountTimespanClause ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c3 ( s4 , s5 , s6 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseTrendingTimespanClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 71 + 2 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 12 ) . toLowerCase ( ) === peg$c4 ) { s2 = input . substr ( peg$currPos , 12 ) ; peg$currPos += 12 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c5 ) ; } } if ( s2 === peg$FAILED ) { if ( input . substr ( peg$currPos , 18 ) . toLowerCase ( ) === peg$c6 ) { s2 = input . substr ( peg$currPos , 18 ) ; peg$currPos += 18 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c7 ) ; } } if ( s2 === peg$FAILED ) { if ( input . substr ( peg$currPos , 14 ) . toLowerCase ( ) === peg$c8 ) { s2 = input . substr ( peg$currPos , 14 ) ; peg$currPos += 14 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c9 ) ; } } } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c10 ( s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseTrendingArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 71 + 3 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseAliasFeatureList ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseWhereClause ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { s4 = peg$parseMinEventsClause ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseTrendingTimespanClause ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c11 ( s2 , s3 , s4 , s5 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCountTimespanClause ( ) { let s0 ; const key = peg$currPos * 71 + 4 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseCountSpecialTimespanClause ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseCountLastTimespanClause ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCountSpecialTimespanClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 71 + 5 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 12 ) . toLowerCase ( ) === peg$c4 ) { s2 = input . substr ( peg$currPos , 12 ) ; peg$currPos += 12 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c5 ) ; } } if ( s2 === peg$FAILED ) { if ( input . substr ( peg$currPos , 13 ) . toLowerCase ( ) === peg$c12 ) { s2 = input . substr ( peg$currPos , 13 ) ; peg$currPos += 13 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c13 ) ; } } if ( s2 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c14 ) { s2 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c15 ) ; } } if ( s2 === peg$FAILED ) { if ( input . substr ( peg$currPos , 14 ) . toLowerCase ( ) === peg$c8 ) { s2 = input . substr ( peg$currPos , 14 ) ; peg$currPos += 14 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c9 ) ; } } } } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c10 ( s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCountLastTimespanClause ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 6 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseLastMsClause ( ) ; if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c16 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCountPreviousArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 ; const key = peg$currPos * 71 + 7 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c0 ) { s2 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c1 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseAliasFeatureList ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseWhereClause ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 8 ) . toLowerCase ( ) === peg$c17 ) { s7 = input . substr ( peg$currPos , 8 ) ; peg$currPos += 8 ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c18 ) ; } } if ( s7 === peg$FAILED ) { if ( input . substr ( peg$currPos , 9 ) === peg$c19 ) { s7 = peg$c19 ; peg$currPos += 9 ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c20 ) ; } } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c21 ( s4 , s5 , s7 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCountUniqueArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 ; const key = peg$currPos * 71 + 8 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseAliasFeatureList ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseGroupBy ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parseAliasFeatureList ( ) ; if ( s7 !== peg$FAILED ) { s4 = [ s4 , s5 , s6 , s7 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { s4 = peg$currPos ; s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 9 ) . toLowerCase ( ) === peg$c22 ) { s6 = input . substr ( peg$currPos , 9 ) ; peg$currPos += 9 ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c23 ) ; } } if ( s6 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c24 ) { s6 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c25 ) ; } } } if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 !== peg$FAILED ) { s8 = peg$parseAliasFeatureList ( ) ; if ( s8 !== peg$FAILED ) { s5 = [ s5 , s6 , s7 , s8 ] ; s4 = s5 ; } else { peg$currPos = s4 ; s4 = peg$FAILED ; } } else { peg$currPos = s4 ; s4 = peg$FAILED ; } } else { peg$currPos = s4 ; s4 = peg$FAILED ; } } else { peg$currPos = s4 ; s4 = peg$FAILED ; } if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseWhereClause ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parseLastMsClause ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseBeforeActionClause ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c26 ( s2 , s3 , s4 , s5 , s6 , s7 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseRateLimitArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 ; const key = peg$currPos * 71 + 9 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c0 ) { s2 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c1 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseFeatureList ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$currPos ; if ( input . substr ( peg$currPos , 3 ) . toLowerCase ( ) === peg$c27 ) { s7 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c28 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 !== peg$FAILED ) { s9 = peg$parseIntLiteral ( ) ; if ( s9 !== peg$FAILED ) { s10 = peg$parse_ ( ) ; if ( s10 !== peg$FAILED ) { s7 = [ s7 , s8 , s9 , s10 ] ; s6 = s7 ; } else { peg$currPos = s6 ; s6 = peg$FAILED ; } } else { peg$currPos = s6 ; s6 = peg$FAILED ; } } else { peg$currPos = s6 ; s6 = peg$FAILED ; } } else { peg$currPos = s6 ; s6 = peg$FAILED ; } if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c29 ) { s7 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c30 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 !== peg$FAILED ) { s9 = peg$parseDurationMsExpr ( ) ; if ( s9 !== peg$FAILED ) { s10 = peg$parseRateLimitRefillClause ( ) ; if ( s10 === peg$FAILED ) { s10 = null ; } if ( s10 !== peg$FAILED ) { s11 = peg$parseRateLimitTakeClause ( ) ; if ( s11 === peg$FAILED ) { s11 = null ; } if ( s11 !== peg$FAILED ) { s12 = peg$parseRateLimitStrictClause ( ) ; if ( s12 === peg$FAILED ) { s12 = null ; } if ( s12 !== peg$FAILED ) { s13 = peg$parseWhereClause ( ) ; if ( s13 === peg$FAILED ) { s13 = null ; } if ( s13 !== peg$FAILED ) { s14 = peg$parse_ ( ) ; if ( s14 === peg$FAILED ) { s14 = null ; } if ( s14 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c31 ( s4 , s6 , s9 , s10 , s11 , s12 , s13 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseRateLimitRefillClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 71 + 10 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c32 ) { s2 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c33 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseIntLiteral ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c34 ( s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseRateLimitTakeClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 71 + 11 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c35 ) { s2 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c36 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseBooleanExpr ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c34 ( s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseRateLimitStrictClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 71 + 12 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c37 ) { s2 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c38 ) ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c39 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parsePercentileArgsExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 71 + 13 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFeature ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$currPos ; s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseGroupBy ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$parseFeatureList ( ) ; if ( s6 !== peg$FAILED ) { s3 = [ s3 , s4 , s5 , s6 ] ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { s3 = peg$parseWhereClause ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c40 ( s1 , s2 , s3 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parsePercentileArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 71 + 14 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseIntLiteral ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s4 = peg$c41 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parsePercentileArgsExpr ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c43 ( s2 , s6 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parsePercentileForCallArguments ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 15 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parsePercentileArgsExpr ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c44 ( s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseStreamingStatsArguments ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 71 + 16 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseFeature ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseGroupBy ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parseFeature ( ) ; if ( s7 !== peg$FAILED ) { s4 = [ s4 , s5 , s6 , s7 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { s4 = peg$parseWhereClause ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c45 ( s2 , s3 , s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSubExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 17 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 40 ) { s1 = peg$c46 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c47 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { s3 = peg$parseBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 41 ) { s5 = peg$c48 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c49 ) ; } } if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c50 ( s3 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseWhereClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 71 + 18 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c51 ) { s2 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c52 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseBooleanExpr ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c50 ( s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseMinEventsClause ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 71 + 19 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 8 ) . toLowerCase ( ) === peg$c53 ) { s2 = input . substr ( peg$currPos , 8 ) ; peg$currPos += 8 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c54 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseIntLiteral ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c55 ) { s6 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c56 ) ; } } if ( s6 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c57 ( s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseLastMsClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 71 + 20 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c58 ) { s2 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c59 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseDurationMsExpr ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c60 ( s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBeforeActionClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 71 + 21 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 13 ) . toLowerCase ( ) === peg$c61 ) { s2 = input . substr ( peg$currPos , 13 ) ; peg$currPos += 13 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c62 ) ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c39 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseTimespanSecondsExpr ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 22 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . substr ( peg$currPos , 7 ) . toLowerCase ( ) === peg$c63 ) { s1 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c64 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c65 ) { s1 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c66 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 7 ) . toLowerCase ( ) === peg$c67 ) { s1 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c68 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c69 ) { s1 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c70 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c71 ) { s1 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c72 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c73 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c74 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c75 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c76 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 3 ) . toLowerCase ( ) === peg$c77 ) { s1 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c78 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c79 ) { s1 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c80 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c81 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c82 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c83 ) { s1 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c84 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c85 ) { s1 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c86 ) ; } } } } } } } } } } } } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c87 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseDurationMsExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 23 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$currPos ; s2 = peg$parseIntLiteral ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s2 = [ s2 , s3 ] ; s1 = s2 ; } else { peg$currPos = s1 ; s1 = peg$FAILED ; } } else { peg$currPos = s1 ; s1 = peg$FAILED ; } if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseTimespanSecondsExpr ( ) ; if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c88 ( s1 , s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseListExpr ( ) { let s0 ; const key = peg$currPos * 71 + 24 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseEmptyListExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseNonEmptyListExpr ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseEmptyListExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 25 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 91 ) { s1 = peg$c89 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c90 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 93 ) { s3 = peg$c91 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c92 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c93 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNonEmptyListExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ; const key = peg$currPos * 71 + 26 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 91 ) { s1 = peg$c89 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c90 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { s3 = peg$parseBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { s4 = [ ] ; s5 = peg$currPos ; s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s7 = peg$c41 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { s9 = peg$parseBooleanExpr ( ) ; if ( s9 !== peg$FAILED ) { s6 = [ s6 , s7 , s8 , s9 ] ; s5 = s6 ; } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } while ( s5 !== peg$FAILED ) { s4 . push ( s5 ) ; s5 = peg$currPos ; s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s7 = peg$c41 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { s9 = peg$parseBooleanExpr ( ) ; if ( s9 !== peg$FAILED ) { s6 = [ s6 , s7 , s8 , s9 ] ; s5 = s6 ; } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s6 = peg$c41 ; peg$currPos ++ ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 93 ) { s8 = peg$c91 ; peg$currPos ++ ; } else { s8 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c92 ) ; } } if ( s8 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c94 ( s3 , s4 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBooleanExpr ( ) { let s0 ; const key = peg$currPos * 71 + 27 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseBinaryBooleanExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseUnaryBooleanExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseBooleanTerm ( ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBinaryBooleanExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 28 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseUnaryBooleanExpr ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 3 ) . toLowerCase ( ) === peg$c95 ) { s3 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c96 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c97 ) { s3 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c98 ) ; } } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseBooleanExpr ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c99 ( s1 , s3 , s5 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseUnaryBooleanExpr ( ) { let s0 ; const key = peg$currPos * 71 + 29 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseNotBooleanTerm ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseBooleanTerm ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNotBooleanTerm ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 30 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . substr ( peg$currPos , 3 ) . toLowerCase ( ) === peg$c100 ) { s1 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c101 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseUnaryBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c102 ( s3 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBooleanTerm ( ) { let s0 ; const key = peg$currPos * 71 + 31 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseBinaryLogicalExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseIsNullLogicalExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseLogicalTerm ( ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseIsNullLogicalExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 32 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseLogicalTerm ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c103 ) { s3 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c104 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c105 ) { s3 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c106 ) ; } } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseNullExpr ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c107 ( s1 , s3 , s5 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBinaryLogicalExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 33 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseLogicalTerm ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 61 ) { s3 = peg$c108 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c109 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c110 ) { s3 = peg$c110 ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c111 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c112 ) { s3 = peg$c112 ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c113 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c114 ) { s3 = peg$c114 ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c115 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 62 ) { s3 = peg$c116 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c117 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 60 ) { s3 = peg$c118 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c119 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 8 ) . toLowerCase ( ) === peg$c120 ) { s3 = input . substr ( peg$currPos , 8 ) ; peg$currPos += 8 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c121 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c122 ) { s3 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c123 ) ; } } } } } } } } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseLogicalTerm ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c107 ( s1 , s3 , s5 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseLogicalTerm ( ) { let s0 ; const key = peg$currPos * 71 + 34 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseBinaryArithmeticExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseHighArithmeticExpr ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseArithmeticExpr ( ) { let s0 ; const key = peg$currPos * 71 + 35 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseBinaryArithmeticExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseHighArithmeticExpr ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBinaryArithmeticExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 36 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseHighArithmeticExpr ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 43 ) { s3 = peg$c124 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c125 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 45 ) { s3 = peg$c126 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c127 ) ; } } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseArithmeticExpr ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c107 ( s1 , s3 , s5 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseHighArithmeticExpr ( ) { let s0 ; const key = peg$currPos * 71 + 37 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseBinaryHighArithmeticExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseHighArithmeticTerm ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBinaryHighArithmeticExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 38 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseHighArithmeticTerm ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 42 ) { s3 = peg$c128 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c129 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 47 ) { s3 = peg$c130 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c131 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 37 ) { s3 = peg$c132 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c133 ) ; } } } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseHighArithmeticExpr ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c107 ( s1 , s3 , s5 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseHighArithmeticTerm ( ) { let s0 ; const key = peg$currPos * 71 + 39 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseListExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseSubExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseLiteral ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseFeatureExpr ( ) ; } } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseAliasFeatureList ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 71 + 40 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseAliasFeature ( ) ; if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s5 = peg$c41 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseAliasFeature ( ) ; if ( s7 !== peg$FAILED ) { s4 = [ s4 , s5 , s6 , s7 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s5 = peg$c41 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseAliasFeature ( ) ; if ( s7 !== peg$FAILED ) { s4 = [ s4 , s5 , s6 , s7 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c134 ( s1 , s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFeatureList ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 71 + 41 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFeatureExpr ( ) ; if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s5 = peg$c41 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseFeatureExpr ( ) ; if ( s7 !== peg$FAILED ) { s4 = [ s4 , s5 , s6 , s7 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s5 = peg$c41 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c42 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseFeatureExpr ( ) ; if ( s7 !== peg$FAILED ) { s4 = [ s4 , s5 , s6 , s7 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c134 ( s1 , s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseAliasFeature ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 71 + 42 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFeatureExpr ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$currPos ; s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c135 ) { s4 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c136 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { s6 = peg$parseFeature ( ) ; if ( s6 !== peg$FAILED ) { s3 = [ s3 , s4 , s5 , s6 ] ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c137 ( s1 , s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFeatureExpr ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 43 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFeature ( ) ; if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c138 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFeature ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 44 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$currPos ; s1 = peg$parseSymbol ( ) ; if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 46 ) { s4 = peg$c140 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c141 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parseSymbol ( ) ; if ( s5 !== peg$FAILED ) { s4 = [ s4 , s5 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 46 ) { s4 = peg$c140 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c141 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parseSymbol ( ) ; if ( s5 !== peg$FAILED ) { s4 = [ s4 , s5 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c142 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c139 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSymbol ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 71 + 45 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = [ ] ; if ( peg$c143 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c144 ) ; } } if ( s2 !== peg$FAILED ) { while ( s2 !== peg$FAILED ) { s1 . push ( s2 ) ; if ( peg$c143 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c144 ) ; } } } } else { s1 = peg$FAILED ; } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c142 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseGroupBy ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 46 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$currPos ; if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c145 ) { s2 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c146 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s2 = [ s2 , s3 ] ; s1 = s2 ; } else { peg$currPos = s1 ; s1 = peg$FAILED ; } } else { peg$currPos = s1 ; s1 = peg$FAILED ; } if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c0 ) { s2 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c1 ) ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c147 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseLiteral ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 47 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseNumber ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseString ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseTrue ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseFalse ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseNull ( ) ; } } } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c148 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNullExpr ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 48 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c149 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c150 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c151 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNull ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 49 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$currPos ; if ( input . substr ( peg$currPos , 4 ) === peg$c149 ) { s1 = peg$c149 ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c153 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c154 ( ) ; } s0 = s1 ; peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c152 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseTrue ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 50 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$currPos ; if ( input . substr ( peg$currPos , 4 ) === peg$c156 ) { s1 = peg$c156 ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c157 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c39 ( ) ; } s0 = s1 ; peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c155 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFalse ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 51 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$currPos ; if ( input . substr ( peg$currPos , 5 ) === peg$c159 ) { s1 = peg$c159 ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c160 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c161 ( ) ; } s0 = s1 ; peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c158 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNumber ( ) { let s0 ; const key = peg$currPos * 71 + 52 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$parseFloatLiteral ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseIntLiteral ( ) ; } peg$silentFails -- ; if ( s0 === peg$FAILED ) { if ( peg$silentFails === 0 ) { peg$fail ( peg$c162 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseIntLiteral ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 71 + 53 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseZeroLiteral ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$currPos ; if ( peg$c163 . test ( input . charAt ( peg$currPos ) ) ) { s1 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c164 ) ; } } if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( peg$c165 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c166 ) ; } } if ( s2 !== peg$FAILED ) { s3 = [ ] ; if ( peg$c167 . test ( input . charAt ( peg$currPos ) ) ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } while ( s4 !== peg$FAILED ) { s3 . push ( s4 ) ; if ( peg$c167 . test ( input . charAt ( peg$currPos ) ) ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c169 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseZeroLiteral ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 54 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 48 ) { s1 = peg$c170 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c171 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c172 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFloatLiteral ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 55 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( peg$c163 . test ( input . charAt ( peg$currPos ) ) ) { s1 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c164 ) ; } } if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = [ ] ; if ( peg$c167 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } if ( s3 !== peg$FAILED ) { while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; if ( peg$c167 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } } } else { s2 = peg$FAILED ; } if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 46 ) { s3 = peg$c140 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c141 ) ; } } if ( s3 !== peg$FAILED ) { s4 = [ ] ; if ( peg$c167 . test ( input . charAt ( peg$currPos ) ) ) { s5 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } if ( s5 !== peg$FAILED ) { while ( s5 !== peg$FAILED ) { s4 . push ( s5 ) ; if ( peg$c167 . test ( input . charAt ( peg$currPos ) ) ) { s5 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } } } else { s4 = peg$FAILED ; } if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c173 ( ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseString ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 71 + 56 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseQuoteString ( ) ; if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseQuoteString ( ) ; if ( s5 !== peg$FAILED ) { s4 = [ s4 , s5 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$currPos ; s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseQuoteString ( ) ; if ( s5 !== peg$FAILED ) { s4 = [ s4 , s5 ] ; s3 = s4 ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } else { peg$currPos = s3 ; s3 = peg$FAILED ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c174 ( s1 , s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parse_ ( ) { let s0 , s1 ; const key = peg$currPos * 71 + 57 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = [ ] ; s1 = peg$parseWhitespace ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseComment ( ) ; } if ( s1 !== peg$FAILED ) { while ( s1 !== peg$FAILED ) { s0 . push ( s1 ) ; s1 = peg$parseWhitespace ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseComment ( ) ; } } } else { s0 = peg$FAILED ; } peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c175 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseWhitespace ( ) { let s0 ; const key = peg$currPos * 71 + 58 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c176 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c177 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseComment ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 59 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseUnterminatedComment ( ) ; if ( s1 !== peg$FAILED ) { s2 = [ ] ; if ( peg$c178 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c179 ) ; } } if ( s3 !== peg$FAILED ) { while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; if ( peg$c178 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c179 ) ; } } } } else { s2 = peg$FAILED ; } if ( s2 !== peg$FAILED ) { s1 = [ s1 , s2 ] ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseUnterminatedComment ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 60 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 35 ) { s1 = peg$c180 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c181 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c182 ) { s1 = peg$c182 ; peg$currPos += 2 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c183 ) ; } } } if ( s1 !== peg$FAILED ) { s2 = [ ] ; if ( peg$c184 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c185 ) ; } } while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; if ( peg$c184 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c185 ) ; } } } if ( s2 !== peg$FAILED ) { s1 = [ s1 , s2 ] ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseQuoteString ( ) { let s0 ; const key = peg$currPos * 71 + 61 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$parseSingleQuoteString ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseDoubleQuoteString ( ) ; } peg$silentFails -- ; if ( s0 === peg$FAILED ) { if ( peg$silentFails === 0 ) { peg$fail ( peg$c186 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSingleQuoteString ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 62 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 39 ) { s1 = peg$c187 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c188 ) ; } } if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$parseSingleQuoteStringChar ( ) ; while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$parseSingleQuoteStringChar ( ) ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 39 ) { s3 = peg$c187 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c188 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c189 ( s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseDoubleQuoteString ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 71 + 63 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 34 ) { s1 = peg$c190 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c191 ) ; } } if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$parseDoubleQuoteStringChar ( ) ; while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$parseDoubleQuoteStringChar ( ) ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 34 ) { s3 = peg$c190 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c191 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c189 ( s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSingleQuoteStringChar ( ) { let s0 ; const key = peg$currPos * 71 + 64 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseSingleQuoteStringCharUnescaped ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseStringEscapedChar ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseDoubleQuoteStringChar ( ) { let s0 ; const key = peg$currPos * 71 + 65 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseDoubleQuoteStringCharUnescaped ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseStringEscapedChar ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseStringEscapedChar ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ; const key = peg$currPos * 71 + 66 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseStringCharEscape ( ) ; if ( s1 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 34 ) { s2 = peg$c190 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c191 ) ; } } if ( s2 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 39 ) { s2 = peg$c187 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c188 ) ; } } if ( s2 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 92 ) { s2 = peg$c192 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c193 ) ; } } if ( s2 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 47 ) { s2 = peg$c130 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c131 ) ; } } if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 98 ) { s3 = peg$c194 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c195 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c196 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 102 ) { s3 = peg$c197 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c198 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c199 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 110 ) { s3 = peg$c200 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c201 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c202 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 114 ) { s3 = peg$c203 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c204 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c205 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 116 ) { s3 = peg$c206 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c207 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c208 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 117 ) { s3 = peg$c209 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c210 ) ; } } if ( s3 !== peg$FAILED ) { s4 = peg$currPos ; s5 = peg$currPos ; s6 = peg$parseHexDigit ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parseHexDigit ( ) ; if ( s7 !== peg$FAILED ) { s8 = peg$parseHexDigit ( ) ; if ( s8 !== peg$FAILED ) { s9 = peg$parseHexDigit ( ) ; if ( s9 !== peg$FAILED ) { s6 = [ s6 , s7 , s8 , s9 ] ; s5 = s6 ; } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } } else { peg$currPos = s5 ; s5 = peg$FAILED ; } if ( s5 !== peg$FAILED ) { s4 = input . substring ( s4 , peg$currPos ) ; } else { s4 = s5 ; } if ( s4 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c211 ( s4 ) ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } } } } } } } } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c212 ( s2 ) ; s0 = s1 ; } else { peg$currPos = s0 ; s0 = peg$FAILED ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseStringCharEscape ( ) { let s0 ; const key = peg$currPos * 71 + 67 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( input . charCodeAt ( peg$currPos ) === 92 ) { s0 = peg$c192 ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c193 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseDoubleQuoteStringCharUnescaped ( ) { let s0 ; const key = peg$currPos * 71 + 68 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c213 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c214 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSingleQuoteStringCharUnescaped ( ) { let s0 ; const key = peg$currPos * 71 + 69 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c215 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c216 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseHexDigit ( ) { let s0 ; const key = peg$currPos * 71 + 70 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c217 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c218 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } ( function ( ) { error || expected || peg$anyExpectation ; } ) ( ) ; function loc ( ) { return location ( ) ; } function camelCase ( string ) { return string . toLowerCase ( ) . replace ( /\b\w/g , function ( chr , idx ) { return idx > 0 ? chr . toUpperCase ( ) : chr ; } ) . replace ( /\s+/g , "" ) ; } peg$result = peg$startRuleFunction ( ) ; if ( peg$result !== peg$FAILED && peg$currPos === input . length ) { return peg$result ; } else { if ( peg$result !== peg$FAILED && peg$currPos < input . length ) { peg$fail ( peg$endExpectation ( ) ) ; } throw peg$buildStructuredError ( peg$maxFailExpected , peg$maxFailPos < input . length ? input . charAt ( peg$maxFailPos ) : null , peg$maxFailPos < input . length ? peg$computeLocation ( peg$maxFailPos , peg$maxFailPos + 1 ) : peg$computeLocation ( peg$maxFailPos , peg$maxFailPos ) ) ; } } export interface IParseOptions { filename ? : string ; startRule ? : string ; tracer ? : any ; [ key ] : any ; } export type ParseFunction = ( input : string , options ? : IParseOptions ) => any ; export const parse = peg$parse ;