about summary refs log tree commit diff
path: root/pkg/lang
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-06-14 00:13:12 +0000
committerGitHub <noreply@github.com>2022-06-14 00:13:12 +0000
commitae56d386c5885f58432f162923462749cc816562 (patch)
treec275c89c863cedebf6d071dfc3b933f39ec05b61 /pkg/lang
parent3498876f06104515002191468fd99019d40051c2 (diff)
downloadjinx-ae56d386c5885f58432f162923462749cc816562.tar.zst
jinx-ae56d386c5885f58432f162923462749cc816562.zip
Fix parser not creating ExprGroup
Diffstat (limited to 'pkg/lang')
-rw-r--r--pkg/lang/parser/exprs.go11
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) {