-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoken.h
47 lines (38 loc) · 890 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
41
42
43
44
45
46
47
#ifndef TOKEN_H_
#define TOKEN_H_
#include <iostream>
using namespace std;
// Class for token
class token
{
private:
string type; // Type of the token
string val; // Value of the token
public:
void setType(const string &sts); // Set the type of the token
void setVal(const string &str); // Set the value of the token
string getType(); // Get the type of the token
string getVal(); // Get the value of the token
bool operator!=(token t); // Inequality comparison operator for tokens
};
// Set the type of the token
void token::setType(const string &str)
{
type = str;
}
// Set the value of the token
void token::setVal(const string &str)
{
val = str;
}
// Get the type of the token
string token::getType()
{
return type;
}
// Get the value of the token
string token::getVal()
{
return val;
}
#endif