utilized GOTO well

This commit is contained in:
Richard Thier 2024-09-25 23:37:57 +02:00
parent f83fd990f8
commit ae1ef64838

View File

@ -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;