diff options
Diffstat (limited to 'src/util')
| -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; +} |
