diff options
author | c+1 | 2023-05-18 14:25:20 -0400 |
---|---|---|
committer | c+1 | 2023-05-18 14:25:20 -0400 |
commit | 0e6a987ed476ffa4c7deba189b1e25cccf449ba4 (patch) | |
tree | 7290e2e6727d967b21620f26705e15d8ae44ec86 /src/include | |
parent | 9f3cfd0c976a3e33a7c51407b17967614f163f05 (diff) |
signatures for future lexing methods
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/lexer.h | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/src/include/lexer.h b/src/include/lexer.h index 3d3b916..b84cea6 100644 --- a/src/include/lexer.h +++ b/src/include/lexer.h @@ -11,31 +11,52 @@ typedef struct LEXER_STRUC { char* content; // the code itself } lexer_t; + +// constructor / destroyer extern lexer_t* lexer_init(char* content); +extern void lexer_destroy(lexer_t* lexer); +// advance the lexer extern void lexer_next(lexer_t* lexer); extern void lexer_pass(lexer_t* lexer); - extern token_t* lexer_get_next_token(lexer_t* lexer); +extern token_t* lexer_next_token(lexer_t* lexer, token_t* token); +extern char* lexer_get_c_as_string(lexer_t* lexer); +// collectors +extern token_t* lexer_get_array(lexer_t* lexer); extern token_t* lexer_get_string(lexer_t* lexer); - -extern token_t* lexer_get_def_const(lexer_t* lexer); -extern token_t* lexer_get_def_mut(lexer_t* lexer); - -extern token_t* lexer_get_def_var(lexer_t* lexer); - extern token_t* lexer_get_comment(lexer_t* lexer); +// def collectors extern token_t* lexer_get_directive(lexer_t* lexer); - extern token_t* lexer_get_keyword(lexer_t* lexer); - -extern token_t* lexer_next_token(lexer_t* lexer, token_t* token); - -extern char* lexer_get_c_as_string(lexer_t* lexer); - -extern void lexer_destroy(lexer_t* lexer); +extern token_t* lexer_get_def(lexer_t* lexer); + +// <mut:?><type:><name>=<value?> + // get the definition + extern token_t* lexer_get_def(lexer_t* lexer); + // looks for mut: or immut: + extern token_t* lexer_get_def_mutability(lexer_t* lexer); + // get the type of the definition, with syntax <type>: + extern token_t* lexer_get_def_type(lexer_t* lexer); + // get the name of the definition + extern token_t* lexer_det_def_name(lexer_t* lexer); + // calls either get_def_var or get_def_fn + extern token_t* lexer_get_def_deftype(lexer_t* lexer); + +// get a var def +extern token_t* lexer_get_def_var(lexer_t* lexer); +// get the var value +extern token_t* lexer_get_var_value(lexer_t* lexer); + +// get a fn def +extern token_t* lexer_get_fn_def(lexer_t* lexer); +// get the fn args -- calls get get_def_mut and get_def_type and get_def_name +// for each +extern token_t* lexer_get_fn_args(lexer_t* lexer); +// get the fn body +extern token_t* lexer_get_fn_body(lexer_t* lexer); #endif |