From 5409e79d4e2917e8daa4d7d218b0cf25686ffe98 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Fri, 6 Jun 2025 00:21:08 +0200 Subject: Feature: Support declaring type aliases --- src/bootstrap/tokenizer.src | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/tokenizer.src b/src/bootstrap/tokenizer.src index 3716e79..814a377 100644 --- a/src/bootstrap/tokenizer.src +++ b/src/bootstrap/tokenizer.src @@ -17,6 +17,7 @@ let TOKEN_BREAK = 7; let TOKEN_CONTINUE = 8; let TOKEN_ARROW = 9; let TOKEN_STRUCT = 10; +let TOKEN_TYPE = 34; /* Identifiers */ let TOKEN_IDENTIFIER = 11; @@ -97,6 +98,9 @@ let print_tokens = (ts: *token, ts_len: i64) => i64 { if (to.type == TOKEN_STRUCT) { printf("Struct\n"); }; + if (to.type == TOKEN_TYPE) { + printf("Type\n"); + }; if (to.type == TOKEN_IDENTIFIER) { printf("Identifier: %s\n", cast(*i8, to.data)); }; @@ -390,6 +394,10 @@ let tokenizer_next = (t: *tokenizer) => *token { (*to).type = TOKEN_STRUCT; return to; }; + if tokenizer_accept_string(t, "newtype") { + (*to).type = TOKEN_TYPE; + return to; + }; if tokenizer_accept_string(t, "=>") { (*to).type = TOKEN_ARROW; -- cgit 1.4.1