diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 15:02:01 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 15:02:01 +0000 |
| commit | a29cb23c5517fd4f8f5524fdf38b67ff5fe4a902 (patch) | |
| tree | a3bfa1a30a16c03f420cbe706fd42143d653064d /lib/Lexer | |
| parent | 4a34e970fb224be7640883f6b0dfa602157759f4 (diff) | |
feat(parser): parse EXTERN "C" declarations and INCLUDE_OBJ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/Lexer')
| -rw-r--r-- | lib/Lexer/Lexer.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Lexer/Lexer.cc b/lib/Lexer/Lexer.cc index 9956cd9..8f906ae 100644 --- a/lib/Lexer/Lexer.cc +++ b/lib/Lexer/Lexer.cc @@ -75,6 +75,10 @@ int Lexer::readToken() { if (IdentifierStr == "CONSTANT") return tok_constant; if (IdentifierStr == "INCLUDE") return tok_include; + if (IdentifierStr == "INCLUDE_OBJ") return tok_include_obj; + if (IdentifierStr == "EXTERN") return tok_extern; + if (IdentifierStr == "EXTERN_FUNCTION") return tok_extern_function; + if (IdentifierStr == "EXTERN_PROCEDURE") return tok_extern_procedure; if (IdentifierStr == "GLOBAL") return tok_global; if (IdentifierStr == "ENDGLOBAL") return tok_endglobal; if (IdentifierStr == "DECLARE") return tok_declare; @@ -229,6 +233,19 @@ int Lexer::readToken() { return tok_colon; } + if (LastChar == '.' && Input.peek() == '.') { + Input.get(); + if (Input.peek() == '.') { + Input.get(); + LastChar = Input.get(); + return tok_ellipsis; + } + cps::sourceDiagnostic(CurrentLine, "error: Expected '...' at line %d\n", CurrentLine); + HadError = true; + LastChar = Input.get(); + return tok_ellipsis; + } + if (LastChar == '(') { LastChar = Input.get(); return '('; } if (LastChar == ')') { LastChar = Input.get(); return ')'; } if (LastChar == '[') { LastChar = Input.get(); return '['; } |
