# HG changeset patch # User Oleksandr Gavenko # Date 1459108559 -10800 # Node ID aa03182d2e269801561585650187d0320f7181a0 # Parent a6a7036f3c6f05cf912d6fea88c4f424d6ec82f3 Proper check for trailing spaces. diff -r a6a7036f3c6f -r aa03182d2e26 py/gadict.py --- 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):