[utils] Fix comment handling in js_to_json for Python <3.5

This commit is contained in:
TinyToweringTree 2020-01-29 08:47:05 +01:00
parent 13a91f1642
commit 3acb64abd5
1 changed files with 1 additions and 1 deletions

View File

@ -3984,7 +3984,7 @@ def js_to_json(code):
# This regular expression is based on this Stack Overflow answer:
# https://stackoverflow.com/a/25735600
code = re.sub(r'("(?:[^"\\]|\\[\s\S])*"|\'(?:[^\'\\]|\\[\s\S])*\')|[ \t]*//.*|[ \t]*/\*(?:[^*]|\*(?!/))*\*/',
'\\1', code)
lambda m: m.group(1) or '', code)
def fix_kv(m):
v = m.group(0)