diff options
author | c+1 | 2023-11-17 18:58:54 -0500 |
---|---|---|
committer | c+1 | 2023-11-17 18:58:54 -0500 |
commit | 2cc68205a1c0b746ad405607940e7183c4fb09b0 (patch) | |
tree | dd16a65479194da364929c71a22d6fb01b58f36a /src/include/token.h | |
parent | 7be0923d486cd6ed2e304d3673146563ad677ea7 (diff) |
Cleaned up.
Diffstat (limited to 'src/include/token.h')
-rw-r--r-- | src/include/token.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/include/token.h b/src/include/token.h index 9e64c97..08de829 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -4,9 +4,9 @@ #include "util.h" #include "hlkt.h" -/* token struct */ +/* Token struct. */ typedef struct TOKEN_STRUC { - /* token type */ + /* Token type. */ enum TOKEN_TYPE { TOKEN_UNKNOWN, TOKEN_CHAR, @@ -28,24 +28,28 @@ typedef struct TOKEN_STRUC { TOKEN_INT } type; - /* token value */ + /* Token value. */ char* val; - /* next token */ + /* Next token. */ struct TOKEN_STRUC* nxt; } token_t; -/* creates a token */ +/* Creates a token. */ token_t* token_init(int type, char val); -/* destroys a token **and all tokens contained in nxt** **Make sure to set the nxt of any parent tokens to NULL** */ +/* + Destroys a token. + - Frees all tokens contained in `nxt`. + - Make sure to set the `nxt` field of a parent token to `NULL`. +*/ void token_destroy(token_t* token); -/* return pointer to the last token */ +/* Return pointer to the last token. */ token_t* token_last(token_t* token); -/* add a character to the token value */ +/* Add a character to the token value. */ void token_add_char(token_t*, char); -/* print a token -- for debugging purposes */ +/* Print a token -- for debugging purposes. */ void token_print(token_t* token); #endif |