From ca3c9c8dd023982e092b77b0159f3a6b963ed47b Mon Sep 17 00:00:00 2001 From: Russell Jones Date: Tue, 29 Oct 2013 20:20:14 -0700 Subject: [PATCH] Made the display-name more relaxed, now allows you to have periods outside of qstrings. Violates RFC, but more conformant with what we see in the wild. --- flanker/addresslib/tokenizer.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/flanker/addresslib/tokenizer.py b/flanker/addresslib/tokenizer.py index 2d37177..08e5683 100644 --- a/flanker/addresslib/tokenizer.py +++ b/flanker/addresslib/tokenizer.py @@ -34,8 +34,16 @@ UNI_WHITE = re.compile(ur''' ]* ''', re.MULTILINE | re.VERBOSE | re.UNICODE) +# because we only use an atom in display-names, we've included a dot (.) which +# is normally not part of an atom. this allows us to be a little more relaxed +# in display-name parsing. ATOM = re.compile(r''' + [A-Za-z0-9\.!#$%&'*+\-/=?^_`{|}~]+ # atext + ''', re.MULTILINE | re.VERBOSE) + +DOT_ATOM = re.compile(r''' [A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+ # atext + (\.[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+)* # (dot atext)* ''', re.MULTILINE | re.VERBOSE) UNI_ATOM = re.compile(ur''' @@ -97,11 +105,6 @@ UNI_QSTR = re.compile(ur''' " ''', re.MULTILINE | re.VERBOSE | re.UNICODE) -DOT_ATOM = re.compile(r''' - [A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+ # atext - (\.[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+)* # (dot atext)* - ''', re.MULTILINE | re.VERBOSE) - QSTRING = re.compile(r''' " # dquote (\s* # whitespace -- 2.43.0