Grammalecte  Check-in [b217bc2731]

Overview
Comment:[build] nnbsp in py2js() also
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: b217bc2731ca9ac44eb8c5f390abd805e0799017a76414e7f10f37be15b5c19f
User & Date: olr on 2021-01-21 21:12:52
Other Links: manifest | tags
Context
2021-01-22
11:34
[core][fr] fix bug in suggestions for JS check-in: a6f73e3a7b user: olr tags: core, fr, trunk
2021-01-21
21:12
[build] nnbsp in py2js() also check-in: b217bc2731 user: olr tags: build, trunk
18:04
[core][fr] tests suggestions for JS, suggestions update check-in: fb8de11c89 user: olr tags: core, fr, trunk
Changes

Modified compile_rules_js_convert.py from [4c8c5a2dbe] to [48401df6d7].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
"""
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('(r"', '("')
    sCode = sCode.replace("(r'", "('")
    sCode = sCode.replace(' r"', ' "')
    sCode = sCode.replace(" r'", " '")
    sCode = sCode.replace(',r"', ',"')
    sCode = sCode.replace(",r'", ",'")
    # operators












>







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