From ae56d386c5885f58432f162923462749cc816562 Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 14 Jun 2022 00:13:12 +0000 Subject: Fix parser not creating ExprGroup --- pkg/lang/parser/exprs.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'pkg/lang/parser') diff --git a/pkg/lang/parser/exprs.go b/pkg/lang/parser/exprs.go index ceda018..8c2b475 100644 --- a/pkg/lang/parser/exprs.go +++ b/pkg/lang/parser/exprs.go @@ -183,7 +183,8 @@ func (p *Parser) parseUnitExpr() (ast.Expr, error) { func (p *Parser) parseGroupExpr() (ast.Expr, error) { // GroupExpr = "(" Expr ")" - if _, err := p.expect(token.LParen); err != nil { + openTok, err := p.expect(token.LParen) + if err != nil { return ast.Expr{}, err } @@ -196,7 +197,13 @@ func (p *Parser) parseGroupExpr() (ast.Expr, error) { return ast.Expr{}, err } - return expr, nil + return ast.Expr{ + At: openTok.At, + Kind: ast.ExprKindGroup, + Value: ast.ExprGroup{ + Value: expr, + }, + }, nil } func (p *Parser) parseFnLitExpr() (ast.Expr, error) { -- cgit 1.4.1