Herb C Reference
Loading...
Searching...
No Matches
token.h
Go to the documentation of this file.
1#ifndef HERB_TOKEN_H
2#define HERB_TOKEN_H
3
4#include "lexer_struct.h"
5#include "position.h"
6#include "token_struct.h"
7#include "util/hb_allocator.h"
8#include "util/hb_string.h"
9
10#include <stdarg.h>
11
12token_T* token_init(hb_string_T value, token_type_T type, lexer_T* lexer);
13hb_string_T token_to_string(hb_allocator_T* allocator, const token_T* token);
14hb_string_T token_type_to_string(token_type_T type);
16char* token_types_to_friendly_string_va(hb_allocator_T* allocator, token_type_T first_token, ...);
17char* token_types_to_friendly_string_valist(hb_allocator_T* allocator, token_type_T first_token, va_list args);
18
19#define token_types_to_friendly_string(allocator, ...) \
20 token_types_to_friendly_string_va(allocator, __VA_ARGS__, TOKEN_SENTINEL)
21
22hb_string_T token_value(const token_T* token);
23int token_type(const token_T* token);
24
25token_T* token_copy(token_T* token, hb_allocator_T* allocator);
26
27void token_free(token_T* token, hb_allocator_T* allocator);
28
29bool token_value_empty(const token_T* token);
30
31#endif
Definition lexer_struct.h:17
Definition token_struct.h:58
hb_string_T token_type_to_friendly_string(token_type_T type)
Definition token.c:88
hb_string_T token_type_to_string(token_type_T type)
Definition token.c:47
char * token_types_to_friendly_string_va(hb_allocator_T *allocator, token_type_T first_token,...)
Definition token.c:156
char * token_types_to_friendly_string_valist(hb_allocator_T *allocator, token_type_T first_token, va_list args)
Definition token.c:129
void token_free(token_T *token, hb_allocator_T *allocator)
Definition token.c:231
token_T * token_init(hb_string_T value, token_type_T type, lexer_T *lexer)
Definition token.c:16
token_T * token_copy(token_T *token, hb_allocator_T *allocator)
Definition token.c:211
hb_string_T token_value(const token_T *token)
Definition token.c:203
bool token_value_empty(const token_T *token)
Definition token.c:227
hb_string_T token_to_string(hb_allocator_T *allocator, const token_T *token)
Definition token.c:164
int token_type(const token_T *token)
Definition token.c:207
token_type_T
Definition token_struct.h:10