Fix: regex doesn't match whole line. Add Parser representation to simplify debugging.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Mon, 10 Oct 2016 18:41:15 +0300
changeset 594 910efcf51ac0
parent 593 32de94c1b039
child 595 913528d11315
Fix: regex doesn't match whole line. Add Parser representation to simplify debugging.
py/gadict.py
--- a/py/gadict.py	Fri Oct 07 00:45:54 2016 +0300
+++ b/py/gadict.py	Mon Oct 10 18:41:15 2016 +0300
@@ -116,7 +116,7 @@
     HEADWORD_RE = regex.compile( u"^(\\p{L}.*)$" )
     HEADWORD_VAR_RE = regex.compile(u"^ +(s|pl|v[123]|male|female|comp|super|abbr|Am|Br|Au)$")
     HEADWORD_PRON_RE = regex.compile(u"^ +\\[([\p{L}' ]+)\\]$")
-    TRANSL_POS_RE = regex.compile(u"^n|det|pron|adj|v|adv|prep|conj|num|int|phr|phr\\.v|contr|abbr|prefix$")
+    TRANSL_POS_RE = regex.compile(u"^(?:n|det|pron|adj|v|adv|prep|conj|num|int|phr|phr\\.v|contr|abbr|prefix)$")
     TRANSL_RE = regex.compile(u"^(ru|uk|la|en): ([\\p{L}(].*)$")
     TRANSL_EX_RE = regex.compile(u"^(ru|uk|la|en)> ([-\\p{L}].*)$")
     TRANSL_GLOS_RE = regex.compile(u"^(ru|uk|la|en)= ([-\\p{L}].*)$")
@@ -357,3 +357,6 @@
                 continue
             raise ParseException("""Uknown syntax...""")
         self.tran = senses
+
+    def __repr__(self):
+        return u"<{:s}; line={:s}>".format(type(self).__name__, repr(self.line))