prometheus/promql/parser/generated_parser.y.go
Owen Williams 58eb877f96 UTF-8: Add support for parsing UTF8 metric and label names
This adds support for the new grammar of `{"metric_name", "l1"="val",}`. This grammar will also be valid for non-UTF-8 names.
UTF-8 names will not be considered valid unless model.NameValidationScheme is changed.

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-02-08 14:38:07 -05:00

1851 lines
44 KiB
Go

// Code generated by goyacc -l -o promql/parser/generated_parser.y.go promql/parser/generated_parser.y. DO NOT EDIT.
package parser
import __yyfmt__ "fmt"
import (
"math"
"strconv"
"time"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/value"
"github.com/prometheus/prometheus/promql/parser/posrange"
)
type yySymType struct {
yys int
node Node
item Item
matchers []*labels.Matcher
matcher *labels.Matcher
label labels.Label
labels labels.Labels
lblList []labels.Label
strings []string
series []SequenceValue
histogram *histogram.FloatHistogram
descriptors map[string]interface{}
bucket_set []float64
int int64
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 OPEN_HIST = 57358
const CLOSE_HIST = 57359
const METRIC_IDENTIFIER = 57360
const NUMBER = 57361
const RIGHT_BRACE = 57362
const RIGHT_BRACKET = 57363
const RIGHT_PAREN = 57364
const SEMICOLON = 57365
const SPACE = 57366
const STRING = 57367
const TIMES = 57368
const histogramDescStart = 57369
const SUM_DESC = 57370
const COUNT_DESC = 57371
const SCHEMA_DESC = 57372
const OFFSET_DESC = 57373
const NEGATIVE_OFFSET_DESC = 57374
const BUCKETS_DESC = 57375
const NEGATIVE_BUCKETS_DESC = 57376
const ZERO_BUCKET_DESC = 57377
const ZERO_BUCKET_WIDTH_DESC = 57378
const histogramDescEnd = 57379
const operatorsStart = 57380
const ADD = 57381
const DIV = 57382
const EQLC = 57383
const EQL_REGEX = 57384
const GTE = 57385
const GTR = 57386
const LAND = 57387
const LOR = 57388
const LSS = 57389
const LTE = 57390
const LUNLESS = 57391
const MOD = 57392
const MUL = 57393
const NEQ = 57394
const NEQ_REGEX = 57395
const POW = 57396
const SUB = 57397
const AT = 57398
const ATAN2 = 57399
const operatorsEnd = 57400
const aggregatorsStart = 57401
const AVG = 57402
const BOTTOMK = 57403
const COUNT = 57404
const COUNT_VALUES = 57405
const GROUP = 57406
const MAX = 57407
const MIN = 57408
const QUANTILE = 57409
const STDDEV = 57410
const STDVAR = 57411
const SUM = 57412
const TOPK = 57413
const aggregatorsEnd = 57414
const keywordsStart = 57415
const BOOL = 57416
const BY = 57417
const GROUP_LEFT = 57418
const GROUP_RIGHT = 57419
const IGNORING = 57420
const OFFSET = 57421
const ON = 57422
const WITHOUT = 57423
const keywordsEnd = 57424
const preprocessorStart = 57425
const START = 57426
const END = 57427
const preprocessorEnd = 57428
const startSymbolsStart = 57429
const START_METRIC = 57430
const START_SERIES_DESCRIPTION = 57431
const START_EXPRESSION = 57432
const START_METRIC_SELECTOR = 57433
const startSymbolsEnd = 57434
var yyToknames = [...]string{
"$end",
"error",
"$unk",
"EQL",
"BLANK",
"COLON",
"COMMA",
"COMMENT",
"DURATION",
"EOF",
"ERROR",
"IDENTIFIER",
"LEFT_BRACE",
"LEFT_BRACKET",
"LEFT_PAREN",
"OPEN_HIST",
"CLOSE_HIST",
"METRIC_IDENTIFIER",
"NUMBER",
"RIGHT_BRACE",
"RIGHT_BRACKET",
"RIGHT_PAREN",
"SEMICOLON",
"SPACE",
"STRING",
"TIMES",
"histogramDescStart",
"SUM_DESC",
"COUNT_DESC",
"SCHEMA_DESC",
"OFFSET_DESC",
"NEGATIVE_OFFSET_DESC",
"BUCKETS_DESC",
"NEGATIVE_BUCKETS_DESC",
"ZERO_BUCKET_DESC",
"ZERO_BUCKET_WIDTH_DESC",
"histogramDescEnd",
"operatorsStart",
"ADD",
"DIV",
"EQLC",
"EQL_REGEX",
"GTE",
"GTR",
"LAND",
"LOR",
"LSS",
"LTE",
"LUNLESS",
"MOD",
"MUL",
"NEQ",
"NEQ_REGEX",
"POW",
"SUB",
"AT",
"ATAN2",
"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",
"preprocessorStart",
"START",
"END",
"preprocessorEnd",
"startSymbolsStart",
"START_METRIC",
"START_SERIES_DESCRIPTION",
"START_EXPRESSION",
"START_METRIC_SELECTOR",
"startSymbolsEnd",
}
var yyStatenames = [...]string{}
const yyEofCode = 1
const yyErrCode = 2
const yyInitialStackSize = 16
var yyExca = [...]int{
-1, 1,
1, -1,
-2, 0,
-1, 35,
1, 133,
10, 133,
24, 133,
-2, 0,
-1, 58,
2, 170,
15, 170,
75, 170,
81, 170,
-2, 99,
-1, 59,
2, 171,
15, 171,
75, 171,
81, 171,
-2, 100,
-1, 60,
2, 172,
15, 172,
75, 172,
81, 172,
-2, 102,
-1, 61,
2, 173,
15, 173,
75, 173,
81, 173,
-2, 103,
-1, 62,
2, 174,
15, 174,
75, 174,
81, 174,
-2, 104,
-1, 63,
2, 175,
15, 175,
75, 175,
81, 175,
-2, 109,
-1, 64,
2, 176,
15, 176,
75, 176,
81, 176,
-2, 111,
-1, 65,
2, 177,
15, 177,
75, 177,
81, 177,
-2, 113,
-1, 66,
2, 178,
15, 178,
75, 178,
81, 178,
-2, 114,
-1, 67,
2, 179,
15, 179,
75, 179,
81, 179,
-2, 115,
-1, 68,
2, 180,
15, 180,
75, 180,
81, 180,
-2, 116,
-1, 69,
2, 181,
15, 181,
75, 181,
81, 181,
-2, 117,
-1, 195,
12, 229,
13, 229,
18, 229,
19, 229,
25, 229,
39, 229,
45, 229,
46, 229,
49, 229,
55, 229,
60, 229,
61, 229,
62, 229,
63, 229,
64, 229,
65, 229,
66, 229,
67, 229,
68, 229,
69, 229,
70, 229,
71, 229,
75, 229,
79, 229,
81, 229,
84, 229,
85, 229,
-2, 0,
-1, 196,
12, 229,
13, 229,
18, 229,
19, 229,
25, 229,
39, 229,
45, 229,
46, 229,
49, 229,
55, 229,
60, 229,
61, 229,
62, 229,
63, 229,
64, 229,
65, 229,
66, 229,
67, 229,
68, 229,
69, 229,
70, 229,
71, 229,
75, 229,
79, 229,
81, 229,
84, 229,
85, 229,
-2, 0,
-1, 217,
21, 227,
-2, 0,
-1, 284,
21, 228,
-2, 0,
}
const yyPrivate = 57344
const yyLast = 697
var yyAct = [...]int{
151, 321, 319, 267, 326, 148, 221, 187, 144, 37,
113, 279, 280, 152, 173, 77, 101, 223, 102, 6,
104, 150, 193, 103, 194, 128, 105, 233, 195, 196,
155, 291, 338, 239, 316, 146, 106, 312, 155, 261,
259, 257, 147, 155, 57, 339, 315, 174, 293, 175,
156, 337, 262, 156, 336, 258, 123, 282, 156, 310,
235, 236, 155, 108, 237, 109, 157, 320, 263, 157,
107, 100, 250, 291, 157, 224, 226, 228, 229, 230,
238, 240, 243, 244, 245, 246, 247, 177, 145, 225,
227, 231, 232, 234, 241, 242, 104, 176, 178, 248,
249, 110, 105, 153, 154, 2, 3, 4, 5, 158,
256, 96, 223, 99, 252, 183, 168, 162, 165, 161,
160, 300, 233, 327, 189, 124, 147, 191, 239, 251,
179, 213, 220, 255, 192, 181, 98, 190, 182, 197,
198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 235, 236, 214, 215, 237,
106, 72, 33, 7, 309, 308, 307, 250, 306, 305,
224, 226, 228, 229, 230, 238, 240, 243, 244, 245,
246, 247, 254, 299, 225, 227, 231, 232, 234, 241,
242, 164, 285, 304, 248, 249, 311, 303, 298, 147,
260, 302, 100, 175, 163, 297, 277, 278, 281, 129,
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 301, 81, 284, 82, 84, 85,
34, 86, 87, 88, 89, 90, 91, 92, 93, 94,
95, 177, 96, 97, 99, 83, 116, 1, 288, 100,
283, 176, 178, 287, 218, 10, 114, 169, 217, 159,
290, 292, 289, 294, 253, 74, 147, 98, 286, 117,
295, 296, 47, 216, 82, 84, 85, 46, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95, 45, 96,
97, 99, 83, 116, 313, 314, 48, 79, 122, 100,
121, 318, 73, 114, 323, 324, 325, 78, 322, 44,
328, 112, 330, 329, 98, 180, 117, 331, 332, 100,
51, 72, 333, 53, 82, 84, 22, 52, 335, 127,
167, 43, 42, 54, 79, 93, 94, 340, 41, 96,
97, 99, 83, 125, 78, 84, 56, 70, 166, 9,
9, 40, 76, 18, 19, 93, 94, 20, 126, 96,
39, 99, 83, 71, 98, 38, 49, 186, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
172, 334, 8, 13, 98, 171, 35, 24, 264, 30,
120, 80, 31, 32, 36, 119, 51, 72, 170, 53,
184, 219, 22, 52, 75, 115, 185, 149, 118, 54,
55, 222, 50, 188, 111, 0, 0, 191, 0, 0,
155, 0, 0, 70, 0, 0, 0, 0, 0, 18,
19, 0, 0, 20, 0, 0, 0, 0, 0, 71,
156, 0, 0, 0, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 157, 0, 0, 13,
0, 0, 0, 24, 0, 30, 0, 0, 31, 32,
51, 72, 0, 53, 266, 0, 22, 52, 0, 0,
0, 265, 0, 54, 0, 269, 270, 268, 274, 276,
273, 275, 271, 272, 0, 0, 0, 70, 0, 0,
0, 0, 0, 18, 19, 0, 0, 20, 0, 0,
0, 17, 72, 71, 0, 0, 0, 22, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
0, 0, 0, 13, 0, 0, 0, 24, 0, 30,
0, 0, 31, 32, 18, 19, 0, 0, 20, 0,
0, 0, 17, 33, 0, 0, 0, 0, 22, 11,
12, 14, 15, 16, 21, 23, 25, 26, 27, 28,
29, 0, 0, 0, 13, 0, 0, 0, 24, 317,
30, 0, 0, 31, 32, 18, 19, 0, 0, 20,
269, 270, 268, 274, 276, 273, 275, 271, 272, 0,
11, 12, 14, 15, 16, 21, 23, 25, 26, 27,
28, 29, 100, 0, 0, 13, 0, 0, 0, 24,
0, 30, 0, 0, 31, 32, 0, 0, 0, 0,
0, 100, 0, 0, 0, 0, 0, 82, 84, 85,
0, 86, 87, 88, 0, 90, 91, 92, 93, 94,
95, 0, 96, 97, 99, 83, 82, 84, 85, 0,
86, 87, 0, 0, 90, 91, 0, 93, 94, 95,
0, 96, 97, 99, 83, 0, 0, 98, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 98,
}
var yyPact = [...]int{
17, 153, 540, 540, 384, 499, -1000, -1000, -1000, 149,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, 332, -1000, 223, -1000, 188, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
21, 145, -1000, 458, -1000, 458, 148, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, 291, -1000, -1000, 388, -1000, -1000, 296, -1000,
32, -1000, -49, -49, -49, -49, -49, -49, -49, -49,
-49, -49, -49, -49, -49, -49, -49, -49, 33, 19,
257, 145, -55, -1000, 189, 189, 308, -1000, 235, 57,
-1000, 378, -1000, -1000, 45, 199, -1000, -1000, -1000, 295,
-1000, 113, -1000, 401, 458, -1000, -56, -48, -1000, 458,
458, 458, 458, 458, 458, 458, 458, 458, 458, 458,
458, 458, 458, 458, -1000, 117, -1000, -1000, -1000, 116,
-1000, -1000, -1000, -1000, -1000, -1000, 43, 43, 252, -1000,
-1000, -1000, -1000, 110, -1000, -1000, 107, -1000, 188, -1000,
-1000, 244, -1000, 108, -1000, -1000, -1000, -1000, -1000, 16,
-1000, -1000, -1000, -1000, -1000, 29, 14, 13, -1000, -1000,
-1000, 457, 305, 189, 189, 189, 189, 57, 57, 285,
285, 285, 617, 598, 285, 285, 617, 57, 57, 285,
57, 305, -1000, 35, -1000, -1000, -1000, 190, -1000, 246,
-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, -1000,
-1000, -1000, 458, -1000, -1000, -1000, -1000, -1000, 54, 54,
22, 54, 111, 111, 181, 104, -1000, -1000, 218, 195,
191, 187, 163, 162, 160, 159, 158, -1000, -1000, -1000,
-1000, -1000, -1000, 38, 194, -1000, -1000, 15, -1000, 188,
-1000, -1000, -1000, 54, -1000, 20, 8, 562, -1000, -1000,
-1000, 12, 11, 43, 43, 43, 109, 12, 109, 12,
-1000, -1000, -1000, -1000, -1000, 54, 54, -1000, -1000, -1000,
54, -1000, -1000, -1000, -1000, -1000, -1000, 43, -1000, -1000,
-1000, -1000, -1000, -1000, 30, -1000, 24, -1000, -1000, -1000,
-1000,
}
var yyPgo = [...]int{
0, 414, 10, 412, 6, 14, 411, 346, 410, 407,
405, 255, 382, 404, 15, 401, 12, 11, 400, 391,
7, 388, 3, 4, 381, 2, 1, 0, 367, 13,
5, 366, 365, 16, 125, 360, 358, 9, 351, 348,
18, 343, 44, 338, 332, 331, 329, 309, 288, 277,
272, 296, 8, 250, 247, 230,
}
var yyR1 = [...]int{
0, 54, 54, 54, 54, 54, 54, 54, 37, 37,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
32, 32, 32, 32, 33, 33, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 34, 36, 36, 46, 46, 41, 41, 41,
41, 16, 16, 16, 16, 15, 15, 15, 4, 4,
38, 40, 40, 39, 39, 39, 47, 45, 45, 45,
31, 31, 31, 9, 9, 43, 49, 49, 49, 49,
49, 50, 51, 51, 51, 42, 42, 42, 1, 1,
1, 2, 2, 2, 2, 2, 2, 12, 12, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 11, 11, 11, 11, 13, 13, 13, 14, 14,
14, 14, 55, 19, 19, 19, 19, 18, 18, 18,
18, 18, 18, 18, 18, 18, 28, 28, 28, 20,
20, 20, 20, 21, 21, 21, 22, 22, 22, 22,
22, 22, 22, 22, 22, 23, 23, 24, 24, 24,
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, 6, 6, 6, 8,
8, 5, 5, 5, 5, 44, 27, 29, 29, 30,
30, 26, 25, 25, 52, 48, 10, 53, 53, 17,
17,
}
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, 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, 4, 3,
3, 5, 3, 1, 1, 4, 6, 6, 5, 4,
3, 2, 2, 1, 1, 3, 4, 2, 3, 1,
2, 3, 3, 1, 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, 1,
1, 3, 4, 2, 0, 3, 1, 2, 3, 3,
2, 1, 2, 0, 3, 2, 1, 1, 3, 1,
3, 4, 1, 3, 5, 5, 1, 1, 1, 4,
3, 3, 2, 3, 1, 2, 3, 3, 3, 3,
3, 3, 3, 3, 3, 4, 3, 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, 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, 2, 1, 1, 1, 1, 0, 1, 0,
1,
}
var yyChk = [...]int{
-1000, -54, 88, 89, 90, 91, 2, 10, -12, -7,
-11, 60, 61, 75, 62, 63, 64, 12, 45, 46,
49, 65, 18, 66, 79, 67, 68, 69, 70, 71,
81, 84, 85, 13, -55, -12, 10, -37, -32, -35,
-38, -43, -44, -45, -47, -48, -49, -50, -51, -31,
-3, 12, 19, 15, 25, -8, -7, -42, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
39, 55, 13, -51, -11, -13, 20, -14, 12, 2,
-19, 2, 39, 57, 40, 41, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 54, 55, 79, 56,
14, -33, -40, 2, 75, 81, 15, -40, -37, -37,
-42, -1, 20, -2, 12, -10, 2, 25, 20, 7,
2, 4, 2, 24, -34, -41, -36, -46, 74, -34,
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34,
-34, -34, -34, -34, -52, 55, 2, 9, -30, -9,
2, -27, -29, 84, 85, 19, 39, 55, -52, 2,
-40, -33, -16, 15, 2, -16, -39, 22, -37, 22,
20, 7, 2, -5, 2, 4, 52, 42, 53, -5,
20, -14, 25, 2, -18, 5, -28, -20, 12, -27,
-29, 16, -37, 78, 80, 76, 77, -37, -37, -37,
-37, -37, -37, -37, -37, -37, -37, -37, -37, -37,
-37, -37, -52, 15, -27, -27, 21, 6, 2, -15,
22, -4, -6, 2, 60, 74, 61, 75, 62, 63,
64, 76, 77, 12, 78, 45, 46, 49, 65, 18,
66, 79, 80, 67, 68, 69, 70, 71, 84, 85,
57, 22, 7, 20, -2, 25, 2, 25, 26, 26,
-29, 26, 39, 55, -21, 24, 17, -22, 30, 28,
29, 35, 36, 33, 31, 34, 32, -16, -16, -17,
-16, -17, 22, -53, -52, 2, 22, 7, 2, -37,
-26, 19, -26, 26, -26, -20, -20, 24, 17, 2,
17, 6, 6, 6, 6, 6, 6, 6, 6, 6,
21, 2, 22, -4, -26, 26, 26, 17, -22, -25,
55, -26, -30, -27, -27, -27, -23, 14, -25, -23,
-25, -26, -26, -26, -24, -27, 24, 21, 2, 21,
-27,
}
var yyDef = [...]int{
0, -2, 124, 124, 0, 0, 7, 6, 1, 124,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 0, 2, -2, 3, 4, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
0, 105, 215, 0, 225, 0, 83, 84, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
209, 210, 0, 5, 97, 0, 123, 126, 0, 131,
132, 136, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 0, 0,
0, 0, 22, 23, 0, 0, 0, 60, 0, 81,
82, 0, 87, 89, 0, 93, 96, 226, 121, 0,
127, 0, 130, 135, 0, 42, 47, 48, 44, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 67, 0, 69, 224, 70, 0,
72, 219, 220, 73, 74, 216, 0, 0, 0, 80,
20, 21, 24, 0, 54, 25, 0, 62, 64, 66,
85, 0, 90, 0, 95, 211, 212, 213, 214, 0,
122, 125, 128, 129, 134, 137, 139, 142, 146, 147,
148, 0, 26, 0, 0, -2, -2, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 68, 0, 217, 218, 75, -2, 79, 0,
53, 56, 58, 59, 182, 183, 184, 185, 186, 187,
188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 61, 65, 86, 88, 91, 94, 92, 0, 0,
0, 0, 0, 0, 0, 0, 152, 154, 0, 0,
0, 0, 0, 0, 0, 0, 0, 45, 46, 49,
230, 50, 71, 0, -2, 78, 51, 0, 57, 63,
138, 221, 140, 0, 143, 0, 0, 0, 150, 155,
151, 0, 0, 0, 0, 0, 0, 0, 0, 0,
76, 77, 52, 55, 141, 0, 0, 149, 153, 156,
0, 223, 157, 158, 159, 160, 161, 0, 162, 163,
164, 144, 145, 222, 0, 168, 0, 166, 169, 165,
167,
}
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, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92,
}
var yyTok3 = [...]int{
0,
}
var yyErrorMessages = [...]struct {
state int
token int
msg string
}{}
/* 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]
{
yylex.(*parser).generatedParserResult = yyDollar[2].labels
}
case 3:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).addParseErrf(posrange.PositionRange{}, "no expression found in input")
}
case 4:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).generatedParserResult = yyDollar[2].node
}
case 5:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).generatedParserResult = yyDollar[2].node
}
case 7:
yyDollar = yyS[yypt-1 : yypt+1]
{
yylex.(*parser).unexpected("", "")
}
case 20:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[2].node, yyDollar[3].node)
}
case 21:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[3].node, yyDollar[2].node)
}
case 22:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, yyDollar[2].node)
}
case 23:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("aggregation", "")
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, Expressions{})
}
case 24:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.node = &AggregateExpr{
Grouping: yyDollar[2].strings,
}
}
case 25:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.node = &AggregateExpr{
Grouping: yyDollar[2].strings,
Without: true,
}
}
case 26:
yyDollar = yyS[yypt-4 : yypt+1]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
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]
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 41:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 43:
yyDollar = yyS[yypt-0 : yypt+1]
{
yyVAL.node = &BinaryExpr{
VectorMatching: &VectorMatching{Card: CardOneToOne},
}
}
case 44:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.node = &BinaryExpr{
VectorMatching: &VectorMatching{Card: CardOneToOne},
ReturnBool: true,
}
}
case 45:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
}
case 46:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
yyVAL.node.(*BinaryExpr).VectorMatching.On = true
}
case 49:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardManyToOne
yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings
}
case 50:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardOneToMany
yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings
}
case 51:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.strings = yyDollar[2].strings
}
case 52:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.strings = yyDollar[2].strings
}
case 53:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.strings = []string{}
}
case 54:
yyDollar = yyS[yypt-1 : yypt+1]
{
yylex.(*parser).unexpected("grouping opts", "\"(\"")
yyVAL.strings = nil
}
case 55:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.strings = append(yyDollar[1].strings, yyDollar[3].item.Val)
}
case 56:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.strings = []string{yyDollar[1].item.Val}
}
case 57:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("grouping opts", "\",\" or \")\"")
yyVAL.strings = yyDollar[1].strings
}
case 58:
yyDollar = yyS[yypt-1 : yypt+1]
{
if !isLabel(yyDollar[1].item.Val) {
yylex.(*parser).unexpected("grouping opts", "label")
}
yyVAL.item = yyDollar[1].item
}
case 59:
yyDollar = yyS[yypt-1 : yypt+1]
{
yylex.(*parser).unexpected("grouping opts", "label")
yyVAL.item = Item{}
}
case 60:
yyDollar = yyS[yypt-2 : yypt+1]
{
fn, exist := getFunction(yyDollar[1].item.Val, yylex.(*parser).functions)
if !exist {
yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "unknown function with name %q", yyDollar[1].item.Val)
}
if fn != nil && fn.Experimental && !EnableExperimentalFunctions {
yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "function %q is not enabled", yyDollar[1].item.Val)
}
yyVAL.node = &Call{
Func: fn,
Args: yyDollar[2].node.(Expressions),
PosRange: posrange.PositionRange{
Start: yyDollar[1].item.Pos,
End: yylex.(*parser).lastClosing,
},
}
}
case 61:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = yyDollar[2].node
}
case 62:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.node = Expressions{}
}
case 63:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = append(yyDollar[1].node.(Expressions), yyDollar[3].node.(Expr))
}
case 64:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.node = Expressions{yyDollar[1].node.(Expr)}
}
case 65:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).addParseErrf(yyDollar[2].item.PositionRange(), "trailing commas not allowed in function call args")
yyVAL.node = yyDollar[1].node
}
case 66:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = &ParenExpr{Expr: yyDollar[2].node.(Expr), PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item)}
}
case 67:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).addOffset(yyDollar[1].node, yyDollar[3].duration)
yyVAL.node = yyDollar[1].node
}
case 68:
yyDollar = yyS[yypt-4 : yypt+1]
{
yylex.(*parser).addOffset(yyDollar[1].node, -yyDollar[4].duration)
yyVAL.node = yyDollar[1].node
}
case 69:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).unexpected("offset", "duration")
yyVAL.node = yyDollar[1].node
}
case 70:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).setTimestamp(yyDollar[1].node, yyDollar[3].float)
yyVAL.node = yyDollar[1].node
}
case 71:
yyDollar = yyS[yypt-5 : yypt+1]
{
yylex.(*parser).setAtModifierPreprocessor(yyDollar[1].node, yyDollar[3].item)
yyVAL.node = yyDollar[1].node
}
case 72:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).unexpected("@", "timestamp")
yyVAL.node = yyDollar[1].node
}
case 75:
yyDollar = yyS[yypt-4 : yypt+1]
{
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 76:
yyDollar = yyS[yypt-6 : yypt+1]
{
yyVAL.node = &SubqueryExpr{
Expr: yyDollar[1].node.(Expr),
Range: yyDollar[3].duration,
Step: yyDollar[5].duration,
EndPos: yyDollar[6].item.Pos + 1,
}
}
case 77:
yyDollar = yyS[yypt-6 : yypt+1]
{
yylex.(*parser).unexpected("subquery selector", "\"]\"")
yyVAL.node = yyDollar[1].node
}
case 78:
yyDollar = yyS[yypt-5 : yypt+1]
{
yylex.(*parser).unexpected("subquery selector", "duration or \"]\"")
yyVAL.node = yyDollar[1].node
}
case 79:
yyDollar = yyS[yypt-4 : yypt+1]
{
yylex.(*parser).unexpected("subquery or range", "\":\" or \"]\"")
yyVAL.node = yyDollar[1].node
}
case 80:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).unexpected("subquery selector", "duration")
yyVAL.node = yyDollar[1].node
}
case 81:
yyDollar = yyS[yypt-2 : yypt+1]
{
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 82:
yyDollar = yyS[yypt-2 : yypt+1]
{
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 83:
yyDollar = yyS[yypt-1 : yypt+1]
{
vs := &VectorSelector{
Name: yyDollar[1].item.Val,
LabelMatchers: []*labels.Matcher{},
PosRange: yyDollar[1].item.PositionRange(),
}
yylex.(*parser).assembleVectorSelector(vs)
yyVAL.node = vs
}
case 84:
yyDollar = yyS[yypt-1 : yypt+1]
{
vs := yyDollar[1].node.(*VectorSelector)
yylex.(*parser).assembleVectorSelector(vs)
yyVAL.node = vs
}
case 85:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.node = &VectorSelector{
LabelMatchers: yyDollar[2].matchers,
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item),
}
}
case 86:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.node = &VectorSelector{
LabelMatchers: yyDollar[2].matchers,
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[4].item),
}
}
case 87:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.node = &VectorSelector{
LabelMatchers: []*labels.Matcher{},
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[2].item),
}
}
case 88:
yyDollar = yyS[yypt-3 : yypt+1]
{
if yyDollar[1].matchers != nil {
yyVAL.matchers = append(yyDollar[1].matchers, yyDollar[3].matcher)
} else {
yyVAL.matchers = yyDollar[1].matchers
}
}
case 89:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher}
}
case 90:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("label matching", "\",\" or \"}\"")
yyVAL.matchers = yyDollar[1].matchers
}
case 91:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
}
case 92:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
}
case 93:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.matcher = yylex.(*parser).newMetricNameMatcher(yyDollar[1].item)
}
case 94:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).unexpected("label matching", "string")
yyVAL.matcher = nil
}
case 95:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("label matching", "label matching operator")
yyVAL.matcher = nil
}
case 96:
yyDollar = yyS[yypt-1 : yypt+1]
{
yylex.(*parser).unexpected("label matching", "identifier or \"}\"")
yyVAL.matcher = nil
}
case 97:
yyDollar = yyS[yypt-2 : yypt+1]
{
b := labels.NewBuilder(yyDollar[2].labels)
b.Set(labels.MetricName, yyDollar[1].item.Val)
yyVAL.labels = b.Labels()
}
case 98:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.labels = yyDollar[1].labels
}
case 121:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.labels = labels.New(yyDollar[2].lblList...)
}
case 122:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.labels = labels.New(yyDollar[2].lblList...)
}
case 123:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.labels = labels.New()
}
case 124:
yyDollar = yyS[yypt-0 : yypt+1]
{
yyVAL.labels = labels.New()
}
case 125:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.lblList = append(yyDollar[1].lblList, yyDollar[3].label)
}
case 126:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.lblList = []labels.Label{yyDollar[1].label}
}
case 127:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("label set", "\",\" or \"}\"")
yyVAL.lblList = yyDollar[1].lblList
}
case 128:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
}
case 129:
yyDollar = yyS[yypt-3 : yypt+1]
{
yylex.(*parser).unexpected("label set", "string")
yyVAL.label = labels.Label{}
}
case 130:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("label set", "\"=\"")
yyVAL.label = labels.Label{}
}
case 131:
yyDollar = yyS[yypt-1 : yypt+1]
{
yylex.(*parser).unexpected("label set", "identifier or \"}\"")
yyVAL.label = labels.Label{}
}
case 132:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).generatedParserResult = &seriesDescription{
labels: yyDollar[1].labels,
values: yyDollar[2].series,
}
}
case 133:
yyDollar = yyS[yypt-0 : yypt+1]
{
yyVAL.series = []SequenceValue{}
}
case 134:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...)
}
case 135:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.series = yyDollar[1].series
}
case 136:
yyDollar = yyS[yypt-1 : yypt+1]
{
yylex.(*parser).unexpected("series values", "")
yyVAL.series = nil
}
case 137:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.series = []SequenceValue{{Omitted: true}}
}
case 138:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.series = []SequenceValue{}
for i := uint64(0); i < yyDollar[3].uint; i++ {
yyVAL.series = append(yyVAL.series, SequenceValue{Omitted: true})
}
}
case 139:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.series = []SequenceValue{{Value: yyDollar[1].float}}
}
case 140:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.series = []SequenceValue{}
// Add an additional value for time 0, which we ignore in tests.
for i := uint64(0); i <= yyDollar[3].uint; i++ {
yyVAL.series = append(yyVAL.series, SequenceValue{Value: yyDollar[1].float})
}
}
case 141:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.series = []SequenceValue{}
// Add an additional value for time 0, which we ignore in tests.
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 142:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.series = []SequenceValue{{Histogram: yyDollar[1].histogram}}
}
case 143:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.series = []SequenceValue{}
// Add an additional value for time 0, which we ignore in tests.
for i := uint64(0); i <= yyDollar[3].uint; i++ {
yyVAL.series = append(yyVAL.series, SequenceValue{Histogram: yyDollar[1].histogram})
//$1 += $2
}
}
case 144:
yyDollar = yyS[yypt-5 : yypt+1]
{
val, err := yylex.(*parser).histogramsIncreaseSeries(yyDollar[1].histogram, yyDollar[3].histogram, yyDollar[5].uint)
if err != nil {
yylex.(*parser).addSemanticError(err)
}
yyVAL.series = val
}
case 145:
yyDollar = yyS[yypt-5 : yypt+1]
{
val, err := yylex.(*parser).histogramsDecreaseSeries(yyDollar[1].histogram, yyDollar[3].histogram, yyDollar[5].uint)
if err != nil {
yylex.(*parser).addSemanticError(err)
}
yyVAL.series = val
}
case 146:
yyDollar = yyS[yypt-1 : yypt+1]
{
if yyDollar[1].item.Val != "stale" {
yylex.(*parser).unexpected("series values", "number or \"stale\"")
}
yyVAL.float = math.Float64frombits(value.StaleNaN)
}
case 149:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&yyDollar[2].descriptors)
}
case 150:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&yyDollar[2].descriptors)
}
case 151:
yyDollar = yyS[yypt-3 : yypt+1]
{
m := yylex.(*parser).newMap()
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&m)
}
case 152:
yyDollar = yyS[yypt-2 : yypt+1]
{
m := yylex.(*parser).newMap()
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&m)
}
case 153:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = *(yylex.(*parser).mergeMaps(&yyDollar[1].descriptors, &yyDollar[3].descriptors))
}
case 154:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.descriptors = yyDollar[1].descriptors
}
case 155:
yyDollar = yyS[yypt-2 : yypt+1]
{
yylex.(*parser).unexpected("histogram description", "histogram description key, e.g. buckets:[5 10 7]")
}
case 156:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["schema"] = yyDollar[3].int
}
case 157:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["sum"] = yyDollar[3].float
}
case 158:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["count"] = yyDollar[3].float
}
case 159:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["z_bucket"] = yyDollar[3].float
}
case 160:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["z_bucket_w"] = yyDollar[3].float
}
case 161:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["buckets"] = yyDollar[3].bucket_set
}
case 162:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["offset"] = yyDollar[3].int
}
case 163:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["n_buckets"] = yyDollar[3].bucket_set
}
case 164:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.descriptors = yylex.(*parser).newMap()
yyVAL.descriptors["n_offset"] = yyDollar[3].int
}
case 165:
yyDollar = yyS[yypt-4 : yypt+1]
{
yyVAL.bucket_set = yyDollar[2].bucket_set
}
case 166:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.bucket_set = yyDollar[2].bucket_set
}
case 167:
yyDollar = yyS[yypt-3 : yypt+1]
{
yyVAL.bucket_set = append(yyDollar[1].bucket_set, yyDollar[3].float)
}
case 168:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.bucket_set = []float64{yyDollar[1].float}
}
case 215:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.node = &NumberLiteral{
Val: yylex.(*parser).number(yyDollar[1].item.Val),
PosRange: yyDollar[1].item.PositionRange(),
}
}
case 216:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val)
}
case 217:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.float = yyDollar[2].float
}
case 218:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.float = -yyDollar[2].float
}
case 221:
yyDollar = yyS[yypt-1 : yypt+1]
{
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 222:
yyDollar = yyS[yypt-2 : yypt+1]
{
yyVAL.int = -int64(yyDollar[2].uint)
}
case 223:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.int = int64(yyDollar[1].uint)
}
case 224:
yyDollar = yyS[yypt-1 : yypt+1]
{
var err error
yyVAL.duration, err = parseDuration(yyDollar[1].item.Val)
if err != nil {
yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err)
}
}
case 225:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.node = &StringLiteral{
Val: yylex.(*parser).unquoteString(yyDollar[1].item.Val),
PosRange: yyDollar[1].item.PositionRange(),
}
}
case 226:
yyDollar = yyS[yypt-1 : yypt+1]
{
yyVAL.item = Item{
Typ: METRIC_IDENTIFIER,
Pos: yyDollar[1].item.PositionRange().Start,
Val: yylex.(*parser).unquoteString(yyDollar[1].item.Val),
}
}
case 227:
yyDollar = yyS[yypt-0 : yypt+1]
{
yyVAL.duration = 0
}
case 229:
yyDollar = yyS[yypt-0 : yypt+1]
{
yyVAL.strings = nil
}
}
goto yystack /* stack new state and value */
}