Proper check for trailing spaces.
--- a/py/gadict.py Sun Mar 27 22:43:45 2016 +0300
+++ b/py/gadict.py Sun Mar 27 22:55:59 2016 +0300
@@ -38,6 +38,8 @@
self.eof = len(self.line) == 0
if not self.eof:
self.lineno += 1
+ if self.TRAILING_SPACES_RE.search(self.line):
+ raise ParseException("Traling spaces detected...\n")
def parse(self, stream):
self.lineno = 0
@@ -48,8 +50,6 @@
while not self.eof:
self.parse_article()
except ParseException as ex:
- if self.TRAILING_SPACES_RE.match(self.line):
- raise ParseException("Traling spaces detected...\n", self.lineno, self.line) from ex
raise ParseException(ex.msg, self.lineno, self.line) from ex
return self.dom
@@ -111,7 +111,7 @@
if m is not None:
attrs.add(m.group(1))
continue
- raise ParseException("""Line is not headword or translation or headword attribute...""")
+ raise ParseException("""Line is not a headword or translation or headword attribute...""")
self.words[word] = (pron, attrs)
def parse_translation(self):