prometheus/promql/parser/generated_parser.y.go
Ganesh Vernekar 9199fcb8d1
'@ <timestamp>' modifier (#8121)
This commit adds `@ <timestamp>` modifier as per this design doc: https://docs.google.com/document/d/1uSbD3T2beM-iX4-Hp7V074bzBRiRNlqUdcWP6JTDQSs/edit.

An example query:

```
rate(process_cpu_seconds_total[1m]) 
  and
topk(7, rate(process_cpu_seconds_total[1h] @ 1234))
```

which ranks based on last 1h rate and w.r.t. unix timestamp 1234 but actually plots the 1m rate.

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2021-01-20 16:27:39 +05:30

1681 lines
39 KiB
Go

// Code generated by goyacc -o generated_parser.y.go generated_parser.y. DO NOT EDIT.
//line generated_parser.y:15
package parser
import __yyfmt__ "fmt"
//line generated_parser.y:15
import (
"math"
"sort"
"strconv"
"time"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/pkg/value"
)
//line 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
duration time.Duration
}
const EQL = 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 EQLC = 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 AT = 57385
const operatorsEnd = 57386
const aggregatorsStart = 57387
const AVG = 57388
const BOTTOMK = 57389
const COUNT = 57390
const COUNT_VALUES = 57391
const GROUP = 57392
const MAX = 57393
const MIN = 57394
const QUANTILE = 57395
const STDDEV = 57396
const STDVAR = 57397
const SUM = 57398
const TOPK = 57399
const aggregatorsEnd = 57400
const keywordsStart = 57401
const BOOL = 57402
const BY = 57403
const GROUP_LEFT = 57404
const GROUP_RIGHT = 57405
const IGNORING = 57406
const OFFSET = 57407
const ON = 57408
const WITHOUT = 57409
const keywordsEnd = 57410
const startSymbolsStart = 57411
const START_METRIC = 57412
const START_SERIES_DESCRIPTION = 57413
const START_EXPRESSION = 57414
const START_METRIC_SELECTOR = 57415
const startSymbolsEnd = 57416
var yyToknames = [...]string{
"$end",
"error",
"$unk",
"EQL",
"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",
"EQLC",
"EQL_REGEX",
"GTE",
"GTR",
"LAND",
"LOR",
"LSS",
"LTE",
"LUNLESS",
"MOD",
"MUL",
"NEQ",
"NEQ_REGEX",
"POW",
"SUB",
"AT",
"operatorsEnd",
"aggregatorsStart",
"AVG",
"BOTTOMK",
"COUNT",
"COUNT_VALUES",
"GROUP",
"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 generated_parser.y:729
//line yacctab:1
var yyExca = [...]int{
-1, 1,
1, -1,
-2, 0,
-1, 33,
1, 124,
10, 124,
22, 124,
-2, 0,
-1, 56,
2, 136,
15, 136,
61, 136,
67, 136,
-2, 92,
-1, 57,
2, 137,
15, 137,
61, 137,
67, 137,
-2, 93,
-1, 58,
2, 138,
15, 138,
61, 138,
67, 138,
-2, 95,
-1, 59,
2, 139,
15, 139,
61, 139,
67, 139,
-2, 96,
-1, 60,
2, 140,
15, 140,
61, 140,
67, 140,
-2, 97,
-1, 61,
2, 141,
15, 141,
61, 141,
67, 141,
-2, 102,
-1, 62,
2, 142,
15, 142,
61, 142,
67, 142,
-2, 104,
-1, 63,
2, 143,
15, 143,
61, 143,
67, 143,
-2, 106,
-1, 64,
2, 144,
15, 144,
61, 144,
67, 144,
-2, 107,
-1, 65,
2, 145,
15, 145,
61, 145,
67, 145,
-2, 108,
-1, 66,
2, 146,
15, 146,
61, 146,
67, 146,
-2, 109,
-1, 67,
2, 147,
15, 147,
61, 147,
67, 147,
-2, 110,
-1, 182,
12, 189,
13, 189,
16, 189,
17, 189,
23, 189,
26, 189,
32, 189,
33, 189,
36, 189,
42, 189,
46, 189,
47, 189,
48, 189,
49, 189,
50, 189,
51, 189,
52, 189,
53, 189,
54, 189,
55, 189,
56, 189,
57, 189,
61, 189,
65, 189,
67, 189,
-2, 0,
-1, 183,
12, 189,
13, 189,
16, 189,
17, 189,
23, 189,
26, 189,
32, 189,
33, 189,
36, 189,
42, 189,
46, 189,
47, 189,
48, 189,
49, 189,
50, 189,
51, 189,
52, 189,
53, 189,
54, 189,
55, 189,
56, 189,
57, 189,
61, 189,
65, 189,
67, 189,
-2, 0,
-1, 201,
19, 187,
-2, 0,
-1, 247,
19, 188,
-2, 0,
}
const yyPrivate = 57344
const yyLast = 629
var yyAct = [...]int{
253, 35, 205, 138, 244, 243, 144, 110, 75, 99,
98, 180, 101, 181, 182, 183, 6, 100, 102, 123,
55, 256, 238, 143, 237, 172, 118, 97, 49, 70,
103, 51, 22, 50, 233, 103, 157, 257, 254, 52,
81, 145, 68, 70, 154, 236, 171, 232, 18, 19,
90, 91, 20, 105, 93, 106, 96, 153, 69, 104,
31, 119, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 251, 107, 101, 13, 95, 250,
142, 24, 102, 30, 2, 3, 4, 5, 258, 248,
97, 239, 249, 146, 202, 145, 140, 79, 201, 7,
32, 148, 80, 81, 146, 158, 152, 155, 150, 147,
151, 200, 8, 90, 91, 149, 33, 93, 94, 96,
147, 179, 140, 170, 1, 178, 184, 185, 186, 187,
188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
246, 95, 177, 124, 125, 126, 127, 128, 129, 130,
131, 132, 133, 134, 135, 136, 137, 164, 139, 165,
46, 45, 162, 10, 44, 140, 71, 161, 43, 235,
198, 199, 97, 72, 34, 42, 49, 70, 160, 51,
22, 50, 240, 122, 167, 241, 242, 52, 112, 245,
68, 41, 77, 112, 166, 168, 18, 19, 111, 93,
20, 96, 76, 111, 234, 247, 69, 40, 169, 109,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 117, 95, 116, 13, 39, 120, 156, 24,
38, 30, 121, 54, 77, 252, 9, 9, 49, 70,
255, 51, 22, 50, 76, 37, 36, 47, 174, 52,
74, 115, 68, 260, 141, 176, 114, 261, 18, 19,
145, 175, 20, 78, 173, 203, 73, 113, 69, 146,
53, 206, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 207, 147, 163, 13, 48, 108,
0, 24, 0, 30, 217, 0, 0, 0, 223, 0,
0, 0, 259, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 219, 220, 0, 0, 221, 0,
0, 0, 0, 0, 0, 0, 0, 0, 208, 210,
212, 213, 214, 222, 224, 227, 228, 229, 230, 231,
207, 0, 209, 211, 215, 216, 218, 225, 226, 0,
217, 0, 0, 0, 223, 0, 0, 0, 204, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
219, 220, 0, 0, 221, 0, 0, 0, 0, 0,
0, 0, 0, 0, 208, 210, 212, 213, 214, 222,
224, 227, 228, 229, 230, 231, 0, 0, 209, 211,
215, 216, 218, 225, 226, 17, 70, 0, 0, 22,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 18, 19, 0, 0, 20,
0, 17, 31, 0, 0, 22, 0, 0, 0, 11,
12, 14, 15, 16, 21, 23, 25, 26, 27, 28,
29, 18, 19, 0, 13, 20, 0, 0, 24, 0,
30, 0, 0, 0, 0, 11, 12, 14, 15, 16,
21, 23, 25, 26, 27, 28, 29, 97, 0, 0,
13, 0, 0, 159, 24, 0, 30, 0, 0, 80,
81, 82, 0, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 0, 93, 94, 96, 0, 0, 0,
0, 0, 0, 97, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 80, 81, 82, 95, 83,
84, 85, 86, 87, 88, 89, 90, 91, 92, 0,
93, 94, 96, 0, 0, 97, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 80, 81, 82,
0, 83, 84, 85, 95, 87, 88, 89, 90, 91,
92, 0, 93, 94, 96, 0, 0, 97, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 80,
81, 82, 0, 83, 84, 0, 95, 87, 88, 0,
90, 91, 92, 0, 93, 94, 96, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 95,
}
var yyPact = [...]int{
14, 89, 419, 419, 164, 393, -1000, -1000, -1000, 47,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, 232, -1000, 95, -1000, 499, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 15, 20,
-1000, 226, -1000, 226, 30, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
191, -1000, -1000, 249, -1000, -1000, 220, -1000, 4, -1000,
-41, -41, -41, -41, -41, -41, -41, -41, -41, -41,
-41, -41, -41, -41, -41, 156, 78, 113, 20, -49,
-1000, 42, 42, 16, -1000, 463, 158, -1000, 160, -1000,
-1000, 155, -1000, -1000, 190, -1000, 23, -1000, 243, 226,
-1000, -53, -48, -1000, 226, 226, 226, 226, 226, 226,
226, 226, 226, 226, 226, 226, 226, 226, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, 24, 24, 92, -1000,
-1000, -1000, -1000, 338, -1000, -1000, 27, -1000, 499, -1000,
-1000, 186, -1000, 22, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -2, 67, -1000, -1000, -1000, 13,
42, 42, 42, 42, 158, 76, 76, 76, 563, 531,
76, 76, 563, 158, 158, 76, 158, 13, -1000, -1000,
-1000, 87, -1000, 72, -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, -1000, 226, -1000, -1000, -1000, -1000, 21, 21,
-3, -1000, -1000, -1000, -1000, -1000, 18, 86, -1000, -1000,
282, -1000, 499, -1000, -1000, -1000, 21, -1000, -1000, -1000,
-1000, -1000,
}
var yyPgo = [...]int{
0, 289, 7, 288, 2, 286, 271, 233, 270, 163,
266, 112, 8, 265, 4, 5, 264, 263, 0, 23,
261, 6, 254, 247, 246, 10, 61, 245, 232, 1,
230, 228, 9, 227, 20, 226, 207, 191, 183, 175,
168, 164, 161, 160, 3, 140, 124, 100,
}
var yyR1 = [...]int{
0, 46, 46, 46, 46, 46, 46, 46, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
24, 24, 24, 24, 25, 25, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 26, 28, 28, 38, 38, 33, 33, 33, 33,
14, 14, 14, 14, 13, 13, 13, 4, 4, 30,
32, 32, 31, 31, 31, 39, 37, 37, 23, 23,
35, 41, 41, 41, 41, 41, 42, 43, 43, 43,
34, 34, 34, 1, 1, 1, 2, 2, 2, 2,
11, 11, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 9, 9, 9, 9, 10, 10, 10, 12,
12, 12, 12, 47, 17, 17, 17, 17, 16, 16,
16, 16, 16, 20, 20, 20, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 8, 8, 5, 5, 5, 5, 36, 19,
21, 21, 22, 22, 18, 44, 40, 45, 45, 15,
15,
}
var yyR2 = [...]int{
0, 2, 2, 2, 2, 2, 2, 1, 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, 2, 3, 3, 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, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1,
2, 2, 1, 1, 1, 1, 1, 0, 1, 0,
1,
}
var yyChk = [...]int{
-1000, -46, 70, 71, 72, 73, 2, 10, -11, -7,
-9, 46, 47, 61, 48, 49, 50, 12, 32, 33,
36, 51, 16, 52, 65, 53, 54, 55, 56, 57,
67, 13, -47, -11, 10, -29, -24, -27, -30, -35,
-36, -37, -39, -40, -41, -42, -43, -23, -3, 12,
17, 15, 23, -8, -7, -34, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 26, 42,
13, -43, -9, -10, 18, -12, 12, 2, -17, 2,
26, 27, 28, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 41, 42, 65, 43, 14, -25, -32,
2, 61, 67, 15, -32, -29, -29, -34, -1, 18,
-2, 12, 2, 18, 7, 2, 4, 2, 22, -26,
-33, -28, -38, 60, -26, -26, -26, -26, -26, -26,
-26, -26, -26, -26, -26, -26, -26, -26, -44, 2,
9, -22, 2, -19, -21, 17, 26, 42, -44, 2,
-32, -25, -14, 15, 2, -14, -31, 20, -29, 20,
18, 7, 2, -5, 2, 4, 39, 29, 40, 18,
-12, 23, 2, -16, 5, -20, 12, -19, -21, -29,
64, 66, 62, 63, -29, -29, -29, -29, -29, -29,
-29, -29, -29, -29, -29, -29, -29, -29, -19, -19,
19, 6, 2, -13, 20, -4, -6, 2, 46, 60,
47, 61, 48, 49, 50, 62, 63, 12, 64, 32,
33, 36, 51, 16, 52, 65, 66, 53, 54, 55,
56, 57, 20, 7, 18, -2, 23, 2, 24, 24,
-21, -14, -14, -15, -14, -15, -45, -44, 2, 20,
7, 2, -29, -18, 17, -18, 24, 19, 2, 20,
-4, -18,
}
var yyDef = [...]int{
0, -2, 115, 115, 0, 0, 7, 6, 1, 115,
91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 0, 2, -2, 3, 4, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 0, 98,
178, 0, 186, 0, 78, 79, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, 172, 173,
0, 5, 90, 0, 114, 117, 0, 122, 123, 127,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 0, 0, 0, 0, 22,
23, 0, 0, 0, 59, 0, 76, 77, 0, 82,
84, 0, 89, 112, 0, 118, 0, 121, 126, 0,
41, 46, 47, 43, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 66, 67,
185, 68, 69, 182, 183, 179, 0, 0, 0, 75,
20, 21, 24, 0, 53, 25, 0, 61, 63, 65,
80, 0, 85, 0, 88, 174, 175, 176, 177, 113,
116, 119, 120, 125, 128, 130, 133, 134, 135, 26,
0, 0, -2, -2, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 180, 181,
70, -2, 74, 0, 52, 55, 57, 58, 148, 149,
150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
170, 171, 60, 64, 81, 83, 86, 87, 0, 0,
0, 44, 45, 48, 190, 49, 0, -2, 73, 50,
0, 56, 62, 129, 184, 131, 0, 71, 72, 51,
54, 132,
}
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, 73, 74,
}
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 generated_parser.y:166
{
yylex.(*parser).generatedParserResult = yyDollar[2].labels
}
case 3:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:169
{
yylex.(*parser).addParseErrf(PositionRange{}, "no expression found in input")
}
case 4:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:171
{
yylex.(*parser).generatedParserResult = yyDollar[2].node
}
case 5:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:173
{
yylex.(*parser).generatedParserResult = yyDollar[2].node
}
case 7:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:176
{
yylex.(*parser).unexpected("", "")
}
case 20:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:199
{
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[2].node, yyDollar[3].node)
}
case 21:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:201
{
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[3].node, yyDollar[2].node)
}
case 22:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:203
{
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, yyDollar[2].node)
}
case 23:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:205
{
yylex.(*parser).unexpected("aggregation", "")
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, Expressions{})
}
case 24:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:213
{
yyVAL.node = &AggregateExpr{
Grouping: yyDollar[2].strings,
}
}
case 25:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:219
{
yyVAL.node = &AggregateExpr{
Grouping: yyDollar[2].strings,
Without: true,
}
}
case 26:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:232
{
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 generated_parser.y:233
{
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 generated_parser.y:234
{
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 generated_parser.y:235
{
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 generated_parser.y:236
{
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 generated_parser.y:237
{
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 generated_parser.y:238
{
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 generated_parser.y:239
{
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 generated_parser.y:240
{
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 generated_parser.y:241
{
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 generated_parser.y:242
{
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 generated_parser.y:243
{
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 generated_parser.y:244
{
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 generated_parser.y:245
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 40:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:246
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 42:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:254
{
yyVAL.node = &BinaryExpr{
VectorMatching: &VectorMatching{Card: CardOneToOne},
}
}
case 43:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:259
{
yyVAL.node = &BinaryExpr{
VectorMatching: &VectorMatching{Card: CardOneToOne},
ReturnBool: true,
}
}
case 44:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:267
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
}
case 45:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:272
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
yyVAL.node.(*BinaryExpr).VectorMatching.On = true
}
case 48:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:282
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardManyToOne
yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings
}
case 49:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:288
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardOneToMany
yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings
}
case 50:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:297
{
yyVAL.strings = yyDollar[2].strings
}
case 51:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:299
{
yyVAL.strings = yyDollar[2].strings
}
case 52:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:301
{
yyVAL.strings = []string{}
}
case 53:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:303
{
yylex.(*parser).unexpected("grouping opts", "\"(\"")
yyVAL.strings = nil
}
case 54:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:309
{
yyVAL.strings = append(yyDollar[1].strings, yyDollar[3].item.Val)
}
case 55:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:311
{
yyVAL.strings = []string{yyDollar[1].item.Val}
}
case 56:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:313
{
yylex.(*parser).unexpected("grouping opts", "\",\" or \")\"")
yyVAL.strings = yyDollar[1].strings
}
case 57:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:317
{
if !isLabel(yyDollar[1].item.Val) {
yylex.(*parser).unexpected("grouping opts", "label")
}
yyVAL.item = yyDollar[1].item
}
case 58:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:324
{
yylex.(*parser).unexpected("grouping opts", "label")
yyVAL.item = Item{}
}
case 59:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:332
{
fn, exist := getFunction(yyDollar[1].item.Val)
if !exist {
yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "unknown function with name %q", yyDollar[1].item.Val)
}
yyVAL.node = &Call{
Func: fn,
Args: yyDollar[2].node.(Expressions),
PosRange: PositionRange{
Start: yyDollar[1].item.Pos,
End: yylex.(*parser).lastClosing,
},
}
}
case 60:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:349
{
yyVAL.node = yyDollar[2].node
}
case 61:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:351
{
yyVAL.node = Expressions{}
}
case 62:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:355
{
yyVAL.node = append(yyDollar[1].node.(Expressions), yyDollar[3].node.(Expr))
}
case 63:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:357
{
yyVAL.node = Expressions{yyDollar[1].node.(Expr)}
}
case 64:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:359
{
yylex.(*parser).addParseErrf(yyDollar[2].item.PositionRange(), "trailing commas not allowed in function call args")
yyVAL.node = yyDollar[1].node
}
case 65:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:370
{
yyVAL.node = &ParenExpr{Expr: yyDollar[2].node.(Expr), PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item)}
}
case 66:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:378
{
yylex.(*parser).addOffset(yyDollar[1].node, yyDollar[3].duration)
yyVAL.node = yyDollar[1].node
}
case 67:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:383
{
yylex.(*parser).unexpected("offset", "duration")
yyVAL.node = yyDollar[1].node
}
case 68:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:390
{
yylex.(*parser).setTimestamp(yyDollar[1].node, yyDollar[3].float)
yyVAL.node = yyDollar[1].node
}
case 69:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:396
{
yylex.(*parser).unexpected("@", "timestamp")
yyVAL.node = yyDollar[1].node
}
case 70:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:404
{
var errMsg string
vs, ok := yyDollar[1].node.(*VectorSelector)
if !ok {
errMsg = "ranges only allowed for vector selectors"
} else if vs.OriginalOffset != 0 {
errMsg = "no offset modifiers allowed before range"
} else if vs.Timestamp != nil {
errMsg = "no @ modifiers allowed before range"
}
if errMsg != "" {
errRange := mergeRanges(&yyDollar[2].item, &yyDollar[4].item)
yylex.(*parser).addParseErrf(errRange, errMsg)
}
yyVAL.node = &MatrixSelector{
VectorSelector: yyDollar[1].node.(Expr),
Range: yyDollar[3].duration,
EndPos: yylex.(*parser).lastClosing,
}
}
case 71:
yyDollar = yyS[yypt-6 : yypt+1]
//line generated_parser.y:429
{
yyVAL.node = &SubqueryExpr{
Expr: yyDollar[1].node.(Expr),
Range: yyDollar[3].duration,
Step: yyDollar[5].duration,
EndPos: yyDollar[6].item.Pos + 1,
}
}
case 72:
yyDollar = yyS[yypt-6 : yypt+1]
//line generated_parser.y:439
{
yylex.(*parser).unexpected("subquery selector", "\"]\"")
yyVAL.node = yyDollar[1].node
}
case 73:
yyDollar = yyS[yypt-5 : yypt+1]
//line generated_parser.y:441
{
yylex.(*parser).unexpected("subquery selector", "duration or \"]\"")
yyVAL.node = yyDollar[1].node
}
case 74:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:443
{
yylex.(*parser).unexpected("subquery or range", "\":\" or \"]\"")
yyVAL.node = yyDollar[1].node
}
case 75:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:445
{
yylex.(*parser).unexpected("subquery selector", "duration")
yyVAL.node = yyDollar[1].node
}
case 76:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:455
{
if nl, ok := yyDollar[2].node.(*NumberLiteral); ok {
if yyDollar[1].item.Typ == SUB {
nl.Val *= -1
}
nl.PosRange.Start = yyDollar[1].item.Pos
yyVAL.node = nl
} else {
yyVAL.node = &UnaryExpr{Op: yyDollar[1].item.Typ, Expr: yyDollar[2].node.(Expr), StartPos: yyDollar[1].item.Pos}
}
}
case 77:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:473
{
vs := yyDollar[2].node.(*VectorSelector)
vs.PosRange = mergeRanges(&yyDollar[1].item, vs)
vs.Name = yyDollar[1].item.Val
yylex.(*parser).assembleVectorSelector(vs)
yyVAL.node = vs
}
case 78:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:481
{
vs := &VectorSelector{
Name: yyDollar[1].item.Val,
LabelMatchers: []*labels.Matcher{},
PosRange: yyDollar[1].item.PositionRange(),
}
yylex.(*parser).assembleVectorSelector(vs)
yyVAL.node = vs
}
case 79:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:491
{
vs := yyDollar[1].node.(*VectorSelector)
yylex.(*parser).assembleVectorSelector(vs)
yyVAL.node = vs
}
case 80:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:499
{
yyVAL.node = &VectorSelector{
LabelMatchers: yyDollar[2].matchers,
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item),
}
}
case 81:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:506
{
yyVAL.node = &VectorSelector{
LabelMatchers: yyDollar[2].matchers,
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[4].item),
}
}
case 82:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:513
{
yyVAL.node = &VectorSelector{
LabelMatchers: []*labels.Matcher{},
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[2].item),
}
}
case 83:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:522
{
if yyDollar[1].matchers != nil {
yyVAL.matchers = append(yyDollar[1].matchers, yyDollar[3].matcher)
} else {
yyVAL.matchers = yyDollar[1].matchers
}
}
case 84:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:530
{
yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher}
}
case 85:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:532
{
yylex.(*parser).unexpected("label matching", "\",\" or \"}\"")
yyVAL.matchers = yyDollar[1].matchers
}
case 86:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:536
{
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
}
case 87:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:538
{
yylex.(*parser).unexpected("label matching", "string")
yyVAL.matcher = nil
}
case 88:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:540
{
yylex.(*parser).unexpected("label matching", "label matching operator")
yyVAL.matcher = nil
}
case 89:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:542
{
yylex.(*parser).unexpected("label matching", "identifier or \"}\"")
yyVAL.matcher = nil
}
case 90:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:550
{
yyVAL.labels = append(yyDollar[2].labels, labels.Label{Name: labels.MetricName, Value: yyDollar[1].item.Val})
sort.Sort(yyVAL.labels)
}
case 91:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:552
{
yyVAL.labels = yyDollar[1].labels
}
case 112:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:559
{
yyVAL.labels = labels.New(yyDollar[2].labels...)
}
case 113:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:561
{
yyVAL.labels = labels.New(yyDollar[2].labels...)
}
case 114:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:563
{
yyVAL.labels = labels.New()
}
case 115:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:565
{
yyVAL.labels = labels.New()
}
case 116:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:569
{
yyVAL.labels = append(yyDollar[1].labels, yyDollar[3].label)
}
case 117:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:571
{
yyVAL.labels = []labels.Label{yyDollar[1].label}
}
case 118:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:573
{
yylex.(*parser).unexpected("label set", "\",\" or \"}\"")
yyVAL.labels = yyDollar[1].labels
}
case 119:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:578
{
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
}
case 120:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:580
{
yylex.(*parser).unexpected("label set", "string")
yyVAL.label = labels.Label{}
}
case 121:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:582
{
yylex.(*parser).unexpected("label set", "\"=\"")
yyVAL.label = labels.Label{}
}
case 122:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:584
{
yylex.(*parser).unexpected("label set", "identifier or \"}\"")
yyVAL.label = labels.Label{}
}
case 123:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:592
{
yylex.(*parser).generatedParserResult = &seriesDescription{
labels: yyDollar[1].labels,
values: yyDollar[2].series,
}
}
case 124:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:601
{
yyVAL.series = []SequenceValue{}
}
case 125:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:603
{
yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...)
}
case 126:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:605
{
yyVAL.series = yyDollar[1].series
}
case 127:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:607
{
yylex.(*parser).unexpected("series values", "")
yyVAL.series = nil
}
case 128:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:611
{
yyVAL.series = []SequenceValue{{Omitted: true}}
}
case 129:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:613
{
yyVAL.series = []SequenceValue{}
for i := uint64(0); i < yyDollar[3].uint; i++ {
yyVAL.series = append(yyVAL.series, SequenceValue{Omitted: true})
}
}
case 130:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:620
{
yyVAL.series = []SequenceValue{{Value: yyDollar[1].float}}
}
case 131:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:622
{
yyVAL.series = []SequenceValue{}
for i := uint64(0); i <= yyDollar[3].uint; i++ {
yyVAL.series = append(yyVAL.series, SequenceValue{Value: yyDollar[1].float})
}
}
case 132:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:629
{
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 133:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:639
{
if yyDollar[1].item.Val != "stale" {
yylex.(*parser).unexpected("series values", "number or \"stale\"")
}
yyVAL.float = math.Float64frombits(value.StaleNaN)
}
case 178:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:670
{
yyVAL.node = &NumberLiteral{
Val: yylex.(*parser).number(yyDollar[1].item.Val),
PosRange: yyDollar[1].item.PositionRange(),
}
}
case 179:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:678
{
yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val)
}
case 180:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:680
{
yyVAL.float = yyDollar[2].float
}
case 181:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:681
{
yyVAL.float = -yyDollar[2].float
}
case 184:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:687
{
var err error
yyVAL.uint, err = strconv.ParseUint(yyDollar[1].item.Val, 10, 64)
if err != nil {
yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "invalid repetition in series values: %s", err)
}
}
case 185:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:697
{
var err error
yyVAL.duration, err = parseDuration(yyDollar[1].item.Val)
if err != nil {
yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err)
}
}
case 186:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:708
{
yyVAL.node = &StringLiteral{
Val: yylex.(*parser).unquoteString(yyDollar[1].item.Val),
PosRange: yyDollar[1].item.PositionRange(),
}
}
case 187:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:721
{
yyVAL.duration = 0
}
case 189:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:725
{
yyVAL.strings = nil
}
}
goto yystack /* stack new state and value */
}