diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 10:30:02 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 10:30:02 +0000 |
| commit | f5246db6d045ffb86d6717e1b1c37f03bcb2b75b (patch) | |
| tree | 468f4fba2e7ef75f29f90fd64af7d4e1fe05f50f /lib/Parser/Parser.cc | |
| parent | 066a378ca09ccc5d8074a942cf4bf1b9d4f40729 (diff) | |
feat(parser): parse OVERLOAD prefix on FUNCTION and PROCEDURE
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/Parser/Parser.cc')
| -rw-r--r-- | lib/Parser/Parser.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc index d4dd18e..f7817ec 100644 --- a/lib/Parser/Parser.cc +++ b/lib/Parser/Parser.cc @@ -50,7 +50,7 @@ void Parser::syncToStatementStart() { case tok_delete: case tok_constant: case tok_declare: case tok_identifier: case tok_input: case tok_output: case tok_case: case tok_endcase: case tok_otherwise: case tok_if: case tok_while: case tok_repeat: case tok_for: - case tok_function: case tok_procedure: case tok_call: case tok_return: + case tok_overload: case tok_function: case tok_procedure: case tok_call: case tok_return: case tok_else: case tok_endif: case tok_endwhile: case tok_until: case tok_next: case tok_endfunction: case tok_endprocedure: case tok_openfile: case tok_readfile: case tok_writefile: case tok_closefile: @@ -212,6 +212,14 @@ std::unique_ptr<StmtAST> Parser::ParseStatementImpl() { else if (CurTok == tok_for) { return ParseForStmt(); } + else if (CurTok == tok_overload) { + int Line = Lex.getLine(); + getNextToken(); + if (CurTok == tok_function) return ParseFunction({}, true, true); + if (CurTok == tok_procedure) return ParseProcedure({}, true, true); + cps::sourceDiagnostic(Line, "error: OVERLOAD must be followed by FUNCTION or PROCEDURE at line %d\n", Line); + return nullptr; + } else if (CurTok == tok_function) { return ParseFunction(); } |
