@@ -291,31 +291,6 @@ fn arrowNodes(self: *const Ast, idx: Node.Idx) collections.NodeSlices(Node.Idx).
291291}
292292
293293/// Given the idx to a lambda, return the region of just its args (the `| ... |` including the pipes)
294- fn lambdaArgsRegion (self : * const Ast , idx : Node.Idx ) Region {
295- // This function returns the region of lambda args
296- // Since we now store complete regions, just return the lambda's region
297- // This function isn't actually used anywhere in the codebase
298- return self .getRegion (idx );
299- }
300-
301- /// Given the idx to a BinOp, return the region of just its symbol (e.g. "*" or "==") etc.
302- fn binOpSymbolRegion (self : * const Ast , idx : Node.Idx ) Region {
303- const binop = self .binOp (idx );
304-
305- // To find the binop symbol itself, we scan from lhs_end to either rhs_start or first whitespace.
306- const lhs_end : usize = self .getRegion (binop .lhs ).end .offset ;
307- const rhs_start : usize = self .getRegion (binop .rhs ).start .offset ;
308-
309- // These relationships should always be true. If not, there is a bug in some earlier step!
310- std .debug .assert (lhs_end < rhs_start );
311-
312- // For now, return a simplified region between lhs and rhs
313- // This function isn't actually used anywhere
314- return .{
315- .start = Position { .offset = @as (u32 , @intCast (lhs_end )) },
316- .end = Position { .offset = @as (u32 , @intCast (rhs_start )) },
317- };
318- }
319294pub const Node = struct {
320295 tag : Node.Tag , // u8 discriminant
321296 region : Region , // Region spans from start of first token to end of last token in this AST node
@@ -603,13 +578,16 @@ pub const Diagnostic = struct {
603578 // Expression errors
604579 expr_unexpected_token ,
605580 expr_no_space_dot_int ,
581+ state_not_implemented ,
606582 no_else ,
607583 expected_expr_bar ,
608584 backslash_not_valid_lambda_syntax ,
585+ obsolete_interface_keyword ,
609586 expected_expr_close_curly_or_comma ,
610587 expected_expr_close_round_or_comma ,
611588 expected_expr_close_square_or_comma ,
612589 expected_close_curly_at_end_of_match ,
590+ expected_close_round ,
613591 expected_open_curly_after_match ,
614592 expected_expr_record_field_name ,
615593 expected_expr_apply_close_round ,
@@ -789,6 +767,7 @@ pub fn parseDiagnosticToReport(self: *const @This(), env: *const CommonEnv, diag
789767 .expected_exposes = > "EXPECTED EXPOSES" ,
790768 .pattern_unexpected_token = > "UNEXPECTED TOKEN IN PATTERN" ,
791769 .expr_unexpected_token = > "UNEXPECTED TOKEN IN EXPRESSION" ,
770+ .state_not_implemented = > "PARSER STATE NOT IMPLEMENTED" ,
792771 .string_unexpected_token = > "UNEXPECTED TOKEN IN STRING" ,
793772 .ty_anno_unexpected_token = > "UNEXPECTED TOKEN IN TYPE ANNOTATION" ,
794773 .statement_unexpected_token = > "UNEXPECTED TOKEN" ,
@@ -867,6 +846,13 @@ pub fn parseDiagnosticToReport(self: *const @This(), env: *const CommonEnv, diag
867846 try report .document .addLineBreak ();
868847 try report .document .addReflowingText ("This could be a missing operator, incorrect syntax, or a token in the wrong place." );
869848 },
849+ .state_not_implemented = > {
850+ try report .document .addText ("Parser encountered an unimplemented state." );
851+ try report .document .addLineBreak ();
852+ try report .document .addReflowingText ("This is a limitation in the current parser implementation. The feature you're trying to use may not be fully implemented yet." );
853+ try report .document .addLineBreak ();
854+ try report .document .addReflowingText ("Please report this issue with your code example to help improve the parser." );
855+ },
870856 else = > {
871857 // Generic parse error message
872858 try report .document .addText ("A parsing error occurred: " );
0 commit comments