[utils] Fixing js_to_json
This commit is contained in:
parent
58355a3bf1
commit
9a2ef3f7fd
@ -2109,10 +2109,13 @@ def js_to_json(code):
|
||||
|
||||
return '"%s"' % v
|
||||
|
||||
# fixing , followed nothing, but comments
|
||||
# fixing unnecessary ? in /\*.*?\*/
|
||||
# fixing greedy comment
|
||||
return re.sub(r'''(?sx)
|
||||
"(?:[^"\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^"\\]*"|
|
||||
'(?:[^'\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^'\\]*'|
|
||||
/\*.*?\*/|,(?=\s*[\]}])|
|
||||
/\*[^*]*\*/|,(?=(\s|(/\*[^*]*\*/))*[\]}])|
|
||||
[a-zA-Z_][.a-zA-Z_0-9]*|
|
||||
\b(?:0[xX][0-9a-fA-F]+|0+[0-7]+)(?:\s*:)?|
|
||||
[0-9]+(?=\s*:)
|
||||
|
Loading…
x
Reference in New Issue
Block a user