Add new tokens
This commit is contained in:
parent
63437014b9
commit
403371f3f7
1 changed files with 14 additions and 1 deletions
|
|
@ -32,6 +32,12 @@ class TokenType(Enum):
|
||||||
QUOTE = 21
|
QUOTE = 21
|
||||||
DB_QUOTE = 22
|
DB_QUOTE = 22
|
||||||
|
|
||||||
|
COMMENT = 23
|
||||||
|
AND = 24
|
||||||
|
OR = 25
|
||||||
|
NOT = 26
|
||||||
|
IS = 27
|
||||||
|
|
||||||
|
|
||||||
class Token(object):
|
class Token(object):
|
||||||
|
|
||||||
|
|
@ -46,6 +52,10 @@ class Token(object):
|
||||||
'char': TokenType.CHAR,
|
'char': TokenType.CHAR,
|
||||||
'for': TokenType.FOR,
|
'for': TokenType.FOR,
|
||||||
'in': TokenType.IN,
|
'in': TokenType.IN,
|
||||||
|
'and': TokenType.AND,
|
||||||
|
'or': TokenType.OR,
|
||||||
|
'not': TokenType.NOT,
|
||||||
|
'is': TokenType.IS,
|
||||||
'(': TokenType.LEFT_BRACKET,
|
'(': TokenType.LEFT_BRACKET,
|
||||||
')': TokenType.RIGHT_BRACKET,
|
')': TokenType.RIGHT_BRACKET,
|
||||||
'=': TokenType.EQUALS,
|
'=': TokenType.EQUALS,
|
||||||
|
|
@ -61,7 +71,10 @@ class Token(object):
|
||||||
self.line = line
|
self.line = line
|
||||||
self.col = col
|
self.col = col
|
||||||
|
|
||||||
def __str__(self):
|
def __repr__(self):
|
||||||
return ('Token(type: {}, content: {}, '
|
return ('Token(type: {}, content: {}, '
|
||||||
'line: {}, col: {})'.format(self.token_type, self.content,
|
'line: {}, col: {})'.format(self.token_type, self.content,
|
||||||
self.line, self.col))
|
self.line, self.col))
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.__repr__()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue