|
|
@@ -72,7 +72,12 @@ class Token(Str): |
|
|
|
__slots__ = ('type', 'pos_in_stream', 'value', 'line', 'column', 'end_line', 'end_column') |
|
|
|
|
|
|
|
def __new__(cls, type_, value, pos_in_stream=None, line=None, column=None): |
|
|
|
self = super(Token, cls).__new__(cls, value) |
|
|
|
try: |
|
|
|
self = super(Token, cls).__new__(cls, value) |
|
|
|
except UnicodeDecodeError: |
|
|
|
value = value.decode('latin1') |
|
|
|
self = super(Token, cls).__new__(cls, value) |
|
|
|
|
|
|
|
self.type = type_ |
|
|
|
self.pos_in_stream = pos_in_stream |
|
|
|
self.value = value |
|
|
|