From 05cdcb6a1cc3d4de3a0b3d12d4babcd6438b4754 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 13:45:03 +0000 Subject: Add record-derived classes with explicit field visibility Co-Authored-By: Claude Fable 5.1 --- lib/Parser/Parser.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/Parser/Parser.cc') diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc index e68b405..098ef82 100644 --- a/lib/Parser/Parser.cc +++ b/lib/Parser/Parser.cc @@ -275,6 +275,7 @@ void Parser::syncToStatementStart() { case tok_next: case tok_endfunction: case tok_endprocedure: case tok_openfile: case tok_readfile: case tok_writefile: case tok_closefile: case tok_type: case tok_define: case tok_endtype: + case tok_class: case tok_endclass: return; default: getNextToken(); @@ -601,7 +602,7 @@ std::unique_ptr Parser::ParseStatementImpl() { else if (CurTok == tok_closefile) { return ParseCloseFile(); } - else if (CurTok == tok_type) { + else if (CurTok == tok_type || CurTok == tok_class) { return ParseTypeDecl(); } else if (CurTok == tok_define) { @@ -614,6 +615,11 @@ std::unique_ptr Parser::ParseStatementImpl() { getNextToken(); return nullptr; } + else if (CurTok == tok_endclass) { + fprintf(stderr, "error: ENDCLASS without matching CLASS at line %d\n", Lex.getLine()); + getNextToken(); + return nullptr; + } fprintf(stderr, "error: Unexpected token at line %d when expecting a statement\n", Lex.getLine()); getNextToken(); // guarantee progress so error recovery cannot loop forever -- cgit v1.3.1-4-g156e