From 07c2c391436d93a0f11290ed71c0d9b569ae8c9c Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Thu, 26 Sep 2024 10:42:36 +0200 Subject: [PATCH] some tricky ideas - might revert --- engine/slc.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/engine/slc.h b/engine/slc.h index a28c3ed..fb07871 100644 --- a/engine/slc.h +++ b/engine/slc.h @@ -274,7 +274,8 @@ static inline slc_state slc_comment_statechange_in( static inline slc_state slc_def_name_statechange( slc_state current_state, char c, - const char *prefix) { + const char *prefix, + int *prefix_i) { // FIXME: Implement return current_state; } @@ -352,6 +353,7 @@ static inline void slc( int comment_i = 0; int multiline_i = 0; + int prefix_i = 0; uint8_t c = 0; while(((c = code_src()) != 0)) { @@ -368,23 +370,27 @@ static inline void slc( multiline_comment_opener_len, &comment_i, &multiline_i); + /* state -> def_name */ if(state == SLC_START) { state = slc_def_name_statechange( state, c, - prefix); - } else goto process_char; // new state might need 'c' too + prefix, + &prefix_i); + } else goto process_char; /* new state might need 'c' too */ + /* state -> word_name */ - if(state == SLC_START) { + /* XXX: You can't START words with ':', parts of prefix or comment prefix - that makes my life simpler here */ + if((state == SLC_START) && (comment_i == 0) && (multiline_i == 0) && (prefix_i == 0)) { 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 + 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 + /* Step to read next character */ break; case SLC_COMMENT: break;