Commit graph

48 commits

Author SHA1 Message Date
Jeong YunWon
1125a529e7 CompilerError always contains source_path 2020-07-14 13:48:39 +09:00
TheAnyKey
60a787e3e0 fixed scoping issue, commented test with references to original version 2020-06-21 22:18:43 +00:00
TheAnyKey
162e5d02ab commented and cleaned up 2020-06-14 12:06:39 +00:00
TheAnyKey
71f2603556 completion of error handling for named expressions and scope handling improvements 2020-06-13 21:16:51 +00:00
TheAnyKey
50c0b99136 fixed scoping issue for nonlocals - now also indirect outer scopes are supported 2020-06-01 22:47:28 +00:00
TheAnyKey
097b6a1889 Implement Py38 named expression (PEP 572) (#1934)
* Initial implementation of named expression and  import  according CPython tests

* added new instruction with inversed evaluation order for dict comprehension, in other cases use regular evaluation order

* added further aspects to implementation, cleaned up, imported test from CPython

* implemented first parts of scoping enhancement and extended checks

* completion of name resolution ongoing, now more test passing, still warinings and cleanup required

* further optimization of name resolution in nested scopes

* Initialize the vm with imports from _io instead of io

* Add the OpenBSD support that I am smart enough to

* adapted grammer to full support, most test are passing now, esp. all invalids are passed. Cleaned up in symboltable

* more conditional compiling, this time for errors

* rustfmt was not pleased

* premature push, whoops

* Add expected_failure result type to jsontests

* Initial implementation of named expression and  import  according CPython tests

* added new instruction with inversed evaluation order for dict comprehension, in other cases use regular evaluation order

* added further aspects to implementation, cleaned up, imported test from CPython

* implemented first parts of scoping enhancement and extended checks

* completion of name resolution ongoing, now more test passing, still warinings and cleanup required

* further optimization of name resolution in nested scopes

* adapted grammer to full support, most test are passing now, esp. all invalids are passed. Cleaned up in symboltable

* Fixed nameing convention violation and removed unnecessary information from symbol resolution. Added some more comments.

* Fixed nameing convention violation and removed unnecessary information from symbol resolution. Added some more comments.

Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
Co-authored-by: Reuben Staley <lighthousemaniac@gmail.com>
2020-06-01 11:22:15 +02:00
Jeong YunWon
3f2b414fcc Merge pull request #1843 from RustPython/coolreader18/clippy-fixes
Fix some clippy lints that were previously 'allow'ed
2020-04-27 00:10:01 +09:00
HyeockJinKim
e85baf4dfb Remove unused variable
Removed unused `is_param` variable for symbol.

Closes RustPython#1879
2020-04-25 13:59:54 +09:00
Noah
c27abf862f Fix some clippy lints that were 'allow'ed 2020-04-05 14:55:51 -05:00
Jeong YunWon
04c29f384e &str::to_string -> &str::to_owned for variables 2020-02-05 22:55:34 +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
Jeong YunWon
23993c2833 implement SyntaxError attributes 2019-12-16 00:08:16 +09: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
fee1b6f2c7 Only overwrite the locals in __build_class__ if it's a class 2019-09-28 00:41:41 -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
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
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
Jeong YunWon
efecef9d48 Remove duplicated contains_key test 2019-08-31 00:25:16 +09:00
Jeong YunWon
a02ba6104f Fix scan_expression not to mark sequence as Load 2019-08-31 00:25:16 +09:00
Windel Bouwman
a0dcfdd57f Add scope type and other symboltable properties. 2019-08-29 19:16:45 +02:00
Windel Bouwman
39c095d12c Add Free enum variant to the symbol scope to be able to distuingish between true local and free variables. 2019-08-18 12:12:27 +02:00
Windel Bouwman
9b1771b483 Fix clippy warnings. Add proper names to symboltables. 2019-08-18 10:03:00 +02:00
Windel Bouwman
99b3532cae Merge pull request #1251 from RustPython/scope-detection
Extend AST python module. Add idea for scope detection.
2019-08-18 09:14:20 +02:00
coolreader18
7aac5b634f Fix weirdness with import submodules 2019-08-15 15:30:14 -05:00
Windel Bouwman
e0c3755777 Extend AST python module. Add idea for scope detection. 2019-08-14 20:43:23 +02:00
Windel Bouwman
3b876205e5 Improve symbol table processing. 2019-08-13 21:13:16 +02:00
Windel Bouwman
6128b2b46e Merge pull request #1232 from corona10/gh-1212
gh-1212: Fix scope_for_name to catch NameError properly
2019-08-12 07:32:02 +02:00
Dong-hee Na
5135c696e7 Fix scope_for_name to catch NameError properly 2019-08-12 10:19:31 +09:00
Windel Bouwman
4f9f9252e4 Improve the situation regarding boolean operations. 2019-08-11 20:20:15 +02:00
Windel Bouwman
b22698a6f1 Add variable annotation syntax. Simplify grammar for comprehensions. Add capital J suffix for complex numbers. 2019-08-07 15:31:24 +02:00
Windel Bouwman
7e9b3ddc1f Implement review comments and improve parsing a bit. 2019-07-25 23:54:31 +02:00
Windel Bouwman
9f7ef2050e Add location to expressions. Change symboltable to use flags for symbols. 2019-07-20 20:44:38 +02:00
Windel Bouwman
eab3b357dd Extend symtable module. 2019-07-19 22:05:35 +02:00
Windel Bouwman
5dc63b9e8e Implement suggestion from clippy. 2019-07-17 09:36:11 +02:00
Windel Bouwman
de2e496e1f Add initial draft of symtable module. 2019-07-16 22:04:38 +02:00
Windel Bouwman
69c4d0b240 Simplify import AST in line with CPython. 2019-07-15 21:00:28 +02:00
Aviv Palivoda
02c4064b85 Merge pull request #1112 from RustPython/parser-error-cleaning
parser error handling improvements.
2019-07-07 20:16:16 +03:00
Maxim Kurnikov
71cd8cad85 fix remaining clippy warnings 2019-07-07 06:27:07 +03:00
Windel Bouwman
888cb310e5 parser error handling improvements. 2019-07-06 20:18:18 +02:00
Aviv Palivoda
a932b729d8 Import all from_list in one __import__ call 2019-06-14 08:27:49 +03:00
coolreader18
064919348d Split off bytecode compilation into a separate crate 2019-06-12 21:43:43 -05:00