diff --git a/engine/slc.h b/engine/slc.h index 8442ec9..61740dc 100644 --- a/engine/slc.h +++ b/engine/slc.h @@ -342,12 +342,17 @@ static inline void slc( const char *prefix, const char *ender, const char *varprefix) { + slc_state state = SLC_START; int singleline_comment_len = strlen(singleline_comment); int multiline_comment_opener_len = strlen(multiline_comment_opener); + // TODO: Count line numbers + // TODO: Handle/count indentation for better error messages + uint8_t c = 0; while(((c = code_src()) != 0)) { + process_char: switch(state) { case SLC_START: int comment_i = 0; @@ -369,14 +374,17 @@ static inline void slc( state, c, prefix); - } + } else goto process_char; // new state might need 'c' too /* state -> word_name */ if(state == SLC_START) { state = slc_word_name_statechange( state, c, prefix); - } + if(state != SLC_START) goto process_char; // new state might need 'c' too + } else goto process_char; // new state might need 'c' too + + // Step to read next character break; case SLC_COMMENT: break;