skopy/lib/include/token.h

41 lines
1010 B
C

#ifndef SK_TOKEN_H
#define SK_TOKEN_H
#include "commons.h"
#define TOKEN_KIND(G) \
G(TOKEN_ROOT), \
G(TOKEN_INT), \
G(TOKEN_ADD), G(TOKEN_SUB), \
G(TOKEN_MUL), G(TOKEN_DIV), G(TOKEN_MOD), \
G(TOKEN_POW), G(TOKEN_OPAR), G(TOKEN_CPAR), \
G(TOKEN_ASSERT), G(TOKEN_ASSERT_EQ), \
G(TOKEN_BOOL), G(TOKEN_AND), G(TOKEN_OR), \
G(TOKEN_NOT), G(TOKEN_FLOAT), G(TOKEN_STRING), \
G(TOKEN_LT), G(TOKEN_LE), G(TOKEN_GT), G(TOKEN_GE), \
G(TOKEN_EQUAL), G(TOKEN_NOT_EQUAL), G(TOKEN_VAR), \
G(TOKEN_CONST), G(TOKEN_ASSIGN), G(TOKEN_IDENT), \
G(TOKEN_BEGIN), G(TOKEN_END), G(TOKEN_IF), G(TOKEN_ELSE), \
G(TOKEN_FUN), G(TOKEN_RETURN), G(TOKEN_COMMA), G(TOKEN_MODULE), \
G(TOKEN_MOD_ACCESS)
SK_ENUM_H(TokenKind, TOKEN_KIND);
struct token
{
TokenKind kind;
char* value;
int line;
};
void token_init(struct token* self,
TokenKind kind,
char const* value,
int line);
void token_free(struct token* self);
void token_str(struct token* self, struct str* dest);
#endif