From 4657f91116675e930e24466e1cd18d689d9217df Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Thu, 10 Aug 2017 00:08:26 -0700 Subject: [PATCH] add a few comments to the date parser (since I keep forgetting) --- gramps/gen/datehandler/_dateparser.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gramps/gen/datehandler/_dateparser.py b/gramps/gen/datehandler/_dateparser.py index 3ef821e4c..4700ad862 100644 --- a/gramps/gen/datehandler/_dateparser.py +++ b/gramps/gen/datehandler/_dateparser.py @@ -451,6 +451,7 @@ class DateParser: self._abt2 = re.compile('<(.*)>', re.IGNORECASE) self._text = re.compile('%s\.?\s+(\d+)?\s*,?\s*((\d+)(/\d+)?)?\s*$' % self._mon_str, re.IGNORECASE) + # this next RE has the (possibly-slashed) year at the string's end self._text2 = re.compile('(\d+)?\s+?%s\.?\s*((\d+)(/\d+)?)?\s*$' % self._mon_str, re.IGNORECASE) self._jtext = re.compile('%s\s+(\d+)?\s*,?\s*((\d+)(/\d+)?)?\s*$' % self._jmon_str, @@ -521,7 +522,7 @@ class DateParser: def _parse_calendar(self, text, regex1, regex2, mmap, check=None): match = regex1.match(text.lower()) - if match: + if match: # user typed in month-name day year groups = match.groups() if groups[0] is None: m = 0 @@ -546,7 +547,7 @@ class DateParser: return value match = regex2.match(text.lower()) - if match: + if match: # user typed in day month-name year or year month-name day groups = match.groups() if self.ymd: if groups[3] is None: @@ -906,8 +907,6 @@ class DateParser: if subdate == Date.EMPTY and text != "": date.set_as_text(text) return - #else: - # print 'valid subdate', text, subdate except: date.set_as_text(text) return