Further cleanup and source formatting.

This commit is contained in:
Griatch 2015-11-18 14:08:09 +01:00
parent d41b1437f2
commit f7083b2d5d

View file

@ -124,16 +124,16 @@ except AttributeError:
# regex definitions
_RE_STARTTOKEN = re.compile(r"(?<!\\)\$(\w+)\{") # unescaped $funcname( (start of function call)
_RE_STARTTOKEN = re.compile(r"(?<!\\)\$(\w+)\{") # unescaped $funcname{ (start of function call)
_RE_TOKEN = re.compile(r"""(?<!\\)\'\'\'(?P<singlequote>.*?)(?<!\\)\'\'\'| # unescaped single-triples (escapes all inside them)
(?<!\\)\"\"\"(?P<doublequote>.*?)(?<!\\)\"\"\"| # unescaped triple quotes (escapes all inside them)
(?P<comma>(?<!\\)\,)| # unescaped , (argument lists) - this is thrown away
(?P<end>(?<!\\)\})| # unescaped ) (end of function call)
(?P<start>(?<!\\)\$\w+\{)| # unescaped $funcname( (start of function call)
(?P<escaped>\\'|\\"|\\\)|\\$\w+\{)| # escaped tokens should appear in text
(?P<rest>[\w\s.-\/#!%\^&\*;:=\-_`~()\[\]]+) # everything else should also be included
""",
_RE_TOKEN = re.compile(r"""
(?<!\\)\'\'\'(?P<singlequote>.*?)(?<!\\)\'\'\'| # unescaped single-triples (escapes all inside them)
(?<!\\)\"\"\"(?P<doublequote>.*?)(?<!\\)\"\"\"| # unescaped triple quotes (escapes all inside them)
(?P<comma>(?<!\\)\,)| # unescaped , (argument separator)
(?P<end>(?<!\\)\})| # unescaped } (end of function call)
(?P<start>(?<!\\)\$\w+\{)| # unescaped $funcname{ (start of function call)
(?P<escaped>\\'|\\"|\\\)|\\$\w+\{)| # escaped tokens should re-appear in text
(?P<rest>[\w\s.-\/#!%\^&\*;:=\-_`~()\[\]]+) # everything else should also be included""",
re.UNICODE + re.IGNORECASE + re.VERBOSE + re.DOTALL)