Commit Graph

811 Commits

Author SHA1 Message Date
Windel Bouwman
d425c26763 Merge pull request #245 from coolreader18/final-demo-improvements
Final demo improvements
2018-12-29 15:28:26 +01:00
coolreader18
231e3f2f16 Export PyEvalOptions in typescript defs 2018-12-28 21:57:41 -06:00
coolreader18
e65639f61a Remove yarn.lock 2018-12-28 21:43:13 -06:00
coolreader18
d7fdc5c177 Fix typescript hack 2018-12-28 14:42:43 -06:00
coolreader18
36997e12d9 Comment out WB's TS definitions using a hack 2018-12-28 14:35:45 -06:00
coolreader18
1d5df4130a Add doc comments and typescript custom section 2018-12-27 22:31:15 -06:00
coolreader18
b2772804f2 Add README and manifest fields for the WASM library 2018-12-27 21:06:59 -06:00
coolreader18
4cc7f5aa9c Merge #console and #code styles 2018-12-27 20:43:09 -06:00
coolreader18
1f02cc0fa3 Squash all demo commits onto one branch 2018-12-27 20:28:12 -06:00
Windel Bouwman
4c5b5845bb Merge pull request #244 from coolreader18/boxed-rustfunc
Change RustPyFunc from a fn pointer to a Fn trait
2018-12-27 20:23:22 +01:00
AgentMacklin
79a3b13252 Implement most of the string methods. (#239)
* implemented more functions

* backup

* Improve demo site

* Formatting; move the `+ '\n'` hack to eval().

* Rename run_code() to run_from_textbox()

* Switch to using json.dumps for py_to_js()

* Clarify names of wasm builtins

* Remove dependency on num_bigint

* Allow injecting JS variables into python with eval_py()

eval_py(`return js_vars["a"]`, { a: 9 }) == 9

* dict() now should work properly

e.g.
``` dict(a=2, b=3) == {"a": 2, "b": 3} ```

* Add documentation for eval_py() and update error message handling

Also, switch from iterating over the values of js_injections and
serializing each of them individually to asserting it's an object and
then just stringifying the whole thing.

* Finish revamping `dict_new()`

* Add 'from x import *' syntax.

This is a separate opcode in CPython so I added it as such here.

* Add test for dicts

* added functions

* ran rustfmt and fixed isidentifier

* fixed zfill and make_title

* python3.6 doesn't contain isascii()
2018-12-27 20:22:04 +01:00
coolreader18
8303743aab Remove RustPyFunc trait, just use Fn(..) everywhere 2018-12-27 11:50:14 -06:00
coolreader18
09602a2ec6 Change RustPyFunc from a fn pointer to a Fn trait 2018-12-27 09:18:00 -06:00
Windel Bouwman
f325ef1499 Merge pull request #240 from coolreader18/json-error
Have the json ser/de functions throw an exception instead of panicking
2018-12-27 09:20:52 +01:00
Windel Bouwman
978e7eabe3 Merge pull request #241 from coolreader18/formatted-exceptions
Format exceptions nicely (no more RefCell { value: .. }!)
2018-12-27 09:14:35 +01:00
coolreader18
8fee5a8800 Run cargo fmt --all 2018-12-27 00:12:08 -06:00
coolreader18
396842ef9d Readd conflicting files 2018-12-27 00:04:20 -06:00
coolreader18
dfadd03f95 Remove (now outdated) previously conflicting files 2018-12-27 00:02:33 -06:00
coolreader18
ada92d33a3 Add conflicting files 2018-12-27 00:01:20 -06:00
coolreader18
2968982a8f Change README portion for compiling wasm 2018-12-26 23:51:28 -06:00
coolreader18
877206dc47 Switch from shell to npm scripts for demo using webpack and @wasm-tool/wasm-pack-plugin
Also change travis deploy to use new demo directory.
2018-12-26 23:34:51 -06:00
coolreader18
0ac0432a53 Run cargo fmt 2018-12-26 18:23:40 -06:00
coolreader18
80573b0544 Format PyObject's correctly and nicely 2018-12-26 18:09:49 -06:00
coolreader18
d1a584f0fd Don't allocate a new string for each new type for the ExceptionZoo 2018-12-26 14:19:19 -06:00
coolreader18
a77b7e0ce4 Have json.* throw an exception instead of panicking 2018-12-26 14:18:15 -06:00
coolreader18
c38796bb49 Add some documentation for functions on the demo site 2018-12-26 13:25:56 -06:00
coolreader18
94d6a91873 Fix js_to_py with JS undefined 2018-12-26 13:21:29 -06:00
coolreader18
e0959b9384 Implement error conversion for js_to_py 2018-12-26 11:21:45 -06:00
coolreader18
132930ec82 Allow passing closures from JS to python via vars 2018-12-26 01:59:15 -06:00
coolreader18
63b3f3e71b Fix blanket impl of RustPyFunc 2018-12-24 15:51:54 -06:00
coolreader18
d1d958516d Change the instances of Fn(..) -> PyResult to a RustPyFunc trait alias 2018-12-24 15:45:45 -06:00
coolreader18
ffcd40b435 Remove conflicting files 2018-12-24 15:35:50 -06:00
coolreader18
24507de3b1 Re-add conflicting files 2018-12-24 15:34:52 -06:00
coolreader18
ab23f2c940 Use str.format for the demo 2018-12-24 15:28:49 -06:00
coolreader18
840c5072fb Improve UX for demo 2018-12-24 15:28:49 -06:00
coolreader18
d54d2b1c03 Make scripts executable 2018-12-24 15:28:49 -06:00
coolreader18
2ea9dca40c Add example, change some stuff in the demo to align with example 2018-12-24 15:28:49 -06:00
coolreader18
ca30ebcf5d Genericize the wasm lib to not be specifically for the demo
This included changing RustObjectKind::RustFunction.function to be
a `Box<Fn()>` instead of a `fn()` to support closures.
2018-12-24 15:28:49 -06:00
coolreader18
4c32693c7b Switch to using one workspace, move profile to root Cargo.toml 2018-12-24 15:28:49 -06:00
Windel Bouwman
946df53077 Merge pull request #237 from johndaniels/add-star-import
Add 'from x import *' syntax.
2018-12-23 17:55:34 +01:00
Gitea
ac3da8b453 Add 'from x import *' syntax.
This is a separate opcode in CPython so I added it as such here.
2018-12-22 22:40:02 -05:00
Windel Bouwman
366f3e2b13 Merge pull request #236 from coolreader18/proper-dict
Make `dict()` work like it does in cpython
2018-12-22 16:05:31 +01:00
coolreader18
427ce4347e Add test for dicts 2018-12-22 00:04:13 -06:00
coolreader18
f1784236af Finish revamping dict_new() 2018-12-21 23:35:45 -06:00
Shing Lyu
71ba5019bf Merge pull request #230 from coolreader18/master
Improve wasm demo website
2018-12-21 16:22:34 +01:00
coolreader18
e77f223538 Add documentation for eval_py() and update error message handling
Also, switch from iterating over the values of js_injections and
serializing each of them individually to asserting it's an object and
then just stringifying the whole thing.
2018-12-18 19:03:04 -06:00
coolreader18
03c619f79e Rearrange website directory and change webpack config 2018-12-18 18:22:30 -06:00
coolreader18
bdc80dc75b dict() now should work properly
e.g.
``` dict(a=2, b=3) == {"a": 2, "b": 3} ```
2018-12-18 01:34:00 -06:00
Windel Bouwman
950dbd1a77 Use new_list when constructing multiplied list. 2018-12-17 12:14:29 +01:00
Windel Bouwman
bbe333d6c7 Merge pull request #233 from rossjones/232-impl-mul-for-list
Implements __mul__ for lists
2018-12-17 11:55:44 +01:00