# HG changeset patch # User Oleksandr Gavenko # Date 1476114075 -10800 # Node ID 910efcf51ac0f763ef511ef8b12788c41f621a32 # Parent 32de94c1b0395fd2d341c0eca888c9b5bd81c061 Fix: regex doesn't match whole line. Add Parser representation to simplify debugging. diff -r 32de94c1b039 -r 910efcf51ac0 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))