mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
8d4bcd2c77
Some checks failed
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Fixes UTF-8 aggregator label list items getting mutated with quote marks when String-ified. Fixes quoted metric names not supported in metric declarations. Fixes UTF-8 label names not being quoted when String-ified. Fixes https://github.com/prometheus/prometheus/issues/15470 Fixes https://github.com/prometheus/prometheus/issues/15528 Signed-off-by: Owen Williams <owen.williams@grafana.com> Co-authored-by: Bryan Boreham <bjboreham@gmail.com>
1976 lines
48 KiB
Go
1976 lines
48 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"
|
|
|
|
"github.com/prometheus/common/model"
|
|
)
|
|
|
|
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
|
|
}
|
|
|
|
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 CUSTOM_VALUES_DESC = 57379
|
|
const COUNTER_RESET_HINT_DESC = 57380
|
|
const histogramDescEnd = 57381
|
|
const operatorsStart = 57382
|
|
const ADD = 57383
|
|
const DIV = 57384
|
|
const EQLC = 57385
|
|
const EQL_REGEX = 57386
|
|
const GTE = 57387
|
|
const GTR = 57388
|
|
const LAND = 57389
|
|
const LOR = 57390
|
|
const LSS = 57391
|
|
const LTE = 57392
|
|
const LUNLESS = 57393
|
|
const MOD = 57394
|
|
const MUL = 57395
|
|
const NEQ = 57396
|
|
const NEQ_REGEX = 57397
|
|
const POW = 57398
|
|
const SUB = 57399
|
|
const AT = 57400
|
|
const ATAN2 = 57401
|
|
const operatorsEnd = 57402
|
|
const aggregatorsStart = 57403
|
|
const AVG = 57404
|
|
const BOTTOMK = 57405
|
|
const COUNT = 57406
|
|
const COUNT_VALUES = 57407
|
|
const GROUP = 57408
|
|
const MAX = 57409
|
|
const MIN = 57410
|
|
const QUANTILE = 57411
|
|
const STDDEV = 57412
|
|
const STDVAR = 57413
|
|
const SUM = 57414
|
|
const TOPK = 57415
|
|
const LIMITK = 57416
|
|
const LIMIT_RATIO = 57417
|
|
const aggregatorsEnd = 57418
|
|
const keywordsStart = 57419
|
|
const BOOL = 57420
|
|
const BY = 57421
|
|
const GROUP_LEFT = 57422
|
|
const GROUP_RIGHT = 57423
|
|
const IGNORING = 57424
|
|
const OFFSET = 57425
|
|
const ON = 57426
|
|
const WITHOUT = 57427
|
|
const keywordsEnd = 57428
|
|
const preprocessorStart = 57429
|
|
const START = 57430
|
|
const END = 57431
|
|
const preprocessorEnd = 57432
|
|
const counterResetHintsStart = 57433
|
|
const UNKNOWN_COUNTER_RESET = 57434
|
|
const COUNTER_RESET = 57435
|
|
const NOT_COUNTER_RESET = 57436
|
|
const GAUGE_TYPE = 57437
|
|
const counterResetHintsEnd = 57438
|
|
const startSymbolsStart = 57439
|
|
const START_METRIC = 57440
|
|
const START_SERIES_DESCRIPTION = 57441
|
|
const START_EXPRESSION = 57442
|
|
const START_METRIC_SELECTOR = 57443
|
|
const startSymbolsEnd = 57444
|
|
|
|
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",
|
|
"CUSTOM_VALUES_DESC",
|
|
"COUNTER_RESET_HINT_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",
|
|
"LIMITK",
|
|
"LIMIT_RATIO",
|
|
"aggregatorsEnd",
|
|
"keywordsStart",
|
|
"BOOL",
|
|
"BY",
|
|
"GROUP_LEFT",
|
|
"GROUP_RIGHT",
|
|
"IGNORING",
|
|
"OFFSET",
|
|
"ON",
|
|
"WITHOUT",
|
|
"keywordsEnd",
|
|
"preprocessorStart",
|
|
"START",
|
|
"END",
|
|
"preprocessorEnd",
|
|
"counterResetHintsStart",
|
|
"UNKNOWN_COUNTER_RESET",
|
|
"COUNTER_RESET",
|
|
"NOT_COUNTER_RESET",
|
|
"GAUGE_TYPE",
|
|
"counterResetHintsEnd",
|
|
"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 = [...]int16{
|
|
-1, 1,
|
|
1, -1,
|
|
-2, 0,
|
|
-1, 37,
|
|
1, 141,
|
|
10, 141,
|
|
24, 141,
|
|
-2, 0,
|
|
-1, 61,
|
|
2, 184,
|
|
15, 184,
|
|
79, 184,
|
|
85, 184,
|
|
-2, 102,
|
|
-1, 62,
|
|
2, 185,
|
|
15, 185,
|
|
79, 185,
|
|
85, 185,
|
|
-2, 103,
|
|
-1, 63,
|
|
2, 186,
|
|
15, 186,
|
|
79, 186,
|
|
85, 186,
|
|
-2, 105,
|
|
-1, 64,
|
|
2, 187,
|
|
15, 187,
|
|
79, 187,
|
|
85, 187,
|
|
-2, 106,
|
|
-1, 65,
|
|
2, 188,
|
|
15, 188,
|
|
79, 188,
|
|
85, 188,
|
|
-2, 107,
|
|
-1, 66,
|
|
2, 189,
|
|
15, 189,
|
|
79, 189,
|
|
85, 189,
|
|
-2, 112,
|
|
-1, 67,
|
|
2, 190,
|
|
15, 190,
|
|
79, 190,
|
|
85, 190,
|
|
-2, 114,
|
|
-1, 68,
|
|
2, 191,
|
|
15, 191,
|
|
79, 191,
|
|
85, 191,
|
|
-2, 116,
|
|
-1, 69,
|
|
2, 192,
|
|
15, 192,
|
|
79, 192,
|
|
85, 192,
|
|
-2, 117,
|
|
-1, 70,
|
|
2, 193,
|
|
15, 193,
|
|
79, 193,
|
|
85, 193,
|
|
-2, 118,
|
|
-1, 71,
|
|
2, 194,
|
|
15, 194,
|
|
79, 194,
|
|
85, 194,
|
|
-2, 119,
|
|
-1, 72,
|
|
2, 195,
|
|
15, 195,
|
|
79, 195,
|
|
85, 195,
|
|
-2, 120,
|
|
-1, 73,
|
|
2, 196,
|
|
15, 196,
|
|
79, 196,
|
|
85, 196,
|
|
-2, 124,
|
|
-1, 74,
|
|
2, 197,
|
|
15, 197,
|
|
79, 197,
|
|
85, 197,
|
|
-2, 125,
|
|
-1, 204,
|
|
9, 246,
|
|
12, 246,
|
|
13, 246,
|
|
18, 246,
|
|
19, 246,
|
|
25, 246,
|
|
41, 246,
|
|
47, 246,
|
|
48, 246,
|
|
51, 246,
|
|
57, 246,
|
|
62, 246,
|
|
63, 246,
|
|
64, 246,
|
|
65, 246,
|
|
66, 246,
|
|
67, 246,
|
|
68, 246,
|
|
69, 246,
|
|
70, 246,
|
|
71, 246,
|
|
72, 246,
|
|
73, 246,
|
|
74, 246,
|
|
75, 246,
|
|
79, 246,
|
|
83, 246,
|
|
85, 246,
|
|
88, 246,
|
|
89, 246,
|
|
-2, 0,
|
|
-1, 205,
|
|
9, 246,
|
|
12, 246,
|
|
13, 246,
|
|
18, 246,
|
|
19, 246,
|
|
25, 246,
|
|
41, 246,
|
|
47, 246,
|
|
48, 246,
|
|
51, 246,
|
|
57, 246,
|
|
62, 246,
|
|
63, 246,
|
|
64, 246,
|
|
65, 246,
|
|
66, 246,
|
|
67, 246,
|
|
68, 246,
|
|
69, 246,
|
|
70, 246,
|
|
71, 246,
|
|
72, 246,
|
|
73, 246,
|
|
74, 246,
|
|
75, 246,
|
|
79, 246,
|
|
83, 246,
|
|
85, 246,
|
|
88, 246,
|
|
89, 246,
|
|
-2, 0,
|
|
}
|
|
|
|
const yyPrivate = 57344
|
|
|
|
const yyLast = 803
|
|
|
|
var yyAct = [...]int16{
|
|
154, 338, 336, 157, 343, 230, 39, 196, 280, 44,
|
|
295, 294, 84, 120, 82, 233, 180, 109, 108, 350,
|
|
351, 352, 353, 110, 111, 243, 202, 158, 203, 135,
|
|
112, 249, 361, 6, 333, 329, 113, 332, 232, 204,
|
|
205, 308, 271, 60, 130, 270, 297, 268, 162, 315,
|
|
156, 360, 153, 306, 359, 344, 200, 162, 161, 55,
|
|
245, 246, 222, 115, 247, 116, 107, 161, 269, 54,
|
|
267, 114, 260, 306, 182, 234, 236, 238, 239, 240,
|
|
248, 250, 253, 254, 255, 256, 257, 261, 262, 163,
|
|
122, 235, 237, 241, 242, 244, 251, 252, 192, 328,
|
|
111, 258, 259, 117, 190, 164, 112, 152, 103, 55,
|
|
106, 337, 77, 113, 184, 151, 35, 165, 327, 54,
|
|
175, 191, 169, 172, 183, 185, 167, 189, 168, 2,
|
|
3, 4, 5, 107, 198, 105, 159, 160, 201, 186,
|
|
188, 7, 326, 206, 207, 208, 209, 210, 211, 212,
|
|
213, 214, 215, 216, 217, 218, 219, 220, 199, 194,
|
|
89, 91, 221, 162, 264, 325, 197, 223, 224, 171,
|
|
200, 100, 101, 161, 162, 103, 104, 106, 90, 263,
|
|
233, 324, 170, 162, 161, 323, 362, 322, 321, 274,
|
|
243, 122, 266, 161, 131, 163, 249, 272, 123, 320,
|
|
229, 319, 105, 232, 275, 318, 163, 317, 121, 85,
|
|
316, 164, 163, 292, 293, 163, 265, 296, 129, 83,
|
|
276, 86, 164, 273, 10, 245, 246, 187, 164, 247,
|
|
88, 164, 86, 50, 79, 36, 298, 260, 1, 78,
|
|
234, 236, 238, 239, 240, 248, 250, 253, 254, 255,
|
|
256, 257, 261, 262, 123, 49, 235, 237, 241, 242,
|
|
244, 251, 252, 181, 121, 182, 258, 259, 128, 48,
|
|
127, 304, 119, 305, 307, 59, 309, 86, 9, 9,
|
|
47, 46, 134, 310, 311, 136, 137, 138, 139, 140,
|
|
141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
|
|
45, 43, 132, 173, 179, 184, 166, 85, 330, 178,
|
|
331, 42, 133, 55, 41, 183, 185, 83, 339, 340,
|
|
341, 335, 177, 54, 342, 81, 346, 345, 348, 347,
|
|
86, 303, 40, 314, 354, 355, 302, 55, 51, 356,
|
|
53, 77, 300, 56, 195, 358, 22, 54, 313, 55,
|
|
174, 301, 227, 57, 8, 312, 226, 357, 37, 54,
|
|
363, 299, 126, 277, 87, 193, 228, 125, 80, 75,
|
|
349, 225, 155, 58, 231, 18, 19, 52, 118, 20,
|
|
124, 0, 0, 0, 0, 76, 0, 0, 0, 0,
|
|
61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
|
|
71, 72, 73, 74, 0, 0, 0, 13, 0, 0,
|
|
0, 24, 0, 30, 0, 0, 31, 32, 55, 38,
|
|
107, 53, 77, 0, 56, 279, 0, 22, 54, 0,
|
|
0, 0, 278, 0, 57, 0, 282, 283, 281, 288,
|
|
290, 287, 289, 284, 285, 286, 291, 0, 91, 0,
|
|
75, 0, 0, 0, 0, 0, 18, 19, 100, 101,
|
|
20, 0, 103, 0, 106, 90, 76, 0, 0, 0,
|
|
0, 61, 62, 63, 64, 65, 66, 67, 68, 69,
|
|
70, 71, 72, 73, 74, 0, 0, 0, 13, 105,
|
|
0, 0, 24, 0, 30, 0, 55, 31, 32, 53,
|
|
77, 0, 56, 334, 0, 22, 54, 0, 0, 0,
|
|
0, 0, 57, 0, 282, 283, 281, 288, 290, 287,
|
|
289, 284, 285, 286, 291, 0, 0, 0, 75, 0,
|
|
0, 0, 0, 0, 18, 19, 0, 0, 20, 0,
|
|
0, 0, 17, 77, 76, 0, 0, 0, 22, 61,
|
|
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
|
|
72, 73, 74, 0, 0, 0, 13, 0, 0, 0,
|
|
24, 0, 30, 0, 0, 31, 32, 18, 19, 0,
|
|
0, 20, 0, 0, 0, 17, 35, 0, 0, 0,
|
|
0, 22, 11, 12, 14, 15, 16, 21, 23, 25,
|
|
26, 27, 28, 29, 33, 34, 0, 0, 0, 13,
|
|
0, 0, 0, 24, 0, 30, 0, 0, 31, 32,
|
|
18, 19, 0, 0, 20, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 11, 12, 14, 15, 16,
|
|
21, 23, 25, 26, 27, 28, 29, 33, 34, 107,
|
|
0, 0, 13, 0, 0, 0, 24, 176, 30, 0,
|
|
0, 31, 32, 0, 0, 0, 0, 0, 107, 0,
|
|
0, 0, 0, 0, 0, 0, 89, 91, 92, 0,
|
|
93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
|
|
0, 103, 104, 106, 90, 89, 91, 92, 0, 93,
|
|
94, 95, 96, 97, 98, 99, 100, 101, 102, 0,
|
|
103, 104, 106, 90, 107, 0, 0, 0, 105, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 107, 0, 0, 0, 105, 0, 0,
|
|
0, 89, 91, 92, 0, 93, 94, 95, 0, 97,
|
|
98, 99, 100, 101, 102, 0, 103, 104, 106, 90,
|
|
89, 91, 92, 0, 93, 94, 0, 0, 97, 98,
|
|
0, 100, 101, 102, 0, 103, 104, 106, 90, 0,
|
|
0, 0, 0, 105, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 105,
|
|
}
|
|
|
|
var yyPact = [...]int16{
|
|
31, 131, 573, 573, 409, 530, -1000, -1000, -1000, 103,
|
|
-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, 305, -1000, 228, -1000, 654,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, 21, 98, -1000, -1000, 487, -1000, 487, 99,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, 252, -1000, -1000,
|
|
360, -1000, -1000, 266, 214, -1000, -1000, 20, -1000, -49,
|
|
-49, -49, -49, -49, -49, -49, -49, -49, -49, -49,
|
|
-49, -49, -49, -49, -49, 50, 48, 304, 98, -55,
|
|
-1000, 167, 167, 328, -1000, 635, 52, -1000, 302, -1000,
|
|
-1000, 261, 70, -1000, -1000, 207, -1000, 102, -1000, 96,
|
|
154, 487, -1000, -56, -41, -1000, 487, 487, 487, 487,
|
|
487, 487, 487, 487, 487, 487, 487, 487, 487, 487,
|
|
487, -1000, 100, -1000, -1000, 47, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, 39, 39, 350, -1000, -1000, -1000, -1000,
|
|
178, -1000, -1000, 157, -1000, 654, -1000, -1000, 196, -1000,
|
|
45, -1000, -1000, -1000, -1000, -1000, 43, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, 16, 171, 163, -1000, -1000, -1000,
|
|
408, 406, 167, 167, 167, 167, 52, 52, 119, 119,
|
|
119, 719, 700, 119, 119, 719, 52, 52, 119, 52,
|
|
406, -1000, 24, -1000, -1000, -1000, 340, -1000, 329, -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, -1000, -1000, -1000, 487, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, 34, 34, 15, 34, 40, 40, 331, 32, -1000,
|
|
-1000, 204, 201, 199, 195, 193, 182, 181, 179, 175,
|
|
159, 136, -1000, -1000, -1000, -1000, -1000, -1000, 97, -1000,
|
|
-1000, -1000, 13, -1000, 654, -1000, -1000, -1000, 34, -1000,
|
|
11, 8, 486, -1000, -1000, -1000, 54, 174, 174, 174,
|
|
39, 41, 41, 54, 41, 54, -73, -1000, -1000, -1000,
|
|
-1000, -1000, 34, 34, -1000, -1000, -1000, 34, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, 174, -1000, -1000, -1000, -1000, -1000,
|
|
-1000, -1000, -1000, -1000, -1000, -1000, -1000, 30, -1000, 165,
|
|
-1000, -1000, -1000, -1000,
|
|
}
|
|
|
|
var yyPgo = [...]int16{
|
|
0, 378, 13, 377, 5, 16, 374, 275, 373, 372,
|
|
12, 370, 224, 354, 368, 14, 366, 10, 11, 365,
|
|
364, 7, 363, 8, 4, 357, 2, 1, 3, 344,
|
|
27, 0, 338, 332, 18, 194, 314, 312, 6, 311,
|
|
303, 17, 302, 43, 301, 9, 300, 282, 281, 280,
|
|
269, 255, 233, 238, 235,
|
|
}
|
|
|
|
var yyR1 = [...]int8{
|
|
0, 53, 53, 53, 53, 53, 53, 53, 38, 38,
|
|
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
|
|
33, 33, 33, 33, 34, 34, 36, 36, 36, 36,
|
|
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
|
|
36, 36, 35, 37, 37, 47, 47, 42, 42, 42,
|
|
42, 17, 17, 17, 17, 16, 16, 16, 4, 4,
|
|
4, 39, 41, 41, 40, 40, 40, 48, 46, 46,
|
|
46, 32, 32, 32, 9, 9, 44, 50, 50, 50,
|
|
50, 50, 50, 51, 52, 52, 52, 43, 43, 43,
|
|
1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
|
|
13, 13, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 12, 12, 12, 12,
|
|
14, 14, 14, 15, 15, 15, 15, 15, 15, 15,
|
|
54, 20, 20, 20, 20, 19, 19, 19, 19, 19,
|
|
19, 19, 19, 19, 29, 29, 29, 21, 21, 21,
|
|
21, 22, 22, 22, 23, 23, 23, 23, 23, 23,
|
|
23, 23, 23, 23, 23, 24, 24, 25, 25, 25,
|
|
11, 11, 11, 11, 3, 3, 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, 6, 6, 8, 8, 5,
|
|
5, 5, 5, 45, 45, 28, 28, 30, 30, 31,
|
|
31, 27, 26, 26, 49, 10, 18, 18,
|
|
}
|
|
|
|
var yyR2 = [...]int8{
|
|
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,
|
|
1, 2, 3, 2, 3, 1, 2, 3, 3, 4,
|
|
3, 3, 5, 3, 1, 1, 4, 6, 5, 6,
|
|
5, 4, 3, 2, 2, 1, 1, 3, 4, 2,
|
|
3, 1, 2, 3, 3, 1, 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, 1, 1, 1, 1, 3, 4, 2, 0,
|
|
3, 1, 2, 3, 3, 1, 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, 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, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 2, 2, 1,
|
|
1, 1, 2, 1, 1, 1, 0, 1,
|
|
}
|
|
|
|
var yyChk = [...]int16{
|
|
-1000, -53, 98, 99, 100, 101, 2, 10, -13, -7,
|
|
-12, 62, 63, 79, 64, 65, 66, 12, 47, 48,
|
|
51, 67, 18, 68, 83, 69, 70, 71, 72, 73,
|
|
85, 88, 89, 74, 75, 13, -54, -13, 10, -38,
|
|
-33, -36, -39, -44, -45, -46, -48, -49, -50, -51,
|
|
-52, -32, -3, 12, 19, 9, 15, 25, -8, -7,
|
|
-43, 62, 63, 64, 65, 66, 67, 68, 69, 70,
|
|
71, 72, 73, 74, 75, 41, 57, 13, -52, -12,
|
|
-14, 20, -15, 12, -10, 2, 25, -20, 2, 41,
|
|
59, 42, 43, 45, 46, 47, 48, 49, 50, 51,
|
|
52, 53, 54, 56, 57, 83, 58, 14, -34, -41,
|
|
2, 79, 85, 15, -41, -38, -38, -43, -1, 20,
|
|
-2, 12, -10, 2, 20, 7, 2, 4, 2, 4,
|
|
24, -35, -42, -37, -47, 78, -35, -35, -35, -35,
|
|
-35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
|
|
-35, -45, 57, 2, -31, -9, 2, -28, -30, 88,
|
|
89, 19, 9, 41, 57, -45, 2, -41, -34, -17,
|
|
15, 2, -17, -40, 22, -38, 22, 20, 7, 2,
|
|
-5, 2, 4, 54, 44, 55, -5, 20, -15, 25,
|
|
2, 25, 2, -19, 5, -29, -21, 12, -28, -30,
|
|
16, -38, 82, 84, 80, 81, -38, -38, -38, -38,
|
|
-38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
|
|
-38, -45, 15, -28, -28, 21, 6, 2, -16, 22,
|
|
-4, -6, 25, 2, 62, 78, 63, 79, 64, 65,
|
|
66, 80, 81, 12, 82, 47, 48, 51, 67, 18,
|
|
68, 83, 84, 69, 70, 71, 72, 73, 88, 89,
|
|
59, 74, 75, 22, 7, 20, -2, 25, 2, 25,
|
|
2, 26, 26, -30, 26, 41, 57, -22, 24, 17,
|
|
-23, 30, 28, 29, 35, 36, 37, 33, 31, 34,
|
|
32, 38, -17, -17, -18, -17, -18, 22, -45, 21,
|
|
2, 22, 7, 2, -38, -27, 19, -27, 26, -27,
|
|
-21, -21, 24, 17, 2, 17, 6, 6, 6, 6,
|
|
6, 6, 6, 6, 6, 6, 6, 21, 2, 22,
|
|
-4, -27, 26, 26, 17, -23, -26, 57, -27, -31,
|
|
-31, -31, -28, -24, 14, -24, -26, -24, -26, -11,
|
|
92, 93, 94, 95, -27, -27, -27, -25, -31, 24,
|
|
21, 2, 21, -31,
|
|
}
|
|
|
|
var yyDef = [...]int16{
|
|
0, -2, 129, 129, 0, 0, 7, 6, 1, 129,
|
|
101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
|
|
111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
|
|
121, 122, 123, 124, 125, 0, 2, -2, 3, 4,
|
|
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
|
18, 19, 0, 108, 233, 234, 0, 244, 0, 85,
|
|
86, -2, -2, -2, -2, -2, -2, -2, -2, -2,
|
|
-2, -2, -2, -2, -2, 227, 228, 0, 5, 100,
|
|
0, 128, 131, 0, 135, 139, 245, 140, 144, 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, 61, 0, 83, 84, 0, 89,
|
|
91, 0, 95, 99, 126, 0, 132, 0, 138, 0,
|
|
143, 0, 42, 47, 48, 44, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 68, 0, 70, 71, 0, 73, 239, 240, 74,
|
|
75, 235, 236, 0, 0, 0, 82, 20, 21, 24,
|
|
0, 54, 25, 0, 63, 65, 67, 87, 0, 92,
|
|
0, 98, 229, 230, 231, 232, 0, 127, 130, 133,
|
|
136, 134, 137, 142, 145, 147, 150, 154, 155, 156,
|
|
0, 26, 0, 0, -2, -2, 27, 28, 29, 30,
|
|
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
|
41, 69, 0, 237, 238, 76, 0, 81, 0, 53,
|
|
56, 58, 59, 60, 198, 199, 200, 201, 202, 203,
|
|
204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
|
|
214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
|
224, 225, 226, 62, 66, 88, 90, 93, 97, 94,
|
|
96, 0, 0, 0, 0, 0, 0, 0, 0, 160,
|
|
162, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 45, 46, 49, 247, 50, 72, 0, 78,
|
|
80, 51, 0, 57, 64, 146, 241, 148, 0, 151,
|
|
0, 0, 0, 158, 163, 159, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 77, 79, 52,
|
|
55, 149, 0, 0, 157, 161, 164, 0, 243, 165,
|
|
166, 167, 168, 169, 0, 170, 171, 172, 173, 174,
|
|
180, 181, 182, 183, 152, 153, 242, 0, 178, 0,
|
|
176, 179, 175, 177,
|
|
}
|
|
|
|
var yyTok1 = [...]int8{
|
|
1,
|
|
}
|
|
|
|
var yyTok2 = [...]int8{
|
|
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, 93, 94, 95, 96, 97, 98, 99, 100, 101,
|
|
102,
|
|
}
|
|
|
|
var yyTok3 = [...]int8{
|
|
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 := int(yyPact[state])
|
|
for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {
|
|
if n := base + tok; n >= 0 && n < yyLast && int(yyChk[int(yyAct[n])]) == tok {
|
|
if len(expected) == cap(expected) {
|
|
return res
|
|
}
|
|
expected = append(expected, tok)
|
|
}
|
|
}
|
|
|
|
if yyDef[state] == -2 {
|
|
i := 0
|
|
for yyExca[i] != -1 || int(yyExca[i+1]) != state {
|
|
i += 2
|
|
}
|
|
|
|
// Look for tokens that we accept or reduce.
|
|
for i += 2; yyExca[i] >= 0; i += 2 {
|
|
tok := int(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 = int(yyTok1[0])
|
|
goto out
|
|
}
|
|
if char < len(yyTok1) {
|
|
token = int(yyTok1[char])
|
|
goto out
|
|
}
|
|
if char >= yyPrivate {
|
|
if char < yyPrivate+len(yyTok2) {
|
|
token = int(yyTok2[char-yyPrivate])
|
|
goto out
|
|
}
|
|
}
|
|
for i := 0; i < len(yyTok3); i += 2 {
|
|
token = int(yyTok3[i+0])
|
|
if token == char {
|
|
token = int(yyTok3[i+1])
|
|
goto out
|
|
}
|
|
}
|
|
|
|
out:
|
|
if token == 0 {
|
|
token = int(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 = int(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 = int(yyAct[yyn])
|
|
if int(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 = int(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 && int(yyExca[xi+1]) == yystate {
|
|
break
|
|
}
|
|
xi += 2
|
|
}
|
|
for xi += 2; ; xi += 2 {
|
|
yyn = int(yyExca[xi+0])
|
|
if yyn < 0 || yyn == yytoken {
|
|
break
|
|
}
|
|
}
|
|
yyn = int(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 = int(yyPact[yyS[yyp].yys]) + yyErrCode
|
|
if yyn >= 0 && yyn < yyLast {
|
|
yystate = int(yyAct[yyn]) /* simulate a shift of "error" */
|
|
if int(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 -= int(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 = int(yyR1[yyn])
|
|
yyg := int(yyPgo[yyn])
|
|
yyj := yyg + yyS[yyp].yys + 1
|
|
|
|
if yyj >= yyLast {
|
|
yystate = int(yyAct[yyg])
|
|
} else {
|
|
yystate = int(yyAct[yyj])
|
|
if int(yyChk[yystate]) != -yyn {
|
|
yystate = int(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 !model.LabelName(yyDollar[1].item.Val).IsValid() {
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
}
|
|
yyVAL.item = yyDollar[1].item
|
|
}
|
|
case 59:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
if !model.LabelName(yylex.(*parser).unquoteString(yyDollar[1].item.Val)).IsValid() {
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
}
|
|
yyVAL.item = yyDollar[1].item
|
|
yyVAL.item.Pos++
|
|
yyVAL.item.Val = yylex.(*parser).unquoteString(yyVAL.item.Val)
|
|
}
|
|
case 60:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("grouping opts", "label")
|
|
yyVAL.item = Item{}
|
|
}
|
|
case 61:
|
|
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 62:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.node = yyDollar[2].node
|
|
}
|
|
case 63:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.node = Expressions{}
|
|
}
|
|
case 64:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.node = append(yyDollar[1].node.(Expressions), yyDollar[3].node.(Expr))
|
|
}
|
|
case 65:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.node = Expressions{yyDollar[1].node.(Expr)}
|
|
}
|
|
case 66:
|
|
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 67:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.node = &ParenExpr{Expr: yyDollar[2].node.(Expr), PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item)}
|
|
}
|
|
case 68:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
numLit, _ := yyDollar[3].node.(*NumberLiteral)
|
|
dur := time.Duration(numLit.Val*1000) * time.Millisecond
|
|
yylex.(*parser).addOffset(yyDollar[1].node, dur)
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 69:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
{
|
|
numLit, _ := yyDollar[4].node.(*NumberLiteral)
|
|
dur := time.Duration(numLit.Val*1000) * time.Millisecond
|
|
yylex.(*parser).addOffset(yyDollar[1].node, -dur)
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 70:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("offset", "number or duration")
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 71:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).setTimestamp(yyDollar[1].node, yyDollar[3].float)
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 72:
|
|
yyDollar = yyS[yypt-5 : yypt+1]
|
|
{
|
|
yylex.(*parser).setAtModifierPreprocessor(yyDollar[1].node, yyDollar[3].item)
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 73:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("@", "timestamp")
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 76:
|
|
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)
|
|
}
|
|
|
|
numLit, _ := yyDollar[3].node.(*NumberLiteral)
|
|
yyVAL.node = &MatrixSelector{
|
|
VectorSelector: yyDollar[1].node.(Expr),
|
|
Range: time.Duration(numLit.Val*1000) * time.Millisecond,
|
|
EndPos: yylex.(*parser).lastClosing,
|
|
}
|
|
}
|
|
case 77:
|
|
yyDollar = yyS[yypt-6 : yypt+1]
|
|
{
|
|
numLitRange, _ := yyDollar[3].node.(*NumberLiteral)
|
|
numLitStep, _ := yyDollar[5].node.(*NumberLiteral)
|
|
yyVAL.node = &SubqueryExpr{
|
|
Expr: yyDollar[1].node.(Expr),
|
|
Range: time.Duration(numLitRange.Val*1000) * time.Millisecond,
|
|
Step: time.Duration(numLitStep.Val*1000) * time.Millisecond,
|
|
EndPos: yyDollar[6].item.Pos + 1,
|
|
}
|
|
}
|
|
case 78:
|
|
yyDollar = yyS[yypt-5 : yypt+1]
|
|
{
|
|
numLitRange, _ := yyDollar[3].node.(*NumberLiteral)
|
|
yyVAL.node = &SubqueryExpr{
|
|
Expr: yyDollar[1].node.(Expr),
|
|
Range: time.Duration(numLitRange.Val*1000) * time.Millisecond,
|
|
Step: 0,
|
|
EndPos: yyDollar[5].item.Pos + 1,
|
|
}
|
|
}
|
|
case 79:
|
|
yyDollar = yyS[yypt-6 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("subquery selector", "\"]\"")
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 80:
|
|
yyDollar = yyS[yypt-5 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("subquery selector", "number or duration or \"]\"")
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 81:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("subquery or range", "\":\" or \"]\"")
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 82:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("subquery selector", "number or duration")
|
|
yyVAL.node = yyDollar[1].node
|
|
}
|
|
case 83:
|
|
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 84:
|
|
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 85:
|
|
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 86:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
vs := yyDollar[1].node.(*VectorSelector)
|
|
yylex.(*parser).assembleVectorSelector(vs)
|
|
yyVAL.node = vs
|
|
}
|
|
case 87:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.node = &VectorSelector{
|
|
LabelMatchers: yyDollar[2].matchers,
|
|
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item),
|
|
}
|
|
}
|
|
case 88:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
{
|
|
yyVAL.node = &VectorSelector{
|
|
LabelMatchers: yyDollar[2].matchers,
|
|
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[4].item),
|
|
}
|
|
}
|
|
case 89:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.node = &VectorSelector{
|
|
LabelMatchers: []*labels.Matcher{},
|
|
PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[2].item),
|
|
}
|
|
}
|
|
case 90:
|
|
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 91:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher}
|
|
}
|
|
case 92:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "\",\" or \"}\"")
|
|
yyVAL.matchers = yyDollar[1].matchers
|
|
}
|
|
case 93:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
|
|
}
|
|
case 94:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
|
|
}
|
|
case 95:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.matcher = yylex.(*parser).newMetricNameMatcher(yyDollar[1].item)
|
|
}
|
|
case 96:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "string")
|
|
yyVAL.matcher = nil
|
|
}
|
|
case 97:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "string")
|
|
yyVAL.matcher = nil
|
|
}
|
|
case 98:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "label matching operator")
|
|
yyVAL.matcher = nil
|
|
}
|
|
case 99:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label matching", "identifier or \"}\"")
|
|
yyVAL.matcher = nil
|
|
}
|
|
case 100:
|
|
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 101:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.labels = yyDollar[1].labels
|
|
}
|
|
case 126:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.labels = labels.New(yyDollar[2].lblList...)
|
|
}
|
|
case 127:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
{
|
|
yyVAL.labels = labels.New(yyDollar[2].lblList...)
|
|
}
|
|
case 128:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.labels = labels.New()
|
|
}
|
|
case 129:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
{
|
|
yyVAL.labels = labels.New()
|
|
}
|
|
case 130:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.lblList = append(yyDollar[1].lblList, yyDollar[3].label)
|
|
}
|
|
case 131:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.lblList = []labels.Label{yyDollar[1].label}
|
|
}
|
|
case 132:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label set", "\",\" or \"}\"")
|
|
yyVAL.lblList = yyDollar[1].lblList
|
|
}
|
|
case 133:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
|
|
}
|
|
case 134:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
|
|
}
|
|
case 135:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.label = labels.Label{Name: labels.MetricName, Value: yyDollar[1].item.Val}
|
|
}
|
|
case 136:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label set", "string")
|
|
yyVAL.label = labels.Label{}
|
|
}
|
|
case 137:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label set", "string")
|
|
yyVAL.label = labels.Label{}
|
|
}
|
|
case 138:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label set", "\"=\"")
|
|
yyVAL.label = labels.Label{}
|
|
}
|
|
case 139:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("label set", "identifier or \"}\"")
|
|
yyVAL.label = labels.Label{}
|
|
}
|
|
case 140:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yylex.(*parser).generatedParserResult = &seriesDescription{
|
|
labels: yyDollar[1].labels,
|
|
values: yyDollar[2].series,
|
|
}
|
|
}
|
|
case 141:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
{
|
|
yyVAL.series = []SequenceValue{}
|
|
}
|
|
case 142:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...)
|
|
}
|
|
case 143:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.series = yyDollar[1].series
|
|
}
|
|
case 144:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("series values", "")
|
|
yyVAL.series = nil
|
|
}
|
|
case 145:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.series = []SequenceValue{{Omitted: true}}
|
|
}
|
|
case 146:
|
|
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 147:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.series = []SequenceValue{{Value: yyDollar[1].float}}
|
|
}
|
|
case 148:
|
|
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 149:
|
|
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 150:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.series = []SequenceValue{{Histogram: yyDollar[1].histogram}}
|
|
}
|
|
case 151:
|
|
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 152:
|
|
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 153:
|
|
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 154:
|
|
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 157:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
{
|
|
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&yyDollar[2].descriptors)
|
|
}
|
|
case 158:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&yyDollar[2].descriptors)
|
|
}
|
|
case 159:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
m := yylex.(*parser).newMap()
|
|
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&m)
|
|
}
|
|
case 160:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
m := yylex.(*parser).newMap()
|
|
yyVAL.histogram = yylex.(*parser).buildHistogramFromMap(&m)
|
|
}
|
|
case 161:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = *(yylex.(*parser).mergeMaps(&yyDollar[1].descriptors, &yyDollar[3].descriptors))
|
|
}
|
|
case 162:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yyDollar[1].descriptors
|
|
}
|
|
case 163:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yylex.(*parser).unexpected("histogram description", "histogram description key, e.g. buckets:[5 10 7]")
|
|
}
|
|
case 164:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["schema"] = yyDollar[3].int
|
|
}
|
|
case 165:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["sum"] = yyDollar[3].float
|
|
}
|
|
case 166:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["count"] = yyDollar[3].float
|
|
}
|
|
case 167:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["z_bucket"] = yyDollar[3].float
|
|
}
|
|
case 168:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["z_bucket_w"] = yyDollar[3].float
|
|
}
|
|
case 169:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["custom_values"] = yyDollar[3].bucket_set
|
|
}
|
|
case 170:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["buckets"] = yyDollar[3].bucket_set
|
|
}
|
|
case 171:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["offset"] = yyDollar[3].int
|
|
}
|
|
case 172:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["n_buckets"] = yyDollar[3].bucket_set
|
|
}
|
|
case 173:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["n_offset"] = yyDollar[3].int
|
|
}
|
|
case 174:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.descriptors = yylex.(*parser).newMap()
|
|
yyVAL.descriptors["counter_reset_hint"] = yyDollar[3].item
|
|
}
|
|
case 175:
|
|
yyDollar = yyS[yypt-4 : yypt+1]
|
|
{
|
|
yyVAL.bucket_set = yyDollar[2].bucket_set
|
|
}
|
|
case 176:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.bucket_set = yyDollar[2].bucket_set
|
|
}
|
|
case 177:
|
|
yyDollar = yyS[yypt-3 : yypt+1]
|
|
{
|
|
yyVAL.bucket_set = append(yyDollar[1].bucket_set, yyDollar[3].float)
|
|
}
|
|
case 178:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.bucket_set = []float64{yyDollar[1].float}
|
|
}
|
|
case 233:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.node = &NumberLiteral{
|
|
Val: yylex.(*parser).number(yyDollar[1].item.Val),
|
|
PosRange: yyDollar[1].item.PositionRange(),
|
|
}
|
|
}
|
|
case 234:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
var err error
|
|
var dur time.Duration
|
|
dur, err = parseDuration(yyDollar[1].item.Val)
|
|
if err != nil {
|
|
yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err)
|
|
}
|
|
yyVAL.node = &NumberLiteral{
|
|
Val: dur.Seconds(),
|
|
PosRange: yyDollar[1].item.PositionRange(),
|
|
}
|
|
}
|
|
case 235:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val)
|
|
}
|
|
case 236:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
var err error
|
|
var dur time.Duration
|
|
dur, err = parseDuration(yyDollar[1].item.Val)
|
|
if err != nil {
|
|
yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err)
|
|
}
|
|
yyVAL.float = dur.Seconds()
|
|
}
|
|
case 237:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.float = yyDollar[2].float
|
|
}
|
|
case 238:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.float = -yyDollar[2].float
|
|
}
|
|
case 241:
|
|
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 242:
|
|
yyDollar = yyS[yypt-2 : yypt+1]
|
|
{
|
|
yyVAL.int = -int64(yyDollar[2].uint)
|
|
}
|
|
case 243:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.int = int64(yyDollar[1].uint)
|
|
}
|
|
case 244:
|
|
yyDollar = yyS[yypt-1 : yypt+1]
|
|
{
|
|
yyVAL.node = &StringLiteral{
|
|
Val: yylex.(*parser).unquoteString(yyDollar[1].item.Val),
|
|
PosRange: yyDollar[1].item.PositionRange(),
|
|
}
|
|
}
|
|
case 245:
|
|
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 246:
|
|
yyDollar = yyS[yypt-0 : yypt+1]
|
|
{
|
|
yyVAL.strings = nil
|
|
}
|
|
}
|
|
goto yystack /* stack new state and value */
|
|
}
|