diff options
| author | Mel <einebeere@gmail.com> | 2022-06-14 00:13:12 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-14 00:13:12 +0000 |
| commit | ae56d386c5885f58432f162923462749cc816562 (patch) | |
| tree | c275c89c863cedebf6d071dfc3b933f39ec05b61 /pkg/lang | |
| parent | 3498876f06104515002191468fd99019d40051c2 (diff) | |
| download | jinx-ae56d386c5885f58432f162923462749cc816562.tar.zst jinx-ae56d386c5885f58432f162923462749cc816562.zip | |
Fix parser not creating ExprGroup
Diffstat (limited to 'pkg/lang')
| -rw-r--r-- | pkg/lang/parser/exprs.go | 11 |
1 files changed, 9 insertions, 2 deletions
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) { |
