Register reserved operators as tokens.

This commit is contained in:
2018-03-16 23:09:11 -07:00
parent d25c1a379a
commit 27acfb0be7
5 changed files with 55 additions and 3 deletions

View File

@@ -58,6 +58,7 @@ enum libab_lexer_token_e {
TOKEN_OP_INFIX,
TOKEN_OP_PREFIX,
TOKEN_OP_POSTFIX,
TOKEN_OP_RESERVED,
TOKEN_KW_IF,
TOKEN_KW_ELSE,
TOKEN_KW_WHILE,

View File

@@ -37,5 +37,17 @@ typedef struct libab_reserved_operator_s libab_reserved_operator;
* @return the reserved operator, if it is found.
*/
const libab_reserved_operator* libab_find_reserved_operator(const char* name);
/**
* Registers the existing reserved operators into the given lexer.
* @param lexer the lexer to register into.
* @return the result of the registration.
*/
libab_result libab_register_reserved_operators(libab_lexer* lexer);
/**
* Remove the existing reserved operators from the given lexer.
* @param lexer the lexer to remove from.
* @return the result of the removal.
*/
libab_result libab_remove_reserved_operators(libab_lexer* lexer);
#endif