Differences From Artifact [4c8c5a2dbe]:
- File compile_rules_js_convert.py — part of check-in [16890053da] at 2020-08-19 10:09:13 on branch trunk — [core][build] code clarification: all functions about options in gc_options module (user: olr, size: 7600) [annotate] [blame] [check-ins using]
To Artifact [48401df6d7]:
- File compile_rules_js_convert.py — part of check-in [b217bc2731] at 2021-01-21 21:12:52 on branch trunk — [build] nnbsp in py2js() also (user: olr, size: 7639) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | + |
"""
Convert Python code and regexes to JavaScript code
"""
import copy
import re
import json
def py2js (sCode):
"convert Python code to JavaScript code"
# Python strings
sCode = sCode.replace(' ', ' ')
sCode = sCode.replace('(r"', '("')
sCode = sCode.replace("(r'", "('")
sCode = sCode.replace(' r"', ' "')
sCode = sCode.replace(" r'", " '")
sCode = sCode.replace(',r"', ',"')
sCode = sCode.replace(",r'", ",'")
# operators
|
| ︙ |