diff --git a/lit/regex/match_wds.thorin b/lit/regex/match_wds.thorin index c5584acf56..d0a0661420 100644 --- a/lit/regex/match_wds.thorin +++ b/lit/regex/match_wds.thorin @@ -11,20 +11,16 @@ .let Top = ⊤:.Nat; .let re = %regex.conj 2 (%regex.cls.w, %regex.conj 2 (%regex.cls.d, %regex.cls.s)); -.con .extern main[mem: %mem.M, argc: .I32, argv: %mem.Ptr («⊤:.Nat; %mem.Ptr («⊤:.Nat; .I8», 0)», 0), exit : .Cn [%mem.M, .I32]] = { - .con handle_match [mem: %mem.M, matched: .Bool, match: %mem.Ptr(«Top; .I8», 0)] = { - - exit (mem, %core.conv.u .i32 matched) - }; - - .con match_argument[mem: %mem.M, .I32] = { - .let arg1 = %mem.lea (Top, ‹Top; %mem.Ptr («⊤:.Nat; .I8», 0)›, 0) (argv, 1I32);; - .let (`mem, to_match) = %mem.load (mem, arg1); - .let (`mem, matched, pos) = re (mem, to_match, 0:(.Idx Top)); - exit (mem, %core.conv.u .i32 matched) - }; - +.con .extern main[mem: %mem.M, argc: .I32, argv: %mem.Ptr («⊤:.Nat; %mem.Ptr («⊤:.Nat; .I8», 0)», 0), exit : .Cn [%mem.M, .I32]] = (exit, match_argument) # (%core.icmp.ug (argc, 1I32)) (mem, 0I32) -}; + .where + .con handle_match [mem: %mem.M, matched: .Bool, match: %mem.Ptr(«Top; .I8», 0)] = + exit (mem, %core.conv.u .i32 matched); + .con match_argument[mem: %mem.M, .I32] = + .let arg1 = %mem.lea (Top, ‹Top; %mem.Ptr («⊤:.Nat; .I8», 0)›, 0) (argv, 1I32); + .let (`mem, to_match) = %mem.load (mem, arg1); + .let (`mem, matched, pos) = re (mem, to_match, 0:(.Idx Top)); + exit (mem, %core.conv.u .i32 matched); + .end // CHECK-NOT: %regex. diff --git a/src/thorin/ast/parser.cpp b/src/thorin/ast/parser.cpp index 6f07b30741..4b9b3b7c2d 100644 --- a/src/thorin/ast/parser.cpp +++ b/src/thorin/ast/parser.cpp @@ -318,8 +318,6 @@ Ptr Parser::parse_decl_expr() { auto track = tracker(); auto decls = parse_decls(); auto expr = parse_expr("final expression of a declaration expression"); - if (expr->isa()) - for (const auto& decl : decls) ast().note(decl->loc(), "declaration belonging to this declaration expression"); return ptr(track, std::move(decls), std::move(expr), false); } @@ -330,7 +328,7 @@ Ptr Parser::parse_lit_expr() { return ptr(track, tok, std::move(type)); } -Ptr Parser::parse_sigma_expr() { return ptr(parse_tuple_ptrn(false, Dbg(ahead().loc(), Sym()))); } +Ptr Parser::parse_sigma_expr() { return ptr(parse_tuple_ptrn(false, Dbg(ahead().loc()))); } Ptr Parser::parse_tuple_expr() { auto track = tracker();