[voltLib] minor formatting

This commit is contained in:
moyogo 2015-12-08 16:33:34 +00:00
parent 08d3460850
commit 430b3d21a1
2 changed files with 4 additions and 3 deletions

View File

@ -30,10 +30,10 @@ class Lexer(object):
def __iter__(self):
return self
def next(self): # Python 2
def next(self): # Python 2
return self.__next__()
def __next__(self): # Python 3
def __next__(self): # Python 3
while True:
token_type, token, location = self.next_()
if token_type not in {Lexer.NEWLINE}:
@ -66,7 +66,7 @@ class Lexer(object):
self.scan_until_('"\r\n')
if self.pos_ < self.text_length_ and self.text_[self.pos_] == '"':
self.pos_ += 1
return (Lexer.STRING, text[start + 1:self.pos_ -1], location)
return (Lexer.STRING, text[start + 1:self.pos_ - 1], location)
else:
raise VoltLibError("Expected '\"' to terminate string",
location)

View File

@ -8,6 +8,7 @@ import unittest
def lex(s):
return [(typ, tok) for (typ, tok, _) in Lexer(s, "test.vtp")]
class LexerTest(unittest.TestCase):
def __init__(self, methodName):
unittest.TestCase.__init__(self, methodName)