[jsinterp] Simpler string regex

This commit is contained in:
sulyi 2016-11-26 01:16:58 +01:00
parent 579c49447a
commit 287fd7f0cf

View File

@ -2110,8 +2110,8 @@ def js_to_json(code):
return '"%s"' % v
return re.sub(r'''(?sx)
"(?:[^"\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^"\\]*"|
'(?:[^'\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^'\\]*'|
"(?:[^'\\]|\\['"nurtbfx/\\])*"|
'(?:[^"\\]|\\['"nurtbfx/\\])*'|
,(?=(?:\s|(?:/\*(?:(?!\*/)(?:\n|.))*\*/))*[\]}])|
/\*(?:(?!\*/)(?:\n|.))*\*/|[a-zA-Z_][.a-zA-Z_0-9]*|
\b(?:0[xX][0-9a-fA-F]+|0+[0-7]+)(?:\s*:)?|