aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser/Parser.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-13 13:45:03 +0000
committer_ov4 <ov4@ov4.org>2026-10-13 13:45:03 +0000
commit05cdcb6a1cc3d4de3a0b3d12d4babcd6438b4754 (patch)
treed3e482d215d9d5feba8b40f9de15d6962f1e5bac /lib/Parser/Parser.cc
parentf5a2541ed3faf9a942b867e2d54577352153afce (diff)
Add record-derived classes with explicit field visibility
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'lib/Parser/Parser.cc')
-rw-r--r--lib/Parser/Parser.cc8
1 files changed, 7 insertions, 1 deletions
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<StmtAST> 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<StmtAST> 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