-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToken.py
More file actions
53 lines (39 loc) · 1.05 KB
/
Copy pathToken.py
File metadata and controls
53 lines (39 loc) · 1.05 KB
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
######
#@Jonathan ke
#@9/23/2019
#Java Token objects
class Token(object):
def __init__(self, string):
self.string = string
def __repr__(self):
return self.string
class Identifier(Token):
def __init__(self, string):
super().__init__(string)
def __repr__(self):
return "Id: "+self.string
class Keyword(Token):
def __init__(self, string):
super().__init__(string)
def __repr__(self):
return "Key: "+self.string
class Separator(Token):
def __init__(self, string):
super().__init__(string)
def __repr__(self):
return "Sep: "+ self.string
class Operator(Token):
def __init__(self, string):
super().__init__(string)
def __repr__(self):
return "Op: "+self.string
class Literal(Token):
def __init__(self, string):
super().__init__(string)
def __repr__(self):
return "Lit: "+self.string
class Comment(Token):
def __init__(self, string):
super().__init__(string)
def __repr__(self):
return "Com: "+self.string