Noah
00f9d2247d
Make bytecode::Location Copy
2020-03-13 21:49:10 -05:00
Noah
04606e9057
Make Location Copy and remove all location.clone()s
2020-03-13 21:49:10 -05:00
Jeong YunWon
867152880a
positional only parameter support
2020-03-08 00:13:13 +09:00
Jeong YunWon
04c29f384e
&str::to_string -> &str::to_owned for variables
2020-02-05 22:55:34 +09:00
Jeong YunWon
7860fc877d
&str::to_string -> &str::to_owned for literals
2020-02-05 22:55:33 +09:00
Aviv Palivoda
9a599e81a4
Fix clippy warning
2019-12-27 10:27:51 +02:00
Aviv Palivoda
3827dbfc49
Parse FormattedValue spec in symboltable
2019-12-27 10:19:07 +02:00
Aviv Palivoda
de7f9efd54
Support expression in f-strings spec
2019-12-27 10:19:07 +02:00
Jeong YunWon
8adb8b5105
Fix clippy warnings
2019-12-21 18:49:48 +09:00
Jeong YunWon
23993c2833
implement SyntaxError attributes
2019-12-16 00:08:16 +09:00
Aviv Palivoda
aff1a6d53c
Fix caret diagnostics for mutiple lines
2019-11-29 11:32:45 +02:00
yanganto
28fbdffdc8
Provide caret diagnostics for SyntaxError
...
visualize syntax error with caret diagnostics in shell, eval, exec,
when the error statement and error location are provided.
2019-11-22 09:17:50 +08:00
Noah
a51a3e0e4b
Add a CompileContext
2019-11-07 00:04:51 -06:00
coolreader18
c39e0baab7
Add async for
2019-11-07 00:04:51 -06:00
Noah
19f62b97a3
Deduplicate async/normal with
compilation code
2019-11-07 00:04:51 -06:00
coolreader18
ae825125a5
Add async with, reorganize how with blocks work
2019-11-07 00:04:51 -06:00
coolreader18
3638591cde
Add coroutines, async/await functionality, and gen.close()
2019-11-07 00:04:50 -06:00
Aviv Palivoda
47c8f3756b
Merge pull request #1580 from seeeturtle/doc-f
...
Set docstring of function as None if not declared
2019-11-02 19:18:11 +02:00
joshua1b
30ab196fdc
Set docstring of function as None if not declared
...
In cpython, if there is no docstring declared in function definition,
the `__doc__` attribute of the function is None.
So this implements the behavior.
Fix #1523
2019-11-02 23:47:44 +09:00
ichyo
142a29be4a
Fix wrong const optimization for "1.0 / 0.0" case
...
In cpython, "1.0 / 0.0" raises ZeroDivisionError
```
>>> 1.0 / 0.0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: float division by zer
```
but RustPython doesn't
```
>>>>> 1.0 / 0.0
inf
```
This is because they emits different byte codes.
```
$ echo "1.0 / 0.0" > zero-div.py
$ python -m dis zero-div.py
1 0 LOAD_CONST 0 (1.0)
2 LOAD_CONST 1 (0.0)
4 BINARY_TRUE_DIVIDE
6 POP_TOP
8 LOAD_CONST 2 (None)
10 RETURN_VALUE
$ cargo run --example dis zero-div.py
zero-div.py:
0 LoadConst (inf)
1 Pop
2 LoadConst (None)
3 ReturnValue
```
This commit stops optimization for zero division case
to generate same byte codes.
2019-10-24 00:26:02 +09:00
coolreader18
0fd098569e
Change FunctionOpArg to CodeFlags, stored in CodeObject
2019-10-14 20:20:52 +00:00
ChJR
939b49dc81
Add build compatibility with rustc 1.36.0 since #1318 merged
2019-10-13 15:53:49 +09:00
Windel Bouwman
31b6e815f6
Merge pull request #1318 from youknowone/ast-module
...
ast module
2019-10-12 12:51:26 +02:00
Seo Sanghyeon
0000903a7d
Shut up Clippy
2019-10-12 18:18:45 +09:00
Jeong YunWon
f2b696a75b
Add mode to ast::parse
2019-10-12 18:12:36 +09:00
Seo Sanghyeon
407bb9e4cb
Implement IndentationError
2019-10-12 02:24:12 +09:00
Chris West (Faux)
2326b114c2
upgrade low-risk deps
2019-10-10 21:07:26 +01:00
Seo Sanghyeon
a1e228d4ee
Implement TabError
2019-10-05 10:12:02 +09:00
Seo Sanghyeon
fe4f8237ad
Raise TypeError for duplicate keyword arguments
2019-10-04 19:29:57 +09:00
Seo Sanghyeon
6c88f6af3d
Optimize BuildMap bytecode emission
2019-10-03 00:03:08 +09:00
coolreader18
0c3482e03a
Invert the inverted boolean
2019-09-28 00:41:41 -05:00
Noah
fee1b6f2c7
Only overwrite the locals in __build_class__ if it's a class
2019-09-28 00:41:41 -05:00
Noah
a29fb0de12
Bump crate versions
2019-09-25 11:57:38 -05:00
HyeockJinKim
18c243854e
Fix global declaration error in the function
...
Fix Global symbol to prevent syntax error
when global declaration for same variable in function.
Fixes #1353
2019-09-18 01:57:06 +09:00
coolreader18
bff58fd626
Remove useless_const optimization
...
There could be jump depending on the Pop being there, and then it
breaks.
2019-09-17 08:04:11 +02:00
coolreader18
b8726f03df
Don't emit None, ReturnValue if the last statement in a function is a return
2019-09-17 08:04:11 +02:00
coolreader18
e5f6d11a12
Add optimization to remove unused LoadConst operations
2019-09-17 08:04:11 +02:00
Noah
65c98069db
Merge pull request #1367 from j30ng/syntax-err-on-star
...
Return SyntaxError on Invalid Star Expression
2019-09-12 08:48:57 -05:00
j30ng
df4be1f9ce
Remove Enum Instruction::Unpack
2019-09-12 16:30:03 +09:00
j30ng
3b99c07a1e
Format Code with rustfmt
2019-09-12 04:36:31 +09:00
j30ng
5ce3f2c056
Return SyntaxError on Invalid Star Expression
2019-09-12 04:04:27 +09:00
HyeockJinKim
c852c5d272
nonlocal generate syntax error
...
If the scope depth is less than 2,
a syntax error occurs in nonlocal.
Fixes #1360
2019-09-12 01:13:47 +09:00
coolreader18
5919a1e1ba
Don't clone SymbolTables when analyzing
2019-09-07 18:12:02 -05:00
coolreader18
d7f99dc7b1
Fix class scopes by modifying symboltable
2019-09-07 01:29:11 -05:00
coolreader18
acce23b79b
Fix class vs method scopes
2019-09-05 00:27:16 -05:00
Windel Bouwman
f98d54f09f
Merge pull request #1336 from RustPython/comprehension-scope
...
Add symboltable scope for comprehensions.
2019-09-04 15:45:55 +02:00
Adam
4ae902f788
Merge pull request #1332 from RustPython/load_global_loading_local
...
load_global shouldn't load outermost locals.
2019-09-02 10:13:19 +01:00
Adam Kelly
f3ecba02b1
Be somewhat less conservative about declaring things global.
2019-09-02 09:35:29 +01:00
Windel Bouwman
024cf5db04
Add symboltable scope for comprehensions. Add _ast module nodes for comprehensions.
2019-09-01 22:31:16 +02:00
Adam Kelly
9c17d982ff
Be extremely conservative about guessing scopes when we don't know.
2019-08-31 16:39:27 +01:00