fix unicode issue

This commit is contained in:
Eric Vergnaud 2016-12-13 21:33:19 +08:00
parent 2739a0c9ef
commit e15e88a049
1 changed files with 2 additions and 2 deletions

View File

@ -484,14 +484,14 @@ class DefaultErrorStrategy(ErrorStrategy):
expecting = self.getExpectedTokens(recognizer)
expectedTokenType = expecting[0] # get any element
if expectedTokenType==Token.EOF:
tokenText = "<missing EOF>"
tokenText = u"<missing EOF>"
else:
name = None
if expectedTokenType < len(recognizer.literalNames):
name = recognizer.literalNames[expectedTokenType]
if name is None and expectedTokenType < len(recognizer.symbolicNames):
name = recognizer.symbolicNames[expectedTokenType]
tokenText = "<missing " + str(name) + ">"
tokenText = u"<missing " + unicode(name) + u">"
current = currentSymbol
lookback = recognizer.getTokenStream().LT(-1)
if current.type==Token.EOF and lookback is not None: