diff options
| author | Baitinq <[email protected]> | 2025-07-15 23:50:35 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-07-15 23:59:21 +0200 |
| commit | 4e2ce1b6c484a60b1d9f0d6bb917ba51d6258e4e (patch) | |
| tree | aa374e4bd197e5b9d0482f363e8c30cbb3fe55b1 /src/tokenizer.pry | |
| parent | Boostrap: Regenerate stage 0 in script (diff) | |
| download | pry-lang-4e2ce1b6c484a60b1d9f0d6bb917ba51d6258e4e.tar.gz pry-lang-4e2ce1b6c484a60b1d9f0d6bb917ba51d6258e4e.tar.bz2 pry-lang-4e2ce1b6c484a60b1d9f0d6bb917ba51d6258e4e.zip | |
Feature: Add support for and and or operators
Diffstat (limited to 'src/tokenizer.pry')
| -rw-r--r-- | src/tokenizer.pry | 16 |
1 files changed, 16 insertions, 0 deletions
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; |