Skip to content

Commit fdba92b

Browse files
committed
Better error message for predicate with sequence
1 parent c9f620e commit fdba92b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

parser/parser.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ func (p *parser) parsePredicate() Node {
619619
node = p.parseSequenceExpression()
620620
} else {
621621
node = p.parseExpression(0)
622+
if p.current.Is(Operator, ";") {
623+
p.error("wrap predicate with brackets { and }")
624+
}
622625
}
623626
p.depth--
624627

parser/parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ func TestParse_error(t *testing.T) {
925925
| .....^`},
926926
{
927927
`map(ls, 1; 2; 3)`,
928-
`unexpected token Operator(";") (1:10)
928+
`wrap predicate with brackets { and } (1:10)
929929
| map(ls, 1; 2; 3)
930930
| .........^`,
931931
},

0 commit comments

Comments
 (0)