aboutsummaryrefslogtreecommitdiff
path: root/lib/Lexer/Lexer.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 15:02:01 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 15:02:01 +0000
commita29cb23c5517fd4f8f5524fdf38b67ff5fe4a902 (patch)
treea3bfa1a30a16c03f420cbe706fd42143d653064d /lib/Lexer/Lexer.cc
parent4a34e970fb224be7640883f6b0dfa602157759f4 (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/Lexer.cc')
-rw-r--r--lib/Lexer/Lexer.cc17
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 '['; }