/**
 * Copyright 2019 Twitter, Inc.
 * Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 */ "use strict" ; import { buildSqrlError } from "../compile/buildSqrlError" ; import { Ast , AstLocation , mapAst } from "../ast/Ast" ; 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 = { SqrlExpr : peg$parseSqrlExpr , SqrlRepl : peg$parseSqrlRepl , SqrlScript : peg$parseSqrlScript , Expr : peg$parseExpr , } ; let peg$startRuleFunction = peg$parseSqrlExpr ; const peg$c0 = function ( flag , topStatements ) { return { type : "script" , flag : flag || null , statements : topStatements , location : loc ( ) , } ; } ; const peg$c1 = ";" ; const peg$c2 = peg$literalExpectation ( ";" , false ) ; const peg$c3 = function ( topStatements , last ) { return { type : "repl" , statements : [ ... topStatements , last ] . filter ( ( f ) => f ) , location : loc ( ) , } ; } ; const peg$c4 = function ( expr ) { return { type : "expr" , expr : expr , location : loc ( ) , } ; } ; const peg$c5 = "'use migrate';" ; const peg$c6 = peg$literalExpectation ( "'use migrate';" , false ) ; const peg$c7 = function ( ) { return "migrate" ; } ; const peg$c8 = function ( statement ) { return statement ; } ; const peg$c9 = "include" ; const peg$c10 = peg$literalExpectation ( "INCLUDE" , true ) ; const peg$c11 = "library" ; const peg$c12 = peg$literalExpectation ( "LIBRARY" , true ) ; const peg$c13 = function ( library , filename , where ) { where = where || { type : "constant" , value : true } ; return { type : "include" , filename : filename , where : where , library : ! ! library , location : loc ( ) , } ; } ; const peg$c14 = "assert" ; const peg$c15 = peg$literalExpectation ( "ASSERT" , true ) ; const peg$c16 = function ( expr ) { return { type : "assert" , expr : expr , location : loc ( ) , } ; } ; const peg$c17 = "execute" ; const peg$c18 = peg$literalExpectation ( "EXECUTE" , true ) ; const peg$c19 = "times" ; const peg$c20 = peg$literalExpectation ( "TIMES" , true ) ; const peg$c21 = function ( repeat , skipWait ) { return { type : "execute" , repeat : repeat ? repeat [ 1 ] : 1 , skipWait : ! ! skipWait , location : loc ( ) , } ; } ; const peg$c22 = "default" ; const peg$c23 = peg$literalExpectation ( "DEFAULT" , true ) ; const peg$c24 = function ( ) { return "default" ; } ; const peg$c25 = ":=" ; const peg$c26 = peg$literalExpectation ( ":=" , false ) ; const peg$c27 = function ( keyword , description , feature , expr , where ) { const isDefaultCase = where === "default" ; if ( isDefaultCase ) { where = { type : "constant" , value : null } ; } else { where = where || { type : "constant" , value : true } ; } return { type : "let" , description , expr , feature , final : keyword === "final" , isDefaultCase , location : loc ( ) , where , } ; } ; const peg$c28 = "let" ; const peg$c29 = peg$literalExpectation ( "LET" , true ) ; const peg$c30 = "final" ; const peg$c31 = peg$literalExpectation ( "FINAL" , true ) ; const peg$c32 = function ( ) { return text ( ) . toLowerCase ( ) ; } ; const peg$c33 = function ( description ) { return description ; } ; const peg$c34 = "rollout to" ; const peg$c35 = peg$literalExpectation ( "ROLLOUT TO" , true ) ; const peg$c36 = "%" ; const peg$c37 = peg$literalExpectation ( "%" , false ) ; const peg$c38 = function ( value ) { return value ; } ; const peg$c39 = "create" ; const peg$c40 = peg$literalExpectation ( "CREATE" , true ) ; const peg$c41 = function ( keyword , description , rule ) { return Object . assign ( { } , rule , { description : description , location : loc ( ) , } ) ; } ; const peg$c42 = "when" ; const peg$c43 = peg$literalExpectation ( "WHEN" , true ) ; const peg$c44 = "then" ; const peg$c45 = peg$literalExpectation ( "THEN" , true ) ; const peg$c46 = function ( rules , statements ) { return { type : "when" , rules , statements , location : loc ( ) , } ; } ; const peg$c47 = "rule" ; const peg$c48 = peg$literalExpectation ( "RULE" , true ) ; const peg$c49 = "alias" ; const peg$c50 = peg$literalExpectation ( "ALIAS" , true ) ; const peg$c51 = function ( sync , name , alias , where , reason , rolloutPercent ) { where = where || { type : "constant" , value : true } ; return { type : "rule" , name , where , reason , sync : ! ! sync , rolloutPercent : rolloutPercent || 0 , alias : alias ? alias [ 3 ] : null , location : loc ( ) , } ; } ; const peg$c52 = "sync" ; const peg$c53 = peg$literalExpectation ( "SYNC" , true ) ; const peg$c54 = "async" ; const peg$c55 = peg$literalExpectation ( "ASYNC" , true ) ; const peg$c56 = function ( value ) { return value . toLowerCase ( ) === "sync" ; } ; const peg$c57 = "," ; const peg$c58 = peg$literalExpectation ( "," , false ) ; const peg$c59 = function ( first , rest ) { return [ first ] . concat ( rest . map ( ( item ) => item [ 3 ] ) ) ; } ; const peg$c60 = "rules" ; const peg$c61 = peg$literalExpectation ( "RULES" , true ) ; const peg$c62 = function ( firstRule , restRules ) { return { type : "rules" , rules : [ firstRule ] . concat ( restRules . map ( ( arg ) => arg [ 3 ] ) ) , location : loc ( ) , } ; } ; const peg$c63 = function ( call , where ) { if ( where ) { return { type : "call" , func : "if" , args : [ where , call ] , } ; } return call ; } ; const peg$c64 = function ( func ) { return options . customFunctions . has ( func ) ; } ; const peg$c65 = "(" ; const peg$c66 = peg$literalExpectation ( "(" , false ) ; const peg$c67 = ")" ; const peg$c68 = peg$literalExpectation ( ")" , false ) ; const peg$c69 = function ( func , source ) { return { type : "customCall" , func , source , location : loc ( ) } ; } ; const peg$c70 = /^[()]/ ; const peg$c71 = peg$classExpectation ( [ "(" , ")" ] , false , false ) ; const peg$c72 = peg$anyExpectation ( ) ; const peg$c73 = function ( func , args ) { return { type : "call" , func : func , args : args || [ ] , location : loc ( ) } ; } ; const peg$c74 = function ( expr ) { return expr ; } ; const peg$c75 = function ( expr ) { return { type : "priority" , priority : "lazy" , expr : expr , location : loc ( ) } ; } ; const peg$c76 = function ( expr ) { return { type : "priority" , priority : "eager" , expr : expr , location : loc ( ) } ; } ; const peg$c77 = "where" ; const peg$c78 = peg$literalExpectation ( "WHERE" , true ) ; const peg$c79 = "with reason" ; const peg$c80 = peg$literalExpectation ( "WITH REASON" , true ) ; const peg$c81 = function ( string ) { return string ; } ; const peg$c82 = "without" ; const peg$c83 = peg$literalExpectation ( "WITHOUT" , true ) ; const peg$c84 = "with" ; const peg$c85 = peg$literalExpectation ( "WITH" , true ) ; const peg$c86 = "wait" ; const peg$c87 = peg$literalExpectation ( "WAIT" , true ) ; const peg$c88 = function ( skipWait ) { return skipWait . toLowerCase ( ) === "without" ; } ; const peg$c89 = "{" ; const peg$c90 = peg$literalExpectation ( "{" , false ) ; const peg$c91 = "}" ; const peg$c92 = peg$literalExpectation ( "}" , false ) ; const peg$c93 = function ( ) { return { type : "constant" , value : { } , location : loc ( ) , } ; } ; const peg$c94 = function ( firstPair , restExprs ) { const args = firstPair . concat ( ... restExprs . map ( ( e ) => e [ 3 ] ) ) ; if ( args . every ( ( arg ) => arg . type === "constant" ) ) { const value = { } ; for ( let i = 0 ; i < args . length ; i += 2 ) { value [ args [ i ] . value ] = args [ i + 1 ] . value ; } return { value , type : "constant" , location : loc ( ) , } ; } return { args , type : "call" , func : "createMap" , location : loc ( ) , } ; } ; const peg$c95 = ":" ; const peg$c96 = peg$literalExpectation ( ":" , false ) ; const peg$c97 = function ( key , val ) { return [ key , val ] ; } ; const peg$c98 = function ( feature ) { return [ { type : "constant" , value : feature , location : loc ( ) } , { type : "feature" , value : feature , location : loc ( ) } , ] ; } ; const peg$c99 = "[" ; const peg$c100 = peg$literalExpectation ( "[" , false ) ; const peg$c101 = "for" ; const peg$c102 = peg$literalExpectation ( "FOR" , true ) ; const peg$c103 = "in" ; const peg$c104 = peg$literalExpectation ( "IN" , true ) ; const peg$c105 = "]" ; const peg$c106 = peg$literalExpectation ( "]" , false ) ; const peg$c107 = function ( output , feature , input , where ) { where = where || { type : "constant" , value : true } ; const iterator = feature . value ; const replaceIterator = ( ast ) : Ast => { if ( ast . type === "feature" && ast . value === iterator ) { return { type : "iterator" , name : iterator , location : ast . location , } ; } else if ( ast . type === "customCall" ) { throw buildSqrlError ( ast , "Expression is not valid during a list comprehension" ) ; } return ast ; } ; return { type : "listComprehension" , output : mapAst ( output , replaceIterator ) , input : input , iterator : { type : "iterator" , name : iterator , location : feature . location , } , where : mapAst ( where , replaceIterator ) , location : loc ( ) , } ; } ; const peg$c108 = function ( ) { return { type : "list" , exprs : [ ] , location : loc ( ) , } ; } ; const peg$c109 = function ( firstExpr , restExprs ) { return { type : "list" , exprs : [ firstExpr ] . concat ( restExprs . map ( ( e ) => e [ 3 ] ) ) , location : loc ( ) , } ; } ; const peg$c110 = "and" ; const peg$c111 = peg$literalExpectation ( "AND" , true ) ; const peg$c112 = "or" ; const peg$c113 = peg$literalExpectation ( "OR" , true ) ; const peg$c114 = function ( left , op , right ) { return { type : "boolean_expr" , left : left , operator : op . toLowerCase ( ) , right : right , location : loc ( ) , } ; } ; const peg$c115 = "not" ; const peg$c116 = peg$literalExpectation ( "NOT" , true ) ; const peg$c117 = function ( expr ) { return { type : "not" , expr : expr , location : loc ( ) } ; } ; const peg$c118 = "is not" ; const peg$c119 = peg$literalExpectation ( "IS NOT" , true ) ; const peg$c120 = "is" ; const peg$c121 = peg$literalExpectation ( "IS" , true ) ; const peg$c122 = function ( left , op , right ) { return { type : "binary_expr" , left : left , operator : op . toLowerCase ( ) , right : right , location : loc ( ) , } ; } ; const peg$c123 = "=" ; const peg$c124 = peg$literalExpectation ( "=" , false ) ; const peg$c125 = "!=" ; const peg$c126 = peg$literalExpectation ( "!=" , false ) ; const peg$c127 = ">=" ; const peg$c128 = peg$literalExpectation ( ">=" , false ) ; const peg$c129 = "<=" ; const peg$c130 = peg$literalExpectation ( "<=" , false ) ; const peg$c131 = ">" ; const peg$c132 = peg$literalExpectation ( ">" , false ) ; const peg$c133 = "<" ; const peg$c134 = peg$literalExpectation ( "<" , false ) ; const peg$c135 = "contains" ; const peg$c136 = peg$literalExpectation ( "CONTAINS" , true ) ; const peg$c137 = "+" ; const peg$c138 = peg$literalExpectation ( "+" , false ) ; const peg$c139 = "-" ; const peg$c140 = peg$literalExpectation ( "-" , false ) ; const peg$c141 = "*" ; const peg$c142 = peg$literalExpectation ( "*" , false ) ; const peg$c143 = "/" ; const peg$c144 = peg$literalExpectation ( "/" , false ) ; const peg$c145 = function ( value ) { return { type : "feature" , value : value , location : loc ( ) } ; } ; const peg$c146 = peg$otherExpectation ( "feature name" ) ; const peg$c147 = "." ; const peg$c148 = peg$literalExpectation ( "." , false ) ; const peg$c149 = function ( ) { return text ( ) ; } ; const peg$c150 = /^[A-Za-z0-9_]/ ; const peg$c151 = peg$classExpectation ( [ [ "A" , "Z" ] , [ "a" , "z" ] , [ "0" , "9" ] , "_" ] , false , false ) ; const peg$c152 = peg$otherExpectation ( "function name" ) ; const peg$c153 = function ( value ) { return { type : "constant" , value : value , location : loc ( ) } ; } ; const peg$c154 = "null" ; const peg$c155 = peg$literalExpectation ( "NULL" , true ) ; const peg$c156 = function ( ) { return { type : "constant" , value : null , location : loc ( ) } ; } ; const peg$c157 = peg$otherExpectation ( "eager" ) ; const peg$c158 = "eager" ; const peg$c159 = peg$literalExpectation ( "EAGER" , true ) ; const peg$c160 = peg$otherExpectation ( "lazy" ) ; const peg$c161 = "lazy" ; const peg$c162 = peg$literalExpectation ( "LAZY" , true ) ; const peg$c163 = peg$otherExpectation ( "null" ) ; const peg$c164 = peg$literalExpectation ( "null" , false ) ; const peg$c165 = function ( ) { return null ; } ; const peg$c166 = peg$otherExpectation ( "true" ) ; const peg$c167 = "true" ; const peg$c168 = peg$literalExpectation ( "true" , false ) ; const peg$c169 = function ( ) { return true ; } ; const peg$c170 = peg$otherExpectation ( "false" ) ; const peg$c171 = "false" ; const peg$c172 = peg$literalExpectation ( "false" , false ) ; const peg$c173 = function ( ) { return false ; } ; const peg$c174 = peg$otherExpectation ( "literal number" ) ; const peg$c175 = /^[\-]/ ; const peg$c176 = peg$classExpectation ( [ "-" ] , false , false ) ; const peg$c177 = /^[1-9]/ ; const peg$c178 = peg$classExpectation ( [ [ "1" , "9" ] ] , false , false ) ; const peg$c179 = /^[0-9]/ ; const peg$c180 = peg$classExpectation ( [ [ "0" , "9" ] ] , false , false ) ; const peg$c181 = function ( ) { return parseInt ( text ( ) , 10 ) ; } ; const peg$c182 = "0" ; const peg$c183 = peg$literalExpectation ( "0" , false ) ; const peg$c184 = function ( ) { return 0 ; } ; const peg$c185 = function ( ) { return parseFloat ( text ( ) ) ; } ; const peg$c186 = function ( first , rest ) { return first . concat ( ... rest . map ( ( item ) => item [ 1 ] ) ) ; } ; const peg$c187 = peg$otherExpectation ( "whitespace" ) ; const peg$c188 = /^[ \t\n\r]/ ; const peg$c189 = peg$classExpectation ( [ " " , "\t" , "\n" , "\r" ] , false , false ) ; const peg$c190 = /^[\n]/ ; const peg$c191 = peg$classExpectation ( [ "\n" ] , false , false ) ; const peg$c192 = "#" ; const peg$c193 = peg$literalExpectation ( "#" , false ) ; const peg$c194 = "--" ; const peg$c195 = peg$literalExpectation ( "--" , false ) ; const peg$c196 = /^[^\n]/ ; const peg$c197 = peg$classExpectation ( [ "\n" ] , true , false ) ; const peg$c198 = peg$otherExpectation ( "string" ) ; const peg$c199 = "'" ; const peg$c200 = peg$literalExpectation ( "'" , false ) ; const peg$c201 = function ( chars ) { return chars . join ( "" ) ; } ; const peg$c202 = '"' ; const peg$c203 = peg$literalExpectation ( '"' , false ) ; const peg$c204 = "\\" ; const peg$c205 = peg$literalExpectation ( "\\" , false ) ; const peg$c206 = "b" ; const peg$c207 = peg$literalExpectation ( "b" , false ) ; const peg$c208 = function ( ) { return "\b" ; } ; const peg$c209 = "f" ; const peg$c210 = peg$literalExpectation ( "f" , false ) ; const peg$c211 = function ( ) { return "\f" ; } ; const peg$c212 = "n" ; const peg$c213 = peg$literalExpectation ( "n" , false ) ; const peg$c214 = function ( ) { return "\n" ; } ; const peg$c215 = "r" ; const peg$c216 = peg$literalExpectation ( "r" , false ) ; const peg$c217 = function ( ) { return "\r" ; } ; const peg$c218 = "t" ; const peg$c219 = peg$literalExpectation ( "t" , false ) ; const peg$c220 = function ( ) { return "\t" ; } ; const peg$c221 = "u" ; const peg$c222 = peg$literalExpectation ( "u" , false ) ; const peg$c223 = function ( digits ) { return String . fromCharCode ( parseInt ( digits , 16 ) ) ; } ; const peg$c224 = function ( sequence ) { return sequence ; } ; const peg$c225 = /^[^\0-\x1F"\\]/ ; const peg$c226 = peg$classExpectation ( [ [ "\0" , "\x1F" ] , '"' , "\\" ] , true , false ) ; const peg$c227 = /^[^\0-\x1F'\\]/ ; const peg$c228 = peg$classExpectation ( [ [ "\0" , "\x1F" ] , "'" , "\\" ] , true , false ) ; const peg$c229 = /^[0-9a-f]/i ; const peg$c230 = 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$parseSqrlScript ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 0 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFlagStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = [ ] ; s3 = peg$parseSqrlClosedStatement ( ) ; while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$parseSqrlClosedStatement ( ) ; } if ( s2 !== peg$FAILED ) { s3 = peg$parseFinalWhitespace ( ) ; if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c0 ( s1 , 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$parseSqrlRepl ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 87 + 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 ) { s2 = [ ] ; s3 = peg$parseSqrlClosedStatement ( ) ; while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; s3 = peg$parseSqrlClosedStatement ( ) ; } if ( s2 !== peg$FAILED ) { s3 = peg$parseSqrlStatement ( ) ; if ( s3 === peg$FAILED ) { s3 = peg$parseSqrlExpr ( ) ; } if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 59 ) { s5 = peg$c1 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c2 ) ; } } if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parseFinalWhitespace ( ) ; if ( s6 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c3 ( 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 ; } } 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$parseSqrlExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 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 ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = peg$parseBooleanExpr ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c4 ( 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$parseFlagStatement ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 3 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . substr ( peg$currPos , 14 ) === peg$c5 ) { s1 = peg$c5 ; peg$currPos += 14 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c6 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c7 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSqrlClosedStatement ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 87 + 4 ; 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$parseSqrlStatement ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 59 ) { s4 = peg$c1 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c2 ) ; } } if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c8 ( s2 ) ; 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$parseSqrlStatement ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 5 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseAssertStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseExecuteStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseIncludeStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseLetStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseRuleStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseWhenStatement ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseListComprehensionExpr ( ) ; if ( s1 === peg$FAILED ) { s1 = peg$parseCallStatement ( ) ; } } } } } } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c8 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseIncludeStatement ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 87 + 6 ; 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$c9 ) { s1 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c10 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$currPos ; if ( input . substr ( peg$currPos , 7 ) . toLowerCase ( ) === peg$c11 ) { s4 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c12 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { s4 = [ s4 , s5 ] ; s3 = s4 ; } 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$parseString ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseWhereClause ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c13 ( 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 ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseAssertStatement ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 7 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c14 ) { s1 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c15 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c16 ( 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$parseExecuteStatement ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 87 + 8 ; 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$c17 ) { s1 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c18 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$currPos ; s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseNumber ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c19 ) { s6 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c20 ) ; } } 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$parseSkipWaitClause ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c21 ( 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$parseDefaultClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 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 ) { if ( input . substr ( peg$currPos , 7 ) . toLowerCase ( ) === peg$c22 ) { s2 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c23 ) ; } } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c24 ( ) ; 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$parseSwitchClause ( ) { let s0 ; const key = peg$currPos * 87 + 10 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseDefaultClause ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseWhereClause ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseLetStatement ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ; const key = peg$currPos * 87 + 11 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseLetKeyword ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parseLetDescriptionClause ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseFeature ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parse_ ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c25 ) { s6 = peg$c25 ; peg$currPos += 2 ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c26 ) ; } } if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { s8 = peg$parseBooleanExpr ( ) ; if ( s8 !== peg$FAILED ) { s9 = peg$parseSwitchClause ( ) ; if ( s9 === peg$FAILED ) { s9 = null ; } if ( s9 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c27 ( s1 , s2 , s4 , s8 , s9 ) ; 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$parseLetKeyword ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 12 ; 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$c22 ) { s1 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c23 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 3 ) . toLowerCase ( ) === peg$c28 ) { s1 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c29 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c30 ) { s1 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c31 ) ; } } } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c32 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseLetDescriptionClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 13 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parse_ ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parseString ( ) ; if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c33 ( 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$parseRolloutClause ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 87 + 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 ) { if ( input . substr ( peg$currPos , 10 ) . toLowerCase ( ) === peg$c34 ) { s2 = input . substr ( peg$currPos , 10 ) ; peg$currPos += 10 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c35 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseIntLiteral ( ) ; if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 37 ) { s5 = peg$c36 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c37 ) ; } } if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c38 ( 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$parseRuleStatement ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 87 + 15 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . substr ( peg$currPos , 6 ) . toLowerCase ( ) === peg$c39 ) { s1 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c40 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 7 ) . toLowerCase ( ) === peg$c22 ) { s1 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c23 ) ; } } } if ( s1 !== peg$FAILED ) { s2 = peg$parseLetDescriptionClause ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseNewRuleClause ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c41 ( s1 , s2 , 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$parseWhenStatement ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 87 + 16 ; 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$c42 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c43 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseNewRuleClause ( ) ; if ( s3 === peg$FAILED ) { s3 = peg$parseRulesExpr ( ) ; } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c44 ) { s5 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c45 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parseWhenStatementList ( ) ; if ( s7 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c46 ( s3 , 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 ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNewRuleClause ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ; const key = peg$currPos * 87 + 17 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseSyncClause ( ) ; if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c47 ) { s2 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c48 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseFeature ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$currPos ; s6 = peg$parse_ ( ) ; if ( s6 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c49 ) { s7 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c50 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 !== peg$FAILED ) { s9 = peg$parseFeature ( ) ; 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 ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parseWhereClause ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseReasonClause ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { s8 = peg$parseRolloutClause ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c51 ( s1 , s4 , s5 , 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 ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSyncClause ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 18 ; 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$c52 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c53 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c54 ) { s1 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c55 ) ; } } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c56 ( s1 ) ; 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$parseWhenStatementList ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 87 + 19 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseCallExpr ( ) ; 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$c57 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseCallExpr ( ) ; 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$c57 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseCallExpr ( ) ; 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$c59 ( 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$parseRulesExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 ; const key = peg$currPos * 87 + 20 ; 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$c60 ) { s2 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c61 ) ; } } 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$parseFeatureExpr ( ) ; if ( s2 !== peg$FAILED ) { s3 = [ ] ; s4 = peg$currPos ; s5 = peg$parse_ ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s6 = peg$c57 ; peg$currPos ++ ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { s8 = peg$parseFeatureExpr ( ) ; 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 ; } while ( s4 !== peg$FAILED ) { s3 . push ( s4 ) ; s4 = peg$currPos ; s5 = peg$parse_ ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 44 ) { s6 = peg$c57 ; peg$currPos ++ ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s6 !== peg$FAILED ) { s7 = peg$parse_ ( ) ; if ( s7 === peg$FAILED ) { s7 = null ; } if ( s7 !== peg$FAILED ) { s8 = peg$parseFeatureExpr ( ) ; 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 ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c62 ( 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$parseCallStatement ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 21 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseCallExpr ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parseWhereClause ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c63 ( 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$parseCallExpr ( ) { let s0 ; const key = peg$currPos * 87 + 22 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseCustomCallExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseSimpleCallExpr ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseCustomCallExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 ; const key = peg$currPos * 87 + 23 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFunc ( ) ; if ( s1 !== peg$FAILED ) { peg$savedPos = peg$currPos ; s2 = peg$c64 ( s1 ) ; if ( s2 ) { s2 = undefined ; } else { s2 = peg$FAILED ; } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 === peg$FAILED ) { s3 = null ; } if ( s3 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 40 ) { s4 = peg$c65 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c66 ) ; } } if ( s4 !== peg$FAILED ) { s5 = peg$parseCustomCallSource ( ) ; if ( s5 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 41 ) { s6 = peg$c67 ; peg$currPos ++ ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c68 ) ; } } if ( s6 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c69 ( s1 , 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$parseCustomCallSource ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 87 + 24 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = [ ] ; s2 = peg$parseString ( ) ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; s3 = peg$currPos ; peg$silentFails ++ ; if ( peg$c70 . test ( input . charAt ( peg$currPos ) ) ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c71 ) ; } } peg$silentFails -- ; if ( s4 === peg$FAILED ) { s3 = undefined ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } if ( s3 !== peg$FAILED ) { if ( input . length > peg$currPos ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c72 ) ; } } if ( s4 !== peg$FAILED ) { s3 = [ s3 , s4 ] ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 40 ) { s3 = peg$c65 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c66 ) ; } } if ( s3 !== peg$FAILED ) { s4 = peg$parseCustomCallSource ( ) ; if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 41 ) { s5 = peg$c67 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c68 ) ; } } if ( s5 !== peg$FAILED ) { s3 = [ s3 , s4 , s5 ] ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } } while ( s2 !== peg$FAILED ) { s1 . push ( s2 ) ; s2 = peg$parseString ( ) ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; s3 = peg$currPos ; peg$silentFails ++ ; if ( peg$c70 . test ( input . charAt ( peg$currPos ) ) ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c71 ) ; } } peg$silentFails -- ; if ( s4 === peg$FAILED ) { s3 = undefined ; } else { peg$currPos = s3 ; s3 = peg$FAILED ; } if ( s3 !== peg$FAILED ) { if ( input . length > peg$currPos ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c72 ) ; } } if ( s4 !== peg$FAILED ) { s3 = [ s3 , s4 ] ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 40 ) { s3 = peg$c65 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c66 ) ; } } if ( s3 !== peg$FAILED ) { s4 = peg$parseCustomCallSource ( ) ; if ( s4 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 41 ) { s5 = peg$c67 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c68 ) ; } } if ( s5 !== peg$FAILED ) { s3 = [ s3 , s4 , s5 ] ; s2 = s3 ; } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } else { peg$currPos = s2 ; s2 = peg$FAILED ; } } } } if ( s1 !== peg$FAILED ) { s0 = input . substring ( s0 , peg$currPos ) ; } else { s0 = s1 ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSimpleCallExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 87 + 25 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseFunc ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 40 ) { s3 = peg$c65 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c66 ) ; } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseExprList ( ) ; if ( s5 === peg$FAILED ) { s5 = null ; } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 41 ) { s7 = peg$c67 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c68 ) ; } } if ( s7 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c73 ( s1 , 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 ; } } else { peg$currPos = s0 ; s0 = peg$FAILED ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseExprList ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ; const key = peg$currPos * 87 + 26 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseBooleanExpr ( ) ; 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$c57 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseBooleanExpr ( ) ; 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$c57 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 === peg$FAILED ) { s6 = null ; } if ( s6 !== peg$FAILED ) { s7 = peg$parseBooleanExpr ( ) ; 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$c59 ( 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$parseSubExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 87 + 27 ; 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$c65 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c66 ) ; } } 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$c67 ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c68 ) ; } } if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c74 ( 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$parseLazyExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 28 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseLazy ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c75 ( 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$parseEagerExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 29 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseEager ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c76 ( 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$parseWhereClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 87 + 30 ; 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$c77 ) { s2 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c78 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseBooleanExpr ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c74 ( 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$parseReasonClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 87 + 31 ; 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 , 11 ) . toLowerCase ( ) === peg$c79 ) { s2 = input . substr ( peg$currPos , 11 ) ; peg$currPos += 11 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c80 ) ; } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { s4 = peg$parseString ( ) ; if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c81 ( 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$parseSkipWaitClause ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 87 + 32 ; 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 , 7 ) . toLowerCase ( ) === peg$c82 ) { s2 = input . substr ( peg$currPos , 7 ) ; peg$currPos += 7 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c83 ) ; } } if ( s2 === peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c84 ) { s2 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c85 ) ; } } } if ( s2 !== peg$FAILED ) { s3 = peg$parse_ ( ) ; if ( s3 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c86 ) { s4 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c87 ) ; } } if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c88 ( s2 ) ; 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$parseDataObjectExpr ( ) { let s0 ; const key = peg$currPos * 87 + 33 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseEmptyDataObjectExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseNonEmptyDataObjectExpr ( ) ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseEmptyDataObjectExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 34 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 123 ) { 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 ) === 125 ) { 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$parseNonEmptyDataObjectExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 ; const key = peg$currPos * 87 + 35 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 123 ) { 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$parseDataObjectPair ( ) ; 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$c57 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { s9 = peg$parseDataObjectPair ( ) ; 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$c57 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 === peg$FAILED ) { s8 = null ; } if ( s8 !== peg$FAILED ) { s9 = peg$parseDataObjectPair ( ) ; 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$c57 ; peg$currPos ++ ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } 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 ) === 125 ) { 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$parseDataObjectPair ( ) { let s0 , s1 , s2 , s3 , s4 , s5 ; const key = peg$currPos * 87 + 36 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseConstantString ( ) ; if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 58 ) { s3 = peg$c95 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c96 ) ; } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 === peg$FAILED ) { s4 = null ; } if ( s4 !== peg$FAILED ) { s5 = peg$parseBooleanExpr ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c97 ( s1 , 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 ; } if ( s0 === peg$FAILED ) { s0 = peg$currPos ; s1 = peg$parseFeature ( ) ; if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c98 ( s1 ) ; } s0 = s1 ; } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseListExpr ( ) { let s0 ; const key = peg$currPos * 87 + 37 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseEmptyListExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseListComprehensionExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseNonEmptyListExpr ( ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseListComprehensionExpr ( ) { let s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 ; const key = peg$currPos * 87 + 38 ; 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$c99 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c100 ) ; } } 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 ) { if ( input . substr ( peg$currPos , 3 ) . toLowerCase ( ) === peg$c101 ) { s5 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c102 ) ; } } if ( s5 !== peg$FAILED ) { s6 = peg$parse_ ( ) ; if ( s6 !== peg$FAILED ) { s7 = peg$parseFeatureExpr ( ) ; if ( s7 !== peg$FAILED ) { s8 = peg$parse_ ( ) ; if ( s8 !== peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c103 ) { s9 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s9 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c104 ) ; } } if ( s9 !== peg$FAILED ) { s10 = peg$parse_ ( ) ; if ( s10 !== peg$FAILED ) { s11 = peg$parseBooleanExpr ( ) ; if ( s11 !== peg$FAILED ) { s12 = peg$parseWhereClause ( ) ; if ( s12 === peg$FAILED ) { s12 = null ; } if ( s12 !== peg$FAILED ) { s13 = peg$parse_ ( ) ; if ( s13 === peg$FAILED ) { s13 = null ; } if ( s13 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 93 ) { s14 = peg$c105 ; peg$currPos ++ ; } else { s14 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c106 ) ; } } if ( s14 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c107 ( s3 , s7 , s11 , s12 ) ; 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$parseEmptyListExpr ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 39 ; 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$c99 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c100 ) ; } } 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$c105 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c106 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c108 ( ) ; 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 * 87 + 40 ; 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$c99 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c100 ) ; } } 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$c57 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } 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$c57 ; peg$currPos ++ ; } else { s7 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } 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$c57 ; peg$currPos ++ ; } else { s6 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c58 ) ; } } 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$c105 ; peg$currPos ++ ; } else { s8 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c106 ) ; } } if ( s8 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c109 ( 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$parseExpr ( ) { let s0 ; const key = peg$currPos * 87 + 41 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseBooleanExpr ( ) ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseBooleanExpr ( ) { let s0 ; const key = peg$currPos * 87 + 42 ; 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 * 87 + 43 ; 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$c110 ) { s3 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c111 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c112 ) { s3 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c113 ) ; } } } if ( s3 !== peg$FAILED ) { s4 = peg$parse_ ( ) ; if ( s4 !== peg$FAILED ) { s5 = peg$parseBooleanExpr ( ) ; if ( s5 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c114 ( 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 * 87 + 44 ; 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 * 87 + 45 ; 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$c115 ) { s1 = input . substr ( peg$currPos , 3 ) ; peg$currPos += 3 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c116 ) ; } } if ( s1 !== peg$FAILED ) { s2 = peg$parse_ ( ) ; if ( s2 !== peg$FAILED ) { s3 = peg$parseUnaryBooleanExpr ( ) ; if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c117 ( 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 * 87 + 46 ; 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 * 87 + 47 ; 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$c118 ) { s3 = input . substr ( peg$currPos , 6 ) ; peg$currPos += 6 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c119 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c120 ) { s3 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c121 ) ; } } } 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$c122 ( 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 * 87 + 48 ; 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$c123 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c124 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c125 ) { s3 = peg$c125 ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c126 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c127 ) { s3 = peg$c127 ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c128 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c129 ) { s3 = peg$c129 ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c130 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 62 ) { s3 = peg$c131 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c132 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 60 ) { s3 = peg$c133 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c134 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 8 ) . toLowerCase ( ) === peg$c135 ) { s3 = input . substr ( peg$currPos , 8 ) ; peg$currPos += 8 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c136 ) ; } } if ( s3 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) . toLowerCase ( ) === peg$c103 ) { s3 = input . substr ( peg$currPos , 2 ) ; peg$currPos += 2 ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c104 ) ; } } } } } } } } } 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$c122 ( 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 * 87 + 49 ; 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 * 87 + 50 ; 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 * 87 + 51 ; 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$c137 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c138 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 45 ) { s3 = peg$c139 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c140 ) ; } } } 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$c122 ( 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 * 87 + 52 ; 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 * 87 + 53 ; 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$c141 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c142 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 47 ) { s3 = peg$c143 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c144 ) ; } } if ( s3 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 37 ) { s3 = peg$c36 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c37 ) ; } } } } 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$c122 ( 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 * 87 + 54 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$parseEagerExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseLazyExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseCallExpr ( ) ; if ( s0 === peg$FAILED ) { s0 = peg$parseDataObjectExpr ( ) ; if ( s0 === peg$FAILED ) { 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$parseFeatureExpr ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 55 ; 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$c145 ( 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 * 87 + 56 ; 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$c147 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c148 ) ; } } 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$c147 ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c148 ) ; } } 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$c149 ( ) ; 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$c146 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSymbol ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 57 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = [ ] ; if ( peg$c150 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c151 ) ; } } if ( s2 !== peg$FAILED ) { while ( s2 !== peg$FAILED ) { s1 . push ( s2 ) ; if ( peg$c150 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c151 ) ; } } } } else { s1 = peg$FAILED ; } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c149 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFunc ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 58 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; s0 = peg$currPos ; s1 = [ ] ; if ( peg$c150 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c151 ) ; } } if ( s2 !== peg$FAILED ) { while ( s2 !== peg$FAILED ) { s1 . push ( s2 ) ; if ( peg$c150 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c151 ) ; } } } } else { s1 = peg$FAILED ; } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c149 ( ) ; } 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$parseLiteral ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 59 ; 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$c153 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseConstantString ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 60 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; s1 = peg$parseString ( ) ; if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c153 ( s1 ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNullExpr ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 61 ; 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$c154 ) { s1 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c155 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c156 ( ) ; } s0 = s1 ; peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseEager ( ) { let s0 ; const key = peg$currPos * 87 + 62 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; if ( input . substr ( peg$currPos , 5 ) . toLowerCase ( ) === peg$c158 ) { s0 = input . substr ( peg$currPos , 5 ) ; peg$currPos += 5 ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c159 ) ; } } peg$silentFails -- ; if ( s0 === peg$FAILED ) { if ( peg$silentFails === 0 ) { peg$fail ( peg$c157 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseLazy ( ) { let s0 ; const key = peg$currPos * 87 + 63 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } peg$silentFails ++ ; if ( input . substr ( peg$currPos , 4 ) . toLowerCase ( ) === peg$c161 ) { s0 = input . substr ( peg$currPos , 4 ) ; peg$currPos += 4 ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c162 ) ; } } peg$silentFails -- ; if ( s0 === peg$FAILED ) { if ( peg$silentFails === 0 ) { peg$fail ( peg$c160 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNull ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 64 ; 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$c154 ) { s1 = peg$c154 ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c164 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c165 ( ) ; } s0 = s1 ; peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c163 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseTrue ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 65 ; 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$c167 ) { s1 = peg$c167 ; peg$currPos += 4 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c168 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c169 ( ) ; } s0 = s1 ; peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c166 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseFalse ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 66 ; 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$c171 ) { s1 = peg$c171 ; peg$currPos += 5 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c172 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c173 ( ) ; } s0 = s1 ; peg$silentFails -- ; if ( s0 === peg$FAILED ) { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c170 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseNumber ( ) { let s0 ; const key = peg$currPos * 87 + 67 ; 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$c174 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseIntLiteral ( ) { let s0 , s1 , s2 , s3 , s4 ; const key = peg$currPos * 87 + 68 ; 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$c175 . test ( input . charAt ( peg$currPos ) ) ) { s1 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c176 ) ; } } if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { if ( peg$c177 . test ( input . charAt ( peg$currPos ) ) ) { s2 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c178 ) ; } } if ( s2 !== peg$FAILED ) { s3 = [ ] ; if ( peg$c179 . test ( input . charAt ( peg$currPos ) ) ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c180 ) ; } } while ( s4 !== peg$FAILED ) { s3 . push ( s4 ) ; if ( peg$c179 . test ( input . charAt ( peg$currPos ) ) ) { s4 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s4 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c180 ) ; } } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c181 ( ) ; 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 * 87 + 69 ; 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$c182 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c183 ) ; } } if ( s1 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c184 ( ) ; } 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 * 87 + 70 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } s0 = peg$currPos ; if ( peg$c175 . test ( input . charAt ( peg$currPos ) ) ) { s1 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c176 ) ; } } if ( s1 === peg$FAILED ) { s1 = null ; } if ( s1 !== peg$FAILED ) { s2 = [ ] ; if ( peg$c179 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c180 ) ; } } if ( s3 !== peg$FAILED ) { while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; if ( peg$c179 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c180 ) ; } } } } else { s2 = peg$FAILED ; } if ( s2 === peg$FAILED ) { s2 = null ; } if ( s2 !== peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 46 ) { s3 = peg$c147 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c148 ) ; } } if ( s3 !== peg$FAILED ) { s4 = [ ] ; if ( peg$c179 . test ( input . charAt ( peg$currPos ) ) ) { s5 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c180 ) ; } } if ( s5 !== peg$FAILED ) { while ( s5 !== peg$FAILED ) { s4 . push ( s5 ) ; if ( peg$c179 . test ( input . charAt ( peg$currPos ) ) ) { s5 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s5 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c180 ) ; } } } } else { s4 = peg$FAILED ; } if ( s4 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c185 ( ) ; 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 * 87 + 71 ; 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$c186 ( 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$parseFinalWhitespace ( ) { let s0 , s1 , s2 ; const key = peg$currPos * 87 + 72 ; 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$parseUnterminatedComment ( ) ; if ( s2 === peg$FAILED ) { s2 = null ; } 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$parse_ ( ) { let s0 , s1 ; const key = peg$currPos * 87 + 73 ; 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$c187 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseWhitespace ( ) { let s0 ; const key = peg$currPos * 87 + 74 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c188 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c189 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseComment ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 75 ; 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$c190 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c191 ) ; } } if ( s3 !== peg$FAILED ) { while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; if ( peg$c190 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c191 ) ; } } } } 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 * 87 + 76 ; 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$c192 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c193 ) ; } } if ( s1 === peg$FAILED ) { if ( input . substr ( peg$currPos , 2 ) === peg$c194 ) { s1 = peg$c194 ; peg$currPos += 2 ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c195 ) ; } } } if ( s1 !== peg$FAILED ) { s2 = [ ] ; if ( peg$c196 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c197 ) ; } } while ( s3 !== peg$FAILED ) { s2 . push ( s3 ) ; if ( peg$c196 . test ( input . charAt ( peg$currPos ) ) ) { s3 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c197 ) ; } } } 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 * 87 + 77 ; 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$c198 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSingleQuoteString ( ) { let s0 , s1 , s2 , s3 ; const key = peg$currPos * 87 + 78 ; 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$c199 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c200 ) ; } } 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$c199 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c200 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c201 ( 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 * 87 + 79 ; 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$c202 ; peg$currPos ++ ; } else { s1 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c203 ) ; } } 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$c202 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c203 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s0 ; s1 = peg$c201 ( 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 * 87 + 80 ; 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 * 87 + 81 ; 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 * 87 + 82 ; 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$c202 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c203 ) ; } } if ( s2 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 39 ) { s2 = peg$c199 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c200 ) ; } } if ( s2 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 92 ) { s2 = peg$c204 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c205 ) ; } } if ( s2 === peg$FAILED ) { if ( input . charCodeAt ( peg$currPos ) === 47 ) { s2 = peg$c143 ; peg$currPos ++ ; } else { s2 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c144 ) ; } } if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 98 ) { 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 ) === 102 ) { s3 = peg$c209 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c210 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c211 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 110 ) { s3 = peg$c212 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c213 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c214 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 114 ) { s3 = peg$c215 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c216 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c217 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 116 ) { s3 = peg$c218 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c219 ) ; } } if ( s3 !== peg$FAILED ) { peg$savedPos = s2 ; s3 = peg$c220 ( ) ; } s2 = s3 ; if ( s2 === peg$FAILED ) { s2 = peg$currPos ; if ( input . charCodeAt ( peg$currPos ) === 117 ) { s3 = peg$c221 ; peg$currPos ++ ; } else { s3 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c222 ) ; } } 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$c223 ( 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$c224 ( 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 * 87 + 83 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( input . charCodeAt ( peg$currPos ) === 92 ) { s0 = peg$c204 ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c205 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseDoubleQuoteStringCharUnescaped ( ) { let s0 ; const key = peg$currPos * 87 + 84 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c225 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c226 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseSingleQuoteStringCharUnescaped ( ) { let s0 ; const key = peg$currPos * 87 + 85 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c227 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c228 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } function peg$parseHexDigit ( ) { let s0 ; const key = peg$currPos * 87 + 86 ; const cached = peg$resultsCache [ key ] ; if ( cached ) { peg$currPos = cached . nextPos ; return cached . result ; } if ( peg$c229 . test ( input . charAt ( peg$currPos ) ) ) { s0 = input . charAt ( peg$currPos ) ; peg$currPos ++ ; } else { s0 = peg$FAILED ; if ( peg$silentFails === 0 ) { peg$fail ( peg$c230 ) ; } } peg$resultsCache [ key ] = { nextPos : peg$currPos , result : s0 } ; return s0 ; } ( function ( ) { error || expected || peg$anyExpectation ; } ) ( ) ; function loc ( ) { return options . mergeLocation ( location ( ) ) ; } 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 ;