-
Notifications
You must be signed in to change notification settings - Fork 0
/
token.h
executable file
·40 lines (31 loc) · 937 Bytes
/
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
/*
* token.h
* By: Frank Jones
* January 24th 2017
* Description:
*/
#ifndef TOKEN_H
#define TOKEN_H
#include <string>
enum token_type{COMMA, PERIOD, Q_MARK, LEFT_PAREN, RIGHT_PAREN, COLON,
COLON_DASH, MULTIPLY, ADD, SCHEMES, FACTS, RULES, QUERIES,
ID, STRING, COMMENT, WHITESPACE, UNDEFINED, MY_EOF};
class token
{
public:
token(token_type Type, int Line);
void setType(token_type Type);
token_type Type();
void addCharacter(char Character);
int stringSize();//return the length of the value string
void printDescription();
void clearString();
private:
token_type m_type;
int m_lineCount;
std::string m_value;
std::string token_strings[19] = {"COMMA", "PERIOD", "Q_MARK", "LEFT_PAREN", "RIGHT_PAREN", "COLON",
"COLON_DASH", "MULTIPLY", "ADD", "SCHEMES", "FACTS", "RULES", "QUERIES",
"ID", "STRING", "COMMENT", "WHITESPACE", "UNDEFINED", "EOF"};
};
#endif