PromQL: Fix parser panic (#6931)

Signed-off-by: Tobias Guggenmos <tobias.guggenmos@uni-ulm.de>
This commit is contained in:
Brian Brazil 2020-03-05 08:03:38 +00:00 committed by GitHub
parent 0193b746b1
commit 7164b58945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 112 additions and 97 deletions

View file

@ -199,7 +199,10 @@ aggregate_expr : aggregate_op aggregate_modifier function_call_body
| aggregate_op function_call_body
{ $$ = yylex.(*parser).newAggregateExpr($1, &AggregateExpr{}, $2) }
| aggregate_op error
{ yylex.(*parser).unexpected("aggregation",""); $$ = nil }
{
yylex.(*parser).unexpected("aggregation","");
$$ = yylex.(*parser).newAggregateExpr($1, &AggregateExpr{}, Expressions{})
}
;
aggregate_modifier:

View file

@ -183,7 +183,7 @@ const yyEofCode = 1
const yyErrCode = 2
const yyInitialStackSize = 16
//line generated_parser.y:706
//line generated_parser.y:709
//line yacctab:1
var yyExca = [...]int{
@ -837,11 +837,11 @@ yydefault:
//line generated_parser.y:202
{
yylex.(*parser).unexpected("aggregation", "")
yyVAL.node = nil
yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, Expressions{})
}
case 23:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:207
//line generated_parser.y:210
{
yyVAL.node = &AggregateExpr{
Grouping: yyDollar[2].strings,
@ -849,7 +849,7 @@ yydefault:
}
case 24:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:213
//line generated_parser.y:216
{
yyVAL.node = &AggregateExpr{
Grouping: yyDollar[2].strings,
@ -858,97 +858,97 @@ yydefault:
}
case 25:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:226
//line generated_parser.y:229
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 26:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:227
//line generated_parser.y:230
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 27:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:228
//line generated_parser.y:231
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 28:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:229
//line generated_parser.y:232
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 29:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:230
//line generated_parser.y:233
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 30:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:231
//line generated_parser.y:234
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 31:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:232
//line generated_parser.y:235
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 32:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:233
//line generated_parser.y:236
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 33:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:234
//line generated_parser.y:237
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 34:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:235
//line generated_parser.y:238
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 35:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:236
//line generated_parser.y:239
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 36:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:237
//line generated_parser.y:240
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 37:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:238
//line generated_parser.y:241
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 38:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:239
//line generated_parser.y:242
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 39:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:240
//line generated_parser.y:243
{
yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node)
}
case 41:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:248
//line generated_parser.y:251
{
yyVAL.node = &BinaryExpr{
VectorMatching: &VectorMatching{Card: CardOneToOne},
@ -956,7 +956,7 @@ yydefault:
}
case 42:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:253
//line generated_parser.y:256
{
yyVAL.node = &BinaryExpr{
VectorMatching: &VectorMatching{Card: CardOneToOne},
@ -965,14 +965,14 @@ yydefault:
}
case 43:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:261
//line generated_parser.y:264
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
}
case 44:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:266
//line generated_parser.y:269
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings
@ -980,7 +980,7 @@ yydefault:
}
case 47:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:276
//line generated_parser.y:279
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardManyToOne
@ -988,7 +988,7 @@ yydefault:
}
case 48:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:282
//line generated_parser.y:285
{
yyVAL.node = yyDollar[1].node
yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardOneToMany
@ -996,51 +996,51 @@ yydefault:
}
case 49:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:291
//line generated_parser.y:294
{
yyVAL.strings = yyDollar[2].strings
}
case 50:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:293
//line generated_parser.y:296
{
yyVAL.strings = yyDollar[2].strings
}
case 51:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:295
//line generated_parser.y:298
{
yyVAL.strings = []string{}
}
case 52:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:297
//line generated_parser.y:300
{
yylex.(*parser).unexpected("grouping opts", "\"(\"")
yyVAL.strings = nil
}
case 53:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:303
//line generated_parser.y:306
{
yyVAL.strings = append(yyDollar[1].strings, yyDollar[3].item.Val)
}
case 54:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:305
//line generated_parser.y:308
{
yyVAL.strings = []string{yyDollar[1].item.Val}
}
case 55:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:307
//line generated_parser.y:310
{
yylex.(*parser).unexpected("grouping opts", "\",\" or \")\"")
yyVAL.strings = yyDollar[1].strings
}
case 56:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:311
//line generated_parser.y:314
{
if !isLabel(yyDollar[1].item.Val) {
yylex.(*parser).unexpected("grouping opts", "label")
@ -1049,14 +1049,14 @@ yydefault:
}
case 57:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:318
//line generated_parser.y:321
{
yylex.(*parser).unexpected("grouping opts", "label")
yyVAL.item = Item{}
}
case 58:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:326
//line generated_parser.y:329
{
fn, exist := getFunction(yyDollar[1].item.Val)
if !exist {
@ -1073,58 +1073,58 @@ yydefault:
}
case 59:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:343
//line generated_parser.y:346
{
yyVAL.node = yyDollar[2].node
}
case 60:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:345
//line generated_parser.y:348
{
yyVAL.node = Expressions{}
}
case 61:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:349
//line generated_parser.y:352
{
yyVAL.node = append(yyDollar[1].node.(Expressions), yyDollar[3].node.(Expr))
}
case 62:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:351
//line generated_parser.y:354
{
yyVAL.node = Expressions{yyDollar[1].node.(Expr)}
}
case 63:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:353
//line generated_parser.y:356
{
yylex.(*parser).addParseErrf(yyDollar[2].item.PositionRange(), "trailing commas not allowed in function call args")
yyVAL.node = yyDollar[1].node
}
case 64:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:364
//line generated_parser.y:367
{
yyVAL.node = &ParenExpr{Expr: yyDollar[2].node.(Expr), PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item)}
}
case 65:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:372
//line generated_parser.y:375
{
yylex.(*parser).addOffset(yyDollar[1].node, yyDollar[3].duration)
yyVAL.node = yyDollar[1].node
}
case 66:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:377
//line generated_parser.y:380
{
yylex.(*parser).unexpected("offset", "duration")
yyVAL.node = yyDollar[1].node
}
case 67:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:385
//line generated_parser.y:388
{
var errMsg string
vs, ok := yyDollar[1].node.(*VectorSelector)
@ -1147,7 +1147,7 @@ yydefault:
}
case 68:
yyDollar = yyS[yypt-6 : yypt+1]
//line generated_parser.y:408
//line generated_parser.y:411
{
yyVAL.node = &SubqueryExpr{
Expr: yyDollar[1].node.(Expr),
@ -1159,35 +1159,35 @@ yydefault:
}
case 69:
yyDollar = yyS[yypt-6 : yypt+1]
//line generated_parser.y:418
//line generated_parser.y:421
{
yylex.(*parser).unexpected("subquery selector", "\"]\"")
yyVAL.node = yyDollar[1].node
}
case 70:
yyDollar = yyS[yypt-5 : yypt+1]
//line generated_parser.y:420
//line generated_parser.y:423
{
yylex.(*parser).unexpected("subquery selector", "duration or \"]\"")
yyVAL.node = yyDollar[1].node
}
case 71:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:422
//line generated_parser.y:425
{
yylex.(*parser).unexpected("subquery or range", "\":\" or \"]\"")
yyVAL.node = yyDollar[1].node
}
case 72:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:424
//line generated_parser.y:427
{
yylex.(*parser).unexpected("subquery selector", "duration")
yyVAL.node = yyDollar[1].node
}
case 73:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:434
//line generated_parser.y:437
{
if nl, ok := yyDollar[2].node.(*NumberLiteral); ok {
if yyDollar[1].item.Typ == SUB {
@ -1201,7 +1201,7 @@ yydefault:
}
case 74:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:452
//line generated_parser.y:455
{
vs := yyDollar[2].node.(*VectorSelector)
vs.PosRange = mergeRanges(&yyDollar[1].item, vs)
@ -1211,7 +1211,7 @@ yydefault:
}
case 75:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:460
//line generated_parser.y:463
{
vs := &VectorSelector{
Name: yyDollar[1].item.Val,
@ -1223,7 +1223,7 @@ yydefault:
}
case 76:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:470
//line generated_parser.y:473
{
vs := yyDollar[1].node.(*VectorSelector)
yylex.(*parser).assembleVectorSelector(vs)
@ -1231,7 +1231,7 @@ yydefault:
}
case 77:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:478
//line generated_parser.y:481
{
yyVAL.node = &VectorSelector{
LabelMatchers: yyDollar[2].matchers,
@ -1240,7 +1240,7 @@ yydefault:
}
case 78:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:485
//line generated_parser.y:488
{
yyVAL.node = &VectorSelector{
LabelMatchers: yyDollar[2].matchers,
@ -1249,7 +1249,7 @@ yydefault:
}
case 79:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:492
//line generated_parser.y:495
{
yyVAL.node = &VectorSelector{
LabelMatchers: []*labels.Matcher{},
@ -1258,7 +1258,7 @@ yydefault:
}
case 80:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:501
//line generated_parser.y:504
{
if yyDollar[1].matchers != nil {
yyVAL.matchers = append(yyDollar[1].matchers, yyDollar[3].matcher)
@ -1268,130 +1268,130 @@ yydefault:
}
case 81:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:509
//line generated_parser.y:512
{
yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher}
}
case 82:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:511
//line generated_parser.y:514
{
yylex.(*parser).unexpected("label matching", "\",\" or \"}\"")
yyVAL.matchers = yyDollar[1].matchers
}
case 83:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:515
//line generated_parser.y:518
{
yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item)
}
case 84:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:517
//line generated_parser.y:520
{
yylex.(*parser).unexpected("label matching", "string")
yyVAL.matcher = nil
}
case 85:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:519
//line generated_parser.y:522
{
yylex.(*parser).unexpected("label matching", "label matching operator")
yyVAL.matcher = nil
}
case 86:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:521
//line generated_parser.y:524
{
yylex.(*parser).unexpected("label matching", "identifier or \"}\"")
yyVAL.matcher = nil
}
case 87:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:529
//line generated_parser.y:532
{
yyVAL.labels = append(yyDollar[2].labels, labels.Label{Name: labels.MetricName, Value: yyDollar[1].item.Val})
sort.Sort(yyVAL.labels)
}
case 88:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:531
//line generated_parser.y:534
{
yyVAL.labels = yyDollar[1].labels
}
case 91:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:538
//line generated_parser.y:541
{
yyVAL.labels = labels.New(yyDollar[2].labels...)
}
case 92:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:540
//line generated_parser.y:543
{
yyVAL.labels = labels.New(yyDollar[2].labels...)
}
case 93:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:542
//line generated_parser.y:545
{
yyVAL.labels = labels.New()
}
case 94:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:544
//line generated_parser.y:547
{
yyVAL.labels = labels.New()
}
case 95:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:548
//line generated_parser.y:551
{
yyVAL.labels = append(yyDollar[1].labels, yyDollar[3].label)
}
case 96:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:550
//line generated_parser.y:553
{
yyVAL.labels = []labels.Label{yyDollar[1].label}
}
case 97:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:552
//line generated_parser.y:555
{
yylex.(*parser).unexpected("label set", "\",\" or \"}\"")
yyVAL.labels = yyDollar[1].labels
}
case 98:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:557
//line generated_parser.y:560
{
yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)}
}
case 99:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:559
//line generated_parser.y:562
{
yylex.(*parser).unexpected("label set", "string")
yyVAL.label = labels.Label{}
}
case 100:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:561
//line generated_parser.y:564
{
yylex.(*parser).unexpected("label set", "\"=\"")
yyVAL.label = labels.Label{}
}
case 101:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:563
//line generated_parser.y:566
{
yylex.(*parser).unexpected("label set", "identifier or \"}\"")
yyVAL.label = labels.Label{}
}
case 102:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:571
//line generated_parser.y:574
{
yylex.(*parser).generatedParserResult = &seriesDescription{
labels: yyDollar[1].labels,
@ -1400,38 +1400,38 @@ yydefault:
}
case 103:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:580
//line generated_parser.y:583
{
yyVAL.series = []SequenceValue{}
}
case 104:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:582
//line generated_parser.y:585
{
yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...)
}
case 105:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:584
//line generated_parser.y:587
{
yyVAL.series = yyDollar[1].series
}
case 106:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:586
//line generated_parser.y:589
{
yylex.(*parser).unexpected("series values", "")
yyVAL.series = nil
}
case 107:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:590
//line generated_parser.y:593
{
yyVAL.series = []SequenceValue{{Omitted: true}}
}
case 108:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:592
//line generated_parser.y:595
{
yyVAL.series = []SequenceValue{}
for i := uint64(0); i < yyDollar[3].uint; i++ {
@ -1440,13 +1440,13 @@ yydefault:
}
case 109:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:599
//line generated_parser.y:602
{
yyVAL.series = []SequenceValue{{Value: yyDollar[1].float}}
}
case 110:
yyDollar = yyS[yypt-3 : yypt+1]
//line generated_parser.y:601
//line generated_parser.y:604
{
yyVAL.series = []SequenceValue{}
for i := uint64(0); i <= yyDollar[3].uint; i++ {
@ -1455,7 +1455,7 @@ yydefault:
}
case 111:
yyDollar = yyS[yypt-4 : yypt+1]
//line generated_parser.y:608
//line generated_parser.y:611
{
yyVAL.series = []SequenceValue{}
for i := uint64(0); i <= yyDollar[4].uint; i++ {
@ -1465,7 +1465,7 @@ yydefault:
}
case 112:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:618
//line generated_parser.y:621
{
if yyDollar[1].item.Val != "stale" {
yylex.(*parser).unexpected("series values", "number or \"stale\"")
@ -1474,7 +1474,7 @@ yydefault:
}
case 155:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:649
//line generated_parser.y:652
{
yyVAL.node = &NumberLiteral{
Val: yylex.(*parser).number(yyDollar[1].item.Val),
@ -1483,25 +1483,25 @@ yydefault:
}
case 156:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:657
//line generated_parser.y:660
{
yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val)
}
case 157:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:659
//line generated_parser.y:662
{
yyVAL.float = yyDollar[2].float
}
case 158:
yyDollar = yyS[yypt-2 : yypt+1]
//line generated_parser.y:660
//line generated_parser.y:663
{
yyVAL.float = -yyDollar[2].float
}
case 159:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:664
//line generated_parser.y:667
{
var err error
yyVAL.uint, err = strconv.ParseUint(yyDollar[1].item.Val, 10, 64)
@ -1511,7 +1511,7 @@ yydefault:
}
case 160:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:674
//line generated_parser.y:677
{
var err error
yyVAL.duration, err = parseDuration(yyDollar[1].item.Val)
@ -1521,7 +1521,7 @@ yydefault:
}
case 161:
yyDollar = yyS[yypt-1 : yypt+1]
//line generated_parser.y:685
//line generated_parser.y:688
{
yyVAL.node = &StringLiteral{
Val: yylex.(*parser).unquoteString(yyDollar[1].item.Val),
@ -1530,13 +1530,13 @@ yydefault:
}
case 162:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:698
//line generated_parser.y:701
{
yyVAL.duration = 0
}
case 164:
yyDollar = yyS[yypt-0 : yypt+1]
//line generated_parser.y:702
//line generated_parser.y:705
{
yyVAL.strings = nil
}

View file

@ -2125,6 +2125,18 @@ var testExpr = []struct {
input: "a>b()",
fail: true,
errMsg: `unknown function`,
}, {
input: "rate(avg)",
fail: true,
errMsg: `unexpected ")"`,
}, {
input: "sum(sum)",
fail: true,
errMsg: `unexpected ")"`,
}, {
input: "a + sum",
fail: true,
errMsg: `unexpected end of input`,
},
// String quoting and escape sequence interpretation tests.
{