diff --git a/query/parser/build.sh b/query/parser/build.sh index d35a2b1..a4f291e 100755 --- a/query/parser/build.sh +++ b/query/parser/build.sh @@ -4,3 +4,4 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) peg -inline -switch $DIR/language.peg +goimports -w $DIR/language.peg.go # format the file; optional diff --git a/query/parser/error_test.go b/query/parser/error_test.go new file mode 100644 index 0000000..e4890c4 --- /dev/null +++ b/query/parser/error_test.go @@ -0,0 +1,89 @@ +// Copyright 2015 - 2016 Square Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package parser + +import "testing" + +func TestErrorMessages(t *testing.T) { + type sample struct { + query string + message string + } + tests := []sample{ + { + query: "select foo from", + message: "line 1, column 16: expected value to follow key 'from'", + }, + { + query: "select foo\nfrom -30m to now\nwhere app = 'mqe'", + message: `line 3, column 6: encountered "where" after property clause; "where" blocks must go BEFORE 'from' and 'to' specifiers`, + }, + { + query: "select foo\nfrom -30m to mow", + message: "line 2, column 13: expected value to follow key 'to'", + }, + { + query: "select foo + bar[blah='22']\nwhere tag != 'value' and qux = 'qux'\nfrom -30m to mow", + message: "line 3, column 13: expected value to follow key 'to'", + }, + { + query: "select foo + bar[\nwhere tag != 'value' and qux = 'qux'\nfrom -30m to mow", + message: `line 1, column 18: expected predicate to follow "[" after metric`, + }, + { + query: "select crazy#2dinvalid.metric + bar\nwhere tag != 'value' and qux = 'qux'\nfrom -30m to now", + message: `line 1, column 13: expected key (one of 'from', 'to', 'resolution', or 'sample by') or end of input but got "#2dinvalid.metric + bar\nwhere tag != 'value' and qux = 'qux'\nfrom -30m to now" following a completed expression`, + }, + { + query: "serlect foo from -30m to now", + message: `line 1, column 9: expected key (one of 'from', 'to', 'resolution', or 'sample by') or end of input but got "foo from -30m to now" following a completed expression`, + }, + { + query: "describe all where host = 'foo'", + message: `line 1, column 14: expected end of input after 'describe all' and optional match clause but got "where host = 'foo'"`, + }, + { + query: "select foo, bar,\nfrom -30m to now", + message: `line 1, column 17: expected expression to follow ","`, + }, + { + query: "select foo, bar[host = 'x' and]\nfrom -30m to now", + message: `line 1, column 31: expected predicate to follow "and" operator`, + }, + { + query: "select foo, bar[host = 'x' and '2']\nfrom -30m to now", + message: `line 1, column 31: expected predicate to follow "and" operator`, + }, + { + query: "select foo, bar[host = 'x'] {unclosed annotation\nfrom -30m to now", + message: `line 2, column 17: expected "}" to close "{" opened for annotation`, + }, + } + for _, test := range tests { + _, err := Parse(test.query) + if err == nil { + t.Errorf("Expected error to happen in query\n\t%s\nbut not error happened", test.query) + continue + } + actual := err.Error() + if test.message == "" { + t.Errorf("In query\n\t%s\ngot out error message\n\t%s\n(no expected message was set)", test.query, actual) + continue + } + if test.message != actual { + t.Errorf("In query\n\t%s\ngot out error message\n\t%s\nbut expected\n\t%s", test.query, actual, test.message) + } + } +} diff --git a/query/parser/language.peg b/query/parser/language.peg index af0b48e..c46712e 100644 --- a/query/parser/language.peg +++ b/query/parser/language.peg @@ -28,6 +28,10 @@ type Parser Peg { // a non-empty list at the finish time means an invalid query is provided. errors []SyntaxError + // errorContext describes contexts used to build error messages + fixedContext string + errorContext []string + // programming errors accumulated during the AST traversal. // a non-empty list at the finish time implies a programming error. @@ -50,31 +54,50 @@ root <- (selectStmt / describeStmt) _ !. selectStmt <- _ ("select" KEY)? expressionList + &{ p.setContext("after expression of select statement") } optionalPredicateClause - propertyClause { - p.makeSelect() - } + &{ p.setContext("") } + propertyClause { p.makeSelect() } describeStmt <- _ "describe" KEY (describeAllStmt / describeMetrics / describeSingleStmt) -describeAllStmt <- _ "all" KEY optionalMatchClause { p.makeDescribeAll() } +describeAllStmt <- _ "all" KEY optionalMatchClause { p.makeDescribeAll() } &(_ !. / _ &{p.errorHere(position, `expected end of input after 'describe all' and optional match clause but got %q`, p.after(position) )}) optionalMatchClause <- matchClause / { p.addNullMatchClause() } -matchClause <- _ "match" KEY literalString { p.addMatchClause() } +matchClause <- + _ "match" KEY + (literalString / &{ p.errorHere(position, `expected string literal to follow keyword "match"`) }) + { p.addMatchClause() } -describeMetrics <- _ "metrics" KEY _ "where" KEY tagName _ "=" literalString { p.makeDescribeMetrics() } +describeMetrics <- + _ "metrics" KEY + (_ "where" KEY / &{ p.errorHere(position, `expected "where" to follow keyword "metrics" in "describe metrics" command`) }) + (tagName / &{ p.errorHere(position, `expected tag key to follow keyword "where" in "describe metrics" command`) }) + (_ "=" / &{ p.errorHere(position, `expected "=" to follow keyword "where" in "describe metrics" command`) }) + (literalString / &{ p.errorHere(position, `expected string literal to follow "=" in "describe metrics" command`) }) + { p.makeDescribeMetrics() } describeSingleStmt <- - _ { p.pushString(unescapeLiteral(buffer[begin:end])) } + (_ { p.pushString(unescapeLiteral(text)) } / &{ p.errorHere(position, `expected metric name to follow "describe" in "describe" command`) }) optionalPredicateClause { p.makeDescribe() } propertyClause <- { p.addEvaluationContext() } - ( _ PROPERTY_KEY { p.addPropertyKey(buffer[begin:end]) } - _ PROPERTY_VALUE { p.addPropertyValue(buffer[begin:end]) } + ( + _ PROPERTY_KEY { p.addPropertyKey(text) } + ( + _ PROPERTY_VALUE { + p.addPropertyValue(text) } + / + &{ p.errorHere(position, `expected value to follow key '%s'`, p.contents(tree, tokenIndex-2)) } + ) { p.insertPropertyKeyValue() } + / + _ "where" KEY &{ p.errorHere(position, `encountered "where" after property clause; "where" blocks must go BEFORE 'from' and 'to' specifiers`) } + / + _ (!(!.)) &{ p.errorHere(position, `expected key (one of 'from', 'to', 'resolution', or 'sample by') or end of input but got %q following a completed expression`, p.after(position)) } )* { p.checkPropertyClause() } @@ -85,9 +108,12 @@ optionalPredicateClause <- expressionList <- { p.addExpressionList() } - expression_start{ p.appendExpression() } + expression_start + { p.appendExpression() } ( - _ COMMA expression_start { p.appendExpression() } + _ COMMA + (expression_start / &{ p.errorHere(position, `expected expression to follow ","`) }) + { p.appendExpression() } )* expression_start <- @@ -97,28 +123,34 @@ expression_sum <- expression_product ( add_pipe - ( _ OP_ADD { p.addOperatorLiteral("+") } / _ OP_SUB { p.addOperatorLiteral("-") }) - expression_product { p.addOperatorFunction() } + ( + _ OP_ADD { p.addOperatorLiteral("+") } / _ OP_SUB { p.addOperatorLiteral("-") } + ) + (expression_product / &{ p.errorHere(position, `expected expression to follow operator "+" or "-"`) }) + { p.addOperatorFunction() } ) * expression_product <- expression_atom ( add_pipe - ( _ OP_DIV { p.addOperatorLiteral("/") } / _ OP_MULT { p.addOperatorLiteral("*") }) - expression_atom { p.addOperatorFunction() } + ( + _ OP_DIV { p.addOperatorLiteral("/") } / _ OP_MULT { p.addOperatorLiteral("*") } + ) + (expression_atom / &{ p.errorHere(position, `expected expression to follow operator "*" or "/"`) }) + { p.addOperatorFunction() } ) * add_one_pipe <- _ OP_PIPE - _ - { p.pushString(unescapeLiteral(buffer[begin:end])) } + (_ / &{ p.errorHere(position, `expected function name to follow pipe "|"`) }) + { p.pushString(unescapeLiteral(text)) } ( ( - _ PAREN_OPEN + _ PAREN_OPEN (expressionList / {p.addExpressionList()}) # argument list optionalGroupBy - _ PAREN_CLOSE + (_ PAREN_CLOSE / &{ p.errorHere(position, `expected ")" to close "(" opened in pipe function call`) }) ) / { p.addExpressionList() p.addGroupBy() @@ -127,7 +159,7 @@ add_one_pipe <- { p.addPipeExpression() } expression_annotation -add_pipe <- (add_one_pipe) * +add_pipe <- (add_one_pipe)* expression_atom <- expression_atom_raw expression_annotation @@ -135,62 +167,77 @@ expression_atom_raw <- expression_function / expression_metric / # #sub-expression - _ PAREN_OPEN expression_start _ PAREN_CLOSE / + ( + _ PAREN_OPEN + (expression_start / &{ p.errorHere(position, `expected expression to follow "("`) }) + (_ PAREN_CLOSE / &{ p.errorHere(position, `expected ")" to close "("`) }) + ) / # constant scalar _ { p.addDurationNode(text) } / - _ { p.addNumberNode(buffer[begin:end]) } / - _ STRING { p.addStringNode(unescapeLiteral(buffer[begin:end])) } + _ { p.addNumberNode(text) } / + _ STRING { p.addStringNode(unescapeLiteral(text)) } expression_annotation_required <- _ "{" <[^}]*> - "}" - { p.addAnnotationExpression(buffer[begin:end]) } + ("}" / &{ p.errorHere(position, `expected "$CLOSEBRACE$" to close "$OPENBRACE$" opened for annotation`) }) # peg generator doesn't handle `{` or `}` in comments or strings + { p.addAnnotationExpression(text) } expression_annotation <- expression_annotation_required? -optionalGroupBy <- { p.addGroupBy() } (groupByClause / collapseByClause)? +optionalGroupBy <- (groupByClause / collapseByClause / { p.addGroupBy() })? expression_function <- # We allow syntax of the form: # func(expr_a, expr_b, expr_c group by column_a, column_b, column_c) # a single optional group-by clause. - _ { - p.pushString(unescapeLiteral(buffer[begin:end])) - } + _ + { p.pushString(unescapeLiteral(text)) } _ PAREN_OPEN - expressionList optionalGroupBy - _ PAREN_CLOSE { - p.addFunctionInvocation() - } + (expressionList / &{ p.errorHere(position, `expected expression list to follow "(" in function call`) }) + optionalGroupBy + (_ PAREN_CLOSE / &{ p.errorHere(position, `expected ")" to close "(" opened by function call`) }) + { p.addFunctionInvocation() } expression_metric <- - _ { - p.pushString(unescapeLiteral(buffer[begin:end])) - } - (_ "[" predicate_1 _ "]" / { p.addNullPredicate() })? { - p.addMetricExpression() - } + _ + { p.pushString(unescapeLiteral(text)) } + ( + _ "[" + (predicate_1 / &{ p.errorHere(position, `expected predicate to follow "[" after metric`) }) + (_ "]" / &{ p.errorHere(position, `expected "]" to close "[" opened to apply predicate`) }) + / + { p.addNullPredicate() } + ) + { p.addMetricExpression() } groupByClause <- - _ "group" KEY _ "by" KEY _ { - p.appendGroupBy(unescapeLiteral(buffer[begin:end])) - } + _ "group" KEY + (_ "by" KEY / &{ p.errorHere(position, `expected keyword "by" to follow keyword "group" in "group by" clause`) }) + (_ / &{ p.errorHere(position, `expected tag key identifier to follow "group by" keywords in "group by" clause`) }) + { p.addGroupBy() } + { p.appendGroupTag(unescapeLiteral(text)) } ( - _ COMMA _ { - p.appendGroupBy(unescapeLiteral(buffer[begin:end])) - } + _ COMMA + (_ / &{ p.errorHere(position, `expected tag key identifier to follow "," in "group by" clause`) }) + { p.appendGroupTag(unescapeLiteral(text)) } )* collapseByClause <- - _ "collapse" KEY _ "by" KEY _ { - p.appendCollapseBy(unescapeLiteral(text)) - } + _ "collapse" KEY + (_ "by" KEY / &{ p.errorHere(position, `expected keyword "by" to follow keyword "collapse" in "collapse by" clause`) }) + (_ / &{ p.errorHere(position, `expected tag key identifier to follow "collapse by" keywords in "collapse by" clause`) }) + { p.addCollapseBy() } + { p.appendGroupTag(unescapeLiteral(text)) } ( - _ COMMA _ {p.appendCollapseBy(unescapeLiteral(text))} + _ COMMA + (_ / &{ p.errorHere(position, `expected tag key identifier to follow "," in "collapse by" clause`) }) + { p.appendGroupTag(unescapeLiteral(text)) } )* -predicateClause <- _ "where" KEY _ predicate_1 +predicateClause <- + _ "where" KEY + (_ predicate_1 / &{ p.errorHere(position, `expected predicate to follow "where" keyword`) }) # predicate_X are layered to maintain the order of operations. # not @@ -199,48 +246,84 @@ predicateClause <- _ "where" KEY _ predicate_1 # ... predicate_1 <- - predicate_2 _ OP_OR predicate_1 { p.addOrPredicate() } / + predicate_2 + _ OP_OR + (predicate_1 / &{ p.errorHere(position, `expected predicate to follow "or" operator`) }) + { p.addOrPredicate() } + / predicate_2 predicate_2 <- - predicate_3 _ OP_AND predicate_2 { p.addAndPredicate() } / + predicate_3 + _ OP_AND + (predicate_2 / &{ p.errorHere(position, `expected predicate to follow "and" operator`) }) + { p.addAndPredicate() } + / predicate_3 predicate_3 <- - _ OP_NOT predicate_3 { p.addNotPredicate() } / - _ PAREN_OPEN predicate_1 _ PAREN_CLOSE / + _ OP_NOT + (predicate_3 / &{ p.errorHere(position, `expected predicate to follow "not" operator`) }) + { p.addNotPredicate() } + / + _ PAREN_OPEN + (predicate_1 / &{ p.errorHere(position, `expected predicate to follow "("`) }) + (_ PAREN_CLOSE / &{ p.errorHere(position, `expected ")" to close "(" opened in predicate`) }) + / tagMatcher tagMatcher <- - tagName _ "=" literalString { - p.addLiteralMatcher() - } / - tagName _ "!=" literalString { - p.addLiteralMatcher() - p.addNotPredicate() - } / - tagName _ "match" KEY literalString { - p.addRegexMatcher() - } / - tagName _ "in" KEY literalList { - p.addListMatcher() - } - -literalString <- _ STRING { - p.pushString(unescapeLiteral(buffer[begin:end])) -} + tagName + ( + ( + _ "=" + (literalString / &{ p.errorHere(position, `expected string literal to follow "="`) }) + { p.addLiteralMatcher() } + ) + / + ( + _ "!=" + (literalString / &{ p.errorHere(position, `expected string literal to follow "!="`) }) + { p.addLiteralMatcher() } + { p.addNotPredicate() } + ) + / + ( + _ "match" KEY + (literalString / &{ p.errorHere(position, `expected regex string literal to follow "match"`) }) + { p.addRegexMatcher() } + ) + / + ( + _ "in" KEY + (literalList / &{ p.errorHere(position, `expected string literal list to follow "in" keyword`) }) + { p.addListMatcher() } + ) + / + &{ p.errorHere(position, `expected "=", "!=", "match", or "in" to follow tag key in predicate`) } + ) -literalList <- { p.addLiteralList() } +literalString <- + _ STRING + { p.pushString(unescapeLiteral(text)) } + +literalList <- + { p.addLiteralList() } _ PAREN_OPEN - literalListString (_ COMMA literalListString)* - _ PAREN_CLOSE + (literalListString / &{ p.errorHere(position, `expected string literal to follow "(" in literal list`) }) + ( + _ COMMA + (literalListString / &{ p.errorHere(position, `expected string literal to follow "," in literal list`) }) + )* + (_ PAREN_CLOSE / &{ p.errorHere(position, `expected ")" to close "(" for literal list`) }) -literalListString <- _ STRING { - p.appendLiteral(unescapeLiteral(buffer[begin:end])) -} +literalListString <- + _ STRING + { p.appendLiteral(unescapeLiteral(text)) } tagName <- - _ { p.addTagLiteral(unescapeLiteral(buffer[begin:end])) } + _ + { p.addTagLiteral(unescapeLiteral(text)) } # Lexical Syntax # ============== @@ -250,24 +333,38 @@ COLUMN_NAME <- IDENTIFIER METRIC_NAME <- IDENTIFIER TAG_NAME <- IDENTIFIER # TODO - may be refactored later. -IDENTIFIER <- "`" CHAR* "`" / _ !(KEYWORD KEY) ID_SEGMENT ("." ID_SEGMENT)* +IDENTIFIER <- + "`" CHAR* ("`" / &{ p.errorHere(position, "expected \"`\" to end identifier") }) + / + !(KEYWORD KEY) + ID_SEGMENT + ( + "." + (ID_SEGMENT / &{ p.errorHere(position, `expected identifier segment to follow "."`) }) + )* # `[[a-z]]?` allows for relative timestamps -TIMESTAMP <- _ / _ STRING / _ <"now"> -ID_SEGMENT <- _ ID_START ID_CONT* +TIMESTAMP <- _ / _ STRING / _ <"now"> KEY +ID_SEGMENT <- ID_START ID_CONT* # Hyphen (-) is intentionally omitted, since it makes the language ambiguous. # If hyphens are needed, use backticks instead. ID_START <- [a-zA-Z_] ID_CONT <- ID_START / [0-9] PROPERTY_KEY <- - (<"from"> / - <"to"> / - <"resolution"> / - <"sample"> KEY _ "by") KEY + ( + <"from"> KEY + / + <"to"> KEY + / + <"resolution"> KEY + / + <"sample"> KEY + (_ "by" KEY / &{ p.errorHere(position, `expected keyword "by" to follow keyword "sample"`) }) + ) PROPERTY_VALUE <- TIMESTAMP -KEYWORD <- # List of keywrods used throughout the code. +KEYWORD <- # List of keywords used throughout the code. "all" / "and" / "as" / @@ -282,7 +379,10 @@ KEYWORD <- # List of keywrods used throughout the code. "select" / "where" / "metrics" / - PROPERTY_KEY + "from" / + "to" / + "resolution" / + "sample" # Operators # ========= @@ -299,8 +399,11 @@ OP_NOT <- "not" KEY QUOTE_SINGLE <- "'" QUOTE_DOUBLE <- '"' -STRING <- QUOTE_SINGLE <(!QUOTE_SINGLE CHAR)*> QUOTE_SINGLE / QUOTE_DOUBLE <(!QUOTE_DOUBLE CHAR)*> QUOTE_DOUBLE -CHAR <- "\\" (ESCAPE_CLASS / QUOTE_SINGLE / QUOTE_DOUBLE) / ! ESCAPE_CLASS . +STRING <- + QUOTE_SINGLE <(!QUOTE_SINGLE CHAR)*> (QUOTE_SINGLE / &{ p.errorHere(position, `expected "'" to close string`) }) + / + QUOTE_DOUBLE <(!QUOTE_DOUBLE CHAR)*> (QUOTE_DOUBLE / &{ p.errorHere(position, `expected '"' to close string`) }) +CHAR <- "\\" (ESCAPE_CLASS / QUOTE_SINGLE / (QUOTE_DOUBLE / &{ p.errorHere(position, "expected \"\\\", \"'\", \"`\", or '\"' to follow \"\\\" in string literal") }) ) / ! ESCAPE_CLASS . ESCAPE_CLASS <- "`" / "\\" # Numerical elements @@ -312,7 +415,7 @@ NUMBER <- NUMBER_INTEGER NUMBER_FRACTION? NUMBER_EXP? NUMBER_NATURAL <- "0" / [1-9] [0-9]* NUMBER_FRACTION <- "." [0-9]+ NUMBER_INTEGER <- "-"? NUMBER_NATURAL -NUMBER_EXP <- "e" ("+" / "-")? [0-9]+ +NUMBER_EXP <- "e" ("+" / "-")? ([0-9]+ / &{ p.errorHere(position, `expected exponent`) }) DURATION <- NUMBER [a-z]+ KEY @@ -322,7 +425,7 @@ DURATION <- NUMBER [a-z]+ KEY PAREN_OPEN <- "(" PAREN_CLOSE <- ")" COMMA <- "," -_ <- (SPACE / COMMENT_TRAIL / COMMENT_BLOCK) * # Optional spaces +_ <- (SPACE / COMMENT_TRAIL / COMMENT_BLOCK)* # Optional spaces COMMENT_TRAIL <- "--" (!"\n" .)* COMMENT_BLOCK <- "/*" (!"*/" .)* "*/" KEY <- !ID_CONT diff --git a/query/parser/language.peg.go b/query/parser/language.peg.go index 56ff14e..c55d10d 100644 --- a/query/parser/language.peg.go +++ b/query/parser/language.peg.go @@ -140,6 +140,9 @@ const ( ruleAction48 ruleAction49 ruleAction50 + ruleAction51 + ruleAction52 + ruleAction53 rulePre ruleIn @@ -272,6 +275,9 @@ var rul3s = [...]string{ "Action48", "Action49", "Action50", + "Action51", + "Action52", + "Action53", "Pre_", "_In_", @@ -600,6 +606,10 @@ type Parser struct { // a non-empty list at the finish time means an invalid query is provided. errors []SyntaxError + // errorContext describes contexts used to build error messages + fixedContext string + errorContext []string + // programming errors accumulated during the AST traversal. // a non-empty list at the finish time implies a programming error. @@ -608,7 +618,7 @@ type Parser struct { Buffer string buffer []rune - rules [125]func() bool + rules [128]func() bool Parse func(rule ...int) error Reset func() Pretty bool @@ -693,9 +703,7 @@ func (p *Parser) Execute() { text = string(_buffer[begin:end]) case ruleAction0: - p.makeSelect() - case ruleAction1: p.makeDescribeAll() case ruleAction2: @@ -705,15 +713,16 @@ func (p *Parser) Execute() { case ruleAction4: p.makeDescribeMetrics() case ruleAction5: - p.pushString(unescapeLiteral(buffer[begin:end])) + p.pushString(unescapeLiteral(text)) case ruleAction6: p.makeDescribe() case ruleAction7: p.addEvaluationContext() case ruleAction8: - p.addPropertyKey(buffer[begin:end]) + p.addPropertyKey(text) case ruleAction9: - p.addPropertyValue(buffer[begin:end]) + + p.addPropertyValue(text) case ruleAction10: p.insertPropertyKeyValue() case ruleAction11: @@ -739,7 +748,7 @@ func (p *Parser) Execute() { case ruleAction21: p.addOperatorFunction() case ruleAction22: - p.pushString(unescapeLiteral(buffer[begin:end])) + p.pushString(unescapeLiteral(text)) case ruleAction23: p.addExpressionList() case ruleAction24: @@ -752,80 +761,59 @@ func (p *Parser) Execute() { case ruleAction26: p.addDurationNode(text) case ruleAction27: - p.addNumberNode(buffer[begin:end]) + p.addNumberNode(text) case ruleAction28: - p.addStringNode(unescapeLiteral(buffer[begin:end])) + p.addStringNode(unescapeLiteral(text)) case ruleAction29: - p.addAnnotationExpression(buffer[begin:end]) + p.addAnnotationExpression(text) case ruleAction30: p.addGroupBy() case ruleAction31: - - p.pushString(unescapeLiteral(buffer[begin:end])) - + p.pushString(unescapeLiteral(text)) case ruleAction32: - p.addFunctionInvocation() - case ruleAction33: - - p.pushString(unescapeLiteral(buffer[begin:end])) - + p.pushString(unescapeLiteral(text)) case ruleAction34: p.addNullPredicate() case ruleAction35: - p.addMetricExpression() - case ruleAction36: - - p.appendGroupBy(unescapeLiteral(buffer[begin:end])) - + p.addGroupBy() case ruleAction37: - - p.appendGroupBy(unescapeLiteral(buffer[begin:end])) - + p.appendGroupTag(unescapeLiteral(text)) case ruleAction38: - - p.appendCollapseBy(unescapeLiteral(text)) - + p.appendGroupTag(unescapeLiteral(text)) case ruleAction39: - p.appendCollapseBy(unescapeLiteral(text)) + p.addCollapseBy() case ruleAction40: - p.addOrPredicate() + p.appendGroupTag(unescapeLiteral(text)) case ruleAction41: - p.addAndPredicate() + p.appendGroupTag(unescapeLiteral(text)) case ruleAction42: - p.addNotPredicate() + p.addOrPredicate() case ruleAction43: - - p.addLiteralMatcher() - + p.addAndPredicate() case ruleAction44: - - p.addLiteralMatcher() p.addNotPredicate() - case ruleAction45: - - p.addRegexMatcher() - + p.addLiteralMatcher() case ruleAction46: - - p.addListMatcher() - + p.addLiteralMatcher() case ruleAction47: - - p.pushString(unescapeLiteral(buffer[begin:end])) - + p.addNotPredicate() case ruleAction48: - p.addLiteralList() + p.addRegexMatcher() case ruleAction49: - - p.appendLiteral(unescapeLiteral(buffer[begin:end])) - + p.addListMatcher() case ruleAction50: - p.addTagLiteral(unescapeLiteral(buffer[begin:end])) + p.pushString(unescapeLiteral(text)) + case ruleAction51: + p.addLiteralList() + case ruleAction52: + p.appendLiteral(unescapeLiteral(text)) + case ruleAction53: + p.addTagLiteral(unescapeLiteral(text)) } } @@ -1014,9 +1002,15 @@ func (p *Parser) Init() { if !_rules[ruleexpressionList]() { goto l3 } + if !(p.setContext("after expression of select statement")) { + goto l3 + } if !_rules[ruleoptionalPredicateClause]() { goto l3 } + if !(p.setContext("")) { + goto l3 + } { position19 := position depth++ @@ -1026,703 +1020,1348 @@ func (p *Parser) Init() { l21: { position22, tokenIndex22, depth22 := position, tokenIndex, depth - if !_rules[rule_]() { - goto l22 - } - if !_rules[rulePROPERTY_KEY]() { - goto l22 - } - { - add(ruleAction8, position) - } - if !_rules[rule_]() { - goto l22 - } { - position24 := position - depth++ + position23, tokenIndex23, depth23 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l24 + } { position25 := position depth++ { - position26, tokenIndex26, depth26 := position, tokenIndex, depth - if !_rules[rule_]() { - goto l27 - } - { - position28 := position - depth++ - if !_rules[ruleNUMBER]() { - goto l27 - } - l29: + switch buffer[position] { + case 'S', 's': { - position30, tokenIndex30, depth30 := position, tokenIndex, depth + position27 := position + depth++ + { + position28, tokenIndex28, depth28 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l29 + } + position++ + goto l28 + l29: + position, tokenIndex, depth = position28, tokenIndex28, depth28 + if buffer[position] != rune('S') { + goto l24 + } + position++ + } + l28: { - position31, tokenIndex31, depth31 := position, tokenIndex, depth - if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l32 + position30, tokenIndex30, depth30 := position, tokenIndex, depth + if buffer[position] != rune('a') { + goto l31 } position++ - goto l31 - l32: - position, tokenIndex, depth = position31, tokenIndex31, depth31 - if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l30 + goto l30 + l31: + position, tokenIndex, depth = position30, tokenIndex30, depth30 + if buffer[position] != rune('A') { + goto l24 } position++ } - l31: - goto l29 l30: - position, tokenIndex, depth = position30, tokenIndex30, depth30 - } - depth-- - add(rulePegText, position28) - } - goto l26 - l27: - position, tokenIndex, depth = position26, tokenIndex26, depth26 - if !_rules[rule_]() { - goto l33 - } - if !_rules[ruleSTRING]() { - goto l33 - } - goto l26 - l33: - position, tokenIndex, depth = position26, tokenIndex26, depth26 - if !_rules[rule_]() { - goto l22 - } - { - position34 := position - depth++ - { - position35, tokenIndex35, depth35 := position, tokenIndex, depth - if buffer[position] != rune('n') { + { + position32, tokenIndex32, depth32 := position, tokenIndex, depth + if buffer[position] != rune('m') { + goto l33 + } + position++ + goto l32 + l33: + position, tokenIndex, depth = position32, tokenIndex32, depth32 + if buffer[position] != rune('M') { + goto l24 + } + position++ + } + l32: + { + position34, tokenIndex34, depth34 := position, tokenIndex, depth + if buffer[position] != rune('p') { + goto l35 + } + position++ + goto l34 + l35: + position, tokenIndex, depth = position34, tokenIndex34, depth34 + if buffer[position] != rune('P') { + goto l24 + } + position++ + } + l34: + { + position36, tokenIndex36, depth36 := position, tokenIndex, depth + if buffer[position] != rune('l') { + goto l37 + } + position++ goto l36 + l37: + position, tokenIndex, depth = position36, tokenIndex36, depth36 + if buffer[position] != rune('L') { + goto l24 + } + position++ } - position++ - goto l35 l36: - position, tokenIndex, depth = position35, tokenIndex35, depth35 - if buffer[position] != rune('N') { - goto l22 + { + position38, tokenIndex38, depth38 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l39 + } + position++ + goto l38 + l39: + position, tokenIndex, depth = position38, tokenIndex38, depth38 + if buffer[position] != rune('E') { + goto l24 + } + position++ } - position++ + l38: + depth-- + add(rulePegText, position27) + } + if !_rules[ruleKEY]() { + goto l24 } - l35: { - position37, tokenIndex37, depth37 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l38 + position40, tokenIndex40, depth40 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l41 } - position++ - goto l37 - l38: - position, tokenIndex, depth = position37, tokenIndex37, depth37 - if buffer[position] != rune('O') { - goto l22 + { + position42, tokenIndex42, depth42 := position, tokenIndex, depth + if buffer[position] != rune('b') { + goto l43 + } + position++ + goto l42 + l43: + position, tokenIndex, depth = position42, tokenIndex42, depth42 + if buffer[position] != rune('B') { + goto l41 + } + position++ + } + l42: + { + position44, tokenIndex44, depth44 := position, tokenIndex, depth + if buffer[position] != rune('y') { + goto l45 + } + position++ + goto l44 + l45: + position, tokenIndex, depth = position44, tokenIndex44, depth44 + if buffer[position] != rune('Y') { + goto l41 + } + position++ + } + l44: + if !_rules[ruleKEY]() { + goto l41 + } + goto l40 + l41: + position, tokenIndex, depth = position40, tokenIndex40, depth40 + if !(p.errorHere(position, `expected keyword "by" to follow keyword "sample"`)) { + goto l24 + } + } + l40: + break + case 'R', 'r': + { + position46 := position + depth++ + { + position47, tokenIndex47, depth47 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l48 + } + position++ + goto l47 + l48: + position, tokenIndex, depth = position47, tokenIndex47, depth47 + if buffer[position] != rune('R') { + goto l24 + } + position++ + } + l47: + { + position49, tokenIndex49, depth49 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l50 + } + position++ + goto l49 + l50: + position, tokenIndex, depth = position49, tokenIndex49, depth49 + if buffer[position] != rune('E') { + goto l24 + } + position++ + } + l49: + { + position51, tokenIndex51, depth51 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l52 + } + position++ + goto l51 + l52: + position, tokenIndex, depth = position51, tokenIndex51, depth51 + if buffer[position] != rune('S') { + goto l24 + } + position++ + } + l51: + { + position53, tokenIndex53, depth53 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l54 + } + position++ + goto l53 + l54: + position, tokenIndex, depth = position53, tokenIndex53, depth53 + if buffer[position] != rune('O') { + goto l24 + } + position++ + } + l53: + { + position55, tokenIndex55, depth55 := position, tokenIndex, depth + if buffer[position] != rune('l') { + goto l56 + } + position++ + goto l55 + l56: + position, tokenIndex, depth = position55, tokenIndex55, depth55 + if buffer[position] != rune('L') { + goto l24 + } + position++ + } + l55: + { + position57, tokenIndex57, depth57 := position, tokenIndex, depth + if buffer[position] != rune('u') { + goto l58 + } + position++ + goto l57 + l58: + position, tokenIndex, depth = position57, tokenIndex57, depth57 + if buffer[position] != rune('U') { + goto l24 + } + position++ + } + l57: + { + position59, tokenIndex59, depth59 := position, tokenIndex, depth + if buffer[position] != rune('t') { + goto l60 + } + position++ + goto l59 + l60: + position, tokenIndex, depth = position59, tokenIndex59, depth59 + if buffer[position] != rune('T') { + goto l24 + } + position++ + } + l59: + { + position61, tokenIndex61, depth61 := position, tokenIndex, depth + if buffer[position] != rune('i') { + goto l62 + } + position++ + goto l61 + l62: + position, tokenIndex, depth = position61, tokenIndex61, depth61 + if buffer[position] != rune('I') { + goto l24 + } + position++ + } + l61: + { + position63, tokenIndex63, depth63 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l64 + } + position++ + goto l63 + l64: + position, tokenIndex, depth = position63, tokenIndex63, depth63 + if buffer[position] != rune('O') { + goto l24 + } + position++ + } + l63: + { + position65, tokenIndex65, depth65 := position, tokenIndex, depth + if buffer[position] != rune('n') { + goto l66 + } + position++ + goto l65 + l66: + position, tokenIndex, depth = position65, tokenIndex65, depth65 + if buffer[position] != rune('N') { + goto l24 + } + position++ + } + l65: + depth-- + add(rulePegText, position46) + } + if !_rules[ruleKEY]() { + goto l24 + } + break + case 'T', 't': + { + position67 := position + depth++ + { + position68, tokenIndex68, depth68 := position, tokenIndex, depth + if buffer[position] != rune('t') { + goto l69 + } + position++ + goto l68 + l69: + position, tokenIndex, depth = position68, tokenIndex68, depth68 + if buffer[position] != rune('T') { + goto l24 + } + position++ + } + l68: + { + position70, tokenIndex70, depth70 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l71 + } + position++ + goto l70 + l71: + position, tokenIndex, depth = position70, tokenIndex70, depth70 + if buffer[position] != rune('O') { + goto l24 + } + position++ } - position++ + l70: + depth-- + add(rulePegText, position67) } - l37: + if !_rules[ruleKEY]() { + goto l24 + } + break + default: { - position39, tokenIndex39, depth39 := position, tokenIndex, depth - if buffer[position] != rune('w') { - goto l40 + position72 := position + depth++ + { + position73, tokenIndex73, depth73 := position, tokenIndex, depth + if buffer[position] != rune('f') { + goto l74 + } + position++ + goto l73 + l74: + position, tokenIndex, depth = position73, tokenIndex73, depth73 + if buffer[position] != rune('F') { + goto l24 + } + position++ + } + l73: + { + position75, tokenIndex75, depth75 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l76 + } + position++ + goto l75 + l76: + position, tokenIndex, depth = position75, tokenIndex75, depth75 + if buffer[position] != rune('R') { + goto l24 + } + position++ + } + l75: + { + position77, tokenIndex77, depth77 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l78 + } + position++ + goto l77 + l78: + position, tokenIndex, depth = position77, tokenIndex77, depth77 + if buffer[position] != rune('O') { + goto l24 + } + position++ } - position++ - goto l39 - l40: - position, tokenIndex, depth = position39, tokenIndex39, depth39 - if buffer[position] != rune('W') { - goto l22 + l77: + { + position79, tokenIndex79, depth79 := position, tokenIndex, depth + if buffer[position] != rune('m') { + goto l80 + } + position++ + goto l79 + l80: + position, tokenIndex, depth = position79, tokenIndex79, depth79 + if buffer[position] != rune('M') { + goto l24 + } + position++ } - position++ + l79: + depth-- + add(rulePegText, position72) } - l39: - depth-- - add(rulePegText, position34) + if !_rules[ruleKEY]() { + goto l24 + } + break } } - l26: + depth-- - add(ruleTIMESTAMP, position25) + add(rulePROPERTY_KEY, position25) } - depth-- - add(rulePROPERTY_VALUE, position24) - } - { - add(ruleAction9, position) - } - { - add(ruleAction10, position) - } - goto l21 - l22: - position, tokenIndex, depth = position22, tokenIndex22, depth22 - } - { - add(ruleAction11, position) - } - depth-- - add(rulepropertyClause, position19) - } - { - add(ruleAction0, position) - } - depth-- - add(ruleselectStmt, position4) - } - goto l2 - l3: - position, tokenIndex, depth = position2, tokenIndex2, depth2 - { - position45 := position - depth++ - if !_rules[rule_]() { - goto l0 - } + { + add(ruleAction8, position) + } + { + position82, tokenIndex82, depth82 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l83 + } + { + position84 := position + depth++ + { + position85 := position + depth++ + { + position86, tokenIndex86, depth86 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l87 + } + { + position88 := position + depth++ + if !_rules[ruleNUMBER]() { + goto l87 + } + l89: + { + position90, tokenIndex90, depth90 := position, tokenIndex, depth + { + position91, tokenIndex91, depth91 := position, tokenIndex, depth + if c := buffer[position]; c < rune('a') || c > rune('z') { + goto l92 + } + position++ + goto l91 + l92: + position, tokenIndex, depth = position91, tokenIndex91, depth91 + if c := buffer[position]; c < rune('A') || c > rune('Z') { + goto l90 + } + position++ + } + l91: + goto l89 + l90: + position, tokenIndex, depth = position90, tokenIndex90, depth90 + } + depth-- + add(rulePegText, position88) + } + goto l86 + l87: + position, tokenIndex, depth = position86, tokenIndex86, depth86 + if !_rules[rule_]() { + goto l93 + } + if !_rules[ruleSTRING]() { + goto l93 + } + goto l86 + l93: + position, tokenIndex, depth = position86, tokenIndex86, depth86 + if !_rules[rule_]() { + goto l83 + } + { + position94 := position + depth++ + { + position95, tokenIndex95, depth95 := position, tokenIndex, depth + if buffer[position] != rune('n') { + goto l96 + } + position++ + goto l95 + l96: + position, tokenIndex, depth = position95, tokenIndex95, depth95 + if buffer[position] != rune('N') { + goto l83 + } + position++ + } + l95: + { + position97, tokenIndex97, depth97 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l98 + } + position++ + goto l97 + l98: + position, tokenIndex, depth = position97, tokenIndex97, depth97 + if buffer[position] != rune('O') { + goto l83 + } + position++ + } + l97: + { + position99, tokenIndex99, depth99 := position, tokenIndex, depth + if buffer[position] != rune('w') { + goto l100 + } + position++ + goto l99 + l100: + position, tokenIndex, depth = position99, tokenIndex99, depth99 + if buffer[position] != rune('W') { + goto l83 + } + position++ + } + l99: + depth-- + add(rulePegText, position94) + } + if !_rules[ruleKEY]() { + goto l83 + } + } + l86: + depth-- + add(ruleTIMESTAMP, position85) + } + depth-- + add(rulePROPERTY_VALUE, position84) + } + { + add(ruleAction9, position) + } + goto l82 + l83: + position, tokenIndex, depth = position82, tokenIndex82, depth82 + if !(p.errorHere(position, `expected value to follow key '%s'`, p.contents(tree, tokenIndex-2))) { + goto l24 + } + } + l82: + { + add(ruleAction10, position) + } + goto l23 + l24: + position, tokenIndex, depth = position23, tokenIndex23, depth23 + if !_rules[rule_]() { + goto l103 + } + { + position104, tokenIndex104, depth104 := position, tokenIndex, depth + if buffer[position] != rune('w') { + goto l105 + } + position++ + goto l104 + l105: + position, tokenIndex, depth = position104, tokenIndex104, depth104 + if buffer[position] != rune('W') { + goto l103 + } + position++ + } + l104: + { + position106, tokenIndex106, depth106 := position, tokenIndex, depth + if buffer[position] != rune('h') { + goto l107 + } + position++ + goto l106 + l107: + position, tokenIndex, depth = position106, tokenIndex106, depth106 + if buffer[position] != rune('H') { + goto l103 + } + position++ + } + l106: + { + position108, tokenIndex108, depth108 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l109 + } + position++ + goto l108 + l109: + position, tokenIndex, depth = position108, tokenIndex108, depth108 + if buffer[position] != rune('E') { + goto l103 + } + position++ + } + l108: + { + position110, tokenIndex110, depth110 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l111 + } + position++ + goto l110 + l111: + position, tokenIndex, depth = position110, tokenIndex110, depth110 + if buffer[position] != rune('R') { + goto l103 + } + position++ + } + l110: + { + position112, tokenIndex112, depth112 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l113 + } + position++ + goto l112 + l113: + position, tokenIndex, depth = position112, tokenIndex112, depth112 + if buffer[position] != rune('E') { + goto l103 + } + position++ + } + l112: + if !_rules[ruleKEY]() { + goto l103 + } + if !(p.errorHere(position, `encountered "where" after property clause; "where" blocks must go BEFORE 'from' and 'to' specifiers`)) { + goto l103 + } + goto l23 + l103: + position, tokenIndex, depth = position23, tokenIndex23, depth23 + if !_rules[rule_]() { + goto l22 + } + { + position114, tokenIndex114, depth114 := position, tokenIndex, depth + { + position115, tokenIndex115, depth115 := position, tokenIndex, depth + if !matchDot() { + goto l115 + } + goto l114 + l115: + position, tokenIndex, depth = position115, tokenIndex115, depth115 + } + goto l22 + l114: + position, tokenIndex, depth = position114, tokenIndex114, depth114 + } + if !(p.errorHere(position, `expected key (one of 'from', 'to', 'resolution', or 'sample by') or end of input but got %q following a completed expression`, p.after(position))) { + goto l22 + } + } + l23: + goto l21 + l22: + position, tokenIndex, depth = position22, tokenIndex22, depth22 + } + { + add(ruleAction11, position) + } + depth-- + add(rulepropertyClause, position19) + } + { + add(ruleAction0, position) + } + depth-- + add(ruleselectStmt, position4) + } + goto l2 + l3: + position, tokenIndex, depth = position2, tokenIndex2, depth2 + { + position118 := position + depth++ + if !_rules[rule_]() { + goto l0 + } { - position46, tokenIndex46, depth46 := position, tokenIndex, depth + position119, tokenIndex119, depth119 := position, tokenIndex, depth if buffer[position] != rune('d') { - goto l47 + goto l120 } position++ - goto l46 - l47: - position, tokenIndex, depth = position46, tokenIndex46, depth46 + goto l119 + l120: + position, tokenIndex, depth = position119, tokenIndex119, depth119 if buffer[position] != rune('D') { goto l0 } position++ } - l46: + l119: { - position48, tokenIndex48, depth48 := position, tokenIndex, depth + position121, tokenIndex121, depth121 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l49 + goto l122 } position++ - goto l48 - l49: - position, tokenIndex, depth = position48, tokenIndex48, depth48 + goto l121 + l122: + position, tokenIndex, depth = position121, tokenIndex121, depth121 if buffer[position] != rune('E') { goto l0 } position++ } - l48: + l121: { - position50, tokenIndex50, depth50 := position, tokenIndex, depth + position123, tokenIndex123, depth123 := position, tokenIndex, depth if buffer[position] != rune('s') { - goto l51 + goto l124 } position++ - goto l50 - l51: - position, tokenIndex, depth = position50, tokenIndex50, depth50 + goto l123 + l124: + position, tokenIndex, depth = position123, tokenIndex123, depth123 if buffer[position] != rune('S') { goto l0 } position++ } - l50: + l123: { - position52, tokenIndex52, depth52 := position, tokenIndex, depth + position125, tokenIndex125, depth125 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l53 + goto l126 } position++ - goto l52 - l53: - position, tokenIndex, depth = position52, tokenIndex52, depth52 + goto l125 + l126: + position, tokenIndex, depth = position125, tokenIndex125, depth125 if buffer[position] != rune('C') { goto l0 } position++ } - l52: + l125: { - position54, tokenIndex54, depth54 := position, tokenIndex, depth + position127, tokenIndex127, depth127 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l55 + goto l128 } position++ - goto l54 - l55: - position, tokenIndex, depth = position54, tokenIndex54, depth54 + goto l127 + l128: + position, tokenIndex, depth = position127, tokenIndex127, depth127 if buffer[position] != rune('R') { goto l0 } position++ } - l54: + l127: { - position56, tokenIndex56, depth56 := position, tokenIndex, depth + position129, tokenIndex129, depth129 := position, tokenIndex, depth if buffer[position] != rune('i') { - goto l57 + goto l130 } position++ - goto l56 - l57: - position, tokenIndex, depth = position56, tokenIndex56, depth56 + goto l129 + l130: + position, tokenIndex, depth = position129, tokenIndex129, depth129 if buffer[position] != rune('I') { goto l0 } position++ } - l56: + l129: { - position58, tokenIndex58, depth58 := position, tokenIndex, depth + position131, tokenIndex131, depth131 := position, tokenIndex, depth if buffer[position] != rune('b') { - goto l59 + goto l132 } position++ - goto l58 - l59: - position, tokenIndex, depth = position58, tokenIndex58, depth58 + goto l131 + l132: + position, tokenIndex, depth = position131, tokenIndex131, depth131 if buffer[position] != rune('B') { goto l0 } position++ } - l58: + l131: { - position60, tokenIndex60, depth60 := position, tokenIndex, depth + position133, tokenIndex133, depth133 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l61 + goto l134 } position++ - goto l60 - l61: - position, tokenIndex, depth = position60, tokenIndex60, depth60 + goto l133 + l134: + position, tokenIndex, depth = position133, tokenIndex133, depth133 if buffer[position] != rune('E') { goto l0 } position++ } - l60: + l133: if !_rules[ruleKEY]() { goto l0 } { - position62, tokenIndex62, depth62 := position, tokenIndex, depth + position135, tokenIndex135, depth135 := position, tokenIndex, depth { - position64 := position + position137 := position depth++ if !_rules[rule_]() { - goto l63 + goto l136 } { - position65, tokenIndex65, depth65 := position, tokenIndex, depth + position138, tokenIndex138, depth138 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l66 + goto l139 } position++ - goto l65 - l66: - position, tokenIndex, depth = position65, tokenIndex65, depth65 + goto l138 + l139: + position, tokenIndex, depth = position138, tokenIndex138, depth138 if buffer[position] != rune('A') { - goto l63 + goto l136 } position++ } - l65: + l138: { - position67, tokenIndex67, depth67 := position, tokenIndex, depth + position140, tokenIndex140, depth140 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l68 + goto l141 } position++ - goto l67 - l68: - position, tokenIndex, depth = position67, tokenIndex67, depth67 + goto l140 + l141: + position, tokenIndex, depth = position140, tokenIndex140, depth140 if buffer[position] != rune('L') { - goto l63 + goto l136 } position++ } - l67: + l140: { - position69, tokenIndex69, depth69 := position, tokenIndex, depth + position142, tokenIndex142, depth142 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l70 + goto l143 } position++ - goto l69 - l70: - position, tokenIndex, depth = position69, tokenIndex69, depth69 + goto l142 + l143: + position, tokenIndex, depth = position142, tokenIndex142, depth142 if buffer[position] != rune('L') { - goto l63 + goto l136 } position++ } - l69: + l142: if !_rules[ruleKEY]() { - goto l63 + goto l136 } { - position71 := position + position144 := position depth++ { - position72, tokenIndex72, depth72 := position, tokenIndex, depth + position145, tokenIndex145, depth145 := position, tokenIndex, depth { - position74 := position + position147 := position depth++ if !_rules[rule_]() { - goto l73 + goto l146 } { - position75, tokenIndex75, depth75 := position, tokenIndex, depth + position148, tokenIndex148, depth148 := position, tokenIndex, depth if buffer[position] != rune('m') { - goto l76 + goto l149 } position++ - goto l75 - l76: - position, tokenIndex, depth = position75, tokenIndex75, depth75 + goto l148 + l149: + position, tokenIndex, depth = position148, tokenIndex148, depth148 if buffer[position] != rune('M') { - goto l73 + goto l146 } position++ } - l75: + l148: { - position77, tokenIndex77, depth77 := position, tokenIndex, depth + position150, tokenIndex150, depth150 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l78 + goto l151 } position++ - goto l77 - l78: - position, tokenIndex, depth = position77, tokenIndex77, depth77 + goto l150 + l151: + position, tokenIndex, depth = position150, tokenIndex150, depth150 if buffer[position] != rune('A') { - goto l73 + goto l146 } position++ } - l77: + l150: { - position79, tokenIndex79, depth79 := position, tokenIndex, depth + position152, tokenIndex152, depth152 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l80 + goto l153 } position++ - goto l79 - l80: - position, tokenIndex, depth = position79, tokenIndex79, depth79 + goto l152 + l153: + position, tokenIndex, depth = position152, tokenIndex152, depth152 if buffer[position] != rune('T') { - goto l73 + goto l146 } position++ } - l79: + l152: { - position81, tokenIndex81, depth81 := position, tokenIndex, depth + position154, tokenIndex154, depth154 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l82 + goto l155 } position++ - goto l81 - l82: - position, tokenIndex, depth = position81, tokenIndex81, depth81 + goto l154 + l155: + position, tokenIndex, depth = position154, tokenIndex154, depth154 if buffer[position] != rune('C') { - goto l73 + goto l146 } position++ } - l81: + l154: { - position83, tokenIndex83, depth83 := position, tokenIndex, depth + position156, tokenIndex156, depth156 := position, tokenIndex, depth if buffer[position] != rune('h') { - goto l84 + goto l157 } position++ - goto l83 - l84: - position, tokenIndex, depth = position83, tokenIndex83, depth83 + goto l156 + l157: + position, tokenIndex, depth = position156, tokenIndex156, depth156 if buffer[position] != rune('H') { - goto l73 + goto l146 } position++ } - l83: + l156: if !_rules[ruleKEY]() { - goto l73 + goto l146 } - if !_rules[ruleliteralString]() { - goto l73 + { + position158, tokenIndex158, depth158 := position, tokenIndex, depth + if !_rules[ruleliteralString]() { + goto l159 + } + goto l158 + l159: + position, tokenIndex, depth = position158, tokenIndex158, depth158 + if !(p.errorHere(position, `expected string literal to follow keyword "match"`)) { + goto l146 + } } + l158: { add(ruleAction3, position) } depth-- - add(rulematchClause, position74) + add(rulematchClause, position147) } - goto l72 - l73: - position, tokenIndex, depth = position72, tokenIndex72, depth72 + goto l145 + l146: + position, tokenIndex, depth = position145, tokenIndex145, depth145 { add(ruleAction2, position) } } - l72: + l145: depth-- - add(ruleoptionalMatchClause, position71) + add(ruleoptionalMatchClause, position144) } { add(ruleAction1, position) } + { + position163, tokenIndex163, depth163 := position, tokenIndex, depth + { + position164, tokenIndex164, depth164 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l165 + } + { + position166, tokenIndex166, depth166 := position, tokenIndex, depth + if !matchDot() { + goto l166 + } + goto l165 + l166: + position, tokenIndex, depth = position166, tokenIndex166, depth166 + } + goto l164 + l165: + position, tokenIndex, depth = position164, tokenIndex164, depth164 + if !_rules[rule_]() { + goto l136 + } + if !(p.errorHere(position, `expected end of input after 'describe all' and optional match clause but got %q`, p.after(position))) { + goto l136 + } + } + l164: + position, tokenIndex, depth = position163, tokenIndex163, depth163 + } depth-- - add(ruledescribeAllStmt, position64) + add(ruledescribeAllStmt, position137) } - goto l62 - l63: - position, tokenIndex, depth = position62, tokenIndex62, depth62 + goto l135 + l136: + position, tokenIndex, depth = position135, tokenIndex135, depth135 { - position89 := position + position168 := position depth++ if !_rules[rule_]() { - goto l88 + goto l167 } { - position90, tokenIndex90, depth90 := position, tokenIndex, depth + position169, tokenIndex169, depth169 := position, tokenIndex, depth if buffer[position] != rune('m') { - goto l91 + goto l170 } position++ - goto l90 - l91: - position, tokenIndex, depth = position90, tokenIndex90, depth90 + goto l169 + l170: + position, tokenIndex, depth = position169, tokenIndex169, depth169 if buffer[position] != rune('M') { - goto l88 + goto l167 } position++ } - l90: + l169: { - position92, tokenIndex92, depth92 := position, tokenIndex, depth + position171, tokenIndex171, depth171 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l93 + goto l172 } position++ - goto l92 - l93: - position, tokenIndex, depth = position92, tokenIndex92, depth92 + goto l171 + l172: + position, tokenIndex, depth = position171, tokenIndex171, depth171 if buffer[position] != rune('E') { - goto l88 + goto l167 } position++ } - l92: + l171: { - position94, tokenIndex94, depth94 := position, tokenIndex, depth + position173, tokenIndex173, depth173 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l95 + goto l174 } position++ - goto l94 - l95: - position, tokenIndex, depth = position94, tokenIndex94, depth94 + goto l173 + l174: + position, tokenIndex, depth = position173, tokenIndex173, depth173 if buffer[position] != rune('T') { - goto l88 + goto l167 } position++ } - l94: + l173: { - position96, tokenIndex96, depth96 := position, tokenIndex, depth + position175, tokenIndex175, depth175 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l97 + goto l176 } position++ - goto l96 - l97: - position, tokenIndex, depth = position96, tokenIndex96, depth96 + goto l175 + l176: + position, tokenIndex, depth = position175, tokenIndex175, depth175 if buffer[position] != rune('R') { - goto l88 + goto l167 } position++ } - l96: + l175: { - position98, tokenIndex98, depth98 := position, tokenIndex, depth + position177, tokenIndex177, depth177 := position, tokenIndex, depth if buffer[position] != rune('i') { - goto l99 + goto l178 } position++ - goto l98 - l99: - position, tokenIndex, depth = position98, tokenIndex98, depth98 + goto l177 + l178: + position, tokenIndex, depth = position177, tokenIndex177, depth177 if buffer[position] != rune('I') { - goto l88 + goto l167 } position++ } - l98: + l177: { - position100, tokenIndex100, depth100 := position, tokenIndex, depth + position179, tokenIndex179, depth179 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l101 + goto l180 } position++ - goto l100 - l101: - position, tokenIndex, depth = position100, tokenIndex100, depth100 + goto l179 + l180: + position, tokenIndex, depth = position179, tokenIndex179, depth179 if buffer[position] != rune('C') { - goto l88 + goto l167 } position++ } - l100: + l179: { - position102, tokenIndex102, depth102 := position, tokenIndex, depth + position181, tokenIndex181, depth181 := position, tokenIndex, depth if buffer[position] != rune('s') { - goto l103 + goto l182 } position++ - goto l102 - l103: - position, tokenIndex, depth = position102, tokenIndex102, depth102 + goto l181 + l182: + position, tokenIndex, depth = position181, tokenIndex181, depth181 if buffer[position] != rune('S') { - goto l88 + goto l167 } position++ } - l102: + l181: if !_rules[ruleKEY]() { - goto l88 - } - if !_rules[rule_]() { - goto l88 + goto l167 } { - position104, tokenIndex104, depth104 := position, tokenIndex, depth - if buffer[position] != rune('w') { - goto l105 + position183, tokenIndex183, depth183 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l184 } - position++ - goto l104 - l105: - position, tokenIndex, depth = position104, tokenIndex104, depth104 - if buffer[position] != rune('W') { - goto l88 + { + position185, tokenIndex185, depth185 := position, tokenIndex, depth + if buffer[position] != rune('w') { + goto l186 + } + position++ + goto l185 + l186: + position, tokenIndex, depth = position185, tokenIndex185, depth185 + if buffer[position] != rune('W') { + goto l184 + } + position++ } - position++ - } - l104: - { - position106, tokenIndex106, depth106 := position, tokenIndex, depth - if buffer[position] != rune('h') { - goto l107 + l185: + { + position187, tokenIndex187, depth187 := position, tokenIndex, depth + if buffer[position] != rune('h') { + goto l188 + } + position++ + goto l187 + l188: + position, tokenIndex, depth = position187, tokenIndex187, depth187 + if buffer[position] != rune('H') { + goto l184 + } + position++ } - position++ - goto l106 - l107: - position, tokenIndex, depth = position106, tokenIndex106, depth106 - if buffer[position] != rune('H') { - goto l88 + l187: + { + position189, tokenIndex189, depth189 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l190 + } + position++ + goto l189 + l190: + position, tokenIndex, depth = position189, tokenIndex189, depth189 + if buffer[position] != rune('E') { + goto l184 + } + position++ + } + l189: + { + position191, tokenIndex191, depth191 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l192 + } + position++ + goto l191 + l192: + position, tokenIndex, depth = position191, tokenIndex191, depth191 + if buffer[position] != rune('R') { + goto l184 + } + position++ + } + l191: + { + position193, tokenIndex193, depth193 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l194 + } + position++ + goto l193 + l194: + position, tokenIndex, depth = position193, tokenIndex193, depth193 + if buffer[position] != rune('E') { + goto l184 + } + position++ + } + l193: + if !_rules[ruleKEY]() { + goto l184 + } + goto l183 + l184: + position, tokenIndex, depth = position183, tokenIndex183, depth183 + if !(p.errorHere(position, `expected "where" to follow keyword "metrics" in "describe metrics" command`)) { + goto l167 } - position++ } - l106: + l183: { - position108, tokenIndex108, depth108 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l109 + position195, tokenIndex195, depth195 := position, tokenIndex, depth + if !_rules[ruletagName]() { + goto l196 } - position++ - goto l108 - l109: - position, tokenIndex, depth = position108, tokenIndex108, depth108 - if buffer[position] != rune('E') { - goto l88 + goto l195 + l196: + position, tokenIndex, depth = position195, tokenIndex195, depth195 + if !(p.errorHere(position, `expected tag key to follow keyword "where" in "describe metrics" command`)) { + goto l167 } - position++ } - l108: + l195: { - position110, tokenIndex110, depth110 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l111 + position197, tokenIndex197, depth197 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l198 } - position++ - goto l110 - l111: - position, tokenIndex, depth = position110, tokenIndex110, depth110 - if buffer[position] != rune('R') { - goto l88 + if buffer[position] != rune('=') { + goto l198 } position++ + goto l197 + l198: + position, tokenIndex, depth = position197, tokenIndex197, depth197 + if !(p.errorHere(position, `expected "=" to follow keyword "where" in "describe metrics" command`)) { + goto l167 + } } - l110: + l197: { - position112, tokenIndex112, depth112 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l113 + position199, tokenIndex199, depth199 := position, tokenIndex, depth + if !_rules[ruleliteralString]() { + goto l200 } - position++ - goto l112 - l113: - position, tokenIndex, depth = position112, tokenIndex112, depth112 - if buffer[position] != rune('E') { - goto l88 + goto l199 + l200: + position, tokenIndex, depth = position199, tokenIndex199, depth199 + if !(p.errorHere(position, `expected string literal to follow "=" in "describe metrics" command`)) { + goto l167 } - position++ - } - l112: - if !_rules[ruleKEY]() { - goto l88 - } - if !_rules[ruletagName]() { - goto l88 - } - if !_rules[rule_]() { - goto l88 - } - if buffer[position] != rune('=') { - goto l88 - } - position++ - if !_rules[ruleliteralString]() { - goto l88 } + l199: { add(ruleAction4, position) } depth-- - add(ruledescribeMetrics, position89) + add(ruledescribeMetrics, position168) } - goto l62 - l88: - position, tokenIndex, depth = position62, tokenIndex62, depth62 + goto l135 + l167: + position, tokenIndex, depth = position135, tokenIndex135, depth135 { - position115 := position + position202 := position depth++ - if !_rules[rule_]() { - goto l0 - } { - position116 := position - depth++ + position203, tokenIndex203, depth203 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l204 + } { - position117 := position + position205 := position depth++ - if !_rules[ruleIDENTIFIER]() { - goto l0 + { + position206 := position + depth++ + if !_rules[ruleIDENTIFIER]() { + goto l204 + } + depth-- + add(ruleMETRIC_NAME, position206) } depth-- - add(ruleMETRIC_NAME, position117) + add(rulePegText, position205) + } + { + add(ruleAction5, position) + } + goto l203 + l204: + position, tokenIndex, depth = position203, tokenIndex203, depth203 + if !(p.errorHere(position, `expected metric name to follow "describe" in "describe" command`)) { + goto l0 } - depth-- - add(rulePegText, position116) - } - { - add(ruleAction5, position) } + l203: if !_rules[ruleoptionalPredicateClause]() { goto l0 } @@ -1730,12 +2369,12 @@ func (p *Parser) Init() { add(ruleAction6, position) } depth-- - add(ruledescribeSingleStmt, position115) + add(ruledescribeSingleStmt, position202) } } - l62: + l135: depth-- - add(ruledescribeStmt, position45) + add(ruledescribeStmt, position118) } } l2: @@ -1743,13 +2382,13 @@ func (p *Parser) Init() { goto l0 } { - position120, tokenIndex120, depth120 := position, tokenIndex, depth + position209, tokenIndex209, depth209 := position, tokenIndex, depth if !matchDot() { - goto l120 + goto l209 } goto l0 - l120: - position, tokenIndex, depth = position120, tokenIndex120, depth120 + l209: + position, tokenIndex, depth = position209, tokenIndex209, depth209 } depth-- add(ruleroot, position1) @@ -1759,3285 +2398,3526 @@ func (p *Parser) Init() { position, tokenIndex, depth = position0, tokenIndex0, depth0 return false }, - /* 1 selectStmt <- <(_ (('s' / 'S') ('e' / 'E') ('l' / 'L') ('e' / 'E') ('c' / 'C') ('t' / 'T') KEY)? expressionList optionalPredicateClause propertyClause Action0)> */ + /* 1 selectStmt <- <(_ (('s' / 'S') ('e' / 'E') ('l' / 'L') ('e' / 'E') ('c' / 'C') ('t' / 'T') KEY)? expressionList &{ p.setContext("after expression of select statement") } optionalPredicateClause &{ p.setContext("") } propertyClause Action0)> */ nil, /* 2 describeStmt <- <(_ (('d' / 'D') ('e' / 'E') ('s' / 'S') ('c' / 'C') ('r' / 'R') ('i' / 'I') ('b' / 'B') ('e' / 'E')) KEY (describeAllStmt / describeMetrics / describeSingleStmt))> */ nil, - /* 3 describeAllStmt <- <(_ (('a' / 'A') ('l' / 'L') ('l' / 'L')) KEY optionalMatchClause Action1)> */ + /* 3 describeAllStmt <- <(_ (('a' / 'A') ('l' / 'L') ('l' / 'L')) KEY optionalMatchClause Action1 &((_ !.) / (_ &{p.errorHere(position, `expected end of input after 'describe all' and optional match clause but got %q`, p.after(position) )})))> */ nil, /* 4 optionalMatchClause <- <(matchClause / Action2)> */ nil, - /* 5 matchClause <- <(_ (('m' / 'M') ('a' / 'A') ('t' / 'T') ('c' / 'C') ('h' / 'H')) KEY literalString Action3)> */ + /* 5 matchClause <- <(_ (('m' / 'M') ('a' / 'A') ('t' / 'T') ('c' / 'C') ('h' / 'H')) KEY (literalString / &{ p.errorHere(position, `expected string literal to follow keyword "match"`) }) Action3)> */ nil, - /* 6 describeMetrics <- <(_ (('m' / 'M') ('e' / 'E') ('t' / 'T') ('r' / 'R') ('i' / 'I') ('c' / 'C') ('s' / 'S')) KEY _ (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E')) KEY tagName _ '=' literalString Action4)> */ + /* 6 describeMetrics <- <(_ (('m' / 'M') ('e' / 'E') ('t' / 'T') ('r' / 'R') ('i' / 'I') ('c' / 'C') ('s' / 'S')) KEY ((_ (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E')) KEY) / &{ p.errorHere(position, `expected "where" to follow keyword "metrics" in "describe metrics" command`) }) (tagName / &{ p.errorHere(position, `expected tag key to follow keyword "where" in "describe metrics" command`) }) ((_ '=') / &{ p.errorHere(position, `expected "=" to follow keyword "where" in "describe metrics" command`) }) (literalString / &{ p.errorHere(position, `expected string literal to follow "=" in "describe metrics" command`) }) Action4)> */ nil, - /* 7 describeSingleStmt <- <(_ Action5 optionalPredicateClause Action6)> */ + /* 7 describeSingleStmt <- <(((_ Action5) / &{ p.errorHere(position, `expected metric name to follow "describe" in "describe" command`) }) optionalPredicateClause Action6)> */ nil, - /* 8 propertyClause <- <(Action7 (_ PROPERTY_KEY Action8 _ PROPERTY_VALUE Action9 Action10)* Action11)> */ + /* 8 propertyClause <- <(Action7 ((_ PROPERTY_KEY Action8 ((_ PROPERTY_VALUE Action9) / &{ p.errorHere(position, `expected value to follow key '%s'`, p.contents(tree, tokenIndex-2)) }) Action10) / (_ (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E')) KEY &{ p.errorHere(position, `encountered "where" after property clause; "where" blocks must go BEFORE 'from' and 'to' specifiers`) }) / (_ !!. &{ p.errorHere(position, `expected key (one of 'from', 'to', 'resolution', or 'sample by') or end of input but got %q following a completed expression`, p.after(position)) }))* Action11)> */ nil, /* 9 optionalPredicateClause <- <(predicateClause / Action12)> */ func() bool { { - position130 := position + position219 := position depth++ { - position131, tokenIndex131, depth131 := position, tokenIndex, depth + position220, tokenIndex220, depth220 := position, tokenIndex, depth { - position133 := position + position222 := position depth++ if !_rules[rule_]() { - goto l132 + goto l221 } { - position134, tokenIndex134, depth134 := position, tokenIndex, depth + position223, tokenIndex223, depth223 := position, tokenIndex, depth if buffer[position] != rune('w') { - goto l135 + goto l224 } position++ - goto l134 - l135: - position, tokenIndex, depth = position134, tokenIndex134, depth134 + goto l223 + l224: + position, tokenIndex, depth = position223, tokenIndex223, depth223 if buffer[position] != rune('W') { - goto l132 + goto l221 } position++ } - l134: + l223: { - position136, tokenIndex136, depth136 := position, tokenIndex, depth + position225, tokenIndex225, depth225 := position, tokenIndex, depth if buffer[position] != rune('h') { - goto l137 + goto l226 } position++ - goto l136 - l137: - position, tokenIndex, depth = position136, tokenIndex136, depth136 + goto l225 + l226: + position, tokenIndex, depth = position225, tokenIndex225, depth225 if buffer[position] != rune('H') { - goto l132 + goto l221 } position++ } - l136: + l225: { - position138, tokenIndex138, depth138 := position, tokenIndex, depth + position227, tokenIndex227, depth227 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l139 + goto l228 } position++ - goto l138 - l139: - position, tokenIndex, depth = position138, tokenIndex138, depth138 + goto l227 + l228: + position, tokenIndex, depth = position227, tokenIndex227, depth227 if buffer[position] != rune('E') { - goto l132 + goto l221 } position++ } - l138: + l227: { - position140, tokenIndex140, depth140 := position, tokenIndex, depth + position229, tokenIndex229, depth229 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l141 + goto l230 } position++ - goto l140 - l141: - position, tokenIndex, depth = position140, tokenIndex140, depth140 + goto l229 + l230: + position, tokenIndex, depth = position229, tokenIndex229, depth229 if buffer[position] != rune('R') { - goto l132 + goto l221 } position++ } - l140: + l229: { - position142, tokenIndex142, depth142 := position, tokenIndex, depth + position231, tokenIndex231, depth231 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l143 + goto l232 } position++ - goto l142 - l143: - position, tokenIndex, depth = position142, tokenIndex142, depth142 + goto l231 + l232: + position, tokenIndex, depth = position231, tokenIndex231, depth231 if buffer[position] != rune('E') { - goto l132 + goto l221 } position++ } - l142: + l231: if !_rules[ruleKEY]() { - goto l132 - } - if !_rules[rule_]() { - goto l132 + goto l221 } - if !_rules[rulepredicate_1]() { - goto l132 + { + position233, tokenIndex233, depth233 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l234 + } + if !_rules[rulepredicate_1]() { + goto l234 + } + goto l233 + l234: + position, tokenIndex, depth = position233, tokenIndex233, depth233 + if !(p.errorHere(position, `expected predicate to follow "where" keyword`)) { + goto l221 + } } + l233: depth-- - add(rulepredicateClause, position133) + add(rulepredicateClause, position222) } - goto l131 - l132: - position, tokenIndex, depth = position131, tokenIndex131, depth131 + goto l220 + l221: + position, tokenIndex, depth = position220, tokenIndex220, depth220 { add(ruleAction12, position) } } - l131: + l220: depth-- - add(ruleoptionalPredicateClause, position130) + add(ruleoptionalPredicateClause, position219) } return true }, - /* 10 expressionList <- <(Action13 expression_start Action14 (_ COMMA expression_start Action15)*)> */ + /* 10 expressionList <- <(Action13 expression_start Action14 (_ COMMA (expression_start / &{ p.errorHere(position, `expected expression to follow ","`) }) Action15)*)> */ func() bool { - position145, tokenIndex145, depth145 := position, tokenIndex, depth + position236, tokenIndex236, depth236 := position, tokenIndex, depth { - position146 := position + position237 := position depth++ { add(ruleAction13, position) } if !_rules[ruleexpression_start]() { - goto l145 + goto l236 } { add(ruleAction14, position) } - l149: + l240: { - position150, tokenIndex150, depth150 := position, tokenIndex, depth + position241, tokenIndex241, depth241 := position, tokenIndex, depth if !_rules[rule_]() { - goto l150 + goto l241 } if !_rules[ruleCOMMA]() { - goto l150 + goto l241 } - if !_rules[ruleexpression_start]() { - goto l150 + { + position242, tokenIndex242, depth242 := position, tokenIndex, depth + if !_rules[ruleexpression_start]() { + goto l243 + } + goto l242 + l243: + position, tokenIndex, depth = position242, tokenIndex242, depth242 + if !(p.errorHere(position, `expected expression to follow ","`)) { + goto l241 + } } + l242: { add(ruleAction15, position) } - goto l149 - l150: - position, tokenIndex, depth = position150, tokenIndex150, depth150 + goto l240 + l241: + position, tokenIndex, depth = position241, tokenIndex241, depth241 } depth-- - add(ruleexpressionList, position146) + add(ruleexpressionList, position237) } return true - l145: - position, tokenIndex, depth = position145, tokenIndex145, depth145 + l236: + position, tokenIndex, depth = position236, tokenIndex236, depth236 return false }, /* 11 expression_start <- <(expression_sum add_pipe)> */ func() bool { - position152, tokenIndex152, depth152 := position, tokenIndex, depth + position245, tokenIndex245, depth245 := position, tokenIndex, depth { - position153 := position + position246 := position depth++ { - position154 := position + position247 := position depth++ if !_rules[ruleexpression_product]() { - goto l152 + goto l245 } - l155: + l248: { - position156, tokenIndex156, depth156 := position, tokenIndex, depth + position249, tokenIndex249, depth249 := position, tokenIndex, depth if !_rules[ruleadd_pipe]() { - goto l156 + goto l249 } { - position157, tokenIndex157, depth157 := position, tokenIndex, depth + position250, tokenIndex250, depth250 := position, tokenIndex, depth if !_rules[rule_]() { - goto l158 + goto l251 } { - position159 := position + position252 := position depth++ if buffer[position] != rune('+') { - goto l158 + goto l251 } position++ depth-- - add(ruleOP_ADD, position159) + add(ruleOP_ADD, position252) } { add(ruleAction16, position) } - goto l157 - l158: - position, tokenIndex, depth = position157, tokenIndex157, depth157 + goto l250 + l251: + position, tokenIndex, depth = position250, tokenIndex250, depth250 if !_rules[rule_]() { - goto l156 + goto l249 } { - position161 := position + position254 := position depth++ if buffer[position] != rune('-') { - goto l156 + goto l249 } position++ depth-- - add(ruleOP_SUB, position161) + add(ruleOP_SUB, position254) } { add(ruleAction17, position) } } - l157: - if !_rules[ruleexpression_product]() { - goto l156 + l250: + { + position256, tokenIndex256, depth256 := position, tokenIndex, depth + if !_rules[ruleexpression_product]() { + goto l257 + } + goto l256 + l257: + position, tokenIndex, depth = position256, tokenIndex256, depth256 + if !(p.errorHere(position, `expected expression to follow operator "+" or "-"`)) { + goto l249 + } } + l256: { add(ruleAction18, position) } - goto l155 - l156: - position, tokenIndex, depth = position156, tokenIndex156, depth156 + goto l248 + l249: + position, tokenIndex, depth = position249, tokenIndex249, depth249 } depth-- - add(ruleexpression_sum, position154) + add(ruleexpression_sum, position247) } if !_rules[ruleadd_pipe]() { - goto l152 + goto l245 } depth-- - add(ruleexpression_start, position153) + add(ruleexpression_start, position246) } return true - l152: - position, tokenIndex, depth = position152, tokenIndex152, depth152 + l245: + position, tokenIndex, depth = position245, tokenIndex245, depth245 return false }, - /* 12 expression_sum <- <(expression_product (add_pipe ((_ OP_ADD Action16) / (_ OP_SUB Action17)) expression_product Action18)*)> */ + /* 12 expression_sum <- <(expression_product (add_pipe ((_ OP_ADD Action16) / (_ OP_SUB Action17)) (expression_product / &{ p.errorHere(position, `expected expression to follow operator "+" or "-"`) }) Action18)*)> */ nil, - /* 13 expression_product <- <(expression_atom (add_pipe ((_ OP_DIV Action19) / (_ OP_MULT Action20)) expression_atom Action21)*)> */ + /* 13 expression_product <- <(expression_atom (add_pipe ((_ OP_DIV Action19) / (_ OP_MULT Action20)) (expression_atom / &{ p.errorHere(position, `expected expression to follow operator "*" or "/"`) }) Action21)*)> */ func() bool { - position165, tokenIndex165, depth165 := position, tokenIndex, depth + position260, tokenIndex260, depth260 := position, tokenIndex, depth { - position166 := position + position261 := position depth++ if !_rules[ruleexpression_atom]() { - goto l165 + goto l260 } - l167: + l262: { - position168, tokenIndex168, depth168 := position, tokenIndex, depth + position263, tokenIndex263, depth263 := position, tokenIndex, depth if !_rules[ruleadd_pipe]() { - goto l168 + goto l263 } { - position169, tokenIndex169, depth169 := position, tokenIndex, depth + position264, tokenIndex264, depth264 := position, tokenIndex, depth if !_rules[rule_]() { - goto l170 + goto l265 } { - position171 := position + position266 := position depth++ if buffer[position] != rune('/') { - goto l170 + goto l265 } position++ depth-- - add(ruleOP_DIV, position171) + add(ruleOP_DIV, position266) } { add(ruleAction19, position) } - goto l169 - l170: - position, tokenIndex, depth = position169, tokenIndex169, depth169 + goto l264 + l265: + position, tokenIndex, depth = position264, tokenIndex264, depth264 if !_rules[rule_]() { - goto l168 + goto l263 } { - position173 := position + position268 := position depth++ if buffer[position] != rune('*') { - goto l168 + goto l263 } position++ depth-- - add(ruleOP_MULT, position173) + add(ruleOP_MULT, position268) } { add(ruleAction20, position) } } - l169: - if !_rules[ruleexpression_atom]() { - goto l168 + l264: + { + position270, tokenIndex270, depth270 := position, tokenIndex, depth + if !_rules[ruleexpression_atom]() { + goto l271 + } + goto l270 + l271: + position, tokenIndex, depth = position270, tokenIndex270, depth270 + if !(p.errorHere(position, `expected expression to follow operator "*" or "/"`)) { + goto l263 + } } + l270: { add(ruleAction21, position) } - goto l167 - l168: - position, tokenIndex, depth = position168, tokenIndex168, depth168 + goto l262 + l263: + position, tokenIndex, depth = position263, tokenIndex263, depth263 } depth-- - add(ruleexpression_product, position166) + add(ruleexpression_product, position261) } return true - l165: - position, tokenIndex, depth = position165, tokenIndex165, depth165 + l260: + position, tokenIndex, depth = position260, tokenIndex260, depth260 return false }, - /* 14 add_one_pipe <- <(_ OP_PIPE _ Action22 ((_ PAREN_OPEN (expressionList / Action23) optionalGroupBy _ PAREN_CLOSE) / Action24) Action25 expression_annotation)> */ + /* 14 add_one_pipe <- <(_ OP_PIPE ((_ ) / &{ p.errorHere(position, `expected function name to follow pipe "|"`) }) Action22 ((_ PAREN_OPEN (expressionList / Action23) optionalGroupBy ((_ PAREN_CLOSE) / &{ p.errorHere(position, `expected ")" to close "(" opened in pipe function call`) })) / Action24) Action25 expression_annotation)> */ nil, /* 15 add_pipe <- */ func() bool { { - position178 := position + position275 := position depth++ - l179: + l276: { - position180, tokenIndex180, depth180 := position, tokenIndex, depth + position277, tokenIndex277, depth277 := position, tokenIndex, depth { - position181 := position + position278 := position depth++ if !_rules[rule_]() { - goto l180 + goto l277 } { - position182 := position + position279 := position depth++ if buffer[position] != rune('|') { - goto l180 + goto l277 } position++ depth-- - add(ruleOP_PIPE, position182) - } - if !_rules[rule_]() { - goto l180 + add(ruleOP_PIPE, position279) } { - position183 := position - depth++ - if !_rules[ruleIDENTIFIER]() { - goto l180 + position280, tokenIndex280, depth280 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l281 + } + { + position282 := position + depth++ + if !_rules[ruleIDENTIFIER]() { + goto l281 + } + depth-- + add(rulePegText, position282) + } + goto l280 + l281: + position, tokenIndex, depth = position280, tokenIndex280, depth280 + if !(p.errorHere(position, `expected function name to follow pipe "|"`)) { + goto l277 } - depth-- - add(rulePegText, position183) } + l280: { add(ruleAction22, position) } { - position185, tokenIndex185, depth185 := position, tokenIndex, depth + position284, tokenIndex284, depth284 := position, tokenIndex, depth if !_rules[rule_]() { - goto l186 + goto l285 } if !_rules[rulePAREN_OPEN]() { - goto l186 + goto l285 } { - position187, tokenIndex187, depth187 := position, tokenIndex, depth + position286, tokenIndex286, depth286 := position, tokenIndex, depth if !_rules[ruleexpressionList]() { - goto l188 + goto l287 } - goto l187 - l188: - position, tokenIndex, depth = position187, tokenIndex187, depth187 + goto l286 + l287: + position, tokenIndex, depth = position286, tokenIndex286, depth286 { add(ruleAction23, position) } } - l187: + l286: if !_rules[ruleoptionalGroupBy]() { - goto l186 - } - if !_rules[rule_]() { - goto l186 - } - if !_rules[rulePAREN_CLOSE]() { - goto l186 + goto l285 } - goto l185 - l186: - position, tokenIndex, depth = position185, tokenIndex185, depth185 { - add(ruleAction24, position) - } - } - l185: + position289, tokenIndex289, depth289 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l290 + } + if !_rules[rulePAREN_CLOSE]() { + goto l290 + } + goto l289 + l290: + position, tokenIndex, depth = position289, tokenIndex289, depth289 + if !(p.errorHere(position, `expected ")" to close "(" opened in pipe function call`)) { + goto l285 + } + } + l289: + goto l284 + l285: + position, tokenIndex, depth = position284, tokenIndex284, depth284 + { + add(ruleAction24, position) + } + } + l284: { add(ruleAction25, position) } if !_rules[ruleexpression_annotation]() { - goto l180 + goto l277 } depth-- - add(ruleadd_one_pipe, position181) + add(ruleadd_one_pipe, position278) } - goto l179 - l180: - position, tokenIndex, depth = position180, tokenIndex180, depth180 + goto l276 + l277: + position, tokenIndex, depth = position277, tokenIndex277, depth277 } depth-- - add(ruleadd_pipe, position178) + add(ruleadd_pipe, position275) } return true }, /* 16 expression_atom <- <(expression_atom_raw expression_annotation)> */ func() bool { - position192, tokenIndex192, depth192 := position, tokenIndex, depth + position293, tokenIndex293, depth293 := position, tokenIndex, depth { - position193 := position + position294 := position depth++ { - position194 := position + position295 := position depth++ { - position195, tokenIndex195, depth195 := position, tokenIndex, depth + position296, tokenIndex296, depth296 := position, tokenIndex, depth { - position197 := position + position298 := position depth++ if !_rules[rule_]() { - goto l196 + goto l297 } { - position198 := position + position299 := position depth++ if !_rules[ruleIDENTIFIER]() { - goto l196 + goto l297 } depth-- - add(rulePegText, position198) + add(rulePegText, position299) } { add(ruleAction31, position) } if !_rules[rule_]() { - goto l196 + goto l297 } if !_rules[rulePAREN_OPEN]() { - goto l196 + goto l297 } - if !_rules[ruleexpressionList]() { - goto l196 + { + position301, tokenIndex301, depth301 := position, tokenIndex, depth + if !_rules[ruleexpressionList]() { + goto l302 + } + goto l301 + l302: + position, tokenIndex, depth = position301, tokenIndex301, depth301 + if !(p.errorHere(position, `expected expression list to follow "(" in function call`)) { + goto l297 + } } + l301: if !_rules[ruleoptionalGroupBy]() { - goto l196 - } - if !_rules[rule_]() { - goto l196 + goto l297 } - if !_rules[rulePAREN_CLOSE]() { - goto l196 + { + position303, tokenIndex303, depth303 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l304 + } + if !_rules[rulePAREN_CLOSE]() { + goto l304 + } + goto l303 + l304: + position, tokenIndex, depth = position303, tokenIndex303, depth303 + if !(p.errorHere(position, `expected ")" to close "(" opened by function call`)) { + goto l297 + } } + l303: { add(ruleAction32, position) } depth-- - add(ruleexpression_function, position197) + add(ruleexpression_function, position298) } - goto l195 - l196: - position, tokenIndex, depth = position195, tokenIndex195, depth195 + goto l296 + l297: + position, tokenIndex, depth = position296, tokenIndex296, depth296 { - position202 := position + position307 := position depth++ if !_rules[rule_]() { - goto l201 + goto l306 } { - position203 := position + position308 := position depth++ if !_rules[ruleIDENTIFIER]() { - goto l201 + goto l306 } depth-- - add(rulePegText, position203) + add(rulePegText, position308) } { add(ruleAction33, position) } { - position205, tokenIndex205, depth205 := position, tokenIndex, depth + position310, tokenIndex310, depth310 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l311 + } + if buffer[position] != rune('[') { + goto l311 + } + position++ { - position207, tokenIndex207, depth207 := position, tokenIndex, depth - if !_rules[rule_]() { - goto l208 - } - if buffer[position] != rune('[') { - goto l208 - } - position++ + position312, tokenIndex312, depth312 := position, tokenIndex, depth if !_rules[rulepredicate_1]() { - goto l208 + goto l313 } + goto l312 + l313: + position, tokenIndex, depth = position312, tokenIndex312, depth312 + if !(p.errorHere(position, `expected predicate to follow "[" after metric`)) { + goto l311 + } + } + l312: + { + position314, tokenIndex314, depth314 := position, tokenIndex, depth if !_rules[rule_]() { - goto l208 + goto l315 } if buffer[position] != rune(']') { - goto l208 + goto l315 } position++ - goto l207 - l208: - position, tokenIndex, depth = position207, tokenIndex207, depth207 - { - add(ruleAction34, position) + goto l314 + l315: + position, tokenIndex, depth = position314, tokenIndex314, depth314 + if !(p.errorHere(position, `expected "]" to close "[" opened to apply predicate`)) { + goto l311 } } - l207: - goto l206 - - position, tokenIndex, depth = position205, tokenIndex205, depth205 + l314: + goto l310 + l311: + position, tokenIndex, depth = position310, tokenIndex310, depth310 + { + add(ruleAction34, position) + } } - l206: + l310: { add(ruleAction35, position) } depth-- - add(ruleexpression_metric, position202) + add(ruleexpression_metric, position307) } - goto l195 - l201: - position, tokenIndex, depth = position195, tokenIndex195, depth195 + goto l296 + l306: + position, tokenIndex, depth = position296, tokenIndex296, depth296 if !_rules[rule_]() { - goto l211 + goto l318 } if !_rules[rulePAREN_OPEN]() { - goto l211 - } - if !_rules[ruleexpression_start]() { - goto l211 + goto l318 } - if !_rules[rule_]() { - goto l211 + { + position319, tokenIndex319, depth319 := position, tokenIndex, depth + if !_rules[ruleexpression_start]() { + goto l320 + } + goto l319 + l320: + position, tokenIndex, depth = position319, tokenIndex319, depth319 + if !(p.errorHere(position, `expected expression to follow "("`)) { + goto l318 + } } - if !_rules[rulePAREN_CLOSE]() { - goto l211 + l319: + { + position321, tokenIndex321, depth321 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l322 + } + if !_rules[rulePAREN_CLOSE]() { + goto l322 + } + goto l321 + l322: + position, tokenIndex, depth = position321, tokenIndex321, depth321 + if !(p.errorHere(position, `expected ")" to close "("`)) { + goto l318 + } } - goto l195 - l211: - position, tokenIndex, depth = position195, tokenIndex195, depth195 + l321: + goto l296 + l318: + position, tokenIndex, depth = position296, tokenIndex296, depth296 if !_rules[rule_]() { - goto l212 + goto l323 } { - position213 := position + position324 := position depth++ { - position214 := position + position325 := position depth++ if !_rules[ruleNUMBER]() { - goto l212 + goto l323 } if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l212 + goto l323 } position++ - l215: + l326: { - position216, tokenIndex216, depth216 := position, tokenIndex, depth + position327, tokenIndex327, depth327 := position, tokenIndex, depth if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l216 + goto l327 } position++ - goto l215 - l216: - position, tokenIndex, depth = position216, tokenIndex216, depth216 + goto l326 + l327: + position, tokenIndex, depth = position327, tokenIndex327, depth327 } if !_rules[ruleKEY]() { - goto l212 + goto l323 } depth-- - add(ruleDURATION, position214) + add(ruleDURATION, position325) } depth-- - add(rulePegText, position213) + add(rulePegText, position324) } { add(ruleAction26, position) } - goto l195 - l212: - position, tokenIndex, depth = position195, tokenIndex195, depth195 + goto l296 + l323: + position, tokenIndex, depth = position296, tokenIndex296, depth296 if !_rules[rule_]() { - goto l218 + goto l329 } { - position219 := position + position330 := position depth++ if !_rules[ruleNUMBER]() { - goto l218 + goto l329 } depth-- - add(rulePegText, position219) + add(rulePegText, position330) } { add(ruleAction27, position) } - goto l195 - l218: - position, tokenIndex, depth = position195, tokenIndex195, depth195 + goto l296 + l329: + position, tokenIndex, depth = position296, tokenIndex296, depth296 if !_rules[rule_]() { - goto l192 + goto l293 } if !_rules[ruleSTRING]() { - goto l192 + goto l293 } { add(ruleAction28, position) } } - l195: + l296: depth-- - add(ruleexpression_atom_raw, position194) + add(ruleexpression_atom_raw, position295) } if !_rules[ruleexpression_annotation]() { - goto l192 + goto l293 } depth-- - add(ruleexpression_atom, position193) + add(ruleexpression_atom, position294) } return true - l192: - position, tokenIndex, depth = position192, tokenIndex192, depth192 + l293: + position, tokenIndex, depth = position293, tokenIndex293, depth293 return false }, - /* 17 expression_atom_raw <- <(expression_function / expression_metric / (_ PAREN_OPEN expression_start _ PAREN_CLOSE) / (_ Action26) / (_ Action27) / (_ STRING Action28))> */ + /* 17 expression_atom_raw <- <(expression_function / expression_metric / (_ PAREN_OPEN (expression_start / &{ p.errorHere(position, `expected expression to follow "("`) }) ((_ PAREN_CLOSE) / &{ p.errorHere(position, `expected ")" to close "("`) })) / (_ Action26) / (_ Action27) / (_ STRING Action28))> */ nil, - /* 18 expression_annotation_required <- <(_ '{' <(!'}' .)*> '}' Action29)> */ + /* 18 expression_annotation_required <- <(_ '{' <(!'}' .)*> ('}' / &{ p.errorHere(position, `expected "$CLOSEBRACE$" to close "$OPENBRACE$" opened for annotation`) }) Action29)> */ nil, /* 19 expression_annotation <- */ func() bool { { - position225 := position + position336 := position depth++ { - position226, tokenIndex226, depth226 := position, tokenIndex, depth + position337, tokenIndex337, depth337 := position, tokenIndex, depth { - position228 := position + position339 := position depth++ if !_rules[rule_]() { - goto l226 + goto l337 } if buffer[position] != rune('{') { - goto l226 + goto l337 } position++ { - position229 := position + position340 := position depth++ - l230: + l341: { - position231, tokenIndex231, depth231 := position, tokenIndex, depth + position342, tokenIndex342, depth342 := position, tokenIndex, depth { - position232, tokenIndex232, depth232 := position, tokenIndex, depth + position343, tokenIndex343, depth343 := position, tokenIndex, depth if buffer[position] != rune('}') { - goto l232 + goto l343 } position++ - goto l231 - l232: - position, tokenIndex, depth = position232, tokenIndex232, depth232 + goto l342 + l343: + position, tokenIndex, depth = position343, tokenIndex343, depth343 } if !matchDot() { - goto l231 + goto l342 } - goto l230 - l231: - position, tokenIndex, depth = position231, tokenIndex231, depth231 + goto l341 + l342: + position, tokenIndex, depth = position342, tokenIndex342, depth342 } depth-- - add(rulePegText, position229) + add(rulePegText, position340) } - if buffer[position] != rune('}') { - goto l226 + { + position344, tokenIndex344, depth344 := position, tokenIndex, depth + if buffer[position] != rune('}') { + goto l345 + } + position++ + goto l344 + l345: + position, tokenIndex, depth = position344, tokenIndex344, depth344 + if !(p.errorHere(position, `expected "$CLOSEBRACE$" to close "$OPENBRACE$" opened for annotation`)) { + goto l337 + } } - position++ + l344: { add(ruleAction29, position) } depth-- - add(ruleexpression_annotation_required, position228) + add(ruleexpression_annotation_required, position339) } - goto l227 - l226: - position, tokenIndex, depth = position226, tokenIndex226, depth226 + goto l338 + l337: + position, tokenIndex, depth = position337, tokenIndex337, depth337 } - l227: + l338: depth-- - add(ruleexpression_annotation, position225) + add(ruleexpression_annotation, position336) } return true }, - /* 20 optionalGroupBy <- <(Action30 (groupByClause / collapseByClause)?)> */ + /* 20 optionalGroupBy <- <(groupByClause / collapseByClause / Action30)?> */ func() bool { { - position235 := position + position348 := position depth++ { - add(ruleAction30, position) - } - { - position237, tokenIndex237, depth237 := position, tokenIndex, depth + position349, tokenIndex349, depth349 := position, tokenIndex, depth { - position239, tokenIndex239, depth239 := position, tokenIndex, depth + position351, tokenIndex351, depth351 := position, tokenIndex, depth { - position241 := position + position353 := position depth++ if !_rules[rule_]() { - goto l240 + goto l352 } { - position242, tokenIndex242, depth242 := position, tokenIndex, depth + position354, tokenIndex354, depth354 := position, tokenIndex, depth if buffer[position] != rune('g') { - goto l243 + goto l355 } position++ - goto l242 - l243: - position, tokenIndex, depth = position242, tokenIndex242, depth242 + goto l354 + l355: + position, tokenIndex, depth = position354, tokenIndex354, depth354 if buffer[position] != rune('G') { - goto l240 + goto l352 } position++ } - l242: + l354: { - position244, tokenIndex244, depth244 := position, tokenIndex, depth + position356, tokenIndex356, depth356 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l245 + goto l357 } position++ - goto l244 - l245: - position, tokenIndex, depth = position244, tokenIndex244, depth244 + goto l356 + l357: + position, tokenIndex, depth = position356, tokenIndex356, depth356 if buffer[position] != rune('R') { - goto l240 + goto l352 } position++ } - l244: + l356: { - position246, tokenIndex246, depth246 := position, tokenIndex, depth + position358, tokenIndex358, depth358 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l247 + goto l359 } position++ - goto l246 - l247: - position, tokenIndex, depth = position246, tokenIndex246, depth246 + goto l358 + l359: + position, tokenIndex, depth = position358, tokenIndex358, depth358 if buffer[position] != rune('O') { - goto l240 + goto l352 } position++ } - l246: + l358: { - position248, tokenIndex248, depth248 := position, tokenIndex, depth + position360, tokenIndex360, depth360 := position, tokenIndex, depth if buffer[position] != rune('u') { - goto l249 + goto l361 } position++ - goto l248 - l249: - position, tokenIndex, depth = position248, tokenIndex248, depth248 + goto l360 + l361: + position, tokenIndex, depth = position360, tokenIndex360, depth360 if buffer[position] != rune('U') { - goto l240 + goto l352 } position++ } - l248: + l360: { - position250, tokenIndex250, depth250 := position, tokenIndex, depth + position362, tokenIndex362, depth362 := position, tokenIndex, depth if buffer[position] != rune('p') { - goto l251 + goto l363 } position++ - goto l250 - l251: - position, tokenIndex, depth = position250, tokenIndex250, depth250 + goto l362 + l363: + position, tokenIndex, depth = position362, tokenIndex362, depth362 if buffer[position] != rune('P') { - goto l240 + goto l352 } position++ } - l250: + l362: if !_rules[ruleKEY]() { - goto l240 - } - if !_rules[rule_]() { - goto l240 + goto l352 } { - position252, tokenIndex252, depth252 := position, tokenIndex, depth - if buffer[position] != rune('b') { - goto l253 + position364, tokenIndex364, depth364 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l365 } - position++ - goto l252 - l253: - position, tokenIndex, depth = position252, tokenIndex252, depth252 - if buffer[position] != rune('B') { - goto l240 + { + position366, tokenIndex366, depth366 := position, tokenIndex, depth + if buffer[position] != rune('b') { + goto l367 + } + position++ + goto l366 + l367: + position, tokenIndex, depth = position366, tokenIndex366, depth366 + if buffer[position] != rune('B') { + goto l365 + } + position++ } - position++ - } - l252: - { - position254, tokenIndex254, depth254 := position, tokenIndex, depth - if buffer[position] != rune('y') { - goto l255 + l366: + { + position368, tokenIndex368, depth368 := position, tokenIndex, depth + if buffer[position] != rune('y') { + goto l369 + } + position++ + goto l368 + l369: + position, tokenIndex, depth = position368, tokenIndex368, depth368 + if buffer[position] != rune('Y') { + goto l365 + } + position++ } - position++ - goto l254 - l255: - position, tokenIndex, depth = position254, tokenIndex254, depth254 - if buffer[position] != rune('Y') { - goto l240 + l368: + if !_rules[ruleKEY]() { + goto l365 + } + goto l364 + l365: + position, tokenIndex, depth = position364, tokenIndex364, depth364 + if !(p.errorHere(position, `expected keyword "by" to follow keyword "group" in "group by" clause`)) { + goto l352 } - position++ - } - l254: - if !_rules[ruleKEY]() { - goto l240 - } - if !_rules[rule_]() { - goto l240 } + l364: { - position256 := position - depth++ - if !_rules[ruleCOLUMN_NAME]() { - goto l240 + position370, tokenIndex370, depth370 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l371 + } + { + position372 := position + depth++ + if !_rules[ruleCOLUMN_NAME]() { + goto l371 + } + depth-- + add(rulePegText, position372) + } + goto l370 + l371: + position, tokenIndex, depth = position370, tokenIndex370, depth370 + if !(p.errorHere(position, `expected tag key identifier to follow "group by" keywords in "group by" clause`)) { + goto l352 } - depth-- - add(rulePegText, position256) } + l370: { add(ruleAction36, position) } - l258: { - position259, tokenIndex259, depth259 := position, tokenIndex, depth + add(ruleAction37, position) + } + l375: + { + position376, tokenIndex376, depth376 := position, tokenIndex, depth if !_rules[rule_]() { - goto l259 + goto l376 } if !_rules[ruleCOMMA]() { - goto l259 - } - if !_rules[rule_]() { - goto l259 + goto l376 } { - position260 := position - depth++ - if !_rules[ruleCOLUMN_NAME]() { - goto l259 + position377, tokenIndex377, depth377 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l378 + } + { + position379 := position + depth++ + if !_rules[ruleCOLUMN_NAME]() { + goto l378 + } + depth-- + add(rulePegText, position379) + } + goto l377 + l378: + position, tokenIndex, depth = position377, tokenIndex377, depth377 + if !(p.errorHere(position, `expected tag key identifier to follow "," in "group by" clause`)) { + goto l376 } - depth-- - add(rulePegText, position260) } + l377: { - add(ruleAction37, position) + add(ruleAction38, position) } - goto l258 - l259: - position, tokenIndex, depth = position259, tokenIndex259, depth259 + goto l375 + l376: + position, tokenIndex, depth = position376, tokenIndex376, depth376 } depth-- - add(rulegroupByClause, position241) + add(rulegroupByClause, position353) } - goto l239 - l240: - position, tokenIndex, depth = position239, tokenIndex239, depth239 + goto l351 + l352: + position, tokenIndex, depth = position351, tokenIndex351, depth351 { - position262 := position + position382 := position depth++ if !_rules[rule_]() { - goto l237 + goto l381 } { - position263, tokenIndex263, depth263 := position, tokenIndex, depth + position383, tokenIndex383, depth383 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l264 + goto l384 } position++ - goto l263 - l264: - position, tokenIndex, depth = position263, tokenIndex263, depth263 + goto l383 + l384: + position, tokenIndex, depth = position383, tokenIndex383, depth383 if buffer[position] != rune('C') { - goto l237 + goto l381 } position++ } - l263: + l383: { - position265, tokenIndex265, depth265 := position, tokenIndex, depth + position385, tokenIndex385, depth385 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l266 + goto l386 } position++ - goto l265 - l266: - position, tokenIndex, depth = position265, tokenIndex265, depth265 + goto l385 + l386: + position, tokenIndex, depth = position385, tokenIndex385, depth385 if buffer[position] != rune('O') { - goto l237 + goto l381 } position++ } - l265: + l385: { - position267, tokenIndex267, depth267 := position, tokenIndex, depth + position387, tokenIndex387, depth387 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l268 + goto l388 } position++ - goto l267 - l268: - position, tokenIndex, depth = position267, tokenIndex267, depth267 + goto l387 + l388: + position, tokenIndex, depth = position387, tokenIndex387, depth387 if buffer[position] != rune('L') { - goto l237 + goto l381 } position++ } - l267: + l387: { - position269, tokenIndex269, depth269 := position, tokenIndex, depth + position389, tokenIndex389, depth389 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l270 + goto l390 } position++ - goto l269 - l270: - position, tokenIndex, depth = position269, tokenIndex269, depth269 + goto l389 + l390: + position, tokenIndex, depth = position389, tokenIndex389, depth389 if buffer[position] != rune('L') { - goto l237 + goto l381 } position++ } - l269: + l389: { - position271, tokenIndex271, depth271 := position, tokenIndex, depth + position391, tokenIndex391, depth391 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l272 + goto l392 } position++ - goto l271 - l272: - position, tokenIndex, depth = position271, tokenIndex271, depth271 + goto l391 + l392: + position, tokenIndex, depth = position391, tokenIndex391, depth391 if buffer[position] != rune('A') { - goto l237 + goto l381 } position++ } - l271: + l391: { - position273, tokenIndex273, depth273 := position, tokenIndex, depth + position393, tokenIndex393, depth393 := position, tokenIndex, depth if buffer[position] != rune('p') { - goto l274 + goto l394 } position++ - goto l273 - l274: - position, tokenIndex, depth = position273, tokenIndex273, depth273 + goto l393 + l394: + position, tokenIndex, depth = position393, tokenIndex393, depth393 if buffer[position] != rune('P') { - goto l237 + goto l381 } position++ } - l273: + l393: { - position275, tokenIndex275, depth275 := position, tokenIndex, depth + position395, tokenIndex395, depth395 := position, tokenIndex, depth if buffer[position] != rune('s') { - goto l276 + goto l396 } position++ - goto l275 - l276: - position, tokenIndex, depth = position275, tokenIndex275, depth275 + goto l395 + l396: + position, tokenIndex, depth = position395, tokenIndex395, depth395 if buffer[position] != rune('S') { - goto l237 + goto l381 } position++ } - l275: + l395: { - position277, tokenIndex277, depth277 := position, tokenIndex, depth + position397, tokenIndex397, depth397 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l278 + goto l398 } position++ - goto l277 - l278: - position, tokenIndex, depth = position277, tokenIndex277, depth277 + goto l397 + l398: + position, tokenIndex, depth = position397, tokenIndex397, depth397 if buffer[position] != rune('E') { - goto l237 + goto l381 } position++ } - l277: + l397: if !_rules[ruleKEY]() { - goto l237 - } - if !_rules[rule_]() { - goto l237 + goto l381 } { - position279, tokenIndex279, depth279 := position, tokenIndex, depth - if buffer[position] != rune('b') { - goto l280 + position399, tokenIndex399, depth399 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l400 } - position++ - goto l279 - l280: - position, tokenIndex, depth = position279, tokenIndex279, depth279 - if buffer[position] != rune('B') { - goto l237 + { + position401, tokenIndex401, depth401 := position, tokenIndex, depth + if buffer[position] != rune('b') { + goto l402 + } + position++ + goto l401 + l402: + position, tokenIndex, depth = position401, tokenIndex401, depth401 + if buffer[position] != rune('B') { + goto l400 + } + position++ + } + l401: + { + position403, tokenIndex403, depth403 := position, tokenIndex, depth + if buffer[position] != rune('y') { + goto l404 + } + position++ + goto l403 + l404: + position, tokenIndex, depth = position403, tokenIndex403, depth403 + if buffer[position] != rune('Y') { + goto l400 + } + position++ + } + l403: + if !_rules[ruleKEY]() { + goto l400 + } + goto l399 + l400: + position, tokenIndex, depth = position399, tokenIndex399, depth399 + if !(p.errorHere(position, `expected keyword "by" to follow keyword "collapse" in "collapse by" clause`)) { + goto l381 } - position++ } - l279: + l399: { - position281, tokenIndex281, depth281 := position, tokenIndex, depth - if buffer[position] != rune('y') { - goto l282 + position405, tokenIndex405, depth405 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l406 } - position++ - goto l281 - l282: - position, tokenIndex, depth = position281, tokenIndex281, depth281 - if buffer[position] != rune('Y') { - goto l237 + { + position407 := position + depth++ + if !_rules[ruleCOLUMN_NAME]() { + goto l406 + } + depth-- + add(rulePegText, position407) + } + goto l405 + l406: + position, tokenIndex, depth = position405, tokenIndex405, depth405 + if !(p.errorHere(position, `expected tag key identifier to follow "collapse by" keywords in "collapse by" clause`)) { + goto l381 } - position++ - } - l281: - if !_rules[ruleKEY]() { - goto l237 - } - if !_rules[rule_]() { - goto l237 } + l405: { - position283 := position - depth++ - if !_rules[ruleCOLUMN_NAME]() { - goto l237 - } - depth-- - add(rulePegText, position283) + add(ruleAction39, position) } { - add(ruleAction38, position) + add(ruleAction40, position) } - l285: + l410: { - position286, tokenIndex286, depth286 := position, tokenIndex, depth + position411, tokenIndex411, depth411 := position, tokenIndex, depth if !_rules[rule_]() { - goto l286 + goto l411 } if !_rules[ruleCOMMA]() { - goto l286 - } - if !_rules[rule_]() { - goto l286 + goto l411 } { - position287 := position - depth++ - if !_rules[ruleCOLUMN_NAME]() { - goto l286 + position412, tokenIndex412, depth412 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l413 + } + { + position414 := position + depth++ + if !_rules[ruleCOLUMN_NAME]() { + goto l413 + } + depth-- + add(rulePegText, position414) + } + goto l412 + l413: + position, tokenIndex, depth = position412, tokenIndex412, depth412 + if !(p.errorHere(position, `expected tag key identifier to follow "," in "collapse by" clause`)) { + goto l411 } - depth-- - add(rulePegText, position287) } + l412: { - add(ruleAction39, position) + add(ruleAction41, position) } - goto l285 - l286: - position, tokenIndex, depth = position286, tokenIndex286, depth286 + goto l410 + l411: + position, tokenIndex, depth = position411, tokenIndex411, depth411 } depth-- - add(rulecollapseByClause, position262) + add(rulecollapseByClause, position382) + } + goto l351 + l381: + position, tokenIndex, depth = position351, tokenIndex351, depth351 + { + add(ruleAction30, position) } } - l239: - goto l238 - l237: - position, tokenIndex, depth = position237, tokenIndex237, depth237 + l351: + goto l350 + + position, tokenIndex, depth = position349, tokenIndex349, depth349 } - l238: + l350: depth-- - add(ruleoptionalGroupBy, position235) + add(ruleoptionalGroupBy, position348) } return true }, - /* 21 expression_function <- <(_ Action31 _ PAREN_OPEN expressionList optionalGroupBy _ PAREN_CLOSE Action32)> */ + /* 21 expression_function <- <(_ Action31 _ PAREN_OPEN (expressionList / &{ p.errorHere(position, `expected expression list to follow "(" in function call`) }) optionalGroupBy ((_ PAREN_CLOSE) / &{ p.errorHere(position, `expected ")" to close "(" opened by function call`) }) Action32)> */ nil, - /* 22 expression_metric <- <(_ Action33 ((_ '[' predicate_1 _ ']') / Action34)? Action35)> */ + /* 22 expression_metric <- <(_ Action33 ((_ '[' (predicate_1 / &{ p.errorHere(position, `expected predicate to follow "[" after metric`) }) ((_ ']') / &{ p.errorHere(position, `expected "]" to close "[" opened to apply predicate`) })) / Action34) Action35)> */ nil, - /* 23 groupByClause <- <(_ (('g' / 'G') ('r' / 'R') ('o' / 'O') ('u' / 'U') ('p' / 'P')) KEY _ (('b' / 'B') ('y' / 'Y')) KEY _ Action36 (_ COMMA _ Action37)*)> */ + /* 23 groupByClause <- <(_ (('g' / 'G') ('r' / 'R') ('o' / 'O') ('u' / 'U') ('p' / 'P')) KEY ((_ (('b' / 'B') ('y' / 'Y')) KEY) / &{ p.errorHere(position, `expected keyword "by" to follow keyword "group" in "group by" clause`) }) ((_ ) / &{ p.errorHere(position, `expected tag key identifier to follow "group by" keywords in "group by" clause`) }) Action36 Action37 (_ COMMA ((_ ) / &{ p.errorHere(position, `expected tag key identifier to follow "," in "group by" clause`) }) Action38)*)> */ nil, - /* 24 collapseByClause <- <(_ (('c' / 'C') ('o' / 'O') ('l' / 'L') ('l' / 'L') ('a' / 'A') ('p' / 'P') ('s' / 'S') ('e' / 'E')) KEY _ (('b' / 'B') ('y' / 'Y')) KEY _ Action38 (_ COMMA _ Action39)*)> */ + /* 24 collapseByClause <- <(_ (('c' / 'C') ('o' / 'O') ('l' / 'L') ('l' / 'L') ('a' / 'A') ('p' / 'P') ('s' / 'S') ('e' / 'E')) KEY ((_ (('b' / 'B') ('y' / 'Y')) KEY) / &{ p.errorHere(position, `expected keyword "by" to follow keyword "collapse" in "collapse by" clause`) }) ((_ ) / &{ p.errorHere(position, `expected tag key identifier to follow "collapse by" keywords in "collapse by" clause`) }) Action39 Action40 (_ COMMA ((_ ) / &{ p.errorHere(position, `expected tag key identifier to follow "," in "collapse by" clause`) }) Action41)*)> */ nil, - /* 25 predicateClause <- <(_ (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E')) KEY _ predicate_1)> */ + /* 25 predicateClause <- <(_ (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E')) KEY ((_ predicate_1) / &{ p.errorHere(position, `expected predicate to follow "where" keyword`) }))> */ nil, - /* 26 predicate_1 <- <((predicate_2 _ OP_OR predicate_1 Action40) / predicate_2)> */ + /* 26 predicate_1 <- <((predicate_2 _ OP_OR (predicate_1 / &{ p.errorHere(position, `expected predicate to follow "or" operator`) }) Action42) / predicate_2)> */ func() bool { - position294, tokenIndex294, depth294 := position, tokenIndex, depth + position422, tokenIndex422, depth422 := position, tokenIndex, depth { - position295 := position + position423 := position depth++ { - position296, tokenIndex296, depth296 := position, tokenIndex, depth + position424, tokenIndex424, depth424 := position, tokenIndex, depth if !_rules[rulepredicate_2]() { - goto l297 + goto l425 } if !_rules[rule_]() { - goto l297 + goto l425 } { - position298 := position + position426 := position depth++ { - position299, tokenIndex299, depth299 := position, tokenIndex, depth + position427, tokenIndex427, depth427 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l300 + goto l428 } position++ - goto l299 - l300: - position, tokenIndex, depth = position299, tokenIndex299, depth299 + goto l427 + l428: + position, tokenIndex, depth = position427, tokenIndex427, depth427 if buffer[position] != rune('O') { - goto l297 + goto l425 } position++ } - l299: + l427: { - position301, tokenIndex301, depth301 := position, tokenIndex, depth + position429, tokenIndex429, depth429 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l302 + goto l430 } position++ - goto l301 - l302: - position, tokenIndex, depth = position301, tokenIndex301, depth301 + goto l429 + l430: + position, tokenIndex, depth = position429, tokenIndex429, depth429 if buffer[position] != rune('R') { - goto l297 + goto l425 } position++ } - l301: + l429: if !_rules[ruleKEY]() { - goto l297 + goto l425 } depth-- - add(ruleOP_OR, position298) + add(ruleOP_OR, position426) } - if !_rules[rulepredicate_1]() { - goto l297 + { + position431, tokenIndex431, depth431 := position, tokenIndex, depth + if !_rules[rulepredicate_1]() { + goto l432 + } + goto l431 + l432: + position, tokenIndex, depth = position431, tokenIndex431, depth431 + if !(p.errorHere(position, `expected predicate to follow "or" operator`)) { + goto l425 + } } + l431: { - add(ruleAction40, position) + add(ruleAction42, position) } - goto l296 - l297: - position, tokenIndex, depth = position296, tokenIndex296, depth296 + goto l424 + l425: + position, tokenIndex, depth = position424, tokenIndex424, depth424 if !_rules[rulepredicate_2]() { - goto l294 + goto l422 } } - l296: + l424: depth-- - add(rulepredicate_1, position295) + add(rulepredicate_1, position423) } return true - l294: - position, tokenIndex, depth = position294, tokenIndex294, depth294 + l422: + position, tokenIndex, depth = position422, tokenIndex422, depth422 return false }, - /* 27 predicate_2 <- <((predicate_3 _ OP_AND predicate_2 Action41) / predicate_3)> */ + /* 27 predicate_2 <- <((predicate_3 _ OP_AND (predicate_2 / &{ p.errorHere(position, `expected predicate to follow "and" operator`) }) Action43) / predicate_3)> */ func() bool { - position304, tokenIndex304, depth304 := position, tokenIndex, depth + position434, tokenIndex434, depth434 := position, tokenIndex, depth { - position305 := position + position435 := position depth++ { - position306, tokenIndex306, depth306 := position, tokenIndex, depth + position436, tokenIndex436, depth436 := position, tokenIndex, depth if !_rules[rulepredicate_3]() { - goto l307 + goto l437 } if !_rules[rule_]() { - goto l307 + goto l437 } { - position308 := position + position438 := position depth++ { - position309, tokenIndex309, depth309 := position, tokenIndex, depth + position439, tokenIndex439, depth439 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l310 + goto l440 } position++ - goto l309 - l310: - position, tokenIndex, depth = position309, tokenIndex309, depth309 + goto l439 + l440: + position, tokenIndex, depth = position439, tokenIndex439, depth439 if buffer[position] != rune('A') { - goto l307 + goto l437 } position++ } - l309: + l439: { - position311, tokenIndex311, depth311 := position, tokenIndex, depth + position441, tokenIndex441, depth441 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l312 + goto l442 } position++ - goto l311 - l312: - position, tokenIndex, depth = position311, tokenIndex311, depth311 + goto l441 + l442: + position, tokenIndex, depth = position441, tokenIndex441, depth441 if buffer[position] != rune('N') { - goto l307 + goto l437 } position++ } - l311: + l441: { - position313, tokenIndex313, depth313 := position, tokenIndex, depth + position443, tokenIndex443, depth443 := position, tokenIndex, depth if buffer[position] != rune('d') { - goto l314 + goto l444 } position++ - goto l313 - l314: - position, tokenIndex, depth = position313, tokenIndex313, depth313 + goto l443 + l444: + position, tokenIndex, depth = position443, tokenIndex443, depth443 if buffer[position] != rune('D') { - goto l307 + goto l437 } position++ } - l313: + l443: if !_rules[ruleKEY]() { - goto l307 + goto l437 } depth-- - add(ruleOP_AND, position308) + add(ruleOP_AND, position438) } - if !_rules[rulepredicate_2]() { - goto l307 + { + position445, tokenIndex445, depth445 := position, tokenIndex, depth + if !_rules[rulepredicate_2]() { + goto l446 + } + goto l445 + l446: + position, tokenIndex, depth = position445, tokenIndex445, depth445 + if !(p.errorHere(position, `expected predicate to follow "and" operator`)) { + goto l437 + } } + l445: { - add(ruleAction41, position) + add(ruleAction43, position) } - goto l306 - l307: - position, tokenIndex, depth = position306, tokenIndex306, depth306 + goto l436 + l437: + position, tokenIndex, depth = position436, tokenIndex436, depth436 if !_rules[rulepredicate_3]() { - goto l304 + goto l434 } } - l306: + l436: depth-- - add(rulepredicate_2, position305) + add(rulepredicate_2, position435) } return true - l304: - position, tokenIndex, depth = position304, tokenIndex304, depth304 + l434: + position, tokenIndex, depth = position434, tokenIndex434, depth434 return false }, - /* 28 predicate_3 <- <((_ OP_NOT predicate_3 Action42) / (_ PAREN_OPEN predicate_1 _ PAREN_CLOSE) / tagMatcher)> */ + /* 28 predicate_3 <- <((_ OP_NOT (predicate_3 / &{ p.errorHere(position, `expected predicate to follow "not" operator`) }) Action44) / (_ PAREN_OPEN (predicate_1 / &{ p.errorHere(position, `expected predicate to follow "("`) }) ((_ PAREN_CLOSE) / &{ p.errorHere(position, `expected ")" to close "(" opened in predicate`) })) / tagMatcher)> */ func() bool { - position316, tokenIndex316, depth316 := position, tokenIndex, depth + position448, tokenIndex448, depth448 := position, tokenIndex, depth { - position317 := position + position449 := position depth++ { - position318, tokenIndex318, depth318 := position, tokenIndex, depth + position450, tokenIndex450, depth450 := position, tokenIndex, depth if !_rules[rule_]() { - goto l319 + goto l451 } { - position320 := position + position452 := position depth++ { - position321, tokenIndex321, depth321 := position, tokenIndex, depth + position453, tokenIndex453, depth453 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l322 + goto l454 } position++ - goto l321 - l322: - position, tokenIndex, depth = position321, tokenIndex321, depth321 + goto l453 + l454: + position, tokenIndex, depth = position453, tokenIndex453, depth453 if buffer[position] != rune('N') { - goto l319 + goto l451 } position++ } - l321: + l453: { - position323, tokenIndex323, depth323 := position, tokenIndex, depth + position455, tokenIndex455, depth455 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l324 + goto l456 } position++ - goto l323 - l324: - position, tokenIndex, depth = position323, tokenIndex323, depth323 + goto l455 + l456: + position, tokenIndex, depth = position455, tokenIndex455, depth455 if buffer[position] != rune('O') { - goto l319 + goto l451 } position++ } - l323: + l455: { - position325, tokenIndex325, depth325 := position, tokenIndex, depth + position457, tokenIndex457, depth457 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l326 + goto l458 } position++ - goto l325 - l326: - position, tokenIndex, depth = position325, tokenIndex325, depth325 + goto l457 + l458: + position, tokenIndex, depth = position457, tokenIndex457, depth457 if buffer[position] != rune('T') { - goto l319 + goto l451 } position++ } - l325: + l457: if !_rules[ruleKEY]() { - goto l319 + goto l451 } depth-- - add(ruleOP_NOT, position320) + add(ruleOP_NOT, position452) } - if !_rules[rulepredicate_3]() { - goto l319 + { + position459, tokenIndex459, depth459 := position, tokenIndex, depth + if !_rules[rulepredicate_3]() { + goto l460 + } + goto l459 + l460: + position, tokenIndex, depth = position459, tokenIndex459, depth459 + if !(p.errorHere(position, `expected predicate to follow "not" operator`)) { + goto l451 + } } + l459: { - add(ruleAction42, position) + add(ruleAction44, position) } - goto l318 - l319: - position, tokenIndex, depth = position318, tokenIndex318, depth318 + goto l450 + l451: + position, tokenIndex, depth = position450, tokenIndex450, depth450 if !_rules[rule_]() { - goto l328 + goto l462 } if !_rules[rulePAREN_OPEN]() { - goto l328 - } - if !_rules[rulepredicate_1]() { - goto l328 + goto l462 } - if !_rules[rule_]() { - goto l328 - } - if !_rules[rulePAREN_CLOSE]() { - goto l328 + { + position463, tokenIndex463, depth463 := position, tokenIndex, depth + if !_rules[rulepredicate_1]() { + goto l464 + } + goto l463 + l464: + position, tokenIndex, depth = position463, tokenIndex463, depth463 + if !(p.errorHere(position, `expected predicate to follow "("`)) { + goto l462 + } } - goto l318 - l328: - position, tokenIndex, depth = position318, tokenIndex318, depth318 + l463: { - position329 := position - depth++ - { - position330, tokenIndex330, depth330 := position, tokenIndex, depth - if !_rules[ruletagName]() { - goto l331 - } + position465, tokenIndex465, depth465 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l466 + } + if !_rules[rulePAREN_CLOSE]() { + goto l466 + } + goto l465 + l466: + position, tokenIndex, depth = position465, tokenIndex465, depth465 + if !(p.errorHere(position, `expected ")" to close "(" opened in predicate`)) { + goto l462 + } + } + l465: + goto l450 + l462: + position, tokenIndex, depth = position450, tokenIndex450, depth450 + { + position467 := position + depth++ + if !_rules[ruletagName]() { + goto l448 + } + { + position468, tokenIndex468, depth468 := position, tokenIndex, depth if !_rules[rule_]() { - goto l331 + goto l469 } if buffer[position] != rune('=') { - goto l331 + goto l469 } position++ - if !_rules[ruleliteralString]() { - goto l331 - } { - add(ruleAction43, position) + position470, tokenIndex470, depth470 := position, tokenIndex, depth + if !_rules[ruleliteralString]() { + goto l471 + } + goto l470 + l471: + position, tokenIndex, depth = position470, tokenIndex470, depth470 + if !(p.errorHere(position, `expected string literal to follow "="`)) { + goto l469 + } } - goto l330 - l331: - position, tokenIndex, depth = position330, tokenIndex330, depth330 - if !_rules[ruletagName]() { - goto l333 + l470: + { + add(ruleAction45, position) } + goto l468 + l469: + position, tokenIndex, depth = position468, tokenIndex468, depth468 if !_rules[rule_]() { - goto l333 + goto l473 } if buffer[position] != rune('!') { - goto l333 + goto l473 } position++ if buffer[position] != rune('=') { - goto l333 + goto l473 } position++ - if !_rules[ruleliteralString]() { - goto l333 + { + position474, tokenIndex474, depth474 := position, tokenIndex, depth + if !_rules[ruleliteralString]() { + goto l475 + } + goto l474 + l475: + position, tokenIndex, depth = position474, tokenIndex474, depth474 + if !(p.errorHere(position, `expected string literal to follow "!="`)) { + goto l473 + } } + l474: { - add(ruleAction44, position) + add(ruleAction46, position) } - goto l330 - l333: - position, tokenIndex, depth = position330, tokenIndex330, depth330 - if !_rules[ruletagName]() { - goto l335 + { + add(ruleAction47, position) } + goto l468 + l473: + position, tokenIndex, depth = position468, tokenIndex468, depth468 if !_rules[rule_]() { - goto l335 + goto l478 } { - position336, tokenIndex336, depth336 := position, tokenIndex, depth + position479, tokenIndex479, depth479 := position, tokenIndex, depth if buffer[position] != rune('m') { - goto l337 + goto l480 } position++ - goto l336 - l337: - position, tokenIndex, depth = position336, tokenIndex336, depth336 + goto l479 + l480: + position, tokenIndex, depth = position479, tokenIndex479, depth479 if buffer[position] != rune('M') { - goto l335 + goto l478 } position++ } - l336: + l479: { - position338, tokenIndex338, depth338 := position, tokenIndex, depth + position481, tokenIndex481, depth481 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l339 + goto l482 } position++ - goto l338 - l339: - position, tokenIndex, depth = position338, tokenIndex338, depth338 + goto l481 + l482: + position, tokenIndex, depth = position481, tokenIndex481, depth481 if buffer[position] != rune('A') { - goto l335 + goto l478 } position++ } - l338: + l481: { - position340, tokenIndex340, depth340 := position, tokenIndex, depth + position483, tokenIndex483, depth483 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l341 + goto l484 } position++ - goto l340 - l341: - position, tokenIndex, depth = position340, tokenIndex340, depth340 + goto l483 + l484: + position, tokenIndex, depth = position483, tokenIndex483, depth483 if buffer[position] != rune('T') { - goto l335 + goto l478 } position++ } - l340: + l483: { - position342, tokenIndex342, depth342 := position, tokenIndex, depth + position485, tokenIndex485, depth485 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l343 + goto l486 } position++ - goto l342 - l343: - position, tokenIndex, depth = position342, tokenIndex342, depth342 + goto l485 + l486: + position, tokenIndex, depth = position485, tokenIndex485, depth485 if buffer[position] != rune('C') { - goto l335 + goto l478 } position++ } - l342: + l485: { - position344, tokenIndex344, depth344 := position, tokenIndex, depth + position487, tokenIndex487, depth487 := position, tokenIndex, depth if buffer[position] != rune('h') { - goto l345 + goto l488 } position++ - goto l344 - l345: - position, tokenIndex, depth = position344, tokenIndex344, depth344 + goto l487 + l488: + position, tokenIndex, depth = position487, tokenIndex487, depth487 if buffer[position] != rune('H') { - goto l335 + goto l478 } position++ } - l344: + l487: if !_rules[ruleKEY]() { - goto l335 - } - if !_rules[ruleliteralString]() { - goto l335 + goto l478 } { - add(ruleAction45, position) + position489, tokenIndex489, depth489 := position, tokenIndex, depth + if !_rules[ruleliteralString]() { + goto l490 + } + goto l489 + l490: + position, tokenIndex, depth = position489, tokenIndex489, depth489 + if !(p.errorHere(position, `expected regex string literal to follow "match"`)) { + goto l478 + } } - goto l330 - l335: - position, tokenIndex, depth = position330, tokenIndex330, depth330 - if !_rules[ruletagName]() { - goto l316 + l489: + { + add(ruleAction48, position) } + goto l468 + l478: + position, tokenIndex, depth = position468, tokenIndex468, depth468 if !_rules[rule_]() { - goto l316 + goto l492 } { - position347, tokenIndex347, depth347 := position, tokenIndex, depth + position493, tokenIndex493, depth493 := position, tokenIndex, depth if buffer[position] != rune('i') { - goto l348 + goto l494 } position++ - goto l347 - l348: - position, tokenIndex, depth = position347, tokenIndex347, depth347 + goto l493 + l494: + position, tokenIndex, depth = position493, tokenIndex493, depth493 if buffer[position] != rune('I') { - goto l316 + goto l492 } position++ } - l347: + l493: { - position349, tokenIndex349, depth349 := position, tokenIndex, depth + position495, tokenIndex495, depth495 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l350 + goto l496 } position++ - goto l349 - l350: - position, tokenIndex, depth = position349, tokenIndex349, depth349 + goto l495 + l496: + position, tokenIndex, depth = position495, tokenIndex495, depth495 if buffer[position] != rune('N') { - goto l316 + goto l492 } position++ } - l349: + l495: if !_rules[ruleKEY]() { - goto l316 + goto l492 } { - position351 := position - depth++ + position497, tokenIndex497, depth497 := position, tokenIndex, depth { - add(ruleAction48, position) - } - if !_rules[rule_]() { - goto l316 - } - if !_rules[rulePAREN_OPEN]() { - goto l316 - } - if !_rules[ruleliteralListString]() { - goto l316 - } - l353: - { - position354, tokenIndex354, depth354 := position, tokenIndex, depth + position499 := position + depth++ + { + add(ruleAction51, position) + } if !_rules[rule_]() { - goto l354 + goto l498 } - if !_rules[ruleCOMMA]() { - goto l354 + if !_rules[rulePAREN_OPEN]() { + goto l498 } - if !_rules[ruleliteralListString]() { - goto l354 + { + position501, tokenIndex501, depth501 := position, tokenIndex, depth + if !_rules[ruleliteralListString]() { + goto l502 + } + goto l501 + l502: + position, tokenIndex, depth = position501, tokenIndex501, depth501 + if !(p.errorHere(position, `expected string literal to follow "(" in literal list`)) { + goto l498 + } } - goto l353 - l354: - position, tokenIndex, depth = position354, tokenIndex354, depth354 - } - if !_rules[rule_]() { - goto l316 + l501: + l503: + { + position504, tokenIndex504, depth504 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l504 + } + if !_rules[ruleCOMMA]() { + goto l504 + } + { + position505, tokenIndex505, depth505 := position, tokenIndex, depth + if !_rules[ruleliteralListString]() { + goto l506 + } + goto l505 + l506: + position, tokenIndex, depth = position505, tokenIndex505, depth505 + if !(p.errorHere(position, `expected string literal to follow "," in literal list`)) { + goto l504 + } + } + l505: + goto l503 + l504: + position, tokenIndex, depth = position504, tokenIndex504, depth504 + } + { + position507, tokenIndex507, depth507 := position, tokenIndex, depth + if !_rules[rule_]() { + goto l508 + } + if !_rules[rulePAREN_CLOSE]() { + goto l508 + } + goto l507 + l508: + position, tokenIndex, depth = position507, tokenIndex507, depth507 + if !(p.errorHere(position, `expected ")" to close "(" for literal list`)) { + goto l498 + } + } + l507: + depth-- + add(ruleliteralList, position499) } - if !_rules[rulePAREN_CLOSE]() { - goto l316 + goto l497 + l498: + position, tokenIndex, depth = position497, tokenIndex497, depth497 + if !(p.errorHere(position, `expected string literal list to follow "in" keyword`)) { + goto l492 } - depth-- - add(ruleliteralList, position351) } + l497: { - add(ruleAction46, position) + add(ruleAction49, position) + } + goto l468 + l492: + position, tokenIndex, depth = position468, tokenIndex468, depth468 + if !(p.errorHere(position, `expected "=", "!=", "match", or "in" to follow tag key in predicate`)) { + goto l448 } } - l330: + l468: depth-- - add(ruletagMatcher, position329) + add(ruletagMatcher, position467) } } - l318: + l450: depth-- - add(rulepredicate_3, position317) + add(rulepredicate_3, position449) } return true - l316: - position, tokenIndex, depth = position316, tokenIndex316, depth316 + l448: + position, tokenIndex, depth = position448, tokenIndex448, depth448 return false }, - /* 29 tagMatcher <- <((tagName _ '=' literalString Action43) / (tagName _ ('!' '=') literalString Action44) / (tagName _ (('m' / 'M') ('a' / 'A') ('t' / 'T') ('c' / 'C') ('h' / 'H')) KEY literalString Action45) / (tagName _ (('i' / 'I') ('n' / 'N')) KEY literalList Action46))> */ + /* 29 tagMatcher <- <(tagName ((_ '=' (literalString / &{ p.errorHere(position, `expected string literal to follow "="`) }) Action45) / (_ ('!' '=') (literalString / &{ p.errorHere(position, `expected string literal to follow "!="`) }) Action46 Action47) / (_ (('m' / 'M') ('a' / 'A') ('t' / 'T') ('c' / 'C') ('h' / 'H')) KEY (literalString / &{ p.errorHere(position, `expected regex string literal to follow "match"`) }) Action48) / (_ (('i' / 'I') ('n' / 'N')) KEY (literalList / &{ p.errorHere(position, `expected string literal list to follow "in" keyword`) }) Action49) / &{ p.errorHere(position, `expected "=", "!=", "match", or "in" to follow tag key in predicate`) }))> */ nil, - /* 30 literalString <- <(_ STRING Action47)> */ + /* 30 literalString <- <(_ STRING Action50)> */ func() bool { - position357, tokenIndex357, depth357 := position, tokenIndex, depth + position511, tokenIndex511, depth511 := position, tokenIndex, depth { - position358 := position + position512 := position depth++ if !_rules[rule_]() { - goto l357 + goto l511 } if !_rules[ruleSTRING]() { - goto l357 + goto l511 } { - add(ruleAction47, position) + add(ruleAction50, position) } depth-- - add(ruleliteralString, position358) + add(ruleliteralString, position512) } return true - l357: - position, tokenIndex, depth = position357, tokenIndex357, depth357 + l511: + position, tokenIndex, depth = position511, tokenIndex511, depth511 return false }, - /* 31 literalList <- <(Action48 _ PAREN_OPEN literalListString (_ COMMA literalListString)* _ PAREN_CLOSE)> */ + /* 31 literalList <- <(Action51 _ PAREN_OPEN (literalListString / &{ p.errorHere(position, `expected string literal to follow "(" in literal list`) }) (_ COMMA (literalListString / &{ p.errorHere(position, `expected string literal to follow "," in literal list`) }))* ((_ PAREN_CLOSE) / &{ p.errorHere(position, `expected ")" to close "(" for literal list`) }))> */ nil, - /* 32 literalListString <- <(_ STRING Action49)> */ + /* 32 literalListString <- <(_ STRING Action52)> */ func() bool { - position361, tokenIndex361, depth361 := position, tokenIndex, depth + position515, tokenIndex515, depth515 := position, tokenIndex, depth { - position362 := position + position516 := position depth++ if !_rules[rule_]() { - goto l361 + goto l515 } if !_rules[ruleSTRING]() { - goto l361 + goto l515 } { - add(ruleAction49, position) + add(ruleAction52, position) } depth-- - add(ruleliteralListString, position362) + add(ruleliteralListString, position516) } return true - l361: - position, tokenIndex, depth = position361, tokenIndex361, depth361 + l515: + position, tokenIndex, depth = position515, tokenIndex515, depth515 return false }, - /* 33 tagName <- <(_ Action50)> */ + /* 33 tagName <- <(_ Action53)> */ func() bool { - position364, tokenIndex364, depth364 := position, tokenIndex, depth + position518, tokenIndex518, depth518 := position, tokenIndex, depth { - position365 := position + position519 := position depth++ if !_rules[rule_]() { - goto l364 + goto l518 } { - position366 := position + position520 := position depth++ { - position367 := position + position521 := position depth++ if !_rules[ruleIDENTIFIER]() { - goto l364 + goto l518 } depth-- - add(ruleTAG_NAME, position367) + add(ruleTAG_NAME, position521) } depth-- - add(rulePegText, position366) + add(rulePegText, position520) } { - add(ruleAction50, position) + add(ruleAction53, position) } depth-- - add(ruletagName, position365) + add(ruletagName, position519) } return true - l364: - position, tokenIndex, depth = position364, tokenIndex364, depth364 + l518: + position, tokenIndex, depth = position518, tokenIndex518, depth518 return false }, /* 34 COLUMN_NAME <- */ func() bool { - position369, tokenIndex369, depth369 := position, tokenIndex, depth + position523, tokenIndex523, depth523 := position, tokenIndex, depth { - position370 := position + position524 := position depth++ if !_rules[ruleIDENTIFIER]() { - goto l369 + goto l523 } depth-- - add(ruleCOLUMN_NAME, position370) + add(ruleCOLUMN_NAME, position524) } return true - l369: - position, tokenIndex, depth = position369, tokenIndex369, depth369 + l523: + position, tokenIndex, depth = position523, tokenIndex523, depth523 return false }, /* 35 METRIC_NAME <- */ nil, /* 36 TAG_NAME <- */ nil, - /* 37 IDENTIFIER <- <(('`' CHAR* '`') / (_ !(KEYWORD KEY) ID_SEGMENT ('.' ID_SEGMENT)*))> */ + /* 37 IDENTIFIER <- <(('`' CHAR* ('`' / &{ p.errorHere(position, "expected \"`\" to end identifier") })) / (!(KEYWORD KEY) ID_SEGMENT ('.' (ID_SEGMENT / &{ p.errorHere(position, `expected identifier segment to follow "."`) }))*))> */ func() bool { - position373, tokenIndex373, depth373 := position, tokenIndex, depth + position527, tokenIndex527, depth527 := position, tokenIndex, depth { - position374 := position + position528 := position depth++ { - position375, tokenIndex375, depth375 := position, tokenIndex, depth + position529, tokenIndex529, depth529 := position, tokenIndex, depth if buffer[position] != rune('`') { - goto l376 + goto l530 } position++ - l377: + l531: { - position378, tokenIndex378, depth378 := position, tokenIndex, depth + position532, tokenIndex532, depth532 := position, tokenIndex, depth if !_rules[ruleCHAR]() { - goto l378 + goto l532 } - goto l377 - l378: - position, tokenIndex, depth = position378, tokenIndex378, depth378 - } - if buffer[position] != rune('`') { - goto l376 + goto l531 + l532: + position, tokenIndex, depth = position532, tokenIndex532, depth532 } - position++ - goto l375 - l376: - position, tokenIndex, depth = position375, tokenIndex375, depth375 - if !_rules[rule_]() { - goto l373 + { + position533, tokenIndex533, depth533 := position, tokenIndex, depth + if buffer[position] != rune('`') { + goto l534 + } + position++ + goto l533 + l534: + position, tokenIndex, depth = position533, tokenIndex533, depth533 + if !(p.errorHere(position, "expected \"`\" to end identifier")) { + goto l530 + } } + l533: + goto l529 + l530: + position, tokenIndex, depth = position529, tokenIndex529, depth529 { - position379, tokenIndex379, depth379 := position, tokenIndex, depth + position535, tokenIndex535, depth535 := position, tokenIndex, depth { - position380 := position + position536 := position depth++ { - position381, tokenIndex381, depth381 := position, tokenIndex, depth + position537, tokenIndex537, depth537 := position, tokenIndex, depth { - position383, tokenIndex383, depth383 := position, tokenIndex, depth + position539, tokenIndex539, depth539 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l384 + goto l540 } position++ - goto l383 - l384: - position, tokenIndex, depth = position383, tokenIndex383, depth383 + goto l539 + l540: + position, tokenIndex, depth = position539, tokenIndex539, depth539 if buffer[position] != rune('A') { - goto l382 + goto l538 } position++ } - l383: + l539: { - position385, tokenIndex385, depth385 := position, tokenIndex, depth + position541, tokenIndex541, depth541 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l386 + goto l542 } position++ - goto l385 - l386: - position, tokenIndex, depth = position385, tokenIndex385, depth385 + goto l541 + l542: + position, tokenIndex, depth = position541, tokenIndex541, depth541 if buffer[position] != rune('L') { - goto l382 + goto l538 } position++ } - l385: + l541: { - position387, tokenIndex387, depth387 := position, tokenIndex, depth + position543, tokenIndex543, depth543 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l388 + goto l544 } position++ - goto l387 - l388: - position, tokenIndex, depth = position387, tokenIndex387, depth387 + goto l543 + l544: + position, tokenIndex, depth = position543, tokenIndex543, depth543 if buffer[position] != rune('L') { - goto l382 + goto l538 } position++ } - l387: - goto l381 - l382: - position, tokenIndex, depth = position381, tokenIndex381, depth381 + l543: + goto l537 + l538: + position, tokenIndex, depth = position537, tokenIndex537, depth537 { - position390, tokenIndex390, depth390 := position, tokenIndex, depth + position546, tokenIndex546, depth546 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l391 + goto l547 } position++ - goto l390 - l391: - position, tokenIndex, depth = position390, tokenIndex390, depth390 + goto l546 + l547: + position, tokenIndex, depth = position546, tokenIndex546, depth546 if buffer[position] != rune('A') { - goto l389 + goto l545 } position++ } - l390: + l546: { - position392, tokenIndex392, depth392 := position, tokenIndex, depth + position548, tokenIndex548, depth548 := position, tokenIndex, depth if buffer[position] != rune('n') { - goto l393 + goto l549 } position++ - goto l392 - l393: - position, tokenIndex, depth = position392, tokenIndex392, depth392 + goto l548 + l549: + position, tokenIndex, depth = position548, tokenIndex548, depth548 if buffer[position] != rune('N') { - goto l389 + goto l545 } position++ } - l392: + l548: { - position394, tokenIndex394, depth394 := position, tokenIndex, depth + position550, tokenIndex550, depth550 := position, tokenIndex, depth if buffer[position] != rune('d') { - goto l395 + goto l551 } position++ - goto l394 - l395: - position, tokenIndex, depth = position394, tokenIndex394, depth394 + goto l550 + l551: + position, tokenIndex, depth = position550, tokenIndex550, depth550 if buffer[position] != rune('D') { - goto l389 + goto l545 } position++ } - l394: - goto l381 - l389: - position, tokenIndex, depth = position381, tokenIndex381, depth381 + l550: + goto l537 + l545: + position, tokenIndex, depth = position537, tokenIndex537, depth537 { - position397, tokenIndex397, depth397 := position, tokenIndex, depth + position553, tokenIndex553, depth553 := position, tokenIndex, depth if buffer[position] != rune('m') { - goto l398 + goto l554 } position++ - goto l397 - l398: - position, tokenIndex, depth = position397, tokenIndex397, depth397 + goto l553 + l554: + position, tokenIndex, depth = position553, tokenIndex553, depth553 if buffer[position] != rune('M') { - goto l396 + goto l552 } position++ } - l397: + l553: { - position399, tokenIndex399, depth399 := position, tokenIndex, depth + position555, tokenIndex555, depth555 := position, tokenIndex, depth if buffer[position] != rune('a') { - goto l400 + goto l556 } position++ - goto l399 - l400: - position, tokenIndex, depth = position399, tokenIndex399, depth399 + goto l555 + l556: + position, tokenIndex, depth = position555, tokenIndex555, depth555 if buffer[position] != rune('A') { - goto l396 + goto l552 } position++ } - l399: + l555: { - position401, tokenIndex401, depth401 := position, tokenIndex, depth + position557, tokenIndex557, depth557 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l402 + goto l558 } position++ - goto l401 - l402: - position, tokenIndex, depth = position401, tokenIndex401, depth401 + goto l557 + l558: + position, tokenIndex, depth = position557, tokenIndex557, depth557 if buffer[position] != rune('T') { - goto l396 + goto l552 } position++ } - l401: + l557: { - position403, tokenIndex403, depth403 := position, tokenIndex, depth + position559, tokenIndex559, depth559 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l404 + goto l560 } position++ - goto l403 - l404: - position, tokenIndex, depth = position403, tokenIndex403, depth403 + goto l559 + l560: + position, tokenIndex, depth = position559, tokenIndex559, depth559 if buffer[position] != rune('C') { - goto l396 + goto l552 } position++ } - l403: + l559: { - position405, tokenIndex405, depth405 := position, tokenIndex, depth + position561, tokenIndex561, depth561 := position, tokenIndex, depth if buffer[position] != rune('h') { - goto l406 + goto l562 } position++ - goto l405 - l406: - position, tokenIndex, depth = position405, tokenIndex405, depth405 + goto l561 + l562: + position, tokenIndex, depth = position561, tokenIndex561, depth561 if buffer[position] != rune('H') { - goto l396 + goto l552 } position++ } - l405: - goto l381 - l396: - position, tokenIndex, depth = position381, tokenIndex381, depth381 + l561: + goto l537 + l552: + position, tokenIndex, depth = position537, tokenIndex537, depth537 { - position408, tokenIndex408, depth408 := position, tokenIndex, depth + position564, tokenIndex564, depth564 := position, tokenIndex, depth if buffer[position] != rune('s') { - goto l409 + goto l565 } position++ - goto l408 - l409: - position, tokenIndex, depth = position408, tokenIndex408, depth408 + goto l564 + l565: + position, tokenIndex, depth = position564, tokenIndex564, depth564 if buffer[position] != rune('S') { - goto l407 + goto l563 } position++ } - l408: + l564: { - position410, tokenIndex410, depth410 := position, tokenIndex, depth + position566, tokenIndex566, depth566 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l411 + goto l567 } position++ - goto l410 - l411: - position, tokenIndex, depth = position410, tokenIndex410, depth410 + goto l566 + l567: + position, tokenIndex, depth = position566, tokenIndex566, depth566 if buffer[position] != rune('E') { - goto l407 + goto l563 } position++ } - l410: + l566: { - position412, tokenIndex412, depth412 := position, tokenIndex, depth + position568, tokenIndex568, depth568 := position, tokenIndex, depth if buffer[position] != rune('l') { - goto l413 + goto l569 } position++ - goto l412 - l413: - position, tokenIndex, depth = position412, tokenIndex412, depth412 + goto l568 + l569: + position, tokenIndex, depth = position568, tokenIndex568, depth568 if buffer[position] != rune('L') { - goto l407 + goto l563 } position++ } - l412: + l568: { - position414, tokenIndex414, depth414 := position, tokenIndex, depth + position570, tokenIndex570, depth570 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l415 + goto l571 } position++ - goto l414 - l415: - position, tokenIndex, depth = position414, tokenIndex414, depth414 + goto l570 + l571: + position, tokenIndex, depth = position570, tokenIndex570, depth570 if buffer[position] != rune('E') { - goto l407 + goto l563 } position++ } - l414: + l570: { - position416, tokenIndex416, depth416 := position, tokenIndex, depth + position572, tokenIndex572, depth572 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l417 + goto l573 } position++ - goto l416 - l417: - position, tokenIndex, depth = position416, tokenIndex416, depth416 + goto l572 + l573: + position, tokenIndex, depth = position572, tokenIndex572, depth572 if buffer[position] != rune('C') { - goto l407 + goto l563 } position++ } - l416: + l572: { - position418, tokenIndex418, depth418 := position, tokenIndex, depth + position574, tokenIndex574, depth574 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l419 + goto l575 } position++ - goto l418 - l419: - position, tokenIndex, depth = position418, tokenIndex418, depth418 + goto l574 + l575: + position, tokenIndex, depth = position574, tokenIndex574, depth574 if buffer[position] != rune('T') { - goto l407 + goto l563 } position++ } - l418: - goto l381 - l407: - position, tokenIndex, depth = position381, tokenIndex381, depth381 + l574: + goto l537 + l563: + position, tokenIndex, depth = position537, tokenIndex537, depth537 { switch buffer[position] { - case 'M', 'm': + case 'S', 's': { - position421, tokenIndex421, depth421 := position, tokenIndex, depth - if buffer[position] != rune('m') { - goto l422 + position577, tokenIndex577, depth577 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l578 } position++ - goto l421 - l422: - position, tokenIndex, depth = position421, tokenIndex421, depth421 - if buffer[position] != rune('M') { - goto l379 + goto l577 + l578: + position, tokenIndex, depth = position577, tokenIndex577, depth577 + if buffer[position] != rune('S') { + goto l535 } position++ } - l421: + l577: { - position423, tokenIndex423, depth423 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l424 + position579, tokenIndex579, depth579 := position, tokenIndex, depth + if buffer[position] != rune('a') { + goto l580 } position++ - goto l423 - l424: - position, tokenIndex, depth = position423, tokenIndex423, depth423 - if buffer[position] != rune('E') { - goto l379 + goto l579 + l580: + position, tokenIndex, depth = position579, tokenIndex579, depth579 + if buffer[position] != rune('A') { + goto l535 } position++ } - l423: + l579: { - position425, tokenIndex425, depth425 := position, tokenIndex, depth - if buffer[position] != rune('t') { - goto l426 + position581, tokenIndex581, depth581 := position, tokenIndex, depth + if buffer[position] != rune('m') { + goto l582 } position++ - goto l425 - l426: - position, tokenIndex, depth = position425, tokenIndex425, depth425 - if buffer[position] != rune('T') { - goto l379 + goto l581 + l582: + position, tokenIndex, depth = position581, tokenIndex581, depth581 + if buffer[position] != rune('M') { + goto l535 } position++ } - l425: + l581: { - position427, tokenIndex427, depth427 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l428 + position583, tokenIndex583, depth583 := position, tokenIndex, depth + if buffer[position] != rune('p') { + goto l584 } position++ - goto l427 - l428: - position, tokenIndex, depth = position427, tokenIndex427, depth427 - if buffer[position] != rune('R') { - goto l379 + goto l583 + l584: + position, tokenIndex, depth = position583, tokenIndex583, depth583 + if buffer[position] != rune('P') { + goto l535 } position++ } - l427: + l583: { - position429, tokenIndex429, depth429 := position, tokenIndex, depth - if buffer[position] != rune('i') { - goto l430 + position585, tokenIndex585, depth585 := position, tokenIndex, depth + if buffer[position] != rune('l') { + goto l586 } position++ - goto l429 - l430: - position, tokenIndex, depth = position429, tokenIndex429, depth429 - if buffer[position] != rune('I') { - goto l379 + goto l585 + l586: + position, tokenIndex, depth = position585, tokenIndex585, depth585 + if buffer[position] != rune('L') { + goto l535 } position++ } - l429: + l585: { - position431, tokenIndex431, depth431 := position, tokenIndex, depth - if buffer[position] != rune('c') { - goto l432 + position587, tokenIndex587, depth587 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l588 } position++ - goto l431 - l432: - position, tokenIndex, depth = position431, tokenIndex431, depth431 - if buffer[position] != rune('C') { - goto l379 + goto l587 + l588: + position, tokenIndex, depth = position587, tokenIndex587, depth587 + if buffer[position] != rune('E') { + goto l535 } position++ } - l431: + l587: + break + case 'R', 'r': { - position433, tokenIndex433, depth433 := position, tokenIndex, depth - if buffer[position] != rune('s') { - goto l434 + position589, tokenIndex589, depth589 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l590 } position++ - goto l433 - l434: - position, tokenIndex, depth = position433, tokenIndex433, depth433 - if buffer[position] != rune('S') { - goto l379 + goto l589 + l590: + position, tokenIndex, depth = position589, tokenIndex589, depth589 + if buffer[position] != rune('R') { + goto l535 } position++ } - l433: - break - case 'W', 'w': + l589: { - position435, tokenIndex435, depth435 := position, tokenIndex, depth - if buffer[position] != rune('w') { - goto l436 + position591, tokenIndex591, depth591 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l592 } position++ - goto l435 - l436: - position, tokenIndex, depth = position435, tokenIndex435, depth435 - if buffer[position] != rune('W') { - goto l379 + goto l591 + l592: + position, tokenIndex, depth = position591, tokenIndex591, depth591 + if buffer[position] != rune('E') { + goto l535 } position++ } - l435: + l591: { - position437, tokenIndex437, depth437 := position, tokenIndex, depth - if buffer[position] != rune('h') { - goto l438 + position593, tokenIndex593, depth593 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l594 } position++ - goto l437 - l438: - position, tokenIndex, depth = position437, tokenIndex437, depth437 - if buffer[position] != rune('H') { - goto l379 + goto l593 + l594: + position, tokenIndex, depth = position593, tokenIndex593, depth593 + if buffer[position] != rune('S') { + goto l535 } position++ } - l437: + l593: { - position439, tokenIndex439, depth439 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l440 + position595, tokenIndex595, depth595 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l596 } position++ - goto l439 - l440: - position, tokenIndex, depth = position439, tokenIndex439, depth439 - if buffer[position] != rune('E') { - goto l379 + goto l595 + l596: + position, tokenIndex, depth = position595, tokenIndex595, depth595 + if buffer[position] != rune('O') { + goto l535 } position++ } - l439: + l595: { - position441, tokenIndex441, depth441 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l442 + position597, tokenIndex597, depth597 := position, tokenIndex, depth + if buffer[position] != rune('l') { + goto l598 } position++ - goto l441 - l442: - position, tokenIndex, depth = position441, tokenIndex441, depth441 - if buffer[position] != rune('R') { - goto l379 + goto l597 + l598: + position, tokenIndex, depth = position597, tokenIndex597, depth597 + if buffer[position] != rune('L') { + goto l535 } position++ } - l441: + l597: { - position443, tokenIndex443, depth443 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l444 + position599, tokenIndex599, depth599 := position, tokenIndex, depth + if buffer[position] != rune('u') { + goto l600 } position++ - goto l443 - l444: - position, tokenIndex, depth = position443, tokenIndex443, depth443 - if buffer[position] != rune('E') { - goto l379 + goto l599 + l600: + position, tokenIndex, depth = position599, tokenIndex599, depth599 + if buffer[position] != rune('U') { + goto l535 } position++ } - l443: - break - case 'O', 'o': + l599: { - position445, tokenIndex445, depth445 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l446 + position601, tokenIndex601, depth601 := position, tokenIndex, depth + if buffer[position] != rune('t') { + goto l602 } position++ - goto l445 - l446: - position, tokenIndex, depth = position445, tokenIndex445, depth445 - if buffer[position] != rune('O') { - goto l379 + goto l601 + l602: + position, tokenIndex, depth = position601, tokenIndex601, depth601 + if buffer[position] != rune('T') { + goto l535 } position++ } - l445: + l601: { - position447, tokenIndex447, depth447 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l448 + position603, tokenIndex603, depth603 := position, tokenIndex, depth + if buffer[position] != rune('i') { + goto l604 } position++ - goto l447 - l448: - position, tokenIndex, depth = position447, tokenIndex447, depth447 - if buffer[position] != rune('R') { - goto l379 + goto l603 + l604: + position, tokenIndex, depth = position603, tokenIndex603, depth603 + if buffer[position] != rune('I') { + goto l535 } position++ } - l447: - break - case 'N', 'n': + l603: { - position449, tokenIndex449, depth449 := position, tokenIndex, depth - if buffer[position] != rune('n') { - goto l450 + position605, tokenIndex605, depth605 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l606 } position++ - goto l449 - l450: - position, tokenIndex, depth = position449, tokenIndex449, depth449 - if buffer[position] != rune('N') { - goto l379 + goto l605 + l606: + position, tokenIndex, depth = position605, tokenIndex605, depth605 + if buffer[position] != rune('O') { + goto l535 } position++ } - l449: + l605: { - position451, tokenIndex451, depth451 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l452 + position607, tokenIndex607, depth607 := position, tokenIndex, depth + if buffer[position] != rune('n') { + goto l608 } position++ - goto l451 - l452: - position, tokenIndex, depth = position451, tokenIndex451, depth451 - if buffer[position] != rune('O') { - goto l379 + goto l607 + l608: + position, tokenIndex, depth = position607, tokenIndex607, depth607 + if buffer[position] != rune('N') { + goto l535 } position++ } - l451: + l607: + break + case 'T', 't': { - position453, tokenIndex453, depth453 := position, tokenIndex, depth + position609, tokenIndex609, depth609 := position, tokenIndex, depth if buffer[position] != rune('t') { - goto l454 + goto l610 } position++ - goto l453 - l454: - position, tokenIndex, depth = position453, tokenIndex453, depth453 + goto l609 + l610: + position, tokenIndex, depth = position609, tokenIndex609, depth609 if buffer[position] != rune('T') { - goto l379 + goto l535 } position++ } - l453: - break - case 'I', 'i': + l609: { - position455, tokenIndex455, depth455 := position, tokenIndex, depth - if buffer[position] != rune('i') { - goto l456 + position611, tokenIndex611, depth611 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l612 } position++ - goto l455 - l456: - position, tokenIndex, depth = position455, tokenIndex455, depth455 - if buffer[position] != rune('I') { - goto l379 + goto l611 + l612: + position, tokenIndex, depth = position611, tokenIndex611, depth611 + if buffer[position] != rune('O') { + goto l535 } position++ } - l455: + l611: + break + case 'F', 'f': { - position457, tokenIndex457, depth457 := position, tokenIndex, depth - if buffer[position] != rune('n') { - goto l458 + position613, tokenIndex613, depth613 := position, tokenIndex, depth + if buffer[position] != rune('f') { + goto l614 } position++ - goto l457 - l458: - position, tokenIndex, depth = position457, tokenIndex457, depth457 - if buffer[position] != rune('N') { - goto l379 + goto l613 + l614: + position, tokenIndex, depth = position613, tokenIndex613, depth613 + if buffer[position] != rune('F') { + goto l535 } position++ } - l457: - break - case 'C', 'c': + l613: { - position459, tokenIndex459, depth459 := position, tokenIndex, depth - if buffer[position] != rune('c') { - goto l460 + position615, tokenIndex615, depth615 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l616 } position++ - goto l459 - l460: - position, tokenIndex, depth = position459, tokenIndex459, depth459 - if buffer[position] != rune('C') { - goto l379 + goto l615 + l616: + position, tokenIndex, depth = position615, tokenIndex615, depth615 + if buffer[position] != rune('R') { + goto l535 } position++ } - l459: + l615: { - position461, tokenIndex461, depth461 := position, tokenIndex, depth + position617, tokenIndex617, depth617 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l462 + goto l618 } position++ - goto l461 - l462: - position, tokenIndex, depth = position461, tokenIndex461, depth461 + goto l617 + l618: + position, tokenIndex, depth = position617, tokenIndex617, depth617 if buffer[position] != rune('O') { - goto l379 + goto l535 } position++ } - l461: + l617: { - position463, tokenIndex463, depth463 := position, tokenIndex, depth - if buffer[position] != rune('l') { - goto l464 + position619, tokenIndex619, depth619 := position, tokenIndex, depth + if buffer[position] != rune('m') { + goto l620 } position++ - goto l463 - l464: - position, tokenIndex, depth = position463, tokenIndex463, depth463 - if buffer[position] != rune('L') { - goto l379 + goto l619 + l620: + position, tokenIndex, depth = position619, tokenIndex619, depth619 + if buffer[position] != rune('M') { + goto l535 } position++ } - l463: + l619: + break + case 'M', 'm': { - position465, tokenIndex465, depth465 := position, tokenIndex, depth - if buffer[position] != rune('l') { - goto l466 + position621, tokenIndex621, depth621 := position, tokenIndex, depth + if buffer[position] != rune('m') { + goto l622 } position++ - goto l465 - l466: - position, tokenIndex, depth = position465, tokenIndex465, depth465 - if buffer[position] != rune('L') { - goto l379 + goto l621 + l622: + position, tokenIndex, depth = position621, tokenIndex621, depth621 + if buffer[position] != rune('M') { + goto l535 } position++ } - l465: + l621: { - position467, tokenIndex467, depth467 := position, tokenIndex, depth - if buffer[position] != rune('a') { - goto l468 + position623, tokenIndex623, depth623 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l624 } position++ - goto l467 - l468: - position, tokenIndex, depth = position467, tokenIndex467, depth467 - if buffer[position] != rune('A') { - goto l379 + goto l623 + l624: + position, tokenIndex, depth = position623, tokenIndex623, depth623 + if buffer[position] != rune('E') { + goto l535 } position++ } - l467: + l623: { - position469, tokenIndex469, depth469 := position, tokenIndex, depth - if buffer[position] != rune('p') { - goto l470 + position625, tokenIndex625, depth625 := position, tokenIndex, depth + if buffer[position] != rune('t') { + goto l626 } position++ - goto l469 - l470: - position, tokenIndex, depth = position469, tokenIndex469, depth469 - if buffer[position] != rune('P') { - goto l379 + goto l625 + l626: + position, tokenIndex, depth = position625, tokenIndex625, depth625 + if buffer[position] != rune('T') { + goto l535 } position++ } - l469: + l625: { - position471, tokenIndex471, depth471 := position, tokenIndex, depth - if buffer[position] != rune('s') { - goto l472 + position627, tokenIndex627, depth627 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l628 } position++ - goto l471 - l472: - position, tokenIndex, depth = position471, tokenIndex471, depth471 - if buffer[position] != rune('S') { - goto l379 + goto l627 + l628: + position, tokenIndex, depth = position627, tokenIndex627, depth627 + if buffer[position] != rune('R') { + goto l535 } position++ } - l471: + l627: { - position473, tokenIndex473, depth473 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l474 + position629, tokenIndex629, depth629 := position, tokenIndex, depth + if buffer[position] != rune('i') { + goto l630 } position++ - goto l473 - l474: - position, tokenIndex, depth = position473, tokenIndex473, depth473 - if buffer[position] != rune('E') { - goto l379 + goto l629 + l630: + position, tokenIndex, depth = position629, tokenIndex629, depth629 + if buffer[position] != rune('I') { + goto l535 + } + position++ + } + l629: + { + position631, tokenIndex631, depth631 := position, tokenIndex, depth + if buffer[position] != rune('c') { + goto l632 + } + position++ + goto l631 + l632: + position, tokenIndex, depth = position631, tokenIndex631, depth631 + if buffer[position] != rune('C') { + goto l535 } position++ } - l473: + l631: + { + position633, tokenIndex633, depth633 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l634 + } + position++ + goto l633 + l634: + position, tokenIndex, depth = position633, tokenIndex633, depth633 + if buffer[position] != rune('S') { + goto l535 + } + position++ + } + l633: break - case 'G', 'g': + case 'W', 'w': { - position475, tokenIndex475, depth475 := position, tokenIndex, depth - if buffer[position] != rune('g') { - goto l476 + position635, tokenIndex635, depth635 := position, tokenIndex, depth + if buffer[position] != rune('w') { + goto l636 } position++ - goto l475 - l476: - position, tokenIndex, depth = position475, tokenIndex475, depth475 - if buffer[position] != rune('G') { - goto l379 + goto l635 + l636: + position, tokenIndex, depth = position635, tokenIndex635, depth635 + if buffer[position] != rune('W') { + goto l535 + } + position++ + } + l635: + { + position637, tokenIndex637, depth637 := position, tokenIndex, depth + if buffer[position] != rune('h') { + goto l638 + } + position++ + goto l637 + l638: + position, tokenIndex, depth = position637, tokenIndex637, depth637 + if buffer[position] != rune('H') { + goto l535 + } + position++ + } + l637: + { + position639, tokenIndex639, depth639 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l640 + } + position++ + goto l639 + l640: + position, tokenIndex, depth = position639, tokenIndex639, depth639 + if buffer[position] != rune('E') { + goto l535 } position++ } - l475: + l639: { - position477, tokenIndex477, depth477 := position, tokenIndex, depth + position641, tokenIndex641, depth641 := position, tokenIndex, depth if buffer[position] != rune('r') { - goto l478 + goto l642 } position++ - goto l477 - l478: - position, tokenIndex, depth = position477, tokenIndex477, depth477 + goto l641 + l642: + position, tokenIndex, depth = position641, tokenIndex641, depth641 if buffer[position] != rune('R') { - goto l379 + goto l535 } position++ } - l477: + l641: { - position479, tokenIndex479, depth479 := position, tokenIndex, depth + position643, tokenIndex643, depth643 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l644 + } + position++ + goto l643 + l644: + position, tokenIndex, depth = position643, tokenIndex643, depth643 + if buffer[position] != rune('E') { + goto l535 + } + position++ + } + l643: + break + case 'O', 'o': + { + position645, tokenIndex645, depth645 := position, tokenIndex, depth if buffer[position] != rune('o') { - goto l480 + goto l646 } position++ - goto l479 - l480: - position, tokenIndex, depth = position479, tokenIndex479, depth479 + goto l645 + l646: + position, tokenIndex, depth = position645, tokenIndex645, depth645 if buffer[position] != rune('O') { - goto l379 + goto l535 } position++ } - l479: + l645: { - position481, tokenIndex481, depth481 := position, tokenIndex, depth - if buffer[position] != rune('u') { - goto l482 + position647, tokenIndex647, depth647 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l648 } position++ - goto l481 - l482: - position, tokenIndex, depth = position481, tokenIndex481, depth481 - if buffer[position] != rune('U') { - goto l379 + goto l647 + l648: + position, tokenIndex, depth = position647, tokenIndex647, depth647 + if buffer[position] != rune('R') { + goto l535 } position++ } - l481: + l647: + break + case 'N', 'n': { - position483, tokenIndex483, depth483 := position, tokenIndex, depth - if buffer[position] != rune('p') { - goto l484 + position649, tokenIndex649, depth649 := position, tokenIndex, depth + if buffer[position] != rune('n') { + goto l650 } position++ - goto l483 - l484: - position, tokenIndex, depth = position483, tokenIndex483, depth483 - if buffer[position] != rune('P') { - goto l379 + goto l649 + l650: + position, tokenIndex, depth = position649, tokenIndex649, depth649 + if buffer[position] != rune('N') { + goto l535 } position++ } - l483: - break - case 'D', 'd': + l649: { - position485, tokenIndex485, depth485 := position, tokenIndex, depth - if buffer[position] != rune('d') { - goto l486 + position651, tokenIndex651, depth651 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l652 } position++ - goto l485 - l486: - position, tokenIndex, depth = position485, tokenIndex485, depth485 - if buffer[position] != rune('D') { - goto l379 + goto l651 + l652: + position, tokenIndex, depth = position651, tokenIndex651, depth651 + if buffer[position] != rune('O') { + goto l535 } position++ } - l485: + l651: { - position487, tokenIndex487, depth487 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l488 + position653, tokenIndex653, depth653 := position, tokenIndex, depth + if buffer[position] != rune('t') { + goto l654 } position++ - goto l487 - l488: - position, tokenIndex, depth = position487, tokenIndex487, depth487 - if buffer[position] != rune('E') { - goto l379 + goto l653 + l654: + position, tokenIndex, depth = position653, tokenIndex653, depth653 + if buffer[position] != rune('T') { + goto l535 } position++ } - l487: + l653: + break + case 'I', 'i': { - position489, tokenIndex489, depth489 := position, tokenIndex, depth - if buffer[position] != rune('s') { - goto l490 + position655, tokenIndex655, depth655 := position, tokenIndex, depth + if buffer[position] != rune('i') { + goto l656 } position++ - goto l489 - l490: - position, tokenIndex, depth = position489, tokenIndex489, depth489 - if buffer[position] != rune('S') { - goto l379 + goto l655 + l656: + position, tokenIndex, depth = position655, tokenIndex655, depth655 + if buffer[position] != rune('I') { + goto l535 + } + position++ + } + l655: + { + position657, tokenIndex657, depth657 := position, tokenIndex, depth + if buffer[position] != rune('n') { + goto l658 + } + position++ + goto l657 + l658: + position, tokenIndex, depth = position657, tokenIndex657, depth657 + if buffer[position] != rune('N') { + goto l535 } position++ } - l489: + l657: + break + case 'C', 'c': { - position491, tokenIndex491, depth491 := position, tokenIndex, depth + position659, tokenIndex659, depth659 := position, tokenIndex, depth if buffer[position] != rune('c') { - goto l492 + goto l660 } position++ - goto l491 - l492: - position, tokenIndex, depth = position491, tokenIndex491, depth491 + goto l659 + l660: + position, tokenIndex, depth = position659, tokenIndex659, depth659 if buffer[position] != rune('C') { - goto l379 + goto l535 } position++ } - l491: + l659: { - position493, tokenIndex493, depth493 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l494 + position661, tokenIndex661, depth661 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l662 } position++ - goto l493 - l494: - position, tokenIndex, depth = position493, tokenIndex493, depth493 - if buffer[position] != rune('R') { - goto l379 + goto l661 + l662: + position, tokenIndex, depth = position661, tokenIndex661, depth661 + if buffer[position] != rune('O') { + goto l535 } position++ } - l493: + l661: { - position495, tokenIndex495, depth495 := position, tokenIndex, depth - if buffer[position] != rune('i') { - goto l496 + position663, tokenIndex663, depth663 := position, tokenIndex, depth + if buffer[position] != rune('l') { + goto l664 } position++ - goto l495 - l496: - position, tokenIndex, depth = position495, tokenIndex495, depth495 - if buffer[position] != rune('I') { - goto l379 + goto l663 + l664: + position, tokenIndex, depth = position663, tokenIndex663, depth663 + if buffer[position] != rune('L') { + goto l535 } position++ } - l495: + l663: { - position497, tokenIndex497, depth497 := position, tokenIndex, depth - if buffer[position] != rune('b') { - goto l498 + position665, tokenIndex665, depth665 := position, tokenIndex, depth + if buffer[position] != rune('l') { + goto l666 } position++ - goto l497 - l498: - position, tokenIndex, depth = position497, tokenIndex497, depth497 - if buffer[position] != rune('B') { - goto l379 + goto l665 + l666: + position, tokenIndex, depth = position665, tokenIndex665, depth665 + if buffer[position] != rune('L') { + goto l535 + } + position++ + } + l665: + { + position667, tokenIndex667, depth667 := position, tokenIndex, depth + if buffer[position] != rune('a') { + goto l668 + } + position++ + goto l667 + l668: + position, tokenIndex, depth = position667, tokenIndex667, depth667 + if buffer[position] != rune('A') { + goto l535 + } + position++ + } + l667: + { + position669, tokenIndex669, depth669 := position, tokenIndex, depth + if buffer[position] != rune('p') { + goto l670 + } + position++ + goto l669 + l670: + position, tokenIndex, depth = position669, tokenIndex669, depth669 + if buffer[position] != rune('P') { + goto l535 } position++ } - l497: + l669: { - position499, tokenIndex499, depth499 := position, tokenIndex, depth + position671, tokenIndex671, depth671 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l672 + } + position++ + goto l671 + l672: + position, tokenIndex, depth = position671, tokenIndex671, depth671 + if buffer[position] != rune('S') { + goto l535 + } + position++ + } + l671: + { + position673, tokenIndex673, depth673 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l500 + goto l674 } position++ - goto l499 - l500: - position, tokenIndex, depth = position499, tokenIndex499, depth499 + goto l673 + l674: + position, tokenIndex, depth = position673, tokenIndex673, depth673 if buffer[position] != rune('E') { - goto l379 + goto l535 } position++ } - l499: + l673: break - case 'B', 'b': + case 'G', 'g': { - position501, tokenIndex501, depth501 := position, tokenIndex, depth - if buffer[position] != rune('b') { - goto l502 + position675, tokenIndex675, depth675 := position, tokenIndex, depth + if buffer[position] != rune('g') { + goto l676 } position++ - goto l501 - l502: - position, tokenIndex, depth = position501, tokenIndex501, depth501 - if buffer[position] != rune('B') { - goto l379 + goto l675 + l676: + position, tokenIndex, depth = position675, tokenIndex675, depth675 + if buffer[position] != rune('G') { + goto l535 } position++ } - l501: + l675: { - position503, tokenIndex503, depth503 := position, tokenIndex, depth - if buffer[position] != rune('y') { - goto l504 + position677, tokenIndex677, depth677 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l678 } position++ - goto l503 - l504: - position, tokenIndex, depth = position503, tokenIndex503, depth503 - if buffer[position] != rune('Y') { - goto l379 + goto l677 + l678: + position, tokenIndex, depth = position677, tokenIndex677, depth677 + if buffer[position] != rune('R') { + goto l535 } position++ } - l503: - break - case 'A', 'a': + l677: { - position505, tokenIndex505, depth505 := position, tokenIndex, depth - if buffer[position] != rune('a') { - goto l506 + position679, tokenIndex679, depth679 := position, tokenIndex, depth + if buffer[position] != rune('o') { + goto l680 } position++ - goto l505 - l506: - position, tokenIndex, depth = position505, tokenIndex505, depth505 - if buffer[position] != rune('A') { - goto l379 + goto l679 + l680: + position, tokenIndex, depth = position679, tokenIndex679, depth679 + if buffer[position] != rune('O') { + goto l535 } position++ } - l505: + l679: { - position507, tokenIndex507, depth507 := position, tokenIndex, depth - if buffer[position] != rune('s') { - goto l508 + position681, tokenIndex681, depth681 := position, tokenIndex, depth + if buffer[position] != rune('u') { + goto l682 } position++ - goto l507 - l508: - position, tokenIndex, depth = position507, tokenIndex507, depth507 - if buffer[position] != rune('S') { - goto l379 + goto l681 + l682: + position, tokenIndex, depth = position681, tokenIndex681, depth681 + if buffer[position] != rune('U') { + goto l535 } position++ } - l507: - break - default: - if !_rules[rulePROPERTY_KEY]() { - goto l379 + l681: + { + position683, tokenIndex683, depth683 := position, tokenIndex, depth + if buffer[position] != rune('p') { + goto l684 + } + position++ + goto l683 + l684: + position, tokenIndex, depth = position683, tokenIndex683, depth683 + if buffer[position] != rune('P') { + goto l535 + } + position++ } + l683: break - } - } - - } - l381: - depth-- - add(ruleKEYWORD, position380) - } - if !_rules[ruleKEY]() { - goto l379 - } - goto l373 - l379: - position, tokenIndex, depth = position379, tokenIndex379, depth379 - } - if !_rules[ruleID_SEGMENT]() { - goto l373 - } - l509: - { - position510, tokenIndex510, depth510 := position, tokenIndex, depth - if buffer[position] != rune('.') { - goto l510 - } - position++ - if !_rules[ruleID_SEGMENT]() { - goto l510 - } - goto l509 - l510: - position, tokenIndex, depth = position510, tokenIndex510, depth510 - } - } - l375: - depth-- - add(ruleIDENTIFIER, position374) - } - return true - l373: - position, tokenIndex, depth = position373, tokenIndex373, depth373 - return false - }, - /* 38 TIMESTAMP <- <((_ <(NUMBER ([a-z] / [A-Z])*)>) / (_ STRING) / (_ <(('n' / 'N') ('o' / 'O') ('w' / 'W'))>))> */ - nil, - /* 39 ID_SEGMENT <- <(_ ID_START ID_CONT*)> */ - func() bool { - position512, tokenIndex512, depth512 := position, tokenIndex, depth - { - position513 := position - depth++ - if !_rules[rule_]() { - goto l512 - } - if !_rules[ruleID_START]() { - goto l512 - } - l514: - { - position515, tokenIndex515, depth515 := position, tokenIndex, depth - if !_rules[ruleID_CONT]() { - goto l515 - } - goto l514 - l515: - position, tokenIndex, depth = position515, tokenIndex515, depth515 - } - depth-- - add(ruleID_SEGMENT, position513) - } - return true - l512: - position, tokenIndex, depth = position512, tokenIndex512, depth512 - return false - }, - /* 40 ID_START <- <((&('_') '_') | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z') [A-Z]) | (&('a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') [a-z]))> */ - func() bool { - position516, tokenIndex516, depth516 := position, tokenIndex, depth - { - position517 := position - depth++ - { - switch buffer[position] { - case '_': - if buffer[position] != rune('_') { - goto l516 - } - position++ - break - case 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z': - if c := buffer[position]; c < rune('A') || c > rune('Z') { - goto l516 - } - position++ - break - default: - if c := buffer[position]; c < rune('a') || c > rune('z') { - goto l516 - } - position++ - break - } - } - - depth-- - add(ruleID_START, position517) - } - return true - l516: - position, tokenIndex, depth = position516, tokenIndex516, depth516 - return false - }, - /* 41 ID_CONT <- <(ID_START / [0-9])> */ - func() bool { - position519, tokenIndex519, depth519 := position, tokenIndex, depth - { - position520 := position - depth++ - { - position521, tokenIndex521, depth521 := position, tokenIndex, depth - if !_rules[ruleID_START]() { - goto l522 - } - goto l521 - l522: - position, tokenIndex, depth = position521, tokenIndex521, depth521 - if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l519 - } - position++ - } - l521: - depth-- - add(ruleID_CONT, position520) - } - return true - l519: - position, tokenIndex, depth = position519, tokenIndex519, depth519 - return false - }, - /* 42 PROPERTY_KEY <- <(((&('S' | 's') (<(('s' / 'S') ('a' / 'A') ('m' / 'M') ('p' / 'P') ('l' / 'L') ('e' / 'E'))> KEY _ (('b' / 'B') ('y' / 'Y')))) | (&('R' | 'r') <(('r' / 'R') ('e' / 'E') ('s' / 'S') ('o' / 'O') ('l' / 'L') ('u' / 'U') ('t' / 'T') ('i' / 'I') ('o' / 'O') ('n' / 'N'))>) | (&('T' | 't') <(('t' / 'T') ('o' / 'O'))>) | (&('F' | 'f') <(('f' / 'F') ('r' / 'R') ('o' / 'O') ('m' / 'M'))>)) KEY)> */ - func() bool { - position523, tokenIndex523, depth523 := position, tokenIndex, depth - { - position524 := position - depth++ - { - switch buffer[position] { - case 'S', 's': - { - position526 := position - depth++ - { - position527, tokenIndex527, depth527 := position, tokenIndex, depth - if buffer[position] != rune('s') { - goto l528 - } - position++ - goto l527 - l528: - position, tokenIndex, depth = position527, tokenIndex527, depth527 - if buffer[position] != rune('S') { - goto l523 - } - position++ - } - l527: - { - position529, tokenIndex529, depth529 := position, tokenIndex, depth - if buffer[position] != rune('a') { - goto l530 - } - position++ - goto l529 - l530: - position, tokenIndex, depth = position529, tokenIndex529, depth529 - if buffer[position] != rune('A') { - goto l523 - } - position++ - } - l529: - { - position531, tokenIndex531, depth531 := position, tokenIndex, depth - if buffer[position] != rune('m') { - goto l532 - } - position++ - goto l531 - l532: - position, tokenIndex, depth = position531, tokenIndex531, depth531 - if buffer[position] != rune('M') { - goto l523 - } - position++ - } - l531: - { - position533, tokenIndex533, depth533 := position, tokenIndex, depth - if buffer[position] != rune('p') { - goto l534 - } - position++ - goto l533 - l534: - position, tokenIndex, depth = position533, tokenIndex533, depth533 - if buffer[position] != rune('P') { - goto l523 - } - position++ - } - l533: - { - position535, tokenIndex535, depth535 := position, tokenIndex, depth - if buffer[position] != rune('l') { - goto l536 - } - position++ - goto l535 - l536: - position, tokenIndex, depth = position535, tokenIndex535, depth535 - if buffer[position] != rune('L') { - goto l523 - } - position++ - } - l535: - { - position537, tokenIndex537, depth537 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l538 - } - position++ - goto l537 - l538: - position, tokenIndex, depth = position537, tokenIndex537, depth537 - if buffer[position] != rune('E') { - goto l523 - } - position++ - } - l537: - depth-- - add(rulePegText, position526) - } - if !_rules[ruleKEY]() { - goto l523 - } - if !_rules[rule_]() { - goto l523 - } - { - position539, tokenIndex539, depth539 := position, tokenIndex, depth - if buffer[position] != rune('b') { - goto l540 - } - position++ - goto l539 - l540: - position, tokenIndex, depth = position539, tokenIndex539, depth539 - if buffer[position] != rune('B') { - goto l523 - } - position++ - } - l539: - { - position541, tokenIndex541, depth541 := position, tokenIndex, depth - if buffer[position] != rune('y') { - goto l542 - } - position++ - goto l541 - l542: - position, tokenIndex, depth = position541, tokenIndex541, depth541 - if buffer[position] != rune('Y') { - goto l523 - } - position++ - } - l541: - break - case 'R', 'r': - { - position543 := position - depth++ - { - position544, tokenIndex544, depth544 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l545 - } - position++ - goto l544 - l545: - position, tokenIndex, depth = position544, tokenIndex544, depth544 - if buffer[position] != rune('R') { - goto l523 - } - position++ - } - l544: - { - position546, tokenIndex546, depth546 := position, tokenIndex, depth - if buffer[position] != rune('e') { - goto l547 - } - position++ - goto l546 - l547: - position, tokenIndex, depth = position546, tokenIndex546, depth546 - if buffer[position] != rune('E') { - goto l523 - } - position++ - } - l546: - { - position548, tokenIndex548, depth548 := position, tokenIndex, depth - if buffer[position] != rune('s') { - goto l549 - } - position++ - goto l548 - l549: - position, tokenIndex, depth = position548, tokenIndex548, depth548 - if buffer[position] != rune('S') { - goto l523 - } - position++ - } - l548: - { - position550, tokenIndex550, depth550 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l551 - } - position++ - goto l550 - l551: - position, tokenIndex, depth = position550, tokenIndex550, depth550 - if buffer[position] != rune('O') { - goto l523 - } - position++ - } - l550: - { - position552, tokenIndex552, depth552 := position, tokenIndex, depth - if buffer[position] != rune('l') { - goto l553 - } - position++ - goto l552 - l553: - position, tokenIndex, depth = position552, tokenIndex552, depth552 - if buffer[position] != rune('L') { - goto l523 - } - position++ - } - l552: - { - position554, tokenIndex554, depth554 := position, tokenIndex, depth - if buffer[position] != rune('u') { - goto l555 - } - position++ - goto l554 - l555: - position, tokenIndex, depth = position554, tokenIndex554, depth554 - if buffer[position] != rune('U') { - goto l523 - } - position++ - } - l554: - { - position556, tokenIndex556, depth556 := position, tokenIndex, depth - if buffer[position] != rune('t') { - goto l557 - } - position++ - goto l556 - l557: - position, tokenIndex, depth = position556, tokenIndex556, depth556 - if buffer[position] != rune('T') { - goto l523 - } - position++ - } - l556: - { - position558, tokenIndex558, depth558 := position, tokenIndex, depth - if buffer[position] != rune('i') { - goto l559 - } - position++ - goto l558 - l559: - position, tokenIndex, depth = position558, tokenIndex558, depth558 - if buffer[position] != rune('I') { - goto l523 - } - position++ - } - l558: - { - position560, tokenIndex560, depth560 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l561 - } - position++ - goto l560 - l561: - position, tokenIndex, depth = position560, tokenIndex560, depth560 - if buffer[position] != rune('O') { - goto l523 - } - position++ - } - l560: - { - position562, tokenIndex562, depth562 := position, tokenIndex, depth - if buffer[position] != rune('n') { - goto l563 - } - position++ - goto l562 - l563: - position, tokenIndex, depth = position562, tokenIndex562, depth562 - if buffer[position] != rune('N') { - goto l523 + case 'D', 'd': + { + position685, tokenIndex685, depth685 := position, tokenIndex, depth + if buffer[position] != rune('d') { + goto l686 + } + position++ + goto l685 + l686: + position, tokenIndex, depth = position685, tokenIndex685, depth685 + if buffer[position] != rune('D') { + goto l535 + } + position++ + } + l685: + { + position687, tokenIndex687, depth687 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l688 + } + position++ + goto l687 + l688: + position, tokenIndex, depth = position687, tokenIndex687, depth687 + if buffer[position] != rune('E') { + goto l535 + } + position++ + } + l687: + { + position689, tokenIndex689, depth689 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l690 + } + position++ + goto l689 + l690: + position, tokenIndex, depth = position689, tokenIndex689, depth689 + if buffer[position] != rune('S') { + goto l535 + } + position++ + } + l689: + { + position691, tokenIndex691, depth691 := position, tokenIndex, depth + if buffer[position] != rune('c') { + goto l692 + } + position++ + goto l691 + l692: + position, tokenIndex, depth = position691, tokenIndex691, depth691 + if buffer[position] != rune('C') { + goto l535 + } + position++ + } + l691: + { + position693, tokenIndex693, depth693 := position, tokenIndex, depth + if buffer[position] != rune('r') { + goto l694 + } + position++ + goto l693 + l694: + position, tokenIndex, depth = position693, tokenIndex693, depth693 + if buffer[position] != rune('R') { + goto l535 + } + position++ + } + l693: + { + position695, tokenIndex695, depth695 := position, tokenIndex, depth + if buffer[position] != rune('i') { + goto l696 + } + position++ + goto l695 + l696: + position, tokenIndex, depth = position695, tokenIndex695, depth695 + if buffer[position] != rune('I') { + goto l535 + } + position++ + } + l695: + { + position697, tokenIndex697, depth697 := position, tokenIndex, depth + if buffer[position] != rune('b') { + goto l698 + } + position++ + goto l697 + l698: + position, tokenIndex, depth = position697, tokenIndex697, depth697 + if buffer[position] != rune('B') { + goto l535 + } + position++ + } + l697: + { + position699, tokenIndex699, depth699 := position, tokenIndex, depth + if buffer[position] != rune('e') { + goto l700 + } + position++ + goto l699 + l700: + position, tokenIndex, depth = position699, tokenIndex699, depth699 + if buffer[position] != rune('E') { + goto l535 + } + position++ + } + l699: + break + case 'B', 'b': + { + position701, tokenIndex701, depth701 := position, tokenIndex, depth + if buffer[position] != rune('b') { + goto l702 + } + position++ + goto l701 + l702: + position, tokenIndex, depth = position701, tokenIndex701, depth701 + if buffer[position] != rune('B') { + goto l535 + } + position++ + } + l701: + { + position703, tokenIndex703, depth703 := position, tokenIndex, depth + if buffer[position] != rune('y') { + goto l704 + } + position++ + goto l703 + l704: + position, tokenIndex, depth = position703, tokenIndex703, depth703 + if buffer[position] != rune('Y') { + goto l535 + } + position++ + } + l703: + break + default: + { + position705, tokenIndex705, depth705 := position, tokenIndex, depth + if buffer[position] != rune('a') { + goto l706 + } + position++ + goto l705 + l706: + position, tokenIndex, depth = position705, tokenIndex705, depth705 + if buffer[position] != rune('A') { + goto l535 + } + position++ + } + l705: + { + position707, tokenIndex707, depth707 := position, tokenIndex, depth + if buffer[position] != rune('s') { + goto l708 + } + position++ + goto l707 + l708: + position, tokenIndex, depth = position707, tokenIndex707, depth707 + if buffer[position] != rune('S') { + goto l535 + } + position++ + } + l707: + break + } } - position++ + } - l562: + l537: depth-- - add(rulePegText, position543) + add(ruleKEYWORD, position536) } - break - case 'T', 't': + if !_rules[ruleKEY]() { + goto l535 + } + goto l527 + l535: + position, tokenIndex, depth = position535, tokenIndex535, depth535 + } + if !_rules[ruleID_SEGMENT]() { + goto l527 + } + l709: + { + position710, tokenIndex710, depth710 := position, tokenIndex, depth + if buffer[position] != rune('.') { + goto l710 + } + position++ { - position564 := position - depth++ - { - position565, tokenIndex565, depth565 := position, tokenIndex, depth - if buffer[position] != rune('t') { - goto l566 - } - position++ - goto l565 - l566: - position, tokenIndex, depth = position565, tokenIndex565, depth565 - if buffer[position] != rune('T') { - goto l523 - } - position++ + position711, tokenIndex711, depth711 := position, tokenIndex, depth + if !_rules[ruleID_SEGMENT]() { + goto l712 } - l565: - { - position567, tokenIndex567, depth567 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l568 - } - position++ - goto l567 - l568: - position, tokenIndex, depth = position567, tokenIndex567, depth567 - if buffer[position] != rune('O') { - goto l523 - } - position++ + goto l711 + l712: + position, tokenIndex, depth = position711, tokenIndex711, depth711 + if !(p.errorHere(position, `expected identifier segment to follow "."`)) { + goto l710 } - l567: - depth-- - add(rulePegText, position564) } + l711: + goto l709 + l710: + position, tokenIndex, depth = position710, tokenIndex710, depth710 + } + } + l529: + depth-- + add(ruleIDENTIFIER, position528) + } + return true + l527: + position, tokenIndex, depth = position527, tokenIndex527, depth527 + return false + }, + /* 38 TIMESTAMP <- <((_ <(NUMBER ([a-z] / [A-Z])*)>) / (_ STRING) / (_ <(('n' / 'N') ('o' / 'O') ('w' / 'W'))> KEY))> */ + nil, + /* 39 ID_SEGMENT <- <(ID_START ID_CONT*)> */ + func() bool { + position714, tokenIndex714, depth714 := position, tokenIndex, depth + { + position715 := position + depth++ + if !_rules[ruleID_START]() { + goto l714 + } + l716: + { + position717, tokenIndex717, depth717 := position, tokenIndex, depth + if !_rules[ruleID_CONT]() { + goto l717 + } + goto l716 + l717: + position, tokenIndex, depth = position717, tokenIndex717, depth717 + } + depth-- + add(ruleID_SEGMENT, position715) + } + return true + l714: + position, tokenIndex, depth = position714, tokenIndex714, depth714 + return false + }, + /* 40 ID_START <- <((&('_') '_') | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z') [A-Z]) | (&('a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') [a-z]))> */ + func() bool { + position718, tokenIndex718, depth718 := position, tokenIndex, depth + { + position719 := position + depth++ + { + switch buffer[position] { + case '_': + if buffer[position] != rune('_') { + goto l718 + } + position++ + break + case 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z': + if c := buffer[position]; c < rune('A') || c > rune('Z') { + goto l718 + } + position++ break default: - { - position569 := position - depth++ - { - position570, tokenIndex570, depth570 := position, tokenIndex, depth - if buffer[position] != rune('f') { - goto l571 - } - position++ - goto l570 - l571: - position, tokenIndex, depth = position570, tokenIndex570, depth570 - if buffer[position] != rune('F') { - goto l523 - } - position++ - } - l570: - { - position572, tokenIndex572, depth572 := position, tokenIndex, depth - if buffer[position] != rune('r') { - goto l573 - } - position++ - goto l572 - l573: - position, tokenIndex, depth = position572, tokenIndex572, depth572 - if buffer[position] != rune('R') { - goto l523 - } - position++ - } - l572: - { - position574, tokenIndex574, depth574 := position, tokenIndex, depth - if buffer[position] != rune('o') { - goto l575 - } - position++ - goto l574 - l575: - position, tokenIndex, depth = position574, tokenIndex574, depth574 - if buffer[position] != rune('O') { - goto l523 - } - position++ - } - l574: - { - position576, tokenIndex576, depth576 := position, tokenIndex, depth - if buffer[position] != rune('m') { - goto l577 - } - position++ - goto l576 - l577: - position, tokenIndex, depth = position576, tokenIndex576, depth576 - if buffer[position] != rune('M') { - goto l523 - } - position++ - } - l576: - depth-- - add(rulePegText, position569) + if c := buffer[position]; c < rune('a') || c > rune('z') { + goto l718 } + position++ break } } - if !_rules[ruleKEY]() { - goto l523 + depth-- + add(ruleID_START, position719) + } + return true + l718: + position, tokenIndex, depth = position718, tokenIndex718, depth718 + return false + }, + /* 41 ID_CONT <- <(ID_START / [0-9])> */ + func() bool { + position721, tokenIndex721, depth721 := position, tokenIndex, depth + { + position722 := position + depth++ + { + position723, tokenIndex723, depth723 := position, tokenIndex, depth + if !_rules[ruleID_START]() { + goto l724 + } + goto l723 + l724: + position, tokenIndex, depth = position723, tokenIndex723, depth723 + if c := buffer[position]; c < rune('0') || c > rune('9') { + goto l721 + } + position++ } + l723: depth-- - add(rulePROPERTY_KEY, position524) + add(ruleID_CONT, position722) } return true - l523: - position, tokenIndex, depth = position523, tokenIndex523, depth523 + l721: + position, tokenIndex, depth = position721, tokenIndex721, depth721 return false }, + /* 42 PROPERTY_KEY <- <((&('S' | 's') (<(('s' / 'S') ('a' / 'A') ('m' / 'M') ('p' / 'P') ('l' / 'L') ('e' / 'E'))> KEY ((_ (('b' / 'B') ('y' / 'Y')) KEY) / &{ p.errorHere(position, `expected keyword "by" to follow keyword "sample"`) }))) | (&('R' | 'r') (<(('r' / 'R') ('e' / 'E') ('s' / 'S') ('o' / 'O') ('l' / 'L') ('u' / 'U') ('t' / 'T') ('i' / 'I') ('o' / 'O') ('n' / 'N'))> KEY)) | (&('T' | 't') (<(('t' / 'T') ('o' / 'O'))> KEY)) | (&('F' | 'f') (<(('f' / 'F') ('r' / 'R') ('o' / 'O') ('m' / 'M'))> KEY)))> */ + nil, /* 43 PROPERTY_VALUE <- */ nil, - /* 44 KEYWORD <- <((('a' / 'A') ('l' / 'L') ('l' / 'L')) / (('a' / 'A') ('n' / 'N') ('d' / 'D')) / (('m' / 'M') ('a' / 'A') ('t' / 'T') ('c' / 'C') ('h' / 'H')) / (('s' / 'S') ('e' / 'E') ('l' / 'L') ('e' / 'E') ('c' / 'C') ('t' / 'T')) / ((&('M' | 'm') (('m' / 'M') ('e' / 'E') ('t' / 'T') ('r' / 'R') ('i' / 'I') ('c' / 'C') ('s' / 'S'))) | (&('W' | 'w') (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E'))) | (&('O' | 'o') (('o' / 'O') ('r' / 'R'))) | (&('N' | 'n') (('n' / 'N') ('o' / 'O') ('t' / 'T'))) | (&('I' | 'i') (('i' / 'I') ('n' / 'N'))) | (&('C' | 'c') (('c' / 'C') ('o' / 'O') ('l' / 'L') ('l' / 'L') ('a' / 'A') ('p' / 'P') ('s' / 'S') ('e' / 'E'))) | (&('G' | 'g') (('g' / 'G') ('r' / 'R') ('o' / 'O') ('u' / 'U') ('p' / 'P'))) | (&('D' | 'd') (('d' / 'D') ('e' / 'E') ('s' / 'S') ('c' / 'C') ('r' / 'R') ('i' / 'I') ('b' / 'B') ('e' / 'E'))) | (&('B' | 'b') (('b' / 'B') ('y' / 'Y'))) | (&('A' | 'a') (('a' / 'A') ('s' / 'S'))) | (&('F' | 'R' | 'S' | 'T' | 'f' | 'r' | 's' | 't') PROPERTY_KEY)))> */ + /* 44 KEYWORD <- <((('a' / 'A') ('l' / 'L') ('l' / 'L')) / (('a' / 'A') ('n' / 'N') ('d' / 'D')) / (('m' / 'M') ('a' / 'A') ('t' / 'T') ('c' / 'C') ('h' / 'H')) / (('s' / 'S') ('e' / 'E') ('l' / 'L') ('e' / 'E') ('c' / 'C') ('t' / 'T')) / ((&('S' | 's') (('s' / 'S') ('a' / 'A') ('m' / 'M') ('p' / 'P') ('l' / 'L') ('e' / 'E'))) | (&('R' | 'r') (('r' / 'R') ('e' / 'E') ('s' / 'S') ('o' / 'O') ('l' / 'L') ('u' / 'U') ('t' / 'T') ('i' / 'I') ('o' / 'O') ('n' / 'N'))) | (&('T' | 't') (('t' / 'T') ('o' / 'O'))) | (&('F' | 'f') (('f' / 'F') ('r' / 'R') ('o' / 'O') ('m' / 'M'))) | (&('M' | 'm') (('m' / 'M') ('e' / 'E') ('t' / 'T') ('r' / 'R') ('i' / 'I') ('c' / 'C') ('s' / 'S'))) | (&('W' | 'w') (('w' / 'W') ('h' / 'H') ('e' / 'E') ('r' / 'R') ('e' / 'E'))) | (&('O' | 'o') (('o' / 'O') ('r' / 'R'))) | (&('N' | 'n') (('n' / 'N') ('o' / 'O') ('t' / 'T'))) | (&('I' | 'i') (('i' / 'I') ('n' / 'N'))) | (&('C' | 'c') (('c' / 'C') ('o' / 'O') ('l' / 'L') ('l' / 'L') ('a' / 'A') ('p' / 'P') ('s' / 'S') ('e' / 'E'))) | (&('G' | 'g') (('g' / 'G') ('r' / 'R') ('o' / 'O') ('u' / 'U') ('p' / 'P'))) | (&('D' | 'd') (('d' / 'D') ('e' / 'E') ('s' / 'S') ('c' / 'C') ('r' / 'R') ('i' / 'I') ('b' / 'B') ('e' / 'E'))) | (&('B' | 'b') (('b' / 'B') ('y' / 'Y'))) | (&('A' | 'a') (('a' / 'A') ('s' / 'S')))))> */ nil, /* 45 OP_PIPE <- <'|'> */ nil, @@ -5057,367 +5937,407 @@ func (p *Parser) Init() { nil, /* 53 QUOTE_SINGLE <- <'\''> */ func() bool { - position588, tokenIndex588, depth588 := position, tokenIndex, depth + position736, tokenIndex736, depth736 := position, tokenIndex, depth { - position589 := position + position737 := position depth++ if buffer[position] != rune('\'') { - goto l588 + goto l736 } position++ depth-- - add(ruleQUOTE_SINGLE, position589) + add(ruleQUOTE_SINGLE, position737) } return true - l588: - position, tokenIndex, depth = position588, tokenIndex588, depth588 + l736: + position, tokenIndex, depth = position736, tokenIndex736, depth736 return false }, /* 54 QUOTE_DOUBLE <- <'"'> */ func() bool { - position590, tokenIndex590, depth590 := position, tokenIndex, depth + position738, tokenIndex738, depth738 := position, tokenIndex, depth { - position591 := position + position739 := position depth++ if buffer[position] != rune('"') { - goto l590 + goto l738 } position++ depth-- - add(ruleQUOTE_DOUBLE, position591) + add(ruleQUOTE_DOUBLE, position739) } return true - l590: - position, tokenIndex, depth = position590, tokenIndex590, depth590 + l738: + position, tokenIndex, depth = position738, tokenIndex738, depth738 return false }, - /* 55 STRING <- <((QUOTE_SINGLE <(!QUOTE_SINGLE CHAR)*> QUOTE_SINGLE) / (QUOTE_DOUBLE <(!QUOTE_DOUBLE CHAR)*> QUOTE_DOUBLE))> */ + /* 55 STRING <- <((QUOTE_SINGLE <(!QUOTE_SINGLE CHAR)*> (QUOTE_SINGLE / &{ p.errorHere(position, `expected "'" to close string`) })) / (QUOTE_DOUBLE <(!QUOTE_DOUBLE CHAR)*> (QUOTE_DOUBLE / &{ p.errorHere(position, `expected '"' to close string`) })))> */ func() bool { - position592, tokenIndex592, depth592 := position, tokenIndex, depth + position740, tokenIndex740, depth740 := position, tokenIndex, depth { - position593 := position + position741 := position depth++ { - position594, tokenIndex594, depth594 := position, tokenIndex, depth + position742, tokenIndex742, depth742 := position, tokenIndex, depth if !_rules[ruleQUOTE_SINGLE]() { - goto l595 + goto l743 } { - position596 := position + position744 := position depth++ - l597: + l745: { - position598, tokenIndex598, depth598 := position, tokenIndex, depth + position746, tokenIndex746, depth746 := position, tokenIndex, depth { - position599, tokenIndex599, depth599 := position, tokenIndex, depth + position747, tokenIndex747, depth747 := position, tokenIndex, depth if !_rules[ruleQUOTE_SINGLE]() { - goto l599 + goto l747 } - goto l598 - l599: - position, tokenIndex, depth = position599, tokenIndex599, depth599 + goto l746 + l747: + position, tokenIndex, depth = position747, tokenIndex747, depth747 } if !_rules[ruleCHAR]() { - goto l598 + goto l746 } - goto l597 - l598: - position, tokenIndex, depth = position598, tokenIndex598, depth598 + goto l745 + l746: + position, tokenIndex, depth = position746, tokenIndex746, depth746 } depth-- - add(rulePegText, position596) + add(rulePegText, position744) } - if !_rules[ruleQUOTE_SINGLE]() { - goto l595 + { + position748, tokenIndex748, depth748 := position, tokenIndex, depth + if !_rules[ruleQUOTE_SINGLE]() { + goto l749 + } + goto l748 + l749: + position, tokenIndex, depth = position748, tokenIndex748, depth748 + if !(p.errorHere(position, `expected "'" to close string`)) { + goto l743 + } } - goto l594 - l595: - position, tokenIndex, depth = position594, tokenIndex594, depth594 + l748: + goto l742 + l743: + position, tokenIndex, depth = position742, tokenIndex742, depth742 if !_rules[ruleQUOTE_DOUBLE]() { - goto l592 + goto l740 } { - position600 := position + position750 := position depth++ - l601: + l751: { - position602, tokenIndex602, depth602 := position, tokenIndex, depth + position752, tokenIndex752, depth752 := position, tokenIndex, depth { - position603, tokenIndex603, depth603 := position, tokenIndex, depth + position753, tokenIndex753, depth753 := position, tokenIndex, depth if !_rules[ruleQUOTE_DOUBLE]() { - goto l603 + goto l753 } - goto l602 - l603: - position, tokenIndex, depth = position603, tokenIndex603, depth603 + goto l752 + l753: + position, tokenIndex, depth = position753, tokenIndex753, depth753 } if !_rules[ruleCHAR]() { - goto l602 + goto l752 } - goto l601 - l602: - position, tokenIndex, depth = position602, tokenIndex602, depth602 + goto l751 + l752: + position, tokenIndex, depth = position752, tokenIndex752, depth752 } depth-- - add(rulePegText, position600) + add(rulePegText, position750) } - if !_rules[ruleQUOTE_DOUBLE]() { - goto l592 + { + position754, tokenIndex754, depth754 := position, tokenIndex, depth + if !_rules[ruleQUOTE_DOUBLE]() { + goto l755 + } + goto l754 + l755: + position, tokenIndex, depth = position754, tokenIndex754, depth754 + if !(p.errorHere(position, `expected '"' to close string`)) { + goto l740 + } } + l754: } - l594: + l742: depth-- - add(ruleSTRING, position593) + add(ruleSTRING, position741) } return true - l592: - position, tokenIndex, depth = position592, tokenIndex592, depth592 + l740: + position, tokenIndex, depth = position740, tokenIndex740, depth740 return false }, - /* 56 CHAR <- <(('\\' ((&('"') QUOTE_DOUBLE) | (&('\'') QUOTE_SINGLE) | (&('\\' | '`') ESCAPE_CLASS))) / (!ESCAPE_CLASS .))> */ + /* 56 CHAR <- <(('\\' ((&('"') (QUOTE_DOUBLE / &{ p.errorHere(position, "expected \"\\\", \"'\", \"`\", or '\"' to follow \"\\\" in string literal") })) | (&('\'') QUOTE_SINGLE) | (&('\\' | '`') ESCAPE_CLASS))) / (!ESCAPE_CLASS .))> */ func() bool { - position604, tokenIndex604, depth604 := position, tokenIndex, depth + position756, tokenIndex756, depth756 := position, tokenIndex, depth { - position605 := position + position757 := position depth++ { - position606, tokenIndex606, depth606 := position, tokenIndex, depth + position758, tokenIndex758, depth758 := position, tokenIndex, depth if buffer[position] != rune('\\') { - goto l607 + goto l759 } position++ { switch buffer[position] { case '"': - if !_rules[ruleQUOTE_DOUBLE]() { - goto l607 + { + position761, tokenIndex761, depth761 := position, tokenIndex, depth + if !_rules[ruleQUOTE_DOUBLE]() { + goto l762 + } + goto l761 + l762: + position, tokenIndex, depth = position761, tokenIndex761, depth761 + if !(p.errorHere(position, "expected \"\\\", \"'\", \"`\", or '\"' to follow \"\\\" in string literal")) { + goto l759 + } } + l761: break case '\'': if !_rules[ruleQUOTE_SINGLE]() { - goto l607 + goto l759 } break default: if !_rules[ruleESCAPE_CLASS]() { - goto l607 + goto l759 } break } } - goto l606 - l607: - position, tokenIndex, depth = position606, tokenIndex606, depth606 + goto l758 + l759: + position, tokenIndex, depth = position758, tokenIndex758, depth758 { - position609, tokenIndex609, depth609 := position, tokenIndex, depth + position763, tokenIndex763, depth763 := position, tokenIndex, depth if !_rules[ruleESCAPE_CLASS]() { - goto l609 + goto l763 } - goto l604 - l609: - position, tokenIndex, depth = position609, tokenIndex609, depth609 + goto l756 + l763: + position, tokenIndex, depth = position763, tokenIndex763, depth763 } if !matchDot() { - goto l604 + goto l756 } } - l606: + l758: depth-- - add(ruleCHAR, position605) + add(ruleCHAR, position757) } return true - l604: - position, tokenIndex, depth = position604, tokenIndex604, depth604 + l756: + position, tokenIndex, depth = position756, tokenIndex756, depth756 return false }, /* 57 ESCAPE_CLASS <- <('`' / '\\')> */ func() bool { - position610, tokenIndex610, depth610 := position, tokenIndex, depth + position764, tokenIndex764, depth764 := position, tokenIndex, depth { - position611 := position + position765 := position depth++ { - position612, tokenIndex612, depth612 := position, tokenIndex, depth + position766, tokenIndex766, depth766 := position, tokenIndex, depth if buffer[position] != rune('`') { - goto l613 + goto l767 } position++ - goto l612 - l613: - position, tokenIndex, depth = position612, tokenIndex612, depth612 + goto l766 + l767: + position, tokenIndex, depth = position766, tokenIndex766, depth766 if buffer[position] != rune('\\') { - goto l610 + goto l764 } position++ } - l612: + l766: depth-- - add(ruleESCAPE_CLASS, position611) + add(ruleESCAPE_CLASS, position765) } return true - l610: - position, tokenIndex, depth = position610, tokenIndex610, depth610 + l764: + position, tokenIndex, depth = position764, tokenIndex764, depth764 return false }, /* 58 NUMBER <- <(NUMBER_INTEGER NUMBER_FRACTION? NUMBER_EXP?)> */ func() bool { - position614, tokenIndex614, depth614 := position, tokenIndex, depth + position768, tokenIndex768, depth768 := position, tokenIndex, depth { - position615 := position + position769 := position depth++ { - position616 := position + position770 := position depth++ { - position617, tokenIndex617, depth617 := position, tokenIndex, depth + position771, tokenIndex771, depth771 := position, tokenIndex, depth if buffer[position] != rune('-') { - goto l617 + goto l771 } position++ - goto l618 - l617: - position, tokenIndex, depth = position617, tokenIndex617, depth617 + goto l772 + l771: + position, tokenIndex, depth = position771, tokenIndex771, depth771 } - l618: + l772: { - position619 := position + position773 := position depth++ { - position620, tokenIndex620, depth620 := position, tokenIndex, depth + position774, tokenIndex774, depth774 := position, tokenIndex, depth if buffer[position] != rune('0') { - goto l621 + goto l775 } position++ - goto l620 - l621: - position, tokenIndex, depth = position620, tokenIndex620, depth620 + goto l774 + l775: + position, tokenIndex, depth = position774, tokenIndex774, depth774 if c := buffer[position]; c < rune('1') || c > rune('9') { - goto l614 + goto l768 } position++ - l622: + l776: { - position623, tokenIndex623, depth623 := position, tokenIndex, depth + position777, tokenIndex777, depth777 := position, tokenIndex, depth if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l623 + goto l777 } position++ - goto l622 - l623: - position, tokenIndex, depth = position623, tokenIndex623, depth623 + goto l776 + l777: + position, tokenIndex, depth = position777, tokenIndex777, depth777 } } - l620: + l774: depth-- - add(ruleNUMBER_NATURAL, position619) + add(ruleNUMBER_NATURAL, position773) } depth-- - add(ruleNUMBER_INTEGER, position616) + add(ruleNUMBER_INTEGER, position770) } { - position624, tokenIndex624, depth624 := position, tokenIndex, depth + position778, tokenIndex778, depth778 := position, tokenIndex, depth { - position626 := position + position780 := position depth++ if buffer[position] != rune('.') { - goto l624 + goto l778 } position++ if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l624 + goto l778 } position++ - l627: + l781: { - position628, tokenIndex628, depth628 := position, tokenIndex, depth + position782, tokenIndex782, depth782 := position, tokenIndex, depth if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l628 + goto l782 } position++ - goto l627 - l628: - position, tokenIndex, depth = position628, tokenIndex628, depth628 + goto l781 + l782: + position, tokenIndex, depth = position782, tokenIndex782, depth782 } depth-- - add(ruleNUMBER_FRACTION, position626) + add(ruleNUMBER_FRACTION, position780) } - goto l625 - l624: - position, tokenIndex, depth = position624, tokenIndex624, depth624 + goto l779 + l778: + position, tokenIndex, depth = position778, tokenIndex778, depth778 } - l625: + l779: { - position629, tokenIndex629, depth629 := position, tokenIndex, depth + position783, tokenIndex783, depth783 := position, tokenIndex, depth { - position631 := position + position785 := position depth++ { - position632, tokenIndex632, depth632 := position, tokenIndex, depth + position786, tokenIndex786, depth786 := position, tokenIndex, depth if buffer[position] != rune('e') { - goto l633 + goto l787 } position++ - goto l632 - l633: - position, tokenIndex, depth = position632, tokenIndex632, depth632 + goto l786 + l787: + position, tokenIndex, depth = position786, tokenIndex786, depth786 if buffer[position] != rune('E') { - goto l629 + goto l783 } position++ } - l632: + l786: { - position634, tokenIndex634, depth634 := position, tokenIndex, depth + position788, tokenIndex788, depth788 := position, tokenIndex, depth { - position636, tokenIndex636, depth636 := position, tokenIndex, depth + position790, tokenIndex790, depth790 := position, tokenIndex, depth if buffer[position] != rune('+') { - goto l637 + goto l791 } position++ - goto l636 - l637: - position, tokenIndex, depth = position636, tokenIndex636, depth636 + goto l790 + l791: + position, tokenIndex, depth = position790, tokenIndex790, depth790 if buffer[position] != rune('-') { - goto l634 + goto l788 } position++ } - l636: - goto l635 - l634: - position, tokenIndex, depth = position634, tokenIndex634, depth634 - } - l635: - if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l629 + l790: + goto l789 + l788: + position, tokenIndex, depth = position788, tokenIndex788, depth788 } - position++ - l638: + l789: { - position639, tokenIndex639, depth639 := position, tokenIndex, depth + position792, tokenIndex792, depth792 := position, tokenIndex, depth if c := buffer[position]; c < rune('0') || c > rune('9') { - goto l639 + goto l793 } position++ - goto l638 - l639: - position, tokenIndex, depth = position639, tokenIndex639, depth639 + l794: + { + position795, tokenIndex795, depth795 := position, tokenIndex, depth + if c := buffer[position]; c < rune('0') || c > rune('9') { + goto l795 + } + position++ + goto l794 + l795: + position, tokenIndex, depth = position795, tokenIndex795, depth795 + } + goto l792 + l793: + position, tokenIndex, depth = position792, tokenIndex792, depth792 + if !(p.errorHere(position, `expected exponent`)) { + goto l783 + } } + l792: depth-- - add(ruleNUMBER_EXP, position631) + add(ruleNUMBER_EXP, position785) } - goto l630 - l629: - position, tokenIndex, depth = position629, tokenIndex629, depth629 + goto l784 + l783: + position, tokenIndex, depth = position783, tokenIndex783, depth783 } - l630: + l784: depth-- - add(ruleNUMBER, position615) + add(ruleNUMBER, position769) } return true - l614: - position, tokenIndex, depth = position614, tokenIndex614, depth614 + l768: + position, tokenIndex, depth = position768, tokenIndex768, depth768 return false }, /* 59 NUMBER_NATURAL <- <('0' / ([1-9] [0-9]*))> */ @@ -5426,179 +6346,179 @@ func (p *Parser) Init() { nil, /* 61 NUMBER_INTEGER <- <('-'? NUMBER_NATURAL)> */ nil, - /* 62 NUMBER_EXP <- <(('e' / 'E') ('+' / '-')? [0-9]+)> */ + /* 62 NUMBER_EXP <- <(('e' / 'E') ('+' / '-')? ([0-9]+ / &{ p.errorHere(position, `expected exponent`) }))> */ nil, /* 63 DURATION <- <(NUMBER [a-z]+ KEY)> */ nil, /* 64 PAREN_OPEN <- <'('> */ func() bool { - position645, tokenIndex645, depth645 := position, tokenIndex, depth + position801, tokenIndex801, depth801 := position, tokenIndex, depth { - position646 := position + position802 := position depth++ if buffer[position] != rune('(') { - goto l645 + goto l801 } position++ depth-- - add(rulePAREN_OPEN, position646) + add(rulePAREN_OPEN, position802) } return true - l645: - position, tokenIndex, depth = position645, tokenIndex645, depth645 + l801: + position, tokenIndex, depth = position801, tokenIndex801, depth801 return false }, /* 65 PAREN_CLOSE <- <')'> */ func() bool { - position647, tokenIndex647, depth647 := position, tokenIndex, depth + position803, tokenIndex803, depth803 := position, tokenIndex, depth { - position648 := position + position804 := position depth++ if buffer[position] != rune(')') { - goto l647 + goto l803 } position++ depth-- - add(rulePAREN_CLOSE, position648) + add(rulePAREN_CLOSE, position804) } return true - l647: - position, tokenIndex, depth = position647, tokenIndex647, depth647 + l803: + position, tokenIndex, depth = position803, tokenIndex803, depth803 return false }, /* 66 COMMA <- <','> */ func() bool { - position649, tokenIndex649, depth649 := position, tokenIndex, depth + position805, tokenIndex805, depth805 := position, tokenIndex, depth { - position650 := position + position806 := position depth++ if buffer[position] != rune(',') { - goto l649 + goto l805 } position++ depth-- - add(ruleCOMMA, position650) + add(ruleCOMMA, position806) } return true - l649: - position, tokenIndex, depth = position649, tokenIndex649, depth649 + l805: + position, tokenIndex, depth = position805, tokenIndex805, depth805 return false }, /* 67 _ <- <((&('/') COMMENT_BLOCK) | (&('-') COMMENT_TRAIL) | (&('\t' | '\n' | ' ') SPACE))*> */ func() bool { { - position652 := position + position808 := position depth++ - l653: + l809: { - position654, tokenIndex654, depth654 := position, tokenIndex, depth + position810, tokenIndex810, depth810 := position, tokenIndex, depth { switch buffer[position] { case '/': { - position656 := position + position812 := position depth++ if buffer[position] != rune('/') { - goto l654 + goto l810 } position++ if buffer[position] != rune('*') { - goto l654 + goto l810 } position++ - l657: + l813: { - position658, tokenIndex658, depth658 := position, tokenIndex, depth + position814, tokenIndex814, depth814 := position, tokenIndex, depth { - position659, tokenIndex659, depth659 := position, tokenIndex, depth + position815, tokenIndex815, depth815 := position, tokenIndex, depth if buffer[position] != rune('*') { - goto l659 + goto l815 } position++ if buffer[position] != rune('/') { - goto l659 + goto l815 } position++ - goto l658 - l659: - position, tokenIndex, depth = position659, tokenIndex659, depth659 + goto l814 + l815: + position, tokenIndex, depth = position815, tokenIndex815, depth815 } if !matchDot() { - goto l658 + goto l814 } - goto l657 - l658: - position, tokenIndex, depth = position658, tokenIndex658, depth658 + goto l813 + l814: + position, tokenIndex, depth = position814, tokenIndex814, depth814 } if buffer[position] != rune('*') { - goto l654 + goto l810 } position++ if buffer[position] != rune('/') { - goto l654 + goto l810 } position++ depth-- - add(ruleCOMMENT_BLOCK, position656) + add(ruleCOMMENT_BLOCK, position812) } break case '-': { - position660 := position + position816 := position depth++ if buffer[position] != rune('-') { - goto l654 + goto l810 } position++ if buffer[position] != rune('-') { - goto l654 + goto l810 } position++ - l661: + l817: { - position662, tokenIndex662, depth662 := position, tokenIndex, depth + position818, tokenIndex818, depth818 := position, tokenIndex, depth { - position663, tokenIndex663, depth663 := position, tokenIndex, depth + position819, tokenIndex819, depth819 := position, tokenIndex, depth if buffer[position] != rune('\n') { - goto l663 + goto l819 } position++ - goto l662 - l663: - position, tokenIndex, depth = position663, tokenIndex663, depth663 + goto l818 + l819: + position, tokenIndex, depth = position819, tokenIndex819, depth819 } if !matchDot() { - goto l662 + goto l818 } - goto l661 - l662: - position, tokenIndex, depth = position662, tokenIndex662, depth662 + goto l817 + l818: + position, tokenIndex, depth = position818, tokenIndex818, depth818 } depth-- - add(ruleCOMMENT_TRAIL, position660) + add(ruleCOMMENT_TRAIL, position816) } break default: { - position664 := position + position820 := position depth++ { switch buffer[position] { case '\t': if buffer[position] != rune('\t') { - goto l654 + goto l810 } position++ break case '\n': if buffer[position] != rune('\n') { - goto l654 + goto l810 } position++ break default: if buffer[position] != rune(' ') { - goto l654 + goto l810 } position++ break @@ -5606,18 +6526,18 @@ func (p *Parser) Init() { } depth-- - add(ruleSPACE, position664) + add(ruleSPACE, position820) } break } } - goto l653 - l654: - position, tokenIndex, depth = position654, tokenIndex654, depth654 + goto l809 + l810: + position, tokenIndex, depth = position810, tokenIndex810, depth810 } depth-- - add(rule_, position652) + add(rule_, position808) } return true }, @@ -5627,32 +6547,30 @@ func (p *Parser) Init() { nil, /* 70 KEY <- */ func() bool { - position668, tokenIndex668, depth668 := position, tokenIndex, depth + position824, tokenIndex824, depth824 := position, tokenIndex, depth { - position669 := position + position825 := position depth++ { - position670, tokenIndex670, depth670 := position, tokenIndex, depth + position826, tokenIndex826, depth826 := position, tokenIndex, depth if !_rules[ruleID_CONT]() { - goto l670 + goto l826 } - goto l668 - l670: - position, tokenIndex, depth = position670, tokenIndex670, depth670 + goto l824 + l826: + position, tokenIndex, depth = position826, tokenIndex826, depth826 } depth-- - add(ruleKEY, position669) + add(ruleKEY, position825) } return true - l668: - position, tokenIndex, depth = position668, tokenIndex668, depth668 + l824: + position, tokenIndex, depth = position824, tokenIndex824, depth824 return false }, /* 71 SPACE <- <((&('\t') '\t') | (&('\n') '\n') | (&(' ') ' '))> */ nil, - /* 73 Action0 <- <{ - p.makeSelect() - }> */ + /* 73 Action0 <- <{ p.makeSelect() }> */ nil, /* 74 Action1 <- <{ p.makeDescribeAll() }> */ nil, @@ -5663,15 +6581,16 @@ func (p *Parser) Init() { /* 77 Action4 <- <{ p.makeDescribeMetrics() }> */ nil, nil, - /* 79 Action5 <- <{ p.pushString(unescapeLiteral(buffer[begin:end])) }> */ + /* 79 Action5 <- <{ p.pushString(unescapeLiteral(text)) }> */ nil, /* 80 Action6 <- <{ p.makeDescribe() }> */ nil, /* 81 Action7 <- <{ p.addEvaluationContext() }> */ nil, - /* 82 Action8 <- <{ p.addPropertyKey(buffer[begin:end]) }> */ + /* 82 Action8 <- <{ p.addPropertyKey(text) }> */ nil, - /* 83 Action9 <- <{ p.addPropertyValue(buffer[begin:end]) }> */ + /* 83 Action9 <- <{ + p.addPropertyValue(text) }> */ nil, /* 84 Action10 <- <{ p.insertPropertyKeyValue() }> */ nil, @@ -5697,7 +6616,7 @@ func (p *Parser) Init() { nil, /* 95 Action21 <- <{ p.addOperatorFunction() }> */ nil, - /* 96 Action22 <- <{ p.pushString(unescapeLiteral(buffer[begin:end])) }> */ + /* 96 Action22 <- <{ p.pushString(unescapeLiteral(text)) }> */ nil, /* 97 Action23 <- <{p.addExpressionList()}> */ nil, @@ -5710,80 +6629,59 @@ func (p *Parser) Init() { nil, /* 100 Action26 <- <{ p.addDurationNode(text) }> */ nil, - /* 101 Action27 <- <{ p.addNumberNode(buffer[begin:end]) }> */ + /* 101 Action27 <- <{ p.addNumberNode(text) }> */ nil, - /* 102 Action28 <- <{ p.addStringNode(unescapeLiteral(buffer[begin:end])) }> */ + /* 102 Action28 <- <{ p.addStringNode(unescapeLiteral(text)) }> */ nil, - /* 103 Action29 <- <{ p.addAnnotationExpression(buffer[begin:end]) }> */ + /* 103 Action29 <- <{ p.addAnnotationExpression(text) }> */ nil, /* 104 Action30 <- <{ p.addGroupBy() }> */ nil, - /* 105 Action31 <- <{ - p.pushString(unescapeLiteral(buffer[begin:end])) - }> */ + /* 105 Action31 <- <{ p.pushString(unescapeLiteral(text)) }> */ nil, - /* 106 Action32 <- <{ - p.addFunctionInvocation() - }> */ + /* 106 Action32 <- <{ p.addFunctionInvocation() }> */ nil, - /* 107 Action33 <- <{ - p.pushString(unescapeLiteral(buffer[begin:end])) - }> */ + /* 107 Action33 <- <{ p.pushString(unescapeLiteral(text)) }> */ nil, /* 108 Action34 <- <{ p.addNullPredicate() }> */ nil, - /* 109 Action35 <- <{ - p.addMetricExpression() - }> */ + /* 109 Action35 <- <{ p.addMetricExpression() }> */ nil, - /* 110 Action36 <- <{ - p.appendGroupBy(unescapeLiteral(buffer[begin:end])) - }> */ + /* 110 Action36 <- <{ p.addGroupBy() }> */ nil, - /* 111 Action37 <- <{ - p.appendGroupBy(unescapeLiteral(buffer[begin:end])) - }> */ + /* 111 Action37 <- <{ p.appendGroupTag(unescapeLiteral(text)) }> */ nil, - /* 112 Action38 <- <{ - p.appendCollapseBy(unescapeLiteral(text)) - }> */ + /* 112 Action38 <- <{ p.appendGroupTag(unescapeLiteral(text)) }> */ nil, - /* 113 Action39 <- <{p.appendCollapseBy(unescapeLiteral(text))}> */ + /* 113 Action39 <- <{ p.addCollapseBy() }> */ nil, - /* 114 Action40 <- <{ p.addOrPredicate() }> */ + /* 114 Action40 <- <{ p.appendGroupTag(unescapeLiteral(text)) }> */ nil, - /* 115 Action41 <- <{ p.addAndPredicate() }> */ + /* 115 Action41 <- <{ p.appendGroupTag(unescapeLiteral(text)) }> */ nil, - /* 116 Action42 <- <{ p.addNotPredicate() }> */ + /* 116 Action42 <- <{ p.addOrPredicate() }> */ nil, - /* 117 Action43 <- <{ - p.addLiteralMatcher() - }> */ + /* 117 Action43 <- <{ p.addAndPredicate() }> */ nil, - /* 118 Action44 <- <{ - p.addLiteralMatcher() - p.addNotPredicate() - }> */ + /* 118 Action44 <- <{ p.addNotPredicate() }> */ nil, - /* 119 Action45 <- <{ - p.addRegexMatcher() - }> */ + /* 119 Action45 <- <{ p.addLiteralMatcher() }> */ nil, - /* 120 Action46 <- <{ - p.addListMatcher() - }> */ + /* 120 Action46 <- <{ p.addLiteralMatcher() }> */ + nil, + /* 121 Action47 <- <{ p.addNotPredicate() }> */ + nil, + /* 122 Action48 <- <{ p.addRegexMatcher() }> */ + nil, + /* 123 Action49 <- <{ p.addListMatcher() }> */ nil, - /* 121 Action47 <- <{ - p.pushString(unescapeLiteral(buffer[begin:end])) - }> */ + /* 124 Action50 <- <{ p.pushString(unescapeLiteral(text)) }> */ nil, - /* 122 Action48 <- <{ p.addLiteralList() }> */ + /* 125 Action51 <- <{ p.addLiteralList() }> */ nil, - /* 123 Action49 <- <{ - p.appendLiteral(unescapeLiteral(buffer[begin:end])) - }> */ + /* 126 Action52 <- <{ p.appendLiteral(unescapeLiteral(text)) }> */ nil, - /* 124 Action50 <- <{ p.addTagLiteral(unescapeLiteral(buffer[begin:end])) }> */ + /* 127 Action53 <- <{ p.addTagLiteral(unescapeLiteral(text)) }> */ nil, } p.rules = _rules diff --git a/query/parser/node.go b/query/parser/node.go index 9ae3779..1e755c0 100644 --- a/query/parser/node.go +++ b/query/parser/node.go @@ -27,41 +27,23 @@ type any interface{} // fixes a bug in gopeg // * lists // * evaluation context nodes -// list of literals -type stringLiteralList struct { - literals []string -} - // single tag -type tagLiteral struct { - tag string -} +type tagLiteral string // a single operator -type operatorLiteral struct { - operator string -} - -type groupByList struct { - list []string - collapses bool -} +type operatorLiteral string // evaluationContextKey represents a key (from, to, sampleby) for the evaluation context. -type evaluationContextKey struct { - key string -} +type evaluationContextKey string // evaluationContextValue represents a value (date, samplingmode, etc.) for the evaluation context. -type evaluationContextValue struct { - value string -} +type evaluationContextValue string // evaluationContextMap represents a collection of key-value pairs that form the evaluation context. type evaluationContextNode struct { - Start int64 // Start of data timerange - End int64 // End of data timerange - Resolution int64 // Resolution of data timerange - SampleMethod timeseries.SampleMethod // to use when up/downsampling to match requested resolution - assigned map[string]bool // a map for knowing which elements of the context have been assigned + Start int64 // Start of data timerange + End int64 // End of data timerange + Resolution int64 // Resolution of data timerange + SampleMethod timeseries.SampleMethod // to use when up/downsampling to match requested resolution + assigned map[evaluationContextKey]bool // a map for knowing which elements of the context have been assigned } diff --git a/query/parser/parser.go b/query/parser/parser.go index eb3bb72..66534c6 100644 --- a/query/parser/parser.go +++ b/query/parser/parser.go @@ -105,7 +105,6 @@ var dateFormats = []string{ // parseDate converts the given datestring (from one of the allowable formats) into a millisecond offset from the Unix epoch. func parseDate(date string, now time.Time) (int64, error) { - if date == "now" { return now.Unix() * 1000, nil } @@ -131,10 +130,14 @@ func parseDate(date string, now time.Time) (int64, error) { return -1, errors.New(errorMessage) } +// An Assert is a kind of error that occurs due to a bug in the parser itself. type Assert struct { error } +// A ParserError wraps an error raised during parser execution. +type ParserError error + func Parse(query string) (commandResult command.Command, finalErr error) { p := Parser{Buffer: query} p.Init() @@ -145,7 +148,13 @@ func Parse(query string) (commandResult command.Command, finalErr error) { } if message, ok := r.(Assert); ok { finalErr = message + return + } + if parserError, ok := r.(ParserError); ok { + finalErr = error(parserError) + return } + panic(r) // Can't catch it }() if err := p.Parse(); err != nil { // Parsing error - invalid syntax. @@ -159,7 +168,7 @@ func Parse(query string) (commandResult command.Command, finalErr error) { // generic error (should not occur). return nil, AssertionError{"Non-parse error raised"} } - p.Execute() + p.Execute() // Execute runs code associated with the AST. if len(p.nodeStack) > 0 { return nil, AssertionError{"Node stack is not empty"} } @@ -212,32 +221,6 @@ func (p *Parser) popNodeInto(target interface{}) { targetValue.Elem().Set(nodeValue) } -func (p *Parser) peekNodeInto(target interface{}) { - targetValue := reflect.ValueOf(target) - if targetValue.Type().Kind() != reflect.Ptr { - panic(Assert{ - fmt.Errorf("[%s] peekNodeInto() given a non-pointer target", functionName(1)), - }) - } - l := len(p.nodeStack) - if l == 0 { - panic(Assert{fmt.Errorf("[%s] peekNodeInto() on an empty stack", functionName(1))}) - } - - nodeValue := reflect.ValueOf(p.nodeStack[l-1]) - - expectedType := targetValue.Elem().Type() - actualType := nodeValue.Type() - if !actualType.ConvertibleTo(expectedType) { - panic(Assert{fmt.Errorf("[%s] peekNodeInto() - expected %s, got off the stack %s", - functionName(1), - expectedType.String(), - actualType.String()), - }) - } - targetValue.Elem().Set(nodeValue) -} - func (p *Parser) pushNode(node interface{}) { p.nodeStack = append(p.nodeStack, node) } @@ -252,6 +235,7 @@ func (p *Parser) pushExpression(node function.Expression) { p.pushNode(node) } +// pushPredicate is just a type-safe way to push a predicate func (p *Parser) pushPredicate(node predicate.Predicate) { p.pushNode(node) } @@ -309,65 +293,63 @@ func (p *Parser) makeDescribeMetrics() { var literal string p.popNodeInto(&literal) // Pop of the tag name. - var tagLiteral *tagLiteral - p.popNodeInto(&tagLiteral) + var tag tagLiteral + p.popNodeInto(&tag) p.command = &command.DescribeMetricsCommand{ - TagKey: tagLiteral.tag, + TagKey: string(tag), TagValue: literal, } } func (p *Parser) addOperatorLiteral(operator string) { - p.pushNode(&operatorLiteral{operator}) + p.pushNode(operatorLiteral(operator)) } func (p *Parser) addOperatorFunction() { var right function.Expression - p.popNodeInto(&right) - var operatorNode *operatorLiteral - p.popNodeInto(&operatorNode) + var operator operatorLiteral + p.popNodeInto(&operator) var left function.Expression p.popNodeInto(&left) + p.pushExpression(function.Memoize(&expression.FunctionExpression{ - FunctionName: operatorNode.operator, + FunctionName: string(operator), Arguments: []function.Expression{left, right}, })) } func (p *Parser) addPropertyKey(key string) { - p.pushNode(&evaluationContextKey{key}) + p.pushNode(evaluationContextKey(key)) } func (p *Parser) addPropertyValue(value string) { - p.pushNode(&evaluationContextValue{value}) + p.pushNode(evaluationContextValue(value)) } func (p *Parser) addEvaluationContext() { p.pushNode(&evaluationContextNode{ 0, 0, 30000, timeseries.SampleMean, - make(map[string]bool), + make(map[evaluationContextKey]bool), }) } func (p *Parser) insertPropertyKeyValue() { - var valueNode *evaluationContextValue - p.popNodeInto(&valueNode) - var keyNode *evaluationContextKey - p.popNodeInto(&keyNode) + var value evaluationContextValue + p.popNodeInto(&value) + var key evaluationContextKey + p.popNodeInto(&key) var contextNode *evaluationContextNode p.popNodeInto(&contextNode) - key := keyNode.key - value := valueNode.value // Authenticate the validity of the given key and value... // The key must be one of "sample"(by), "from", "to", "resolution" // First check that the key has been assigned only once: if contextNode.assigned[key] { p.flagSyntaxError(SyntaxError{ - token: key, + token: string(key), message: fmt.Sprintf("Key %s has already been assigned", key), }) } @@ -386,7 +368,7 @@ func (p *Parser) insertPropertyKeyValue() { contextNode.SampleMethod = timeseries.SampleMean default: p.flagSyntaxError(SyntaxError{ - token: value, + token: string(value), message: fmt.Sprintf("Expected sampling method 'max', 'min', or 'mean' but got %s", value), }) } @@ -394,9 +376,9 @@ func (p *Parser) insertPropertyKeyValue() { var unix int64 var err error now := time.Now() - if unix, err = parseDate(value, now); err != nil { + if unix, err = parseDate(string(value), now); err != nil { p.flagSyntaxError(SyntaxError{ - token: value, + token: string(value), message: err.Error(), }) } @@ -407,19 +389,19 @@ func (p *Parser) insertPropertyKeyValue() { } case "resolution": // The value must be determined to be an int if the key is "resolution". - if intValue, err := strconv.ParseInt(value, 10, 64); err == nil { + if intValue, err := strconv.ParseInt(string(value), 10, 64); err == nil { contextNode.Resolution = intValue - } else if duration, err := function.StringToDuration(value); err == nil { + } else if duration, err := function.StringToDuration(string(value)); err == nil { contextNode.Resolution = int64(duration / time.Millisecond) } else { p.flagSyntaxError(SyntaxError{ - token: value, + token: string(value), message: fmt.Sprintf("Expected number but parse failed; %s", err.Error()), }) } default: p.flagSyntaxError(SyntaxError{ - token: key, + token: string(key), message: fmt.Sprintf("Unknown property key %s", key), }) } @@ -430,11 +412,11 @@ func (p *Parser) insertPropertyKeyValue() { func (p *Parser) checkPropertyClause() { var contextNode *evaluationContextNode p.popNodeInto(&contextNode) - mandatoryFields := []string{"from", "to"} // Sample, resolution is optional (default to mean, 30s) + mandatoryFields := []evaluationContextKey{"from", "to"} // Sample, resolution is optional (default to mean, 30s) for _, field := range mandatoryFields { if !contextNode.assigned[field] { p.flagSyntaxError(SyntaxError{ - token: field, + token: string(field), message: fmt.Sprintf("Field %s is never assigned in property clause", field), }) } @@ -443,7 +425,7 @@ func (p *Parser) checkPropertyClause() { } func (p *Parser) addPipeExpression() { - var groupBy *groupByList + var groupBy function.Groups p.popNodeInto(&groupBy) var expressionList []function.Expression p.popNodeInto(&expressionList) @@ -451,16 +433,17 @@ func (p *Parser) addPipeExpression() { p.popNodeInto(&literal) var expressionNode function.Expression p.popNodeInto(&expressionNode) + p.pushExpression(function.Memoize(&expression.FunctionExpression{ FunctionName: literal, Arguments: append([]function.Expression{expressionNode}, expressionList...), - GroupBy: groupBy.list, - GroupByCollapses: groupBy.collapses, + GroupBy: groupBy.List, + GroupByCollapses: groupBy.Collapses, })) } func (p *Parser) addFunctionInvocation() { - var groupBy *groupByList + var groupBy function.Groups p.popNodeInto(&groupBy) var expressionList []function.Expression p.popNodeInto(&expressionList) @@ -470,14 +453,15 @@ func (p *Parser) addFunctionInvocation() { p.pushExpression(function.Memoize(&expression.FunctionExpression{ FunctionName: literal, Arguments: expressionList, - GroupBy: groupBy.list, - GroupByCollapses: groupBy.collapses, + GroupBy: groupBy.List, + GroupByCollapses: groupBy.Collapses, })) } func (p *Parser) addAnnotationExpression(annotation string) { var content function.Expression p.popNodeInto(&content) + p.pushExpression(&expression.AnnotationExpression{ Expression: content, Annotation: annotation, @@ -489,6 +473,7 @@ func (p *Parser) addMetricExpression() { p.popNodeInto(&predicateNode) var literal string p.popNodeInto(&literal) + p.pushExpression(function.Memoize(&expression.MetricFetchExpression{ MetricName: literal, Predicate: predicateNode, @@ -510,71 +495,73 @@ func (p *Parser) appendExpression() { func (p *Parser) addLiteralMatcher() { var literal string p.popNodeInto(&literal) - var tagLiteral *tagLiteral + var tag tagLiteral - p.popNodeInto(&tagLiteral) + p.popNodeInto(&tag) p.pushPredicate(predicate.ListMatcher{ - Tag: tagLiteral.tag, + Tag: string(tag), Values: []string{literal}, }) } func (p *Parser) addListMatcher() { - var stringLiteral *stringLiteralList + var list []string - p.popNodeInto(&stringLiteral) - var tagLiteral *tagLiteral - p.popNodeInto(&tagLiteral) + p.popNodeInto(&list) + var tag tagLiteral + p.popNodeInto(&tag) p.pushPredicate(predicate.ListMatcher{ - Tag: tagLiteral.tag, - Values: stringLiteral.literals, + Tag: string(tag), + Values: list, }) } func (p *Parser) addRegexMatcher() { compiled := p.popRegex() - var tagLiteral *tagLiteral - p.popNodeInto(&tagLiteral) + var tag tagLiteral + p.popNodeInto(&tag) + p.pushPredicate(predicate.RegexMatcher{ - Tag: tagLiteral.tag, + Tag: string(tag), Regex: compiled, }) } func (p *Parser) addTagLiteral(tag string) { - p.pushNode(&tagLiteral{tag: tag}) + p.pushNode(tagLiteral(tag)) } func (p *Parser) addLiteralList() { - p.pushNode(&stringLiteralList{make([]string, 0)}) + p.pushNode([]string(nil)) } func (p *Parser) appendLiteral(literal string) { - var listNode *stringLiteralList - p.peekNodeInto(&listNode) - listNode.literals = append(listNode.literals, literal) + var list []string + p.popNodeInto(&list) + + p.pushNode(append(list, literal)) } func (p *Parser) addGroupBy() { - p.pushNode(&groupByList{make([]string, 0), false}) + p.pushNode(function.Groups{}) } -func (p *Parser) appendGroupBy(literal string) { - var listNode *groupByList - p.peekNodeInto(&listNode) - listNode.list = append(listNode.list, literal) +func (p *Parser) addCollapseBy() { + p.pushNode(function.Groups{Collapses: true}) } -func (p *Parser) appendCollapseBy(literal string) { - var listNode *groupByList - p.peekNodeInto(&listNode) - listNode.collapses = true // Switch to collapsing mode - listNode.list = append(listNode.list, literal) +func (p *Parser) appendGroupTag(literal string) { + var groupBy function.Groups + p.popNodeInto(&groupBy) + + groupBy.List = append(groupBy.List, literal) + p.pushNode(groupBy) } func (p *Parser) addNotPredicate() { var original predicate.Predicate p.popNodeInto(&original) + p.pushPredicate(predicate.NotPredicate{Predicate: original}) } @@ -583,6 +570,7 @@ func (p *Parser) addOrPredicate() { p.popNodeInto(&rightPredicate) var leftPredicate predicate.Predicate p.popNodeInto(&leftPredicate) + p.pushPredicate(predicate.Any(leftPredicate, rightPredicate)) } @@ -595,6 +583,7 @@ func (p *Parser) addAndPredicate() { p.popNodeInto(&rightPredicate) var leftPredicate predicate.Predicate p.popNodeInto(&leftPredicate) + p.pushPredicate(predicate.All(leftPredicate, rightPredicate)) } @@ -746,6 +735,65 @@ func makePrettyLine(parser *Parser, token token32, translations textPositionMap) return line, underline } +// setContext sets the fixed context, overwriting its previous contents. +func (p *Parser) setContext(message string) bool { + p.fixedContext = message + return true +} + +// withContext adds context to errors. +func (p *Parser) withContext(message string) bool { + p.errorContext = append(p.errorContext, message) + return true +} + +func (p *Parser) after(position uint32) string { + return string(p.buffer[position : len(p.buffer)-1]) +} + +// errorHere raises a typed panic with the provided error message, incorporating +// the current line and column and the context of the error. +func (p *Parser) errorHere(position uint32, format string, arguments ...interface{}) bool { + additionalContext := "" + if len(p.errorContext) > 0 { + additionalContext += "; " + strings.Join(p.errorContext, "; ") + } + if len(p.fixedContext) > 0 { + additionalContext += " " + p.fixedContext + } + message := fmt.Sprintf("%s: %s%s", p.currentPosition(position), fmt.Sprintf(format, arguments...), additionalContext) + message = strings.Replace(message, "$OPENBRACE$", "{", -1) + message = strings.Replace(message, "$CLOSEBRACE$", "}", -1) + panic(ParserError(fmt.Errorf("%s", message))) +} + +// contents will give the token contents to the caller +func (p *Parser) contents(tree tokenTree, tokenIndex int) string { + return string(p.buffer[tree.(*tokens32).tree[tokenIndex].begin:tree.(*tokens32).tree[tokenIndex].end]) +} + +func (p *Parser) currentPosition(position uint32) string { + line := 0 + column := 0 + for i, c := range p.buffer { + if uint32(i) >= position { + break + } + switch c { + case '\n': + column = 0 + line++ + case '\r': + column = 0 + case '\t': + column = column/4*4 + 4 + default: + column++ + } + } + return fmt.Sprintf("line %d, column %d", line+1, column+1) +} + func min(x, y int) int { if x < y { return x diff --git a/testing_support/script/verify-build b/testing_support/script/verify-build index ec33a79..ff2902c 100755 --- a/testing_support/script/verify-build +++ b/testing_support/script/verify-build @@ -45,7 +45,7 @@ after=$(cat ./query/parser/language.peg.go) if [ "$before" != "$after" ]; then echo "FAIL: LANGUAGE .GO FILE IS NOT UP TO DATE" echo "THERE WERE CHANGES TO query/parser/language.peg AND NO CHANGES TO query/parser/language.peg.go" - echo "Make sure you ran the build file, and that your version of peg is up to date." + echo "Make sure you ran the build script, and that your version of peg is up to date." echo "To get the latest version of peg, run:" echo "> go get -u github.com/pointlander/peg" fails="fails"