aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-13 12:32:03 +0000
committer_ov4 <ov4@ov4.org>2026-10-13 12:32:03 +0000
commit17cec530b0a4d792bde2d37583b6c26e89f9b1bd (patch)
tree6b67f23d68ccf21dd6052f858037be7b49244c4c /lib/Parser
parent42acac3dac5b8ff5aec4ff204d2c1da948ea34b0 (diff)
fix: distinguish compiler errors and report compilation termination
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'lib/Parser')
-rw-r--r--lib/Parser/Parser.cc64
-rw-r--r--lib/Parser/ParserFile.cc14
-rw-r--r--lib/Parser/ParserFunction.cc36
-rw-r--r--lib/Parser/ParserType.cc22
4 files changed, 68 insertions, 68 deletions
diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc
index 25fc342..e68b405 100644
--- a/lib/Parser/Parser.cc
+++ b/lib/Parser/Parser.cc
@@ -60,7 +60,7 @@ std::unique_ptr<ExprAST> Parser::ParseIdentifierExpr() {
auto Args = ParseExprList(')', true);
if (!Args) return nullptr;
if (CurTok == '[' || CurTok == '.' || CurTok == '^') {
- fprintf(stderr, "Error: record/array/pointer access on a function result is not supported at line %d\n",
+ fprintf(stderr, "error: record/array/pointer access on a function result is not supported at line %d\n",
Lex.getLine());
return nullptr;
}
@@ -92,7 +92,7 @@ bool Parser::ParseDesignatorSuffix(std::vector<DesignatorAccess> &Out) {
} else if (CurTok == '.') {
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected field name after '.' at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected field name after '.' at line %d\n", Lex.getLine());
return false;
}
DesignatorAccess A;
@@ -135,14 +135,14 @@ std::string Parser::ParseTypeName(bool AllowVoid) {
if (CurTok == tok_identifier) {
std::string TypeName = Lex.IdentifierStr;
if (!AllowVoid && TypeName == "VOID") {
- fprintf(stderr, "Error: VOID is not allowed here\n");
+ fprintf(stderr, "error: VOID is not allowed here\n");
return "";
}
getNextToken();
return TypeName;
}
- fprintf(stderr, "Error: Unknown type name\n");
+ fprintf(stderr, "error: Unknown type name\n");
return "";
}
@@ -151,7 +151,7 @@ std::unique_ptr<ExprAST> Parser::ParseParenExpr() {
auto V = ParseExpression();
if (!V) return nullptr;
if (CurTok != ')') {
- fprintf(stderr, "Error: expected ')'\n");
+ fprintf(stderr, "error: expected ')'\n");
return nullptr;
}
getNextToken();
@@ -183,7 +183,7 @@ std::unique_ptr<ExprAST> Parser::ParsePrimary() {
}
case '(': return ParseParenExpr();
default:
- fprintf(stderr, "Error: unknown token '%c' (%d) at line %d when expecting an expression\n",
+ fprintf(stderr, "error: unknown token '%c' (%d) at line %d when expecting an expression\n",
(char)CurTok, CurTok, Lex.getLine());
return nullptr;
}
@@ -202,14 +202,14 @@ std::unique_ptr<ExprAST> Parser::ParseUnary() {
int Line = Lex.getLine();
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: '^' (address-of) requires a variable, array element or record field at line %d\n",
+ fprintf(stderr, "error: '^' (address-of) requires a variable, array element or record field at line %d\n",
Line);
return nullptr;
}
std::string BaseName = Lex.IdentifierStr;
getNextToken();
if (CurTok == '(') {
- fprintf(stderr, "Error: cannot take the address of a function result at line %d\n", Line);
+ fprintf(stderr, "error: cannot take the address of a function result at line %d\n", Line);
return nullptr;
}
std::vector<DesignatorAccess> Accesses;
@@ -317,7 +317,7 @@ std::optional<std::vector<std::unique_ptr<ExprAST>>> Parser::ParseExprList(char
if (CurTok == CloseDelim) break;
if (CurTok != ',') {
- fprintf(stderr, "Error: Expected ',' or '%c' at line %d\n", CloseDelim, Lex.getLine());
+ fprintf(stderr, "error: Expected ',' or '%c' at line %d\n", CloseDelim, Lex.getLine());
return std::nullopt;
}
getNextToken();
@@ -329,14 +329,14 @@ std::optional<std::vector<std::unique_ptr<ExprAST>>> Parser::ParseExprList(char
std::unique_ptr<StmtAST> Parser::ParseDeclare() {
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected identifier after DECLARE at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected identifier after DECLARE at line %d\n", Lex.getLine());
return nullptr;
}
std::string Name = Lex.IdentifierStr;
getNextToken();
if (CurTok != tok_colon) {
- fprintf(stderr, "Error: Expected ':' after variable name '%s' at line %d\n", Name.c_str(), Lex.getLine());
+ fprintf(stderr, "error: Expected ':' after variable name '%s' at line %d\n", Name.c_str(), Lex.getLine());
return nullptr;
}
getNextToken();
@@ -344,7 +344,7 @@ std::unique_ptr<StmtAST> Parser::ParseDeclare() {
if (CurTok == tok_array) {
getNextToken();
if (CurTok != '[') {
- fprintf(stderr, "Error: Expected '[' after ARRAY\n");
+ fprintf(stderr, "error: Expected '[' after ARRAY\n");
return nullptr;
}
getNextToken();
@@ -356,7 +356,7 @@ std::unique_ptr<StmtAST> Parser::ParseDeclare() {
if (!Lower) return nullptr;
if (CurTok != tok_colon) {
- fprintf(stderr, "Error: Expected ':' in array range (e.g. 1:10)\n");
+ fprintf(stderr, "error: Expected ':' in array range (e.g. 1:10)\n");
return nullptr;
}
getNextToken();
@@ -371,13 +371,13 @@ std::unique_ptr<StmtAST> Parser::ParseDeclare() {
getNextToken();
continue;
}
- fprintf(stderr, "Error: Expected ',' or ']' in array dims\n");
+ fprintf(stderr, "error: Expected ',' or ']' in array dims\n");
return nullptr;
}
getNextToken();
if (CurTok != tok_of) {
- fprintf(stderr, "Error: Expected OF after array dims\n");
+ fprintf(stderr, "error: Expected OF after array dims\n");
return nullptr;
}
getNextToken();
@@ -404,7 +404,7 @@ std::unique_ptr<StmtAST> Parser::ParseIfStmt() {
if (!Cond) return nullptr;
if (CurTok != tok_then) {
- fprintf(stderr, "Error: expected THEN\n");
+ fprintf(stderr, "error: expected THEN\n");
return nullptr;
}
getNextToken();
@@ -418,7 +418,7 @@ std::unique_ptr<StmtAST> Parser::ParseIfStmt() {
}
if (CurTok != tok_endif) {
- fprintf(stderr, "Error: expected ENDIF\n");
+ fprintf(stderr, "error: expected ENDIF\n");
return nullptr;
}
getNextToken();
@@ -432,7 +432,7 @@ std::unique_ptr<StmtAST> Parser::ParseWhileStmt() {
if (!Cond) return nullptr;
if (CurTok != tok_do) {
- fprintf(stderr, "Error: expected DO after WHILE condition\n");
+ fprintf(stderr, "error: expected DO after WHILE condition\n");
return nullptr;
}
getNextToken();
@@ -440,7 +440,7 @@ std::unique_ptr<StmtAST> Parser::ParseWhileStmt() {
std::vector<std::unique_ptr<StmtAST>> Body = ParseBlock({tok_endwhile});
if (CurTok != tok_endwhile) {
- fprintf(stderr, "Error: expected ENDWHILE\n");
+ fprintf(stderr, "error: expected ENDWHILE\n");
return nullptr;
}
getNextToken();
@@ -454,7 +454,7 @@ std::unique_ptr<StmtAST> Parser::ParseRepeatStmt() {
std::vector<std::unique_ptr<StmtAST>> Body = ParseBlock({tok_until});
if (CurTok != tok_until) {
- fprintf(stderr, "Error: expected UNTIL\n");
+ fprintf(stderr, "error: expected UNTIL\n");
return nullptr;
}
getNextToken();
@@ -468,14 +468,14 @@ std::unique_ptr<StmtAST> Parser::ParseRepeatStmt() {
std::unique_ptr<StmtAST> Parser::ParseForStmt() {
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: expected identifier after FOR\n");
+ fprintf(stderr, "error: expected identifier after FOR\n");
return nullptr;
}
std::string VarName = Lex.IdentifierStr;
getNextToken();
if (CurTok != tok_assign) {
- fprintf(stderr, "Error: expected '<-' in FOR loop\n");
+ fprintf(stderr, "error: expected '<-' in FOR loop\n");
return nullptr;
}
getNextToken();
@@ -484,7 +484,7 @@ std::unique_ptr<StmtAST> Parser::ParseForStmt() {
if (!Start) return nullptr;
if (CurTok != tok_to) {
- fprintf(stderr, "Error: expected TO in FOR loop\n");
+ fprintf(stderr, "error: expected TO in FOR loop\n");
return nullptr;
}
getNextToken();
@@ -502,18 +502,18 @@ std::unique_ptr<StmtAST> Parser::ParseForStmt() {
std::vector<std::unique_ptr<StmtAST>> Body = ParseBlock({tok_next});
if (CurTok != tok_next) {
- fprintf(stderr, "Error: expected NEXT\n");
+ fprintf(stderr, "error: expected NEXT\n");
return nullptr;
}
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: expected identifier after NEXT (e.g., NEXT %s)\n", VarName.c_str());
+ fprintf(stderr, "error: expected identifier after NEXT (e.g., NEXT %s)\n", VarName.c_str());
return nullptr;
}
if (Lex.IdentifierStr != VarName) {
- fprintf(stderr, "Error: NEXT identifier '%s' does not match FOR variable '%s'\n",
+ fprintf(stderr, "error: NEXT identifier '%s' does not match FOR variable '%s'\n",
Lex.IdentifierStr.c_str(), VarName.c_str());
return nullptr;
}
@@ -538,7 +538,7 @@ std::unique_ptr<StmtAST> Parser::ParseStatementImpl() {
else if (CurTok == tok_input) {
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected variable name after INPUT at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected variable name after INPUT at line %d\n", Lex.getLine());
return nullptr;
}
std::string Name = Lex.IdentifierStr;
@@ -548,7 +548,7 @@ std::unique_ptr<StmtAST> Parser::ParseStatementImpl() {
// Consume the whole designator so it cannot replay as statements.
std::vector<DesignatorAccess> Dummy;
ParseDesignatorSuffix(Dummy);
- fprintf(stderr, "Error: INPUT target must be a plain variable at line %d\n", Line);
+ fprintf(stderr, "error: INPUT target must be a plain variable at line %d\n", Line);
return nullptr;
}
return std::make_unique<InputStmtAST>(Name);
@@ -605,17 +605,17 @@ std::unique_ptr<StmtAST> Parser::ParseStatementImpl() {
return ParseTypeDecl();
}
else if (CurTok == tok_define) {
- fprintf(stderr, "Error: DEFINE (SET literals) is not implemented at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: DEFINE (SET literals) is not implemented at line %d\n", Lex.getLine());
getNextToken();
return nullptr;
}
else if (CurTok == tok_endtype) {
- fprintf(stderr, "Error: ENDTYPE without matching TYPE at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: ENDTYPE without matching TYPE at line %d\n", Lex.getLine());
getNextToken();
return nullptr;
}
- fprintf(stderr, "Error: Unexpected token at line %d when expecting a statement\n", Lex.getLine());
+ fprintf(stderr, "error: Unexpected token at line %d when expecting a statement\n", Lex.getLine());
getNextToken(); // guarantee progress so error recovery cannot loop forever
return nullptr;
}
@@ -632,7 +632,7 @@ std::unique_ptr<StmtAST> Parser::ParseAssignStmt() {
if (!ParseDesignatorSuffix(Accesses)) return nullptr;
if (CurTok != tok_assign) {
- fprintf(stderr, "Error: Expected '<-' after identifier '%s' at line %d\n", Name.c_str(), Line);
+ fprintf(stderr, "error: Expected '<-' after identifier '%s' at line %d\n", Name.c_str(), Line);
return nullptr;
}
getNextToken();
diff --git a/lib/Parser/ParserFile.cc b/lib/Parser/ParserFile.cc
index 4a4ae31..9aa4979 100644
--- a/lib/Parser/ParserFile.cc
+++ b/lib/Parser/ParserFile.cc
@@ -13,7 +13,7 @@ std::unique_ptr<StmtAST> Parser::ParseOpenFile() {
if (!FileName) return nullptr;
if (CurTok != tok_for) {
- fprintf(stderr, "Error: Expected FOR after OPENFILE filename at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected FOR after OPENFILE filename at line %d\n", Lex.getLine());
return nullptr;
}
getNextToken(); // eat FOR
@@ -24,11 +24,11 @@ std::unique_ptr<StmtAST> Parser::ParseOpenFile() {
case tok_write: Mode = FileMode::Write; break;
case tok_append: Mode = FileMode::Append; break;
case tok_random:
- fprintf(stderr, "Error: File mode RANDOM is not implemented (text files only) at line %d\n",
+ fprintf(stderr, "error: File mode RANDOM is not implemented (text files only) at line %d\n",
Lex.getLine());
return nullptr;
default:
- fprintf(stderr, "Error: Expected file mode READ, WRITE or APPEND at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected file mode READ, WRITE or APPEND at line %d\n", Lex.getLine());
return nullptr;
}
getNextToken(); // eat the mode keyword
@@ -45,13 +45,13 @@ std::unique_ptr<StmtAST> Parser::ParseReadFile() {
if (!FileName) return nullptr;
if (CurTok != ',') {
- fprintf(stderr, "Error: Expected ',' after READFILE filename at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected ',' after READFILE filename at line %d\n", Lex.getLine());
return nullptr;
}
getNextToken(); // eat ','
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected variable name after ',' in READFILE at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected variable name after ',' in READFILE at line %d\n", Lex.getLine());
return nullptr;
}
std::string VarName = Lex.IdentifierStr;
@@ -61,7 +61,7 @@ std::unique_ptr<StmtAST> Parser::ParseReadFile() {
// Consume the whole designator so it cannot replay as statements.
std::vector<DesignatorAccess> Dummy;
ParseDesignatorSuffix(Dummy);
- fprintf(stderr, "Error: READFILE target must be a plain STRING variable at line %d\n", Line);
+ fprintf(stderr, "error: READFILE target must be a plain STRING variable at line %d\n", Line);
return nullptr;
}
@@ -77,7 +77,7 @@ std::unique_ptr<StmtAST> Parser::ParseWriteFile() {
if (!FileName) return nullptr;
if (CurTok != ',') {
- fprintf(stderr, "Error: Expected ',' after WRITEFILE filename at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected ',' after WRITEFILE filename at line %d\n", Lex.getLine());
return nullptr;
}
getNextToken(); // eat ','
diff --git a/lib/Parser/ParserFunction.cc b/lib/Parser/ParserFunction.cc
index 81db2c7..f4e39de 100644
--- a/lib/Parser/ParserFunction.cc
+++ b/lib/Parser/ParserFunction.cc
@@ -13,7 +13,7 @@ bool Parser::ParseSignedIntBound(int64_t &Out) {
getNextToken();
}
if (CurTok != tok_number_int) {
- fprintf(stderr, "Error: Array parameter bounds must be integer literals at line %d\n",
+ fprintf(stderr, "error: Array parameter bounds must be integer literals at line %d\n",
Lex.getLine());
return false;
}
@@ -37,7 +37,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
while (CurTok != ')') {
if (CurTok == tok_byref) {
if (!AllowByRef) {
- fprintf(stderr, "Error: BYREF parameters are not allowed in a FUNCTION (procedures only) at line %d\n",
+ fprintf(stderr, "error: BYREF parameters are not allowed in a FUNCTION (procedures only) at line %d\n",
Lex.getLine());
return std::nullopt;
}
@@ -49,7 +49,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
}
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected argument name at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected argument name at line %d\n", Lex.getLine());
return std::nullopt;
}
ParamDecl P;
@@ -58,7 +58,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
getNextToken();
if (CurTok != tok_colon) {
- fprintf(stderr, "Error: Expected ':' after argument name at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected ':' after argument name at line %d\n", Lex.getLine());
return std::nullopt;
}
getNextToken();
@@ -72,7 +72,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
int64_t Lo = 0, Hi = 0;
if (!ParseSignedIntBound(Lo)) return std::nullopt;
if (CurTok != tok_colon) {
- fprintf(stderr, "Error: Expected ':' between array parameter bounds at line %d\n",
+ fprintf(stderr, "error: Expected ':' between array parameter bounds at line %d\n",
Lex.getLine());
return std::nullopt;
}
@@ -81,7 +81,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
P.DeclaredBounds.emplace_back(Lo, Hi);
if (CurTok == ']') break;
if (CurTok != ',') {
- fprintf(stderr, "Error: Expected ',' or ']' in array parameter bounds at line %d\n",
+ fprintf(stderr, "error: Expected ',' or ']' in array parameter bounds at line %d\n",
Lex.getLine());
return std::nullopt;
}
@@ -93,7 +93,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
P.Rank = 1; // ARRAY OF T: bounds travel with the argument
}
if (CurTok != tok_of) {
- fprintf(stderr, "Error: Expected OF after ARRAY in parameter '%s' at line %d\n",
+ fprintf(stderr, "error: Expected OF after ARRAY in parameter '%s' at line %d\n",
P.Name.c_str(), Lex.getLine());
return std::nullopt;
}
@@ -102,13 +102,13 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
P.TypeName = ParseTypeName(false);
if (P.TypeName.empty()) {
- fprintf(stderr, "Error: Expected argument type for '%s'\n", P.Name.c_str());
+ fprintf(stderr, "error: Expected argument type for '%s'\n", P.Name.c_str());
return std::nullopt;
}
for (const ParamDecl &Prev : Params) {
if (Prev.Name == P.Name) {
- fprintf(stderr, "Error: Duplicate parameter name '%s' at line %d\n",
+ fprintf(stderr, "error: Duplicate parameter name '%s' at line %d\n",
P.Name.c_str(), Lex.getLine());
return std::nullopt;
}
@@ -117,12 +117,12 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
if (CurTok == ')') break;
if (CurTok != ',') {
- fprintf(stderr, "Error: Expected ',' or ')'\n");
+ fprintf(stderr, "error: Expected ',' or ')'\n");
return std::nullopt;
}
getNextToken();
if (CurTok == ')') {
- fprintf(stderr, "Error: Expected another parameter after ',' at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected another parameter after ',' at line %d\n", Lex.getLine());
return std::nullopt;
}
}
@@ -133,7 +133,7 @@ std::optional<std::vector<ParamDecl>> Parser::ParsePrototypeArgs(bool AllowByRef
std::unique_ptr<StmtAST> Parser::ParseFunction() {
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected function name\n");
+ fprintf(stderr, "error: Expected function name\n");
return nullptr;
}
@@ -147,13 +147,13 @@ std::unique_ptr<StmtAST> Parser::ParseFunction() {
if (CurTok == tok_returns) {
getNextToken();
if (CurTok == tok_array) {
- fprintf(stderr, "Error: A FUNCTION cannot RETURN an array; use a BYREF PROCEDURE parameter instead at line %d\n",
+ fprintf(stderr, "error: A FUNCTION cannot RETURN an array; use a BYREF PROCEDURE parameter instead at line %d\n",
Lex.getLine());
return nullptr;
}
RetType = ParseTypeName(true);
if (RetType.empty()) {
- fprintf(stderr, "Error: Expected return type for function '%s'\n", Name.c_str());
+ fprintf(stderr, "error: Expected return type for function '%s'\n", Name.c_str());
return nullptr;
}
}
@@ -163,7 +163,7 @@ std::unique_ptr<StmtAST> Parser::ParseFunction() {
std::vector<std::unique_ptr<StmtAST>> Body = ParseBlock({tok_endfunction});
if (CurTok != tok_endfunction) {
- fprintf(stderr, "Error: expected ENDFUNCTION\n");
+ fprintf(stderr, "error: expected ENDFUNCTION\n");
return nullptr;
}
getNextToken();
@@ -174,7 +174,7 @@ std::unique_ptr<StmtAST> Parser::ParseFunction() {
std::unique_ptr<StmtAST> Parser::ParseProcedure() {
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected procedure name\n");
+ fprintf(stderr, "error: Expected procedure name\n");
return nullptr;
}
@@ -188,7 +188,7 @@ std::unique_ptr<StmtAST> Parser::ParseProcedure() {
std::vector<std::unique_ptr<StmtAST>> Body = ParseBlock({tok_endprocedure});
if (CurTok != tok_endprocedure) {
- fprintf(stderr, "Error: expected ENDPROCEDURE\n");
+ fprintf(stderr, "error: expected ENDPROCEDURE\n");
return nullptr;
}
getNextToken();
@@ -200,7 +200,7 @@ std::unique_ptr<StmtAST> Parser::ParseCallStmt() {
int Line = Lex.getLine();
getNextToken();
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected callee name after CALL\n");
+ fprintf(stderr, "error: Expected callee name after CALL\n");
return nullptr;
}
diff --git a/lib/Parser/ParserType.cc b/lib/Parser/ParserType.cc
index 50ee53f..8be7e46 100644
--- a/lib/Parser/ParserType.cc
+++ b/lib/Parser/ParserType.cc
@@ -19,7 +19,7 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
getNextToken(); // eat TYPE
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected type name after TYPE at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected type name after TYPE at line %d\n", Lex.getLine());
return nullptr;
}
std::string Name = Lex.IdentifierStr;
@@ -35,7 +35,7 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
std::vector<std::string> Values;
while (true) {
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected an enum value name in TYPE %s at line %d\n",
+ fprintf(stderr, "error: Expected an enum value name in TYPE %s at line %d\n",
Name.c_str(), Lex.getLine());
return nullptr;
}
@@ -43,7 +43,7 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
getNextToken();
if (CurTok == ')') break;
if (CurTok != ',') {
- fprintf(stderr, "Error: Expected ',' or ')' in TYPE %s at line %d\n",
+ fprintf(stderr, "error: Expected ',' or ')' in TYPE %s at line %d\n",
Name.c_str(), Lex.getLine());
return nullptr;
}
@@ -57,11 +57,11 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
if (Pointee.empty()) return nullptr;
Decl = std::make_unique<PointerTypeDeclAST>(Name, Pointee);
} else if (CurTok == tok_set) {
- fprintf(stderr, "Error: SET OF types are not implemented at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: SET OF types are not implemented at line %d\n", Lex.getLine());
getNextToken();
return nullptr;
} else {
- fprintf(stderr, "Error: Expected '(' or '^' after '=' in TYPE %s at line %d\n",
+ fprintf(stderr, "error: Expected '(' or '^' after '=' in TYPE %s at line %d\n",
Name.c_str(), Lex.getLine());
return nullptr;
}
@@ -79,13 +79,13 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
}
}
if (CurTok != tok_endtype) {
- fprintf(stderr, "Error: Expected DECLARE or ENDTYPE in TYPE %s at line %d\n",
+ fprintf(stderr, "error: Expected DECLARE or ENDTYPE in TYPE %s at line %d\n",
Name.c_str(), Lex.getLine());
return nullptr; // token left for the outer recovery
}
getNextToken(); // eat ENDTYPE
if (Fields.empty()) {
- fprintf(stderr, "Error: Record TYPE %s has no fields at line %d\n", Name.c_str(), Line);
+ fprintf(stderr, "error: Record TYPE %s has no fields at line %d\n", Name.c_str(), Line);
return nullptr;
}
if (HadFieldError) return nullptr;
@@ -93,7 +93,7 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
}
if (!AtTopLevel) {
- fprintf(stderr, "Error: TYPE declarations are only allowed at top level at line %d\n", Line);
+ fprintf(stderr, "error: TYPE declarations are only allowed at top level at line %d\n", Line);
return nullptr;
}
return Decl;
@@ -103,21 +103,21 @@ std::unique_ptr<StmtAST> Parser::ParseTypeDecl() {
bool Parser::ParseRecordField(std::vector<RecordFieldDecl> &Out) {
getNextToken(); // eat DECLARE
if (CurTok != tok_identifier) {
- fprintf(stderr, "Error: Expected field name after DECLARE at line %d\n", Lex.getLine());
+ fprintf(stderr, "error: Expected field name after DECLARE at line %d\n", Lex.getLine());
return false;
}
std::string FieldName = Lex.IdentifierStr;
getNextToken();
if (CurTok != tok_colon) {
- fprintf(stderr, "Error: Expected ':' after field name %s at line %d\n",
+ fprintf(stderr, "error: Expected ':' after field name %s at line %d\n",
FieldName.c_str(), Lex.getLine());
return false;
}
getNextToken();
if (CurTok == tok_array) {
- fprintf(stderr, "Error: Array fields inside records are not implemented at line %d\n",
+ fprintf(stderr, "error: Array fields inside records are not implemented at line %d\n",
Lex.getLine());
return false;
}