From f1882249843caa8bd931ecb76bb489615e079b10 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 12:51:06 +0100 Subject: editor work --- src/util/str_tokenizer.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/util/str_tokenizer.h') 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; +} -- cgit v1.2.3