-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirc_token.h
40 lines (29 loc) · 820 Bytes
/
irc_token.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef ELASTIC_IRC_BOT_IRC_TOKEN_H
#define ELASTIC_IRC_BOT_IRC_TOKEN_H
#include <stdbool.h>
#include <stddef.h>
struct irc_token;
enum irc_token_type {
IRC_TOKEN_COLON = 0,
IRC_TOKEN_SPACE,
IRC_TOKEN_NOSPCRLFCL,
IRC_TOKEN_LETTER,
IRC_TOKEN_DIGIT,
IRC_TOKEN_EOL,
IRC_TOKEN_EOF,
IRC_TOKEN_NONE
};
union irc_token_value {
struct {
size_t length;
char *string;
} string;
int integer;
char character;
};
struct irc_token *allocate_irc_token(enum irc_token_type type, union irc_token_value value);
void deallocate_irc_token(struct irc_token *token);
enum irc_token_type irc_token_get_token_type(struct irc_token *token);
union irc_token_value irc_token_get_token_value(struct irc_token *token);
bool irc_token_is_token_type(struct irc_token *token, enum irc_token_type type);
#endif