From a29cb23c5517fd4f8f5524fdf38b67ff5fe4a902 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 15:02:01 +0000 Subject: feat(parser): parse EXTERN "C" declarations and INCLUDE_OBJ Co-Authored-By: Claude Opus 5.5 --- lib/Lexer/Lexer.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/Lexer') 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 '['; } -- cgit v1.3.1-4-g156e