mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
213a8fe89a
* Use generated parser for series descriptions Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
1029 lines
22 KiB
Go
1029 lines
22 KiB
Go
// Code generated by goyacc -o promql/generated_parser.y.go promql/generated_parser.y. DO NOT EDIT.
|
|
|
|
//line promql/generated_parser.y:15
|
|
package promql
|
|
|
|
import __yyfmt__ "fmt"
|
|
|
|
//line promql/generated_parser.y:15
|
|
|
|
import (
|
|
"math"
|
|
"sort"
|
|
"strconv"
|
|
|
|
"github.com/prometheus/prometheus/pkg/labels"
|
|
"github.com/prometheus/prometheus/pkg/value"
|
|
)
|
|
|
|
//line promql/generated_parser.y:27
|
|
type yySymType struct {
|
|
yys int
|
|
node Node
|
|
item Item
|
|
matchers []*labels.Matcher
|
|
matcher *labels.Matcher
|
|
label labels.Label
|
|
labels labels.Labels
|
|
strings []string
|
|
series []sequenceValue
|
|
uint uint64
|
|
float float64
|
|
}
|
|
|
|
const ERROR = 57346
|
|
const EOF = 57347
|
|
const COMMENT = 57348
|
|
const IDENTIFIER = 57349
|
|
const METRIC_IDENTIFIER = 57350
|
|
const LEFT_PAREN = 57351
|
|
const RIGHT_PAREN = 57352
|
|
const LEFT_BRACE = 57353
|
|
const RIGHT_BRACE = 57354
|
|
const LEFT_BRACKET = 57355
|
|
const RIGHT_BRACKET = 57356
|
|
const COMMA = 57357
|
|
const ASSIGN = 57358
|
|
const COLON = 57359
|
|
const SEMICOLON = 57360
|
|
const STRING = 57361
|
|
const NUMBER = 57362
|
|
const DURATION = 57363
|
|
const BLANK = 57364
|
|
const TIMES = 57365
|
|
const SPACE = 57366
|
|
const operatorsStart = 57367
|
|
const SUB = 57368
|
|
const ADD = 57369
|
|
const MUL = 57370
|
|
const MOD = 57371
|
|
const DIV = 57372
|
|
const LAND = 57373
|
|
const LOR = 57374
|
|
const LUNLESS = 57375
|
|
const EQL = 57376
|
|
const NEQ = 57377
|
|
const LTE = 57378
|
|
const LSS = 57379
|
|
const GTE = 57380
|
|
const GTR = 57381
|
|
const EQL_REGEX = 57382
|
|
const NEQ_REGEX = 57383
|
|
const POW = 57384
|
|
const operatorsEnd = 57385
|
|
const aggregatorsStart = 57386
|
|
const AVG = 57387
|
|
const COUNT = 57388
|
|
const SUM = 57389
|
|
const MIN = 57390
|
|
const MAX = 57391
|
|
const STDDEV = 57392
|
|
const STDVAR = 57393
|
|
const TOPK = 57394
|
|
const BOTTOMK = 57395
|
|
const COUNT_VALUES = 57396
|
|
const QUANTILE = 57397
|
|
const aggregatorsEnd = 57398
|
|
const keywordsStart = 57399
|
|
const OFFSET = 57400
|
|
const BY = 57401
|
|
const WITHOUT = 57402
|
|
const ON = 57403
|
|
const IGNORING = 57404
|
|
const GROUP_LEFT = 57405
|
|
const GROUP_RIGHT = 57406
|
|
const BOOL = 57407
|
|
const keywordsEnd = 57408
|
|
const startSymbolsStart = 57409
|
|
const START_LABELS = 57410
|
|
const START_METRIC = 57411
|
|
const START_GROUPING_LABELS = 57412
|
|
const START_SERIES_DESCRIPTION = 57413
|
|
const startSymbolsEnd = 57414
|
|
|
|
var yyToknames = [...]string{
|
|
"$end",
|
|
"error",
|
|
"$unk",
|
|
"ERROR",
|
|
"EOF",
|
|
"COMMENT",
|
|
"IDENTIFIER",
|
|
"METRIC_IDENTIFIER",
|
|
"LEFT_PAREN",
|
|
"RIGHT_PAREN",
|
|
"LEFT_BRACE",
|
|
"RIGHT_BRACE",
|
|
"LEFT_BRACKET",
|
|
"RIGHT_BRACKET",
|
|
"COMMA",
|
|
"ASSIGN",
|
|
"COLON",
|
|
"SEMICOLON",
|
|
"STRING",
|
|
"NUMBER",
|
|
"DURATION",
|
|
"BLANK",
|
|
"TIMES",
|
|
"SPACE",
|
|
"operatorsStart",
|
|
"SUB",
|
|
"ADD",
|
|
"MUL",
|
|
"MOD",
|
|
"DIV",
|
|
"LAND",
|
|
"LOR",
|
|
"LUNLESS",
|
|
"EQL",
|
|
"NEQ",
|
|
"LTE",
|
|
"LSS",
|
|
"GTE",
|
|
"GTR",
|
|
"EQL_REGEX",
|
|
"NEQ_REGEX",
|
|
"POW",
|
|
"operatorsEnd",
|
|
"aggregatorsStart",
|
|
"AVG",
|
|
"COUNT",
|
|
"SUM",
|
|
"MIN",
|
|
"MAX",
|
|
"STDDEV",
|
|
"STDVAR",
|
|
"TOPK",
|
|
"BOTTOMK",
|
|
"COUNT_VALUES",
|
|
"QUANTILE",
|
|
"aggregatorsEnd",
|
|
"keywordsStart",
|
|
"OFFSET",
|
|
"BY",
|
|
"WITHOUT",
|
|
"ON",
|
|
"IGNORING",
|
|
"GROUP_LEFT",
|
|
"GROUP_RIGHT",
|
|
"BOOL",
|
|
"keywordsEnd",
|
|
"startSymbolsStart",
|
|
"START_LABELS",
|
|
"START_METRIC",
|
|
"START_GROUPING_LABELS",
|
|
"START_SERIES_DESCRIPTION",
|
|
"startSymbolsEnd",
|
|
}
|
|
var yyStatenames = [...]string{}
|
|
|
|
const yyEofCode = 1
|
|
const yyErrCode = 2
|
|
const yyInitialStackSize = 16
|
|
|
|
//line promql/generated_parser.y:382
|
|
|
|
//line yacctab:1
|
|
var yyExca = [...]int{
|
|
-1, 1,
|
|
1, -1,
|
|
-2, 0,
|
|
-1, 20,
|
|
1, 69,
|
|
5, 69,
|
|
24, 69,
|
|
-2, 0,
|
|
}
|
|
|
|
const yyPrivate = 57344
|
|
|
|
const yyLast = 144
|
|
|
|
var yyAct = [...]int{
|
|
|
|
104, 94, 95, 36, 34, 23, 66, 29, 37, 38,
|
|
6, 88, 79, 107, 100, 99, 93, 98, 97, 105,
|
|
96, 15, 9, 87, 83, 75, 14, 13, 61, 96,
|
|
15, 91, 39, 40, 41, 98, 97, 10, 67, 68,
|
|
86, 82, 7, 20, 69, 70, 42, 43, 44, 45,
|
|
46, 47, 48, 49, 50, 51, 52, 74, 73, 53,
|
|
54, 19, 55, 56, 57, 58, 59, 36, 71, 81,
|
|
1, 72, 37, 38, 64, 33, 2, 3, 4, 5,
|
|
85, 78, 89, 31, 62, 18, 92, 63, 30, 76,
|
|
12, 90, 17, 84, 77, 101, 39, 40, 41, 102,
|
|
103, 106, 26, 60, 32, 16, 27, 35, 108, 11,
|
|
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
|
52, 65, 21, 53, 54, 8, 55, 56, 57, 58,
|
|
59, 25, 31, 25, 0, 0, 24, 30, 24, 0,
|
|
0, 80, 28, 22,
|
|
}
|
|
var yyPact = [...]int{
|
|
|
|
8, 37, 11, 19, 83, 19, -1000, -1000, -1000, 131,
|
|
-1000, 10, -1000, -1000, -1000, 130, -1000, 65, -1000, -1000,
|
|
26, 72, -1000, -1000, 4, -1000, -1000, 56, -1000, -1000,
|
|
23, -1000, 79, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-12, -1000, -1000, 129, -1000, 22, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, 81, -1000, 21, -1000, -1000, 1, -1000, 9,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -8, -9, -1000, -1000, -1000, -1000, 0, 0, -1,
|
|
-1, -10, -1000, -1000, -1000, -1000, -1000, -1, -1000,
|
|
}
|
|
var yyPgo = [...]int{
|
|
|
|
0, 125, 122, 5, 121, 109, 4, 107, 106, 90,
|
|
37, 7, 105, 104, 103, 91, 0, 86, 2, 1,
|
|
70, 61,
|
|
}
|
|
var yyR1 = [...]int{
|
|
|
|
0, 20, 20, 20, 20, 20, 20, 1, 1, 1,
|
|
2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
|
|
4, 10, 10, 5, 5, 9, 9, 9, 9, 8,
|
|
8, 8, 11, 11, 11, 11, 12, 12, 12, 12,
|
|
13, 13, 13, 6, 6, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 21, 14,
|
|
14, 14, 14, 15, 15, 15, 15, 15, 16, 18,
|
|
18, 17, 17, 17, 19,
|
|
}
|
|
var yyR2 = [...]int{
|
|
|
|
0, 2, 2, 2, 2, 2, 1, 3, 4, 2,
|
|
3, 1, 2, 3, 3, 2, 1, 1, 1, 1,
|
|
1, 2, 1, 1, 1, 3, 4, 2, 0, 3,
|
|
1, 2, 3, 3, 2, 1, 3, 4, 2, 1,
|
|
3, 1, 2, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 2, 0,
|
|
3, 2, 1, 1, 3, 1, 3, 4, 1, 2,
|
|
2, 1, 1, 1, 1,
|
|
}
|
|
var yyChk = [...]int{
|
|
|
|
-1000, -20, 68, 69, 70, 71, 2, 5, -1, 11,
|
|
-10, -5, -9, 8, 7, 11, -12, 9, 2, -21,
|
|
-10, -2, 12, -3, 7, 2, -9, -8, 12, -11,
|
|
7, 2, -13, 10, -6, -7, 2, 7, 8, 31,
|
|
32, 33, 45, 46, 47, 48, 49, 50, 51, 52,
|
|
53, 54, 55, 58, 59, 61, 62, 63, 64, 65,
|
|
-14, 2, 12, 15, 2, -4, 2, 34, 35, 40,
|
|
41, 12, 15, 2, 34, 2, 10, 15, 2, 24,
|
|
12, -3, 19, 2, 12, -11, 19, 2, 10, -6,
|
|
-15, 22, -17, 7, -19, -18, 20, 27, 26, 23,
|
|
23, -18, -19, -19, -16, 20, -16, 23, -16,
|
|
}
|
|
var yyDef = [...]int{
|
|
|
|
0, -2, 0, 28, 0, 28, 6, 5, 1, 0,
|
|
2, 28, 22, 23, 24, 0, 3, 0, 39, 4,
|
|
-2, 0, 9, 11, 0, 16, 21, 0, 27, 30,
|
|
0, 35, 0, 38, 41, 43, 44, 45, 46, 47,
|
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
|
|
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
|
|
68, 72, 7, 0, 12, 0, 15, 17, 18, 19,
|
|
20, 25, 0, 31, 0, 34, 36, 0, 42, 71,
|
|
8, 10, 13, 14, 26, 29, 32, 33, 37, 40,
|
|
70, 73, 75, 81, 82, 83, 84, 0, 0, 0,
|
|
0, 0, 79, 80, 74, 78, 76, 0, 77,
|
|
}
|
|
var yyTok1 = [...]int{
|
|
|
|
1,
|
|
}
|
|
var yyTok2 = [...]int{
|
|
|
|
2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
|
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
|
|
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
|
52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
|
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
|
|
72,
|
|
}
|
|
var yyTok3 = [...]int{
|
|
0,
|
|
}
|
|
|
|
var yyErrorMessages = [...]struct {
|
|
state int
|
|
token int
|
|
msg string
|
|
}{}
|
|
|
|
//line yaccpar:1
|
|
|
|
/* parser for yacc output */
|
|
|
|
var (
|
|
yyDebug = 0
|
|
yyErrorVerbose = false
|
|
)
|
|
|
|
type yyLexer interface {
|
|
Lex(lval *yySymType) int
|
|
Error(s string)
|
|
}
|
|
|
|
type yyParser interface {
|
|
Parse(yyLexer) int
|
|
Lookahead() int
|
|
}
|
|
|
|
type yyParserImpl struct {
|
|
lval yySymType
|
|
stack [yyInitialStackSize]yySymType
|
|
char int
|
|
}
|
|
|
|
func (p *yyParserImpl) Lookahead() int {
|
|
return p.char
|
|
}
|
|
|
|
func yyNewParser() yyParser {
|
|
return &yyParserImpl{}
|
|
}
|
|
|
|
const yyFlag = -1000
|
|
|
|
func yyTokname(c int) string {
|
|
if c >= 1 && c-1 < len(yyToknames) {
|
|
if yyToknames[c-1] != "" {
|
|
return yyToknames[c-1]
|
|
}
|
|
}
|
|
return __yyfmt__.Sprintf("tok-%v", c)
|
|
}
|
|
|
|
func yyStatname(s int) string {
|
|
if s >= 0 && s < len(yyStatenames) {
|
|
if yyStatenames[s] != "" {
|
|
return yyStatenames[s]
|
|
}
|
|
}
|
|
return __yyfmt__.Sprintf("state-%v", s)
|
|
}
|
|
|
|
func yyErrorMessage(state, lookAhead int) string {
|
|
const TOKSTART = 4
|
|
|
|
if !yyErrorVerbose {
|
|
return "syntax error"
|
|
}
|
|
|
|
for _, e := range yyErrorMessages {
|
|
if e.state == state && e.token == lookAhead {
|
|
return "syntax error: " + e.msg
|
|
}
|
|
}
|
|
|
|
res := "syntax error: unexpected " + yyTokname(lookAhead)
|
|
|
|
// To match Bison, suggest at most four expected tokens.
|
|
expected := make([]int, 0, 4)
|
|
|
|
// Look for shiftable tokens.
|
|
base := yyPact[state]
|
|
for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {
|
|
if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {
|
|
if len(expected) == cap(expected) {
|
|
return res
|
|
}
|
|
expected = append(expected, tok)
|
|
}
|
|
}
|
|
|
|
if yyDef[state] == -2 {
|
|
i := 0
|
|
for yyExca[i] != -1 || yyExca[i+1] != state {
|
|
i += 2
|
|
}
|
|
|
|
// Look for tokens that we accept or reduce.
|
|
for i += 2; yyExca[i] >= 0; i += 2 {
|
|
tok := yyExca[i]
|
|
if tok < TOKSTART || yyExca[i+1] == 0 {
|
|
continue
|
|
}
|
|
if len(expected) == cap(expected) {
|
|
return res
|
|
}
|
|
expected = append(expected, tok)
|
|
}
|
|
|
|
// If the default action is to accept or reduce, give up.
|
|
if yyExca[i+1] != 0 {
|
|
return res
|
|
}
|
|
}
|
|
|
|
for i, tok := range expected {
|
|
if i == 0 {
|
|
res += ", expecting "
|
|
} else {
|
|
res += " or "
|
|
}
|
|
res += yyTokname(tok)
|
|
}
|
|
return res
|
|
}
|
|
|
|
func yylex1(lex yyLexer, lval *yySymType) (char, token int) {
|
|
token = 0
|
|
char = lex.Lex(lval)
|
|
if char <= 0 {
|
|
token = yyTok1[0]
|
|
goto out
|
|
}
|
|
if char < len(yyTok1) {
|
|
token = yyTok1[char]
|
|
goto out
|
|
}
|
|
if char >= yyPrivate {
|
|
if char < yyPrivate+len(yyTok2) {
|
|
token = yyTok2[char-yyPrivate]
|
|
goto out
|
|
}
|
|
}
|
|
for i := 0; i < len(yyTok3); i += 2 {
|
|
token = yyTok3[i+0]
|
|
if token == char {
|
|
token = yyTok3[i+1]
|
|
goto out
|
|
}
|
|
}
|
|
|
|
out:
|
|
if token == 0 {
|
|
token = yyTok2[1] /* unknown char */
|
|
}
|
|
if yyDebug >= 3 {
|
|
__yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))
|
|
}
|
|
return char, token
|
|
}
|
|
|
|
func yyParse(yylex yyLexer) int {
|
|
return yyNewParser().Parse(yylex)
|
|
}
|
|
|
|
func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int {
|
|
var yyn int
|
|
var yyVAL yySymType
|
|
var yyDollar []yySymType
|
|
_ = yyDollar // silence set and not used
|
|
yyS := yyrcvr.stack[:]
|
|
|
|
Nerrs := 0 /* number of errors */
|
|
Errflag := 0 /* error recovery flag */
|
|
yystate := 0
|
|
yyrcvr.char = -1
|
|
yytoken := -1 // yyrcvr.char translated into internal numbering
|
|
defer func() {
|
|
// Make sure we report no lookahead when not parsing.
|
|
yystate = -1
|
|
yyrcvr.char = -1
|
|
yytoken = -1
|
|
}()
|
|
yyp := -1
|
|
goto yystack
|
|
|
|
ret0:
|
|
return 0
|
|
|
|
ret1:
|
|
return 1
|
|
|
|
yystack:
|
|
/* put a state and value onto the stack */
|
|
if yyDebug >= 4 {
|
|
__yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate))
|
|
}
|
|
|
|
yyp++
|
|
if yyp >= len(yyS) {
|
|
nyys := make([]yySymType, len(yyS)*2)
|
|
copy(nyys, yyS)
|
|
yyS = nyys
|
|
}
|
|
yyS[yyp] = yyVAL
|
|
yyS[yyp].yys = yystate
|
|
|
|
yynewstate:
|
|
yyn = yyPact[yystate]
|
|
if yyn <= yyFlag {
|
|
goto yydefault /* simple state */
|
|
}
|
|
if yyrcvr.char < 0 {
|
|
yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)
|
|
}
|
|
yyn += yytoken
|
|
if yyn < 0 || yyn >= yyLast {
|
|
goto yydefault
|
|
}
|
|
yyn = yyAct[yyn]
|
|
if yyChk[yyn] == yytoken { /* valid shift */
|
|
yyrcvr.char = -1
|
|
yytoken = -1
|
|
yyVAL = yyrcvr.lval
|
|
yystate = yyn
|
|
if Errflag > 0 {
|
|
Errflag--
|
|
}
|
|
goto yystack
|
|
}
|
|
|
|
yydefault:
|
|
/* default state action */
|
|
yyn = yyDef[yystate]
|
|
if yyn == -2 {
|
|
if yyrcvr.char < 0 {
|
|
yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)
|
|
}
|
|
|
|
/* look through exception table */
|
|
xi := 0
|
|
for {
|
|
if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {
|
|
break
|
|
}
|
|
xi += 2
|
|
}
|
|
for xi += 2; ; xi += 2 {
|
|
yyn = yyExca[xi+0]
|
|
if yyn < 0 || yyn == yytoken {
|
|
break
|
|
}
|
|
}
|
|
yyn = yyExca[xi+1]
|
|
if yyn < 0 {
|
|
goto ret0
|
|
}
|
|
}
|
|
if yyn == 0 {
|
|
/* error ... attempt to resume parsing */
|
|
switch Errflag {
|
|
case 0: /* brand new error */
|
|
yylex.Error(yyErrorMessage(yystate, yytoken))
|
|
Nerrs++
|
|
if yyDebug >= 1 {
|
|
__yyfmt__.Printf("%s", yyStatname(yystate))
|
|
__yyfmt__.Printf(" saw %s\n", yyTokname(yytoken))
|
|
}
|
|
fallthrough
|
|
|
|
case 1, 2: /* incompletely recovered error ... try again */
|
|
Errflag = 3
|
|
|
|
/* find a state where "error" is a legal shift action */
|
|
for yyp >= 0 {
|
|
yyn = yyPact[yyS[yyp].yys] + yyErrCode
|
|
if yyn >= 0 && yyn < yyLast {
|
|
yystate = yyAct[yyn] /* simulate a shift of "error" */
|
|
if yyChk[yystate] == yyErrCode {
|
|
goto yystack
|
|
}
|
|
}
|
|
|
|
/* the current p has no shift on "error", pop stack */
|
|
if yyDebug >= 2 {
|
|
__yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)
|
|
}
|
|
yyp--
|
|
}
|
|
/* there is no state on the stack with an error shift ... abort */
|
|
goto ret1
|
|
|
|
case 3: /* no shift yet; clobber input char */
|
|
if yyDebug >= 2 {
|
|
__yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken))
|
|
}
|
|
if yytoken == yyEofCode {
|
|
goto ret1
|
|
}
|
|
yyrcvr.char = -1
|
|
yytoken = -1
|
|
goto yynewstate /* try again in the same state */
|
|
}
|
|
}
|
|
|
|
/* reduction by production yyn */
|
|
if yyDebug >= 2 {
|
|
__yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))
|
|
}
|
|
|
|
yynt := yyn
|
|
yypt := yyp
|
|
_ = yypt // guard against "declared and not used"
|
|
|
|
yyp -= yyR2[yyn]
|
|
// yyp is now the index of $0. Perform the default action. Iff the
|
|
// reduced production is ε, $1 is possibly out of range.
|
|
if yyp+1 >= len(yyS) {
|
|
nyys := make([]yySymType, len(yyS)*2)
|
|
copy(nyys, yyS)
|
|
yyS = nyys
|
|
}
|
|
yyVAL = yyS[yyp+1]
|
|
|
|
/* consult goto table to find next state */
|
|
yyn = yyR1[yyn]
|
|
yyg := yyPgo[yyn]
|
|
yyj := yyg + yyS[yyp].yys + 1
|
|
|
|
if yyj >= yyLast {
|
|
yystate = yyAct[yyg]
|
|
} else {
|
|
yystate = yyAct[yyj]
|
|
if yyChk[yystate] != -yyn {
|
|
yystate = yyAct[yyg]
|
|
}
|
|
}
|
|
// dummy call; replaced with literal code
|
|
switch yynt {
|
|
|
|
case 1:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:138
|
|
{
|
|
yylex.(*parser).generatedParserResult.(*VectorSelector).LabelMatchers = yyDollar[2].matchers
|
|
}
|
|
case 2:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:140
|
|
{
|
|
yylex.(*parser).generatedParserResult = yyDollar[2].labels
|
|
}
|
|
case 3:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:142
|
|
{
|
|
yylex.(*parser).generatedParserResult = yyDollar[2].strings
|
|
}
|
|
case 6:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:146
|
|
{
|
|
yylex.(*parser).unexpected("", "")
|
|
}
|
|
case 7:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:152
|
|
{
|
|
yyVAL.matchers = yyDollar[2].matchers
|
|
}
|
|
case 8:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:154
|
|
{
|
|
yyVAL.matchers = yyDollar[2].matchers
|
|
}
|
|
case 9:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:156
|
|
{
|
|
yyVAL.matchers = []*labels.Matcher{}
|
|
}
|
|
case 10:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:162
|
|
{
|
|
yyVAL.matchers = append(yyDollar[1].matchers, yyDollar[3].matcher)
|
|
}
|
|
case 11:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:164
|
|
{
|
|
yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher}
|
|
}
|
|
case 12:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:166
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "\",\" or \"}\"")
|
|
}
|
|
case 13:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:171
|
|
{
|
|
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
|
|
}
|
|
case 14:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:173
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "string")
|
|
}
|
|
case 15:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:175
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "label matching operator")
|
|
}
|
|
case 16:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:177
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "identifier or \"}\"")
|
|
}
|
|
case 17:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:181
|
|
{
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 18:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:182
|
|
{
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 19:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:183
|
|
{
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 20:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:184
|
|
{
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 21:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:190
|
|
{
|
|
yyVAL.labels = append(yyDollar[2].labels, labels.Label{Name: labels.MetricName, Value: yyDollar[1].item.Val})
|
|
sort.Sort(yyVAL.labels)
|
|
}
|
|
case 22:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:192
|
|
{
|
|
yyVAL.labels = yyDollar[1].labels
|
|
}
|
|
case 23:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:199
|
|
{
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 24:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:200
|
|
{
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 25:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:204
|
|
{
|
|
yyVAL.labels = labels.New(yyDollar[2].labels...)
|
|
}
|
|
case 26:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:206
|
|
{
|
|
yyVAL.labels = labels.New(yyDollar[2].labels...)
|
|
}
|
|
case 27:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:208
|
|
{
|
|
yyVAL.labels = labels.New()
|
|
}
|
|
case 28:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:210
|
|
{
|
|
yyVAL.labels = labels.New()
|
|
}
|
|
case 29:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:215
|
|
{
|
|
yyVAL.labels = append(yyDollar[1].labels, yyDollar[3].label)
|
|
}
|
|
case 30:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:217
|
|
{
|
|
yyVAL.labels = []labels.Label{yyDollar[1].label}
|
|
}
|
|
case 31:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:219
|
|
{
|
|
yylex.(*parser).unexpected("label set", "\",\" or \"}\"")
|
|
}
|
|
case 32:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:225
|
|
{
|
|
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
|
|
}
|
|
case 33:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:227
|
|
{
|
|
yylex.(*parser).unexpected("label set", "string")
|
|
}
|
|
case 34:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:229
|
|
{
|
|
yylex.(*parser).unexpected("label set", "\"=\"")
|
|
}
|
|
case 35:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:231
|
|
{
|
|
yylex.(*parser).unexpected("label set", "identifier or \"}\"")
|
|
}
|
|
case 36:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:236
|
|
{
|
|
yyVAL.strings = yyDollar[2].strings
|
|
}
|
|
case 37:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:238
|
|
{
|
|
yyVAL.strings = yyDollar[2].strings
|
|
}
|
|
case 38:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:240
|
|
{
|
|
yyVAL.strings = []string{}
|
|
}
|
|
case 39:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:242
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "\"(\"")
|
|
}
|
|
case 40:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:248
|
|
{
|
|
yyVAL.strings = append(yyDollar[1].strings, yyDollar[3].item.Val)
|
|
}
|
|
case 41:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:250
|
|
{
|
|
yyVAL.strings = []string{yyDollar[1].item.Val}
|
|
}
|
|
case 42:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:252
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "\",\" or \"}\"")
|
|
}
|
|
case 43:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:257
|
|
{
|
|
if !isLabel(yyDollar[1].item.Val) {
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
}
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 44:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:264
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
}
|
|
case 68:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:297
|
|
{
|
|
yylex.(*parser).generatedParserResult = &seriesDescription{
|
|
labels: yyDollar[1].labels,
|
|
values: yyDollar[2].series,
|
|
}
|
|
}
|
|
case 69:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:307
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
}
|
|
case 70:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:309
|
|
{
|
|
yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...)
|
|
}
|
|
case 71:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:311
|
|
{
|
|
yyVAL.series = yyDollar[1].series
|
|
}
|
|
case 72:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:313
|
|
{
|
|
yylex.(*parser).unexpected("series values", "")
|
|
}
|
|
case 73:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:318
|
|
{
|
|
yyVAL.series = []sequenceValue{{omitted: true}}
|
|
}
|
|
case 74:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:320
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
for i := uint64(0); i < yyDollar[3].uint; i++ {
|
|
yyVAL.series = append(yyVAL.series, sequenceValue{omitted: true})
|
|
}
|
|
}
|
|
case 75:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:327
|
|
{
|
|
yyVAL.series = []sequenceValue{{value: yyDollar[1].float}}
|
|
}
|
|
case 76:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:329
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
for i := uint64(0); i <= yyDollar[3].uint; i++ {
|
|
yyVAL.series = append(yyVAL.series, sequenceValue{value: yyDollar[1].float})
|
|
}
|
|
}
|
|
case 77:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:336
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
for i := uint64(0); i <= yyDollar[4].uint; i++ {
|
|
yyVAL.series = append(yyVAL.series, sequenceValue{value: yyDollar[1].float})
|
|
yyDollar[1].float += yyDollar[2].float
|
|
}
|
|
}
|
|
case 78:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:345
|
|
{
|
|
var err error
|
|
yyVAL.uint, err = strconv.ParseUint(yyDollar[1].item.Val, 10, 64)
|
|
if err != nil {
|
|
yylex.(*parser).errorf("invalid repitition in series values: %s", err)
|
|
}
|
|
}
|
|
case 79:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:356
|
|
{
|
|
yyVAL.float = yyDollar[2].float
|
|
}
|
|
case 80:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:358
|
|
{
|
|
yyVAL.float = -yyDollar[2].float
|
|
}
|
|
case 81:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:363
|
|
{
|
|
if yyDollar[1].item.Val != "stale" {
|
|
yylex.(*parser).unexpected("series values", "number or \"stale\"")
|
|
}
|
|
yyVAL.float = math.Float64frombits(value.StaleNaN)
|
|
}
|
|
case 82:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:370
|
|
{
|
|
yyVAL.float = yyDollar[1].float
|
|
}
|
|
case 83:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:372
|
|
{
|
|
yyVAL.float = yyDollar[1].float
|
|
}
|
|
case 84:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:379
|
|
{
|
|
yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val)
|
|
}
|
|
}
|
|
goto yystack /* stack new state and value */
|
|
}
|