mirror of
https://github.com/prometheus/prometheus
synced 2024-12-25 07:52:28 +00:00
d8bc24349c
* PromQL: Fix unary operator precedence Fixes #6575 Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
1485 lines
36 KiB
Go
1485 lines
36 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"
|
|
"time"
|
|
|
|
"github.com/prometheus/prometheus/pkg/labels"
|
|
"github.com/prometheus/prometheus/pkg/value"
|
|
)
|
|
|
|
//line promql/generated_parser.y:28
|
|
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
|
|
string string
|
|
duration time.Duration
|
|
}
|
|
|
|
const ASSIGN = 57346
|
|
const BLANK = 57347
|
|
const COLON = 57348
|
|
const COMMA = 57349
|
|
const COMMENT = 57350
|
|
const DURATION = 57351
|
|
const EOF = 57352
|
|
const ERROR = 57353
|
|
const IDENTIFIER = 57354
|
|
const LEFT_BRACE = 57355
|
|
const LEFT_BRACKET = 57356
|
|
const LEFT_PAREN = 57357
|
|
const METRIC_IDENTIFIER = 57358
|
|
const NUMBER = 57359
|
|
const RIGHT_BRACE = 57360
|
|
const RIGHT_BRACKET = 57361
|
|
const RIGHT_PAREN = 57362
|
|
const SEMICOLON = 57363
|
|
const SPACE = 57364
|
|
const STRING = 57365
|
|
const TIMES = 57366
|
|
const operatorsStart = 57367
|
|
const ADD = 57368
|
|
const DIV = 57369
|
|
const EQL = 57370
|
|
const EQL_REGEX = 57371
|
|
const GTE = 57372
|
|
const GTR = 57373
|
|
const LAND = 57374
|
|
const LOR = 57375
|
|
const LSS = 57376
|
|
const LTE = 57377
|
|
const LUNLESS = 57378
|
|
const MOD = 57379
|
|
const MUL = 57380
|
|
const NEQ = 57381
|
|
const NEQ_REGEX = 57382
|
|
const POW = 57383
|
|
const SUB = 57384
|
|
const operatorsEnd = 57385
|
|
const aggregatorsStart = 57386
|
|
const AVG = 57387
|
|
const BOTTOMK = 57388
|
|
const COUNT = 57389
|
|
const COUNT_VALUES = 57390
|
|
const MAX = 57391
|
|
const MIN = 57392
|
|
const QUANTILE = 57393
|
|
const STDDEV = 57394
|
|
const STDVAR = 57395
|
|
const SUM = 57396
|
|
const TOPK = 57397
|
|
const aggregatorsEnd = 57398
|
|
const keywordsStart = 57399
|
|
const BOOL = 57400
|
|
const BY = 57401
|
|
const GROUP_LEFT = 57402
|
|
const GROUP_RIGHT = 57403
|
|
const IGNORING = 57404
|
|
const OFFSET = 57405
|
|
const ON = 57406
|
|
const WITHOUT = 57407
|
|
const keywordsEnd = 57408
|
|
const startSymbolsStart = 57409
|
|
const START_METRIC = 57410
|
|
const START_SERIES_DESCRIPTION = 57411
|
|
const START_EXPRESSION = 57412
|
|
const START_METRIC_SELECTOR = 57413
|
|
const startSymbolsEnd = 57414
|
|
|
|
var yyToknames = [...]string{
|
|
"$end",
|
|
"error",
|
|
"$unk",
|
|
"ASSIGN",
|
|
"BLANK",
|
|
"COLON",
|
|
"COMMA",
|
|
"COMMENT",
|
|
"DURATION",
|
|
"EOF",
|
|
"ERROR",
|
|
"IDENTIFIER",
|
|
"LEFT_BRACE",
|
|
"LEFT_BRACKET",
|
|
"LEFT_PAREN",
|
|
"METRIC_IDENTIFIER",
|
|
"NUMBER",
|
|
"RIGHT_BRACE",
|
|
"RIGHT_BRACKET",
|
|
"RIGHT_PAREN",
|
|
"SEMICOLON",
|
|
"SPACE",
|
|
"STRING",
|
|
"TIMES",
|
|
"operatorsStart",
|
|
"ADD",
|
|
"DIV",
|
|
"EQL",
|
|
"EQL_REGEX",
|
|
"GTE",
|
|
"GTR",
|
|
"LAND",
|
|
"LOR",
|
|
"LSS",
|
|
"LTE",
|
|
"LUNLESS",
|
|
"MOD",
|
|
"MUL",
|
|
"NEQ",
|
|
"NEQ_REGEX",
|
|
"POW",
|
|
"SUB",
|
|
"operatorsEnd",
|
|
"aggregatorsStart",
|
|
"AVG",
|
|
"BOTTOMK",
|
|
"COUNT",
|
|
"COUNT_VALUES",
|
|
"MAX",
|
|
"MIN",
|
|
"QUANTILE",
|
|
"STDDEV",
|
|
"STDVAR",
|
|
"SUM",
|
|
"TOPK",
|
|
"aggregatorsEnd",
|
|
"keywordsStart",
|
|
"BOOL",
|
|
"BY",
|
|
"GROUP_LEFT",
|
|
"GROUP_RIGHT",
|
|
"IGNORING",
|
|
"OFFSET",
|
|
"ON",
|
|
"WITHOUT",
|
|
"keywordsEnd",
|
|
"startSymbolsStart",
|
|
"START_METRIC",
|
|
"START_SERIES_DESCRIPTION",
|
|
"START_EXPRESSION",
|
|
"START_METRIC_SELECTOR",
|
|
"startSymbolsEnd",
|
|
}
|
|
var yyStatenames = [...]string{}
|
|
|
|
const yyEofCode = 1
|
|
const yyErrCode = 2
|
|
const yyInitialStackSize = 16
|
|
|
|
//line promql/generated_parser.y:641
|
|
|
|
//line yacctab:1
|
|
var yyExca = [...]int{
|
|
-1, 1,
|
|
1, -1,
|
|
-2, 0,
|
|
-1, 15,
|
|
1, 102,
|
|
10, 102,
|
|
22, 102,
|
|
-2, 0,
|
|
-1, 158,
|
|
12, 164,
|
|
13, 164,
|
|
16, 164,
|
|
17, 164,
|
|
23, 164,
|
|
26, 164,
|
|
42, 164,
|
|
45, 164,
|
|
46, 164,
|
|
47, 164,
|
|
48, 164,
|
|
49, 164,
|
|
50, 164,
|
|
51, 164,
|
|
52, 164,
|
|
53, 164,
|
|
54, 164,
|
|
55, 164,
|
|
-2, 0,
|
|
-1, 159,
|
|
12, 164,
|
|
13, 164,
|
|
16, 164,
|
|
17, 164,
|
|
23, 164,
|
|
26, 164,
|
|
42, 164,
|
|
45, 164,
|
|
46, 164,
|
|
47, 164,
|
|
48, 164,
|
|
49, 164,
|
|
50, 164,
|
|
51, 164,
|
|
52, 164,
|
|
53, 164,
|
|
54, 164,
|
|
55, 164,
|
|
-2, 0,
|
|
-1, 175,
|
|
19, 162,
|
|
-2, 0,
|
|
-1, 222,
|
|
19, 163,
|
|
-2, 0,
|
|
}
|
|
|
|
const yyPrivate = 57344
|
|
|
|
const yyLast = 484
|
|
|
|
var yyAct = [...]int{
|
|
|
|
228, 179, 17, 119, 218, 219, 31, 152, 91, 57,
|
|
80, 79, 82, 156, 104, 157, 181, 6, 83, 158,
|
|
159, 78, 212, 231, 153, 98, 190, 211, 99, 206,
|
|
196, 210, 146, 229, 234, 86, 81, 87, 232, 226,
|
|
154, 85, 205, 36, 225, 48, 192, 193, 75, 84,
|
|
194, 97, 209, 145, 84, 52, 13, 224, 100, 182,
|
|
184, 186, 187, 195, 197, 200, 201, 202, 203, 204,
|
|
77, 7, 183, 185, 188, 189, 191, 198, 199, 88,
|
|
233, 93, 122, 2, 3, 4, 5, 132, 126, 129,
|
|
124, 92, 125, 82, 12, 52, 28, 207, 11, 83,
|
|
12, 13, 53, 155, 11, 144, 151, 61, 160, 161,
|
|
162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
|
|
172, 173, 105, 106, 107, 108, 109, 110, 111, 112,
|
|
113, 114, 115, 116, 117, 118, 176, 181, 148, 138,
|
|
175, 128, 59, 14, 208, 150, 1, 190, 221, 223,
|
|
48, 196, 58, 174, 127, 178, 121, 213, 143, 153,
|
|
214, 215, 216, 217, 220, 139, 141, 192, 193, 35,
|
|
8, 194, 9, 9, 15, 154, 140, 142, 33, 222,
|
|
182, 184, 186, 187, 195, 197, 200, 201, 202, 203,
|
|
204, 27, 26, 183, 185, 188, 189, 191, 198, 199,
|
|
136, 78, 96, 25, 123, 135, 24, 95, 120, 227,
|
|
93, 121, 10, 230, 63, 121, 134, 78, 94, 103,
|
|
92, 23, 54, 133, 72, 73, 90, 235, 75, 62,
|
|
63, 64, 236, 65, 66, 67, 68, 69, 70, 71,
|
|
72, 73, 74, 59, 75, 76, 22, 21, 101, 130,
|
|
77, 78, 20, 58, 102, 19, 18, 149, 60, 56,
|
|
147, 177, 55, 62, 63, 64, 77, 65, 66, 67,
|
|
68, 69, 70, 71, 72, 73, 74, 34, 75, 76,
|
|
180, 78, 137, 29, 89, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 62, 63, 64, 0, 65, 66, 67,
|
|
77, 69, 70, 71, 72, 73, 74, 0, 75, 76,
|
|
0, 78, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 62, 63, 64, 0, 65, 66, 0,
|
|
77, 69, 70, 0, 72, 73, 74, 0, 75, 76,
|
|
30, 52, 0, 32, 11, 48, 0, 0, 131, 0,
|
|
0, 49, 0, 0, 50, 0, 16, 0, 30, 52,
|
|
77, 32, 11, 48, 0, 0, 0, 0, 0, 49,
|
|
51, 0, 50, 37, 38, 39, 40, 41, 42, 43,
|
|
44, 45, 46, 47, 0, 0, 0, 0, 51, 0,
|
|
0, 37, 38, 39, 40, 41, 42, 43, 44, 45,
|
|
46, 47, 30, 52, 0, 32, 11, 48, 0, 0,
|
|
0, 0, 0, 49, 0, 0, 50, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 51, 0, 78, 37, 38, 39, 40, 41,
|
|
42, 43, 44, 45, 46, 47, 62, 63, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 72, 73, 0,
|
|
0, 75, 76, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 77,
|
|
}
|
|
var yyPact = [...]int{
|
|
|
|
15, 61, 88, 88, 346, 82, -1000, -1000, -1000, 43,
|
|
-1000, -1000, -1000, 241, -1000, 105, -1000, 237, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 34,
|
|
39, -1000, 390, -1000, 390, 42, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, 208, -1000, -1000, 200, -1000, -1000, 23, -1000,
|
|
6, -1000, -44, -44, -44, -44, -44, -44, -44, -44,
|
|
-44, -44, -44, -44, -44, -44, -44, 206, 202, 39,
|
|
-47, -1000, 139, 139, 328, -1000, 203, 7, -1000, 198,
|
|
-1000, -1000, 137, -1000, -1000, 140, -1000, 30, -1000, 133,
|
|
390, -1000, -49, -41, -1000, 390, 390, 390, 390, 390,
|
|
390, 390, 390, 390, 390, 390, 390, 390, 390, -1000,
|
|
-1000, -1000, 134, -1000, -1000, -1000, -1000, 135, -1000, -1000,
|
|
22, -1000, 237, -1000, -1000, 79, -1000, 29, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 3, -2,
|
|
-1000, -1000, -1000, 28, 28, 187, 139, 139, 139, 139,
|
|
7, 420, 420, 420, 297, 267, 420, 420, 297, 7,
|
|
7, 420, 7, 187, -1000, 147, -1000, 37, -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, -1000, 390, -1000, -1000, -1000,
|
|
-1000, 16, 16, -1, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, 19, 78, -1000, -1000, 14, -1000, 237, -1000, -1000,
|
|
-1000, 16, -1000, -1000, -1000, -1000, -1000,
|
|
}
|
|
var yyPgo = [...]int{
|
|
|
|
0, 284, 43, 8, 283, 1, 282, 280, 169, 277,
|
|
212, 262, 170, 9, 261, 5, 4, 260, 258, 0,
|
|
6, 257, 7, 256, 11, 58, 255, 254, 2, 252,
|
|
249, 10, 248, 247, 246, 221, 219, 206, 203, 192,
|
|
191, 96, 178, 3, 148, 146, 143,
|
|
}
|
|
var yyR1 = [...]int{
|
|
|
|
0, 45, 45, 45, 45, 45, 45, 45, 28, 28,
|
|
28, 28, 28, 28, 28, 28, 28, 28, 28, 23,
|
|
23, 23, 23, 24, 24, 26, 26, 26, 26, 26,
|
|
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
|
25, 27, 27, 36, 36, 32, 32, 32, 32, 15,
|
|
15, 15, 15, 14, 14, 14, 5, 5, 29, 31,
|
|
31, 30, 30, 37, 35, 35, 33, 39, 39, 39,
|
|
39, 39, 40, 41, 41, 41, 2, 2, 2, 1,
|
|
1, 1, 3, 3, 3, 3, 12, 12, 8, 8,
|
|
10, 10, 10, 10, 11, 11, 11, 13, 13, 13,
|
|
13, 46, 18, 18, 18, 18, 17, 17, 17, 17,
|
|
17, 21, 21, 21, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 9, 9,
|
|
6, 6, 6, 6, 34, 20, 22, 22, 19, 43,
|
|
38, 42, 44, 44, 16, 16,
|
|
}
|
|
var yyR2 = [...]int{
|
|
|
|
0, 2, 2, 2, 2, 2, 2, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
|
|
3, 2, 2, 2, 2, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
1, 0, 1, 3, 3, 1, 1, 3, 3, 3,
|
|
4, 2, 1, 3, 1, 2, 1, 1, 2, 3,
|
|
2, 3, 1, 3, 3, 3, 4, 6, 6, 5,
|
|
4, 3, 2, 2, 1, 1, 3, 4, 2, 3,
|
|
1, 2, 3, 3, 2, 1, 2, 1, 1, 1,
|
|
3, 4, 2, 0, 3, 1, 2, 3, 3, 2,
|
|
1, 2, 0, 3, 2, 1, 1, 3, 1, 3,
|
|
4, 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, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 2, 2, 1, 1,
|
|
1, 1, 0, 1, 0, 1,
|
|
}
|
|
var yyChk = [...]int{
|
|
|
|
-1000, -45, 68, 69, 70, 71, 2, 10, -12, -8,
|
|
-10, 16, 12, 13, -46, -12, 10, -28, -23, -26,
|
|
-29, -33, -34, -35, -37, -38, -39, -40, -41, -4,
|
|
12, -20, 15, -42, -9, -8, -2, 45, 46, 47,
|
|
48, 49, 50, 51, 52, 53, 54, 55, 17, 23,
|
|
26, 42, 13, -41, -10, -11, 18, -13, 12, 2,
|
|
-18, 2, 26, 27, 28, 30, 31, 32, 33, 34,
|
|
35, 36, 37, 38, 39, 41, 42, 63, 14, -24,
|
|
-31, 2, 59, 65, 15, -31, -28, -28, -2, -1,
|
|
18, -3, 12, 2, 18, 7, 2, 28, 2, 22,
|
|
-25, -32, -27, -36, 58, -25, -25, -25, -25, -25,
|
|
-25, -25, -25, -25, -25, -25, -25, -25, -25, -43,
|
|
2, 9, -43, 2, -31, -24, -15, 15, 2, -15,
|
|
-30, 20, -28, 20, 18, 7, 2, -6, 2, 28,
|
|
39, 29, 40, 18, -13, 23, 2, -17, 5, -21,
|
|
12, -20, -22, 26, 42, -28, 62, 64, 60, 61,
|
|
-28, -28, -28, -28, -28, -28, -28, -28, -28, -28,
|
|
-28, -28, -28, -28, 19, 6, 2, -14, 20, -5,
|
|
-7, 2, 45, 58, 46, 59, 47, 48, 60, 61,
|
|
12, 62, 32, 33, 36, 49, 16, 50, 63, 64,
|
|
51, 52, 53, 54, 55, 20, 7, 18, -3, 23,
|
|
2, 24, 24, -22, -20, -20, -15, -15, -16, -15,
|
|
-16, -44, -43, 2, 20, 7, 2, -28, -19, 17,
|
|
-19, 24, 19, 2, 20, -5, -19,
|
|
}
|
|
var yyDef = [...]int{
|
|
|
|
0, -2, 93, 93, 0, 0, 7, 6, 1, 93,
|
|
87, 88, 89, 0, 2, -2, 3, 4, 8, 9,
|
|
10, 11, 12, 13, 14, 15, 16, 17, 18, 0,
|
|
89, 154, 0, 160, 0, 74, 75, 114, 115, 116,
|
|
117, 118, 119, 120, 121, 122, 123, 124, 155, 161,
|
|
148, 149, 0, 5, 86, 0, 92, 95, 0, 100,
|
|
101, 105, 41, 41, 41, 41, 41, 41, 41, 41,
|
|
41, 41, 41, 41, 41, 41, 41, 0, 0, 0,
|
|
21, 22, 0, 0, 0, 58, 0, 72, 73, 0,
|
|
78, 80, 0, 85, 90, 0, 96, 0, 99, 104,
|
|
0, 40, 45, 46, 42, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 64,
|
|
65, 159, 0, 71, 19, 20, 23, 0, 52, 24,
|
|
0, 60, 62, 63, 76, 0, 81, 0, 84, 150,
|
|
151, 152, 153, 91, 94, 97, 98, 103, 106, 108,
|
|
111, 112, 113, 0, 0, 25, 0, 0, -2, -2,
|
|
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
|
36, 37, 38, 39, 66, -2, 70, 0, 51, 54,
|
|
56, 57, 125, 126, 127, 128, 129, 130, 131, 132,
|
|
133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
|
|
143, 144, 145, 146, 147, 59, 0, 77, 79, 82,
|
|
83, 0, 0, 0, 156, 157, 43, 44, 47, 165,
|
|
48, 0, -2, 69, 49, 0, 55, 61, 107, 158,
|
|
109, 0, 67, 68, 50, 53, 110,
|
|
}
|
|
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:166
|
|
{
|
|
yylex.(*parser).generatedParserResult = yyDollar[2].labels
|
|
}
|
|
case 3:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:169
|
|
{
|
|
yylex.(*parser).errorf("no expression found in input")
|
|
}
|
|
case 4:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:171
|
|
{
|
|
yylex.(*parser).generatedParserResult = yyDollar[2].node
|
|
}
|
|
case 5:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:173
|
|
{
|
|
yylex.(*parser).generatedParserResult = yyDollar[2].node
|
|
}
|
|
case 7:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:176
|
|
{
|
|
yylex.(*parser).unexpected("", "")
|
|
}
|
|
case 19:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:198
|
|
{
|
|
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[2].node, yyDollar[3].node)
|
|
}
|
|
case 20:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:200
|
|
{
|
|
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[3].node, yyDollar[2].node)
|
|
}
|
|
case 21:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:202
|
|
{
|
|
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, yyDollar[2].node)
|
|
}
|
|
case 22:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:204
|
|
{
|
|
yylex.(*parser).unexpected("aggregation", "")
|
|
}
|
|
case 23:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:209
|
|
{
|
|
yyVAL.node = &AggregateExpr{
|
|
Grouping: yyDollar[2].strings,
|
|
}
|
|
}
|
|
case 24:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:215
|
|
{
|
|
yyVAL.node = &AggregateExpr{
|
|
Grouping: yyDollar[2].strings,
|
|
Without: true,
|
|
}
|
|
}
|
|
case 25:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:228
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 26:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:229
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 27:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:230
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 28:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:231
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 29:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:232
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 30:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:233
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 31:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:234
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 32:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:235
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 33:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:236
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 34:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:237
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 35:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:238
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 36:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:239
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 37:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:240
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 38:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:241
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 39:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:242
|
|
{
|
|
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
|
|
}
|
|
case 41:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:250
|
|
{
|
|
yyVAL.node = &BinaryExpr{
|
|
VectorMatching: &VectorMatching{Card: CardOneToOne},
|
|
}
|
|
}
|
|
case 42:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:255
|
|
{
|
|
yyVAL.node = &BinaryExpr{
|
|
VectorMatching: &VectorMatching{Card: CardOneToOne},
|
|
ReturnBool: true,
|
|
}
|
|
}
|
|
case 43:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:263
|
|
{
|
|
yyVAL.node = yyDollar[1].node
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
|
|
}
|
|
case 44:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:268
|
|
{
|
|
yyVAL.node = yyDollar[1].node
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.On = true
|
|
}
|
|
case 47:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:278
|
|
{
|
|
yyVAL.node = yyDollar[1].node
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardManyToOne
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings
|
|
}
|
|
case 48:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:284
|
|
{
|
|
yyVAL.node = yyDollar[1].node
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardOneToMany
|
|
yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings
|
|
}
|
|
case 49:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:293
|
|
{
|
|
yyVAL.strings = yyDollar[2].strings
|
|
}
|
|
case 50:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:295
|
|
{
|
|
yyVAL.strings = yyDollar[2].strings
|
|
}
|
|
case 51:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:297
|
|
{
|
|
yyVAL.strings = []string{}
|
|
}
|
|
case 52:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:299
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "\"(\"")
|
|
}
|
|
case 53:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:305
|
|
{
|
|
yyVAL.strings = append(yyDollar[1].strings, yyDollar[3].item.Val)
|
|
}
|
|
case 54:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:307
|
|
{
|
|
yyVAL.strings = []string{yyDollar[1].item.Val}
|
|
}
|
|
case 55:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:309
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "\",\" or \")\"")
|
|
}
|
|
case 56:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:313
|
|
{
|
|
if !isLabel(yyDollar[1].item.Val) {
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
}
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 57:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:320
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
}
|
|
case 58:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:328
|
|
{
|
|
fn, exist := getFunction(yyDollar[1].item.Val)
|
|
if !exist {
|
|
yylex.(*parser).errorf("unknown function with name %q", yyDollar[1].item.Val)
|
|
}
|
|
yyVAL.node = &Call{
|
|
Func: fn,
|
|
Args: yyDollar[2].node.(Expressions),
|
|
}
|
|
}
|
|
case 59:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:341
|
|
{
|
|
yyVAL.node = yyDollar[2].node
|
|
}
|
|
case 60:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:343
|
|
{
|
|
yyVAL.node = Expressions{}
|
|
}
|
|
case 61:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:347
|
|
{
|
|
yyVAL.node = append(yyDollar[1].node.(Expressions), yyDollar[3].node.(Expr))
|
|
}
|
|
case 62:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:349
|
|
{
|
|
yyVAL.node = Expressions{yyDollar[1].node.(Expr)}
|
|
}
|
|
case 63:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:357
|
|
{
|
|
yyVAL.node = &ParenExpr{Expr: yyDollar[2].node.(Expr)}
|
|
}
|
|
case 64:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:365
|
|
{
|
|
yylex.(*parser).addOffset(yyDollar[1].node, yyDollar[3].duration)
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 65:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:370
|
|
{
|
|
yylex.(*parser).unexpected("offset", "duration")
|
|
}
|
|
case 66:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:378
|
|
{
|
|
vs, ok := yyDollar[1].node.(*VectorSelector)
|
|
if !ok {
|
|
yylex.(*parser).errorf("ranges only allowed for vector selectors")
|
|
}
|
|
if vs.Offset != 0 {
|
|
yylex.(*parser).errorf("no offset modifiers allowed before range")
|
|
}
|
|
yyVAL.node = &MatrixSelector{
|
|
Name: vs.Name,
|
|
Offset: vs.Offset,
|
|
LabelMatchers: vs.LabelMatchers,
|
|
Range: yyDollar[3].duration,
|
|
}
|
|
}
|
|
case 67:
|
|
yyDollar = yyS[yypt-6 : yypt+1]
|
|
//line promql/generated_parser.y:396
|
|
{
|
|
yyVAL.node = &SubqueryExpr{
|
|
Expr: yyDollar[1].node.(Expr),
|
|
Range: yyDollar[3].duration,
|
|
Step: yyDollar[5].duration,
|
|
}
|
|
}
|
|
case 68:
|
|
yyDollar = yyS[yypt-6 : yypt+1]
|
|
//line promql/generated_parser.y:404
|
|
{
|
|
yylex.(*parser).unexpected("subquery selector", "\"]\"")
|
|
}
|
|
case 69:
|
|
yyDollar = yyS[yypt-5 : yypt+1]
|
|
//line promql/generated_parser.y:406
|
|
{
|
|
yylex.(*parser).unexpected("subquery selector", "duration or \"]\"")
|
|
}
|
|
case 70:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:408
|
|
{
|
|
yylex.(*parser).unexpected("subquery or range", "\":\" or \"]\"")
|
|
}
|
|
case 71:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:410
|
|
{
|
|
yylex.(*parser).unexpected("subquery selector", "duration")
|
|
}
|
|
case 72:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:420
|
|
{
|
|
if nl, ok := yyDollar[2].node.(*NumberLiteral); ok {
|
|
if yyDollar[1].item.Typ == SUB {
|
|
nl.Val *= -1
|
|
}
|
|
yyVAL.node = nl
|
|
} else {
|
|
yyVAL.node = &UnaryExpr{Op: yyDollar[1].item.Typ, Expr: yyDollar[2].node.(Expr)}
|
|
}
|
|
}
|
|
case 73:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:437
|
|
{
|
|
yyVAL.node = yylex.(*parser).newVectorSelector(yyDollar[1].item.Val, yyDollar[2].matchers)
|
|
}
|
|
case 74:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:439
|
|
{
|
|
yyVAL.node = yylex.(*parser).newVectorSelector(yyDollar[1].item.Val, nil)
|
|
}
|
|
case 75:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:441
|
|
{
|
|
yyVAL.node = yylex.(*parser).newVectorSelector("", yyDollar[1].matchers)
|
|
}
|
|
case 76:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:445
|
|
{
|
|
yyVAL.matchers = yyDollar[2].matchers
|
|
}
|
|
case 77:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:447
|
|
{
|
|
yyVAL.matchers = yyDollar[2].matchers
|
|
}
|
|
case 78:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:449
|
|
{
|
|
yyVAL.matchers = []*labels.Matcher{}
|
|
}
|
|
case 79:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:454
|
|
{
|
|
yyVAL.matchers = append(yyDollar[1].matchers, yyDollar[3].matcher)
|
|
}
|
|
case 80:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:456
|
|
{
|
|
yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher}
|
|
}
|
|
case 81:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:458
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "\",\" or \"}\"")
|
|
}
|
|
case 82:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:462
|
|
{
|
|
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
|
|
}
|
|
case 83:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:464
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "string")
|
|
}
|
|
case 84:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:466
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "label matching operator")
|
|
}
|
|
case 85:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:468
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "identifier or \"}\"")
|
|
}
|
|
case 86:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:476
|
|
{
|
|
yyVAL.labels = append(yyDollar[2].labels, labels.Label{Name: labels.MetricName, Value: yyDollar[1].item.Val})
|
|
sort.Sort(yyVAL.labels)
|
|
}
|
|
case 87:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:478
|
|
{
|
|
yyVAL.labels = yyDollar[1].labels
|
|
}
|
|
case 90:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:485
|
|
{
|
|
yyVAL.labels = labels.New(yyDollar[2].labels...)
|
|
}
|
|
case 91:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:487
|
|
{
|
|
yyVAL.labels = labels.New(yyDollar[2].labels...)
|
|
}
|
|
case 92:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:489
|
|
{
|
|
yyVAL.labels = labels.New()
|
|
}
|
|
case 93:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:491
|
|
{
|
|
yyVAL.labels = labels.New()
|
|
}
|
|
case 94:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:495
|
|
{
|
|
yyVAL.labels = append(yyDollar[1].labels, yyDollar[3].label)
|
|
}
|
|
case 95:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:497
|
|
{
|
|
yyVAL.labels = []labels.Label{yyDollar[1].label}
|
|
}
|
|
case 96:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:499
|
|
{
|
|
yylex.(*parser).unexpected("label set", "\",\" or \"}\"")
|
|
}
|
|
case 97:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:504
|
|
{
|
|
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
|
|
}
|
|
case 98:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:506
|
|
{
|
|
yylex.(*parser).unexpected("label set", "string")
|
|
}
|
|
case 99:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:508
|
|
{
|
|
yylex.(*parser).unexpected("label set", "\"=\"")
|
|
}
|
|
case 100:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:510
|
|
{
|
|
yylex.(*parser).unexpected("label set", "identifier or \"}\"")
|
|
}
|
|
case 101:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:518
|
|
{
|
|
yylex.(*parser).generatedParserResult = &seriesDescription{
|
|
labels: yyDollar[1].labels,
|
|
values: yyDollar[2].series,
|
|
}
|
|
}
|
|
case 102:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:527
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
}
|
|
case 103:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:529
|
|
{
|
|
yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...)
|
|
}
|
|
case 104:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:531
|
|
{
|
|
yyVAL.series = yyDollar[1].series
|
|
}
|
|
case 105:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:533
|
|
{
|
|
yylex.(*parser).unexpected("series values", "")
|
|
}
|
|
case 106:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:537
|
|
{
|
|
yyVAL.series = []sequenceValue{{omitted: true}}
|
|
}
|
|
case 107:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:539
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
for i := uint64(0); i < yyDollar[3].uint; i++ {
|
|
yyVAL.series = append(yyVAL.series, sequenceValue{omitted: true})
|
|
}
|
|
}
|
|
case 108:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:546
|
|
{
|
|
yyVAL.series = []sequenceValue{{value: yyDollar[1].float}}
|
|
}
|
|
case 109:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
//line promql/generated_parser.y:548
|
|
{
|
|
yyVAL.series = []sequenceValue{}
|
|
for i := uint64(0); i <= yyDollar[3].uint; i++ {
|
|
yyVAL.series = append(yyVAL.series, sequenceValue{value: yyDollar[1].float})
|
|
}
|
|
}
|
|
case 110:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
//line promql/generated_parser.y:555
|
|
{
|
|
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 111:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:565
|
|
{
|
|
if yyDollar[1].item.Val != "stale" {
|
|
yylex.(*parser).unexpected("series values", "number or \"stale\"")
|
|
}
|
|
yyVAL.float = math.Float64frombits(value.StaleNaN)
|
|
}
|
|
case 154:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:595
|
|
{
|
|
yyVAL.node = &NumberLiteral{yyDollar[1].float}
|
|
}
|
|
case 155:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:597
|
|
{
|
|
yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val)
|
|
}
|
|
case 156:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:599
|
|
{
|
|
yyVAL.float = yyDollar[2].float
|
|
}
|
|
case 157:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
//line promql/generated_parser.y:600
|
|
{
|
|
yyVAL.float = -yyDollar[2].float
|
|
}
|
|
case 158:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:604
|
|
{
|
|
var err error
|
|
yyVAL.uint, err = strconv.ParseUint(yyDollar[1].item.Val, 10, 64)
|
|
if err != nil {
|
|
yylex.(*parser).errorf("invalid repetition in series values: %s", err)
|
|
}
|
|
}
|
|
case 159:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:614
|
|
{
|
|
var err error
|
|
yyVAL.duration, err = parseDuration(yyDollar[1].item.Val)
|
|
if err != nil {
|
|
yylex.(*parser).error(err)
|
|
}
|
|
}
|
|
case 160:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:624
|
|
{
|
|
yyVAL.node = &StringLiteral{yyDollar[1].string}
|
|
}
|
|
case 161:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
//line promql/generated_parser.y:626
|
|
{
|
|
yyVAL.string = yylex.(*parser).unquoteString(yyDollar[1].item.Val)
|
|
}
|
|
case 162:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:633
|
|
{
|
|
yyVAL.duration = 0
|
|
}
|
|
case 164:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
//line promql/generated_parser.y:637
|
|
{
|
|
yyVAL.strings = nil
|
|
}
|
|
}
|
|
goto yystack /* stack new state and value */
|
|
}
|