-
Notifications
You must be signed in to change notification settings - Fork 0
/
alt_token.py
60 lines (34 loc) · 859 Bytes
/
alt_token.py
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
54
55
56
57
58
59
60
class AltToken:
def __init__(self, text: str):
self.text = text
def __repr__(self):
return self.text
def __str__(self):
return repr(self)
class LiteralToken(AltToken):
def __repr__(self):
return '\'' + self.text + '\''
class SpecialToken(AltToken):
pass
class RepeatToken(AltToken):
pass
class MinimumRepeatToken(AltToken):
pass
class SeparatedRepeatToken(AltToken):
pass
class MinimumSeparatedRepeatToken(AltToken):
pass
class OptionalToken(AltToken):
pass
class ColonToken(AltToken):
pass
class BracedToken(AltToken):
def __repr__(self):
return '{' + self.text + '}'
class RuleToken(AltToken):
def __repr__(self):
return '<' + self.text + '>'
class CapitalWordToken(AltToken):
pass
class ParameterNameToken(AltToken):
pass