Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dusk: Support parentheses expressions #1090

Closed
clickingbuttons opened this issue Oct 27, 2023 · 2 comments
Closed

Dusk: Support parentheses expressions #1090

clickingbuttons opened this issue Oct 27, 2023 · 2 comments
Milestone

Comments

@clickingbuttons
Copy link

Pretty simple to add to parser.

 fn expectParenExpr(p: *Parser) !NodeIndex {
-    _ = try p.expectToken(.paren_left);
+    const main_token = try p.expectToken(.paren_left);
     const expr = try p.expression() orelse {
         try p.errors.add(
             p.peekToken(.loc, 0),
@@ -1491,7 +1491,11 @@ fn expectParenExpr(p: *Parser) !NodeIndex {
         return error.Parsing;
     };
     _ = try p.expectToken(.paren_right);
-    return expr;
+    return try p.addNode(.{
+        .tag = .paren_expr,
+        .main_token = main_token,
+        .lhs = expr,
+    });
 }
@alichraghi
Copy link
Contributor

what's the point?

@slimsag
Copy link
Member

slimsag commented Oct 28, 2023

Duplicate of #1091

@slimsag slimsag marked this as a duplicate of #1091 Oct 28, 2023
@slimsag slimsag closed this as completed Oct 28, 2023
@slimsag slimsag added this to the Mach 0.3 milestone Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants