From 4e2ce1b6c484a60b1d9f0d6bb917ba51d6258e4e Mon Sep 17 00:00:00 2001 From: Baitinq Date: Tue, 15 Jul 2025 23:50:35 +0200 Subject: Feature: Add support for and and or operators --- src/tokenizer.pry | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/tokenizer.pry') diff --git a/src/tokenizer.pry b/src/tokenizer.pry index ddc2cef..c809420 100644 --- a/src/tokenizer.pry +++ b/src/tokenizer.pry @@ -18,6 +18,8 @@ let TOKEN_CONTINUE = 8; let TOKEN_ARROW = 9; let TOKEN_STRUCT = 10; let TOKEN_TYPE = 34; +let TOKEN_AND = 35; +let TOKEN_OR = 36; /* Identifiers */ let TOKEN_IDENTIFIER = 11; @@ -101,6 +103,12 @@ let print_tokens = (ts: *token, ts_len: i64) => i64 { if (to.type == TOKEN_TYPE) { printf("Type\n"); }; + if (to.type == TOKEN_AND) { + printf("And\n"); + }; + if (to.type == TOKEN_OR) { + printf("Or\n"); + }; if (to.type == TOKEN_IDENTIFIER) { printf("Identifier: %s\n", cast(*i8, to.data)); }; @@ -398,6 +406,14 @@ let tokenizer_next = (t: *tokenizer) => *token { (*to).type = TOKEN_TYPE; return to; }; + if tokenizer_accept_string(t, "and") { + (*to).type = TOKEN_AND; + return to; + }; + if tokenizer_accept_string(t, "or") { + (*to).type = TOKEN_OR; + return to; + }; if tokenizer_accept_string(t, "=>") { (*to).type = TOKEN_ARROW; -- cgit 1.4.1