#include #include #include #include void Token::init(token_type_e type, char *lexeme, unsigned int line) { m_type = type; m_lexeme = lexeme; m_line = line; m_string = NULL; } char * Token::to_string(void) { if (m_string == NULL) asprintf(&m_string, "%d: %s - %s", m_line, TOKEN_STRING[m_type], m_lexeme); return m_string; } void Token::clean(void) { if (m_string != NULL) free(m_string); }