Commit Graph

7723 Commits

Author SHA1 Message Date
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
Windel Bouwman
8aaadb16c0 Merge pull request #234 from johndaniels/indentation
Handle mixed spaces and tabs.
2018-12-17 11:55:20 +01:00
Windel Bouwman
1b13b0c4e2 Merge pull request #231 from johndaniels/format
Add format builtin and String formatting stuff.
2018-12-17 11:50:14 +01:00
Gitea
9468b657d2 Run cargo fmt. 2018-12-16 17:40:25 -05:00
Gitea
c74cd90d8e Handle mixed spaces and tabs.
This allows the parser to handle tabs and spaces. Currently it
requires that spaces come after any tabs, which is slightly more
strict than python3. It also requires that neighboring indentation
levels have either both more spaces and tabs or less spaces and
tabs so that tab size can't make perception of indentation
differ from what the parser interprets.

I didn't opt to implement PartialOrd on IndentationLevel because I
wasn't sure that the comparison logic would meet the logical
requirements for that trait. One could easily switch to having it
implement PartialOrd though. This would necessitate switching to
manually implementing PartialEq so that it's behavior 'matches'.
It's unclear from the docs what 'matches' exactly means so for
now I'm avoiding implementing the traits.
2018-12-16 17:11:37 -05:00
Gitea
95d4073dd8 Add newline to end of file.
The parser currently doesn't handle missing newline gracefully.
2018-12-16 16:21:40 -05:00
Gitea
a6288acd22 Cargo format. 2018-12-16 15:48:59 -05:00
Gitea
bbe4844f6c Fix snippet to not use tab.
We should add support for '\t', but that should probably be a separate ticket.
2018-12-16 15:43:07 -05:00
Ross Jones
ae2f7ed1cb Implements __mul__ for lists
Implements __mul__ for lists so that it is possible to do things like

```
s = [1, 2,] * 3
s == [1, 2, 1, 2, 1, 2]
```
2018-12-16 12:22:31 +00:00
Gitea
b726e675ff Add format builtin and String formatting stuff.
This includes everything needed to call str.format with integers
as positional and keyword parameters.
2018-12-15 19:46:09 -05:00
coolreader18
a796b134a5 Allow injecting JS variables into python with eval_py()
eval_py(`return js_vars["a"]`, { a: 9 }) == 9
2018-12-15 12:20:03 -06:00
coolreader18
e78a25132e Remove dependency on num_bigint 2018-12-15 11:38:08 -06:00
coolreader18
3be6fee737 Clarify names of wasm builtins 2018-12-15 11:36:53 -06:00
coolreader18
921efd4d14 Switch to using json.dumps for py_to_js() 2018-12-15 11:33:37 -06:00
coolreader18
2ae1df590e Rename run_code() to run_from_textbox() 2018-12-15 01:41:25 -06:00
coolreader18
f8cce25f69 Formatting; move the + '\n' hack to eval(). 2018-12-15 01:31:44 -06:00
coolreader18
b428f2e3b3 Improve demo site 2018-12-15 00:49:47 -06:00
Windel Bouwman
62c53d8e5d Try to make it simpler to switch dict storage types. 2018-12-13 20:38:09 +01:00
Windel Bouwman
521f664e16 Merge pull request #229 from AgentMacklin/master
Added some of the missing str methods
2018-12-13 20:31:45 +01:00
Austen LeBeau
7ac22d96d1 update and added more functions 2018-12-13 12:02:18 -06:00
Windel Bouwman
a29e882bc1 Store dict key as pyobject into hashmap. 2018-12-13 17:05:01 +01:00
Windel Bouwman
e657633e51 Move set_item to context struct. 2018-12-12 22:27:28 +01:00
Windel Bouwman
4095e0cad7 Modify location of set_attr so that we are able to create str python objects for the dictionary. 2018-12-12 22:06:19 +01:00
Windel Bouwman
31f50eda3d Merge pull request #226 from RustPython/demo-error
[WASM] Catch errors and show it in the standard output textarea
2018-12-12 20:01:31 +01:00
Windel Bouwman
0215830aaa Move set_attr and set_item to context. 2018-12-12 19:41:09 +01:00
Austen LeBeau
dd2b4e3c25 added isalnum, isalpha, isdigit, swapcase 2018-12-12 12:01:35 -06:00
Windel Bouwman
5c04ad8aae Make underlying dict type more hidden. 2018-12-12 15:13:40 +01:00
Austen LeBeau
07336fa984 initial fork commit 2018-12-11 22:44:56 -06:00
Shing Lyu
6021fca8cd [WASM] Print the Rust panic to the output textarea 2018-12-11 21:50:25 +01:00
Shing Lyu
fabc67985a Make the run button bigger so it doesn't overflow 2018-12-11 21:38:02 +01:00
Windel Bouwman
95092be36d Merge pull request #225 from RustPython/test-demo
Fixed the travis build for deploying the demo page
2018-12-11 20:22:13 +01:00
Shing Lyu
0159051e95 Updated README about WASM build 2018-12-10 23:13:54 +01:00
Shing Lyu
13a9922d93 Fix the demo page travis build 2018-12-10 23:07:15 +01:00
Windel Bouwman
b46fc938d4 Merge pull request #224 from RustPython/readme-demo
Update README, adding demo and instruction for how to update doc
2018-12-10 22:18:37 +01:00
Shing Lyu
160cfe6155 Added link to online demo in README 2018-12-10 21:58:43 +01:00
Windel Bouwman
8345acc402 Change rustfmt check to stable. 2018-12-10 21:33:23 +01:00
Shing Lyu
bb4454912e Added instruction on updating online doc and demo page 2018-12-10 20:45:12 +01:00
Windel Bouwman
69d21e0ebb Merge pull request #222 from RustPython/wasm-output-pure-rs
[WASM] Print STDOUT to textarea on the demo page
2018-12-09 22:13:00 +01:00
Shing Lyu
b2aa7ac2fb [WASM] Changed the demo to fibonacci calculation 2018-12-09 21:35:23 +01:00