Micha Reiser
f60e204b73
Fix range of keyword identifier ( #14 )
2023-06-22 10:00:25 +02:00
Micha Reiser
08ebbe40d7
Fix ArgWithDefault TextRange ( #13 )
2023-06-20 18:21:09 +02:00
Charlie Marsh
ed3b4eb72b
Add `TextRange` to `Identifier` ( #8 )
...
## Summary
This PR adds `TextRange` to `Identifier`. Right now, the AST only
includes ranges for identifiers in certain cases (`Expr::Name`,
`Keyword`, etc.), namely when the identifier comprises an entire AST
node. In Ruff, we do additional ad-hoc lexing to extract identifiers
from source code.
One frequent example: given a function `def f(): ...`, we lex to find
the range of `f`, for use in diagnostics.
Another: `except ValueError as e`, for which the AST doesn't include a
range for `e`.
Note that, as an optimization, we avoid storing the `TextRange` for
`Expr::Name`, since it's already included.
2023-06-20 11:19:27 -04:00
Charlie Marsh
f0d200c8a1
Remove `fold`, `unparse`, and `location` features ( #9 )
2023-06-19 17:26:17 -04:00
Charlie Marsh
8d74eee750
Make malachite-bigint an optional dependency for rustpython-format ( #12 )
2023-06-19 16:31:25 -04:00
Charlie Marsh
21aa0b8d84
Optimize `validate_arguments` ( #10 )
2023-06-19 15:32:58 -04:00
Charlie Marsh
9cb00518e5
Update snapshot tests
2023-06-19 13:16:07 -04:00
Micha Reiser
6f65c5cba7
Add `Decorator` node ( #7 )
2023-06-19 12:53:05 -04:00
Micha Reiser
8a415fa61e
Include argument parentheses in range ( #5 )
2023-06-19 12:51:18 -04:00
Micha Reiser
5054cbe84f
Merge branch 'RustPython:main' into main
2023-06-19 12:38:24 -04:00
Jeong, YunWon
69d27d924c
Rename unconventional nodes ( #74 )
2023-06-17 01:54:00 +09:00
Jeong, YunWon
5270020423
rustpython_ast python package ( #79 )
2023-06-17 01:32:27 +09:00
yt2b
edcfcb4a74
Fix bool format ( #91 )
...
* Fix format_bool
* Add test_format_bool
2023-06-15 14:56:03 +09:00
Jeong, YunWon
40a603208f
Add Pylyzer
...
done by https://github.com/mtshiba/pylyzer/pull/37
2023-06-11 21:56:59 +09:00
Jeong, YunWon
b2f95e2848
Fix LinearLocator \r handling ( #80 )
2023-06-02 22:35:53 +09:00
Steve Shi
a2e3209c42
Replace num-bigint with malachite-bigint ( #18 )
...
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2023-06-02 17:06:18 +09:00
Jeong, YunWon
5e9e8a7589
Linear Locator ( #46 )
2023-06-01 13:53:31 +09:00
Jeong, YunWon
fdec727f80
New Arguments and Arg/ArgWithDefault AST representation ( #59 )
2023-06-01 01:15:23 +09:00
Jeong, YunWon
3fbf4f6804
Parse for expr and stmt variants + identifier, constant ( #78 )
2023-05-31 20:03:46 +09:00
Micha Reiser
fe25708d89
Merge pull request #76 from astral-sh/match-case-end-location
2023-05-31 09:48:42 +02:00
Micha Reiser
342cd19f50
Add safety comment
2023-05-31 09:37:48 +02:00
Micha Reiser
4a2c4aad0b
Align `MatchCase` end location
2023-05-30 17:31:51 +02:00
Jeong, YunWon
ae3a477c97
Add parser deps to rustpython_ast_pyo3 ( #75 )
2023-05-29 16:48:05 +09:00
Jeong, YunWon
531aeb3511
Cmpop::as_str ( #72 )
...
* clean up pyo3 generation
* Cmpop::as_str
2023-05-29 01:53:54 +09:00
Jeong, YunWon
4de0cb1827
Parse Trait ( #71 )
2023-05-28 21:03:27 +09:00
Micha Reiser
5493c9f4e3
Avoid removing elements from the beginning of a vec ( #69 )
2023-05-25 19:44:49 +09:00
Jeong, YunWon
d23611db65
Merge pull request #65 from youknowone/refactor-pyo3
...
to_pyo3_ast to return &'py + Separate rustpython_ast_pyo3
2023-05-23 03:03:01 +09:00
Jeong YunWon
7d384d88d0
Separate rustpython_ast_pyo3
2023-05-23 02:50:12 +09:00
Jeong YunWon
b81273e9bc
to_pyo3_ast to return &'py
2023-05-23 00:12:22 +09:00
Micha Reiser
335780aeea
Merge pull request #2 from astral-sh/include-decorators-in-class-and-func-range
2023-05-22 13:46:38 +02:00
Jeong, YunWon
e1f02fced7
Fix Vec::to_pyo3_ast ( #63 )
2023-05-22 15:15:05 +09:00
Jeong, YunWon
d4084fb17a
impl From<T> for ast::Ast ( #62 )
2023-05-21 22:44:07 +09:00
Micha Reiser
41a0ef8740
Add test
2023-05-19 10:14:46 +02:00
Micha Reiser
25cc1da319
Include decorators in `Class` and `FunctionDef` range
2023-05-19 08:18:43 +02:00
Micha Reiser
33a3c407a9
Merge pull request #60 from astral-sh/reduce-copy
2023-05-19 08:16:28 +02:00
Micha Reiser
fac0c25343
Update `python.rs`
2023-05-19 08:08:35 +02:00
Micha Reiser
4ff779c298
Update parser/src/python.lalrpop
...
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2023-05-18 22:32:05 +02:00
Micha Reiser
726884b287
Avoid allocating `vec`s for each statement
2023-05-18 21:56:17 +02:00
Micha Reiser
851f23668f
Use named parameters to reducue copying
2023-05-18 21:41:06 +02:00
Jeong, YunWon
3654cf0bdf
Add `Ast` as top level enum ( #58 )
2023-05-19 01:53:39 +09:00
Jeong, YunWon
6c5c311bab
Fix range field order ( #56 )
...
* Skip validate_arguments when empty
* Fix `range` field order
* Fix unused variable
2023-05-18 21:44:01 +09:00
Jeong, YunWon
531e41ae2c
Upgrade bitflags to remove clippy wanrings ( #54 )
...
* Upgrade bitflags to remove clippy wanrings
* Fix python lint warnings
2023-05-18 01:50:00 +09:00
Jeong, YunWon
b48834fe2d
More flexible map_user and fold for new constructor nodes ( #53 )
...
* make fold.rs file
* Split user_map steps
* Fold for new constructor nodes
2023-05-18 00:16:04 +09:00
Jeong, YunWon
205ee80033
README ( #47 )
2023-05-17 18:01:00 +09:00
Jeong, YunWon
fc301ab1b0
Fix build ( #45 )
...
* remove dedent
* Revert parser-pyo3 crate
2023-05-16 23:54:49 +09:00
Jeong, YunWon
e820928f11
Add experimental pyo3-wrapper feature ( #41 )
...
* Fix pyo3 unit type value error
* Add experimental pyo3-wrapper feature
* location support
2023-05-16 23:45:31 +09:00
Jeong, YunWon
ff17f6e178
Add utilities to enum ( #44 )
...
* Add utilities to enum
* Fix unexpected pyo3 dependency propagation
2023-05-16 23:29:49 +09:00
Jeong YunWon
3bdf8a940a
Hash for ConversionFlag
2023-05-16 22:56:17 +09:00
Jeong, YunWon
9d47d3d212
specialize ConversionFlag ( #42 )
...
* specialize ConversionFlag
* Change value of ConversionFlag to i8 and None to -1
* is_* methods to ConversionFlag
2023-05-16 22:52:50 +09:00
Jeong, YunWon
611dcc2e9b
rustpython_ast + pyo3 ( #25 )
2023-05-16 18:06:54 +09:00