Make kv string detection more robust.

Should make all legal python quoting legal in KV. Including mutliline text.
This commit is contained in:
matham 2016-02-18 19:50:03 -05:00
parent 6b2bffffa6
commit 08926eb4a1
1 changed files with 5 additions and 1 deletions

View File

@ -34,7 +34,11 @@ Cache.register('kv.lang')
__KV_INCLUDES__ = []
# precompile regexp expression
lang_str = re.compile('([\'"][^\'"]*[\'"])')
lang_str = re.compile(
"((?:'''.*?''')|"
"(?:(?:(?<!')|''')'(?:[^']|\\\\')+?'(?:(?!')|'''))|"
'(?:""".*?""")|'
'(?:(?:(?<!")|""")"(?:[^"]|\\\\")+?"(?:(?!")|""")))', re.DOTALL)
lang_key = re.compile('([a-zA-Z_]+)')
lang_keyvalue = re.compile('([a-zA-Z_][a-zA-Z0-9_.]*\.[a-zA-Z0-9_.]+)')
lang_tr = re.compile('(_\()')