From 96393257a43ac52f2b911594d106741245dec5f0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 4 Dec 2020 15:20:28 -0500 Subject: - Started work on writing the new version of the assembler. - Did alot of stuff in the emulator. - Did alot of stuff in the SuB Suite. --- lexer.h | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 145 insertions(+), 4 deletions(-) (limited to 'lexer.h') diff --git a/lexer.h b/lexer.h index dc478cd..356fad0 100644 --- a/lexer.h +++ b/lexer.h @@ -1,4 +1,4 @@ -static inline uint8_t isdelm(char c, uint8_t dbg) { +static uint8_t isdelm(char c, uint8_t dbg) { switch (c) { default : return 0x00; case '\0': @@ -11,7 +11,7 @@ static inline uint8_t isdelm(char c, uint8_t dbg) { } } -static inline uint8_t isdelm2(char c, uint8_t dbg) { +static uint8_t isdelm2(char c, uint8_t dbg) { switch (c) { default : return 0; case ')' : @@ -32,7 +32,7 @@ static inline uint8_t isdelm2(char c, uint8_t dbg) { } } -static inline uint8_t get_ptok(char c, uint8_t dbg) { +static uint8_t get_ptok(char c, uint8_t dbg) { switch (c) { case '.' : return PTOK_DOT ; case '@' : return PTOK_AT ; @@ -69,7 +69,7 @@ static inline uint8_t get_ptok(char c, uint8_t dbg) { } } -static inline uint8_t is_altok(uint8_t ptok, uint8_t dbg) { +static uint8_t is_altok(uint8_t ptok, uint8_t dbg) { switch (ptok) { case PTOK_B: case PTOK_E: @@ -80,3 +80,144 @@ static inline uint8_t is_altok(uint8_t ptok, uint8_t dbg) { default : return 0; } } + +#if 0 +static int handle_dot(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_at(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_colon(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_equ(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_plus(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_minus(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_gt(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_lt(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_pipe(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_lbrack(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_rbrack(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_comma(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_b(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_e(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_x(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_y(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_s(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_p(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_dquote(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_squote(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_hash(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_scolon(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_dollar(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_percent(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} +static int handle_number(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_alpha(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + +} + +static int handle_other(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg) { + return idx+1; +} + +typedef int (*ptok_func)(char *str, int idx, uint8_t lex_type, line *l, token *t, uint8_t dbg); + +static ptok_func ptok_handler[PTOK_OTHER+1] = { + [PTOK_DOT ] = handle_dot, + [PTOK_AT ] = handle_at, + [PTOK_COLON ] = handle_colon, + [PTOK_EQU ] = handle_equ, + [PTOK_PLUS ] = handle_plus, + [PTOK_MINUS ] = handle_minus, + [PTOK_GT ] = handle_gt, + [PTOK_LT ] = handle_lt, + [PTOK_PIPE ] = handle_pipe, + [PTOK_LBRACK ] = handle_lbrack, + [PTOK_RBRACK ] = handle_rbrack, + [PTOK_COMMA ] = handle_comma, + [PTOK_B ] = handle_b, + [PTOK_E ] = handle_e, + [PTOK_X ] = handle_x, + [PTOK_Y ] = handle_y, + [PTOK_S ] = handle_s, + [PTOK_P ] = handle_p, + [PTOK_DQUOTE ] = handle_dquote, + [PTOK_SQUOTE ] = handle_squote, + [PTOK_HASH ] = handle_hash, + [PTOK_SCOLON ] = handle_scolon, + [PTOK_DOLLAR ] = handle_dollar, + [PTOK_PERCENT] = handle_percent, + [PTOK_NUMBER ] = handle_number, + [PTOK_ALPHA ] = handle_alpha, + [PTOK_OTHER ] = handle_other +}; +#endif -- cgit v1.2.3-13-gbd6f