-
Notifications
You must be signed in to change notification settings - Fork 52
/
PyToken.h
53 lines (46 loc) · 1.18 KB
/
PyToken.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
48
49
50
51
52
53
/*
* PyToken.h
* Author: Kent D. Lee
* (c) 2013
* Created on: Feb 7, 2013
*
* License:
* Please read the LICENSE file in this distribution for details regarding
* the licensing of this code. This code is freely available for educational
* use. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
*
* Description:
* This class defines tokens that are returned by the PyScanner to the
* PyParser when CoCo reads and parses an assembly language (casm) file.
*/
#ifndef PYTOKEN_H_
#define PYTOKEN_H_
#include <string>
using namespace std;
class PyToken {
public:
PyToken(int tokenType, string lex, int line, int col);
virtual ~PyToken();
string getLex() const;
int getType() const;
int getCol() const;
int getLine() const;
private:
string lexeme;
int tokenType;
int line;
int column;
};
const int PYIDENTIFIERTOKEN = 1;
const int PYINTEGERTOKEN = 2;
const int PYFLOATTOKEN = 3;
const int PYSTRINGTOKEN = 4;
const int PYKEYWORDTOKEN = 5;
const int PYCOLONTOKEN = 6;
const int PYCOMMATOKEN = 7;
const int PYSLASHTOKEN = 8;
const int PYLEFTPARENTOKEN = 9;
const int PYRIGHTPARENTOKEN = 10;
const int PYEOFTOKEN = 98;
const int PYBADTOKEN = 99;
#endif /* PYTOKEN_H_ */