From 3818460a473bd3ffcd35f09eb6429e1b0f00bc07 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 19:15:54 +0000 Subject: fix: top-level RETURN and READFILE designator targets error cleanly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RETURN outside any FUNCTION/PROCEDURE used to emit an i64/void ret inside i32 main — a verifier dump instead of a diagnostic. It is now a clean compile error (no signature means top level: pseudocode cannot name a function 'main', it is a reserved runtime symbol). - READFILE "f.txt", r.f mis-parsed into an error cascade the same way INPUT r.f did before its fix; the target now consumes the designator and reports one clear 'must be a plain STRING variable' error. Co-Authored-By: Claude Fable 5 --- lib/Parser/ParserFile.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Parser/ParserFile.cc') diff --git a/lib/Parser/ParserFile.cc b/lib/Parser/ParserFile.cc index 6fd368c..4a4ae31 100644 --- a/lib/Parser/ParserFile.cc +++ b/lib/Parser/ParserFile.cc @@ -57,6 +57,14 @@ std::unique_ptr Parser::ParseReadFile() { std::string VarName = Lex.IdentifierStr; getNextToken(); // eat the variable name + if (CurTok == '[' || CurTok == '.' || CurTok == '^') { + // Consume the whole designator so it cannot replay as statements. + std::vector Dummy; + ParseDesignatorSuffix(Dummy); + fprintf(stderr, "Error: READFILE target must be a plain STRING variable at line %d\n", Line); + return nullptr; + } + return std::make_unique(std::move(FileName), VarName, Line); } -- cgit v1.3.1-4-g156e