rapydscript-ng 0.7.18 → 0.7.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +40 -0
- package/CHANGELOG.md +49 -1
- package/README.md +22 -7
- package/bin/web-repl-export +2 -2
- package/package.json +2 -2
- package/publish.py +9 -8
- package/release/baselib-plain-pretty.js +1707 -1044
- package/release/baselib-plain-ugly.js +3 -1
- package/release/compiler.js +5530 -3366
- package/release/signatures.json +18 -17
- package/src/ast.pyj +3 -1
- package/src/baselib-builtins.pyj +14 -3
- package/src/baselib-containers.pyj +13 -6
- package/src/baselib-internal.pyj +5 -1
- package/src/baselib-str.pyj +15 -2
- package/src/lib/elementmaker.pyj +2 -2
- package/src/lib/gettext.pyj +8 -7
- package/src/lib/random.pyj +1 -0
- package/src/lib/re.pyj +4 -3
- package/src/lib/traceback.pyj +16 -4
- package/src/output/classes.pyj +33 -5
- package/src/output/codegen.pyj +5 -38
- package/src/output/comments.pyj +45 -0
- package/src/output/functions.pyj +30 -19
- package/src/output/modules.pyj +19 -6
- package/src/output/operators.pyj +50 -19
- package/src/output/statements.pyj +2 -2
- package/src/output/stream.pyj +13 -21
- package/src/parse.pyj +52 -36
- package/src/string_interpolation.pyj +6 -1
- package/src/tokenizer.pyj +8 -2
- package/test/baselib.pyj +10 -0
- package/test/classes.pyj +24 -0
- package/test/collections.pyj +8 -0
- package/test/functions.pyj +16 -0
- package/test/generic.pyj +39 -1
- package/test/internationalization.pyj +8 -2
- package/test/regexp.pyj +3 -2
- package/test/scoped_flags.pyj +2 -0
- package/test/starargs.pyj +43 -0
- package/test/str.pyj +19 -8
- package/tools/cli.js +6 -1
- package/tools/compiler.js +3 -3
- package/tools/embedded_compiler.js +3 -3
- package/tools/export.js +3 -3
- package/tools/gettext.js +5 -2
- package/tools/lint.js +24 -13
- package/tools/msgfmt.js +1 -1
- package/web-repl/env.js +7 -1
- package/.appveyor.yml +0 -13
- package/.npmignore +0 -9
- package/.travis.yml +0 -12
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
env:
|
|
4
|
+
CI: 'true'
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
name: Test on ${{ matrix.os }} Node ${{ matrix.node }} LANG ${{ matrix.lang }}
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
env:
|
|
11
|
+
LANG: ${{ matrix.lang }}
|
|
12
|
+
LC_ALL: ${{ matrix.lang }}
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
include:
|
|
16
|
+
- { node: 10.x, os: ubuntu-latest, lang: en_US.UTF-8 }
|
|
17
|
+
- { node: 12.x, os: ubuntu-latest, lang: de_DE.UTF-8}
|
|
18
|
+
- { node: 15.x, os: ubuntu-latest, lang: hi_IN.UTF-8 }
|
|
19
|
+
|
|
20
|
+
- { node: 15.x, os: macos-latest, lang: en_US.UTF-8 }
|
|
21
|
+
- { node: 15.x, os: windows-latest, lang: en_US.UTF-8 }
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout source code
|
|
25
|
+
uses: actions/checkout@master
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 10
|
|
28
|
+
|
|
29
|
+
- name: Set up Node ${{ matrix.node }}
|
|
30
|
+
uses: actions/setup-node@master
|
|
31
|
+
with:
|
|
32
|
+
node-version: ${{ matrix.node }}
|
|
33
|
+
|
|
34
|
+
- name: Install deps
|
|
35
|
+
run:
|
|
36
|
+
npm install --no-optional
|
|
37
|
+
|
|
38
|
+
- name: Test
|
|
39
|
+
run:
|
|
40
|
+
npm test
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
version 0.7.22
|
|
2
|
+
=======================
|
|
3
|
+
|
|
4
|
+
* Fix assignment operators other than the plain = not working with overload_getitem
|
|
5
|
+
* Fix dict.popitem() removing the first rather than the last item
|
|
6
|
+
|
|
7
|
+
version 0.7.21
|
|
8
|
+
=======================
|
|
9
|
+
|
|
10
|
+
* class decorators are now called after the class prototype is populated
|
|
11
|
+
* Fix len(range()) giving incorrect results
|
|
12
|
+
* Add support for {var=} to format strings
|
|
13
|
+
* Fix unary operators discarding parentheses
|
|
14
|
+
* Add a __module__ property to function objects
|
|
15
|
+
* Get isinstance working for int and float
|
|
16
|
+
|
|
17
|
+
version 0.7.20
|
|
18
|
+
========================
|
|
19
|
+
|
|
20
|
+
* lint: Fix using a tuple for destructuring assignment not registering the defined symbols
|
|
21
|
+
* Add head and body and base to elementmaker
|
|
22
|
+
* Make the gettext tools available in the embedded compiler
|
|
23
|
+
* re.pyj: Allow lookbehind assertions since they are supported in modern JS engines
|
|
24
|
+
|
|
25
|
+
version 0.7.19
|
|
26
|
+
========================
|
|
27
|
+
|
|
28
|
+
* Fix calling super-class methods in a method accepting `*args` not working
|
|
29
|
+
* Fix list.pypop() removing the first instead of the last element
|
|
30
|
+
* Fix exponentiation operator being used when js-version >= 6 rather than 7
|
|
31
|
+
* Disallow assignments in while conditionals
|
|
32
|
+
* Avoid unnecessary function annotations for functions that have empty signatures
|
|
33
|
+
* Fix handing of "not in" operator when LHS is also a binary operator with higher precedence
|
|
34
|
+
* Dont accept while statements without a trailing colon
|
|
35
|
+
* msgfmt: fix parsing of escapes in msg strings
|
|
36
|
+
* Fix missing enclosing brackets when translating an assert to an AssertionError
|
|
37
|
+
* Fix comments at the bottom of the file not being output
|
|
38
|
+
* Fix comments before first statement not being output for imported modules
|
|
39
|
+
* Fix outputting top-level comments preventing output of baselib
|
|
40
|
+
* Allow using NaN with the is operator
|
|
41
|
+
* Fix anonymous function definitions inside class definitions hoisting their variables into the class prototype.
|
|
42
|
+
* Fix gettext catalog generation when plurals are present
|
|
43
|
+
* Fix int() not working correctly on floating point numbers which have exponential string representations.
|
|
44
|
+
* Fix encoding of \u00ad
|
|
45
|
+
* Fir repeated calls to random.seed() with the same seed not fully resetting the RNG.
|
|
46
|
+
* Fix an error in handling chained binary operators involving comparison operators and an equality operator.
|
|
47
|
+
* Ensure repr() of set is always correct
|
|
48
|
+
|
|
1
49
|
version 0.7.18
|
|
2
50
|
==================
|
|
3
51
|
|
|
@@ -324,7 +372,7 @@ Major new features:
|
|
|
324
372
|
--------------------
|
|
325
373
|
|
|
326
374
|
* There is now an in browser REPL (Read-Eval-Print-Loop) for RapydScript,
|
|
327
|
-
available at: https://kovidgoyal.
|
|
375
|
+
available at: https://sw.kovidgoyal.net/rapydscript/repl/
|
|
328
376
|
|
|
329
377
|
* There is now a linter that performs pyflakes style of undefined/unused
|
|
330
378
|
checks.
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
RapydScript
|
|
2
2
|
===========
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
[](https://github.com/kovidgoyal/rapydscript-ng/actions?query=workflow%3ACI)
|
|
6
6
|
[](https://www.npmjs.com/package/rapydscript-ng)
|
|
7
7
|
[](https://www.npmjs.com/package/rapydscript-ng)
|
|
8
8
|
[](https://snyk.io/test/github/kovidgoyal/rapydscript-ng)
|
|
@@ -10,7 +10,7 @@ RapydScript
|
|
|
10
10
|
This is a fork of the original RapydScript that adds many new (not always
|
|
11
11
|
backwards compatible) features. For more on the forking, [see the bottom of this file](#reasons-for-the-fork)
|
|
12
12
|
|
|
13
|
-
[Try RapydScript-ng live via an in-browser REPL!](https://kovidgoyal.
|
|
13
|
+
[Try RapydScript-ng live via an in-browser REPL!](https://sw.kovidgoyal.net/rapydscript/repl/)
|
|
14
14
|
|
|
15
15
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
16
16
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
@@ -100,7 +100,7 @@ learn a new language/framework is to dive in.
|
|
|
100
100
|
Installation
|
|
101
101
|
------------
|
|
102
102
|
|
|
103
|
-
[Try RapydScript-ng live via an in-browser REPL!](https://kovidgoyal.
|
|
103
|
+
[Try RapydScript-ng live via an in-browser REPL!](https://sw.kovidgoyal.net/rapydscript/repl/)
|
|
104
104
|
|
|
105
105
|
First make sure you have installed the latest version of [node.js](https://nodejs.org/) (You may need to restart your computer after this step).
|
|
106
106
|
|
|
@@ -358,7 +358,7 @@ the example in the previous section).
|
|
|
358
358
|
|
|
359
359
|
Decorators
|
|
360
360
|
----------
|
|
361
|
-
Like Python, RapydScript supports
|
|
361
|
+
Like Python, RapydScript supports decorators.
|
|
362
362
|
|
|
363
363
|
```py
|
|
364
364
|
def makebold(fn):
|
|
@@ -379,6 +379,21 @@ def hello():
|
|
|
379
379
|
hello() # returns "<b><i>hello world</i></b>"
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
+
Class decorators are also supported with the caveat that the class properties
|
|
383
|
+
must be accessed via the prototype property. For example:
|
|
384
|
+
|
|
385
|
+
```py
|
|
386
|
+
|
|
387
|
+
def add_x(cls):
|
|
388
|
+
cls.prototype.x = 1
|
|
389
|
+
|
|
390
|
+
@add_x
|
|
391
|
+
class A:
|
|
392
|
+
pass
|
|
393
|
+
|
|
394
|
+
print(A.x) # will print 1
|
|
395
|
+
```
|
|
396
|
+
|
|
382
397
|
|
|
383
398
|
Self-Executing Functions
|
|
384
399
|
------------------------
|
|
@@ -1472,7 +1487,7 @@ may be more verbose:
|
|
|
1472
1487
|
|
|
1473
1488
|
You can embed the RapydScript compiler in your webpage so that you can have
|
|
1474
1489
|
your webapp directly compile user supplied RapydScript code into JavaScript.
|
|
1475
|
-
To do so, simply include the [embeddable rapydscript compiler](https://kovidgoyal.
|
|
1490
|
+
To do so, simply include the [embeddable rapydscript compiler](https://sw.kovidgoyal.net/rapydscript/repl/rapydscript.js)
|
|
1476
1491
|
in your page, and use it to compile arbitrary RapydScript code.
|
|
1477
1492
|
|
|
1478
1493
|
You create the compiler by calling: `RapydScript.create_embedded_compiler()` and compile
|
|
@@ -1486,7 +1501,7 @@ HTML below for an example.
|
|
|
1486
1501
|
<head>
|
|
1487
1502
|
<meta charset="UTF-8">
|
|
1488
1503
|
<title>Test embedded RapydScript</title>
|
|
1489
|
-
<script charset="UTF-8" src="https://kovidgoyal.
|
|
1504
|
+
<script charset="UTF-8" src="https://sw.kovidgoyal.net/rapydscript/repl/rapydscript.js"></script>
|
|
1490
1505
|
<script>
|
|
1491
1506
|
var compiler = RapydScript.create_embedded_compiler();
|
|
1492
1507
|
var js = compiler.compile("def hello_world():\n a='RapydScript is cool!'\n print(a)\n alert(a)");
|
package/bin/web-repl-export
CHANGED
|
@@ -18,7 +18,7 @@ var manifest = {}, total = 0;
|
|
|
18
18
|
total += manifest[x].length;
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
['web_repl.js', 'embedded_compiler.js', 'utils.js', 'completer.js'].forEach(function(x) {
|
|
21
|
+
['web_repl.js', 'embedded_compiler.js', 'utils.js', 'completer.js', 'msgfmt.js', 'gettext.js'].forEach(function(x) {
|
|
22
22
|
x = 'tools/' + x;
|
|
23
23
|
manifest[x] = fs.readFileSync(path.join(base, x), {'encoding':'utf-8'});
|
|
24
24
|
total += manifest[x].length;
|
|
@@ -68,7 +68,7 @@ rs += '// End embedded sha1 implementation }}}\n\n';
|
|
|
68
68
|
rs += 'var exports = namespace;\n';
|
|
69
69
|
rs += fs.readFileSync(path.join(base, 'tools', 'export.js'), {'encoding':'utf-8'});
|
|
70
70
|
rs += 'external_namespace.RapydScript = namespace;\n';
|
|
71
|
-
rs += '})(this)';
|
|
71
|
+
rs += '})(this);\n';
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
var base_dir = process.argv.slice(-1)[0];
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"start": "node bin/rapydscript",
|
|
15
15
|
"build-self": "node bin/rapydscript self --complete"
|
|
16
16
|
},
|
|
17
|
-
"version": "0.7.
|
|
17
|
+
"version": "0.7.22",
|
|
18
18
|
"license": "BSD-2-Clause",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=0.12.0"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"url": "https://github.com/kovidgoyal/rapydscript-ng.git"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"regenerator": ">= 0.
|
|
33
|
+
"regenerator": ">= 0.12.1",
|
|
34
34
|
"uglify-js": ">= 3.0.15"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
package/publish.py
CHANGED
|
@@ -17,20 +17,21 @@ version = m['version']
|
|
|
17
17
|
# Update the files in release/ from dev/
|
|
18
18
|
shutil.rmtree(os.path.join(base, 'release'))
|
|
19
19
|
shutil.copytree(os.path.join(base, 'dev'), os.path.join(base, 'release'))
|
|
20
|
-
subprocess.check_call(['git', 'add', os.path.join(base, 'release')])
|
|
21
|
-
if subprocess.check_output(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
# subprocess.check_call(['git', 'add', os.path.join(base, 'release')])
|
|
21
|
+
# if subprocess.check_output(
|
|
22
|
+
# 'git status --porcelain --untracked-files release'.split()).strip():
|
|
23
|
+
# subprocess.check_call([
|
|
24
|
+
# 'git', 'commit', '-m', 'Updating release build of compiler'])
|
|
25
|
+
# subprocess.check_call('git push'.split())
|
|
26
26
|
|
|
27
27
|
# Tag the release
|
|
28
|
-
subprocess.check_call('git tag -s v{0} -m version-{0}'.format(version).split())
|
|
29
|
-
subprocess.check_call(['git', 'push', 'origin', 'v'+version])
|
|
28
|
+
# subprocess.check_call('git tag -s v{0} -m version-{0}'.format(version).split())
|
|
29
|
+
# subprocess.check_call(['git', 'push', 'origin', 'v'+version])
|
|
30
30
|
|
|
31
31
|
# Update the web REPL
|
|
32
32
|
gh_pages = os.path.join(os.path.dirname(base), 'kovidgoyal.github.io')
|
|
33
33
|
subprocess.check_call([os.path.join(gh_pages, 'update-rapyd-repl.py')])
|
|
34
34
|
|
|
35
35
|
# Publish to NPM
|
|
36
|
+
subprocess.check_call(['npm', 'login'])
|
|
36
37
|
subprocess.check_call(['npm', 'publish', base])
|