diff options
| author | aura <nw@moneybot.cc> | 2026-03-16 12:51:06 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-16 12:51:06 +0100 |
| commit | f1882249843caa8bd931ecb76bb489615e079b10 (patch) | |
| tree | 15d0e3f7d775684ff91d85cc37843138e72b1735 /src/util/str_tokenizer.h | |
| parent | b71bb14c7dec546304e3396d7040d88c6c86a3a7 (diff) | |
editor work
Diffstat (limited to 'src/util/str_tokenizer.h')
| -rw-r--r-- | src/util/str_tokenizer.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/util/str_tokenizer.h b/src/util/str_tokenizer.h index f316104..8a3aebf 100644 --- a/src/util/str_tokenizer.h +++ b/src/util/str_tokenizer.h @@ -58,7 +58,7 @@ inline STR tok_next( STR_TOKENIZER* t ) { return ""; } -inline STR tok_peek( STR_TOKENIZER *t ) { +inline STR tok_peek( STR_TOKENIZER* t ) { if( t->cur >= t->str.size ) return ""; @@ -93,7 +93,7 @@ inline STR tok_peek( STR_TOKENIZER *t ) { } -inline STR tok_next( STR_TOKENIZER *t, STR what ) { +inline STR tok_next( STR_TOKENIZER* t, STR what ) { if( t->cur >= t->str.size ) return ""; @@ -112,3 +112,29 @@ inline STR tok_next( STR_TOKENIZER *t, STR what ) { return ""; } + +inline char tok_nextchar( STR_TOKENIZER* t ) { + if( t->cur >= t->str.size ) + return 0; + + U32 last = t->cur; + for( ; t->cur < t->str.size; t->cur++ ) { + U8 cont = 0; + for( auto& it : t->ignored ) { + if( t->str.data[t->cur] == it ) { + cont = 1; + break; + } + } + + if( cont ) + continue; + else { + t->last = last; + t->cur++; + return t->str.data[t->cur]; + } + } + + return 0; +} |
