Replace LALRPOP parser with hand-written parser (#10036)

(Supersedes #9152, authored by @LaBatata101)

## Summary

This PR replaces the current parser generated from LALRPOP to a
hand-written recursive descent parser.

It also updates the grammar for [PEP
646](https://peps.python.org/pep-0646/) so that the parser outputs the
correct AST. For example, in `data[*x]`, the index expression is now a
tuple with a single starred expression instead of just a starred
expression.

Beyond the performance improvements, the parser is also error resilient
and can provide better error messages. The behavior as seen by any
downstream tools isn't changed. That is, the linter and formatter can
still assume that the parser will _stop_ at the first syntax error. This
will be updated in the following months.

For more details about the change here, refer to the PR corresponding to
the individual commits and the release blog post.

## Test Plan

Write _lots_ and _lots_ of tests for both valid and invalid syntax and
verify the output.

## Acknowledgements

- @MichaReiser for reviewing 100+ parser PRs and continuously providing
guidance throughout the project
- @LaBatata101 for initiating the transition to a hand-written parser in
#9152
- @addisoncrump for implementing the fuzzer which helped
[catch](https://github.com/astral-sh/ruff/pull/10903)
[a](https://github.com/astral-sh/ruff/pull/10910)
[lot](https://github.com/astral-sh/ruff/pull/10966)
[of](https://github.com/astral-sh/ruff/pull/10896)
[bugs](https://github.com/astral-sh/ruff/pull/10877)

---------

Co-authored-by: Victor Hugo Gomes <labatata101@linuxmail.org>
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
Dhruv Manilawala 2024-04-18 17:57:39 +05:30 committed by GitHub
parent e09180b1df
commit 13ffb5bc19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
852 changed files with 112948 additions and 103620 deletions

View file

@ -1,36 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
AnnAssign(
StmtAnnAssign {
range: 0..10,
target: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
annotation: Name(
ExprName {
range: 3..6,
id: "int",
ctx: Load,
},
),
value: Some(
NumberLiteral(
ExprNumberLiteral {
range: 9..10,
value: Int(
1,
),
},
),
),
simple: true,
},
),
]

View file

@ -1,63 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..15,
targets: [
Attribute(
ExprAttribute {
range: 0..3,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
attr: Identifier {
id: "y",
range: 2..3,
},
ctx: Store,
},
),
],
value: Tuple(
ExprTuple {
range: 6..15,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 7..8,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 10..11,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 13..14,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,60 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
For(
StmtFor {
range: 0..24,
is_async: false,
target: Name(
ExprName {
range: 4..5,
id: "x",
ctx: Store,
},
),
iter: Tuple(
ExprTuple {
range: 9..18,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 10..11,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 13..14,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
body: [
Pass(
StmtPass {
range: 20..24,
},
),
],
orelse: [],
},
),
]

View file

@ -1,68 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..18,
targets: [
List(
ExprList {
range: 0..6,
elts: [
Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
Name(
ExprName {
range: 4..5,
id: "y",
ctx: Store,
},
),
],
ctx: Store,
},
),
],
value: Tuple(
ExprTuple {
range: 9..18,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 10..11,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 13..14,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,79 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..26,
targets: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
],
value: ListComp(
ExprListComp {
range: 4..26,
elt: Name(
ExprName {
range: 5..6,
id: "y",
ctx: Load,
},
),
generators: [
Comprehension {
range: 7..25,
target: Name(
ExprName {
range: 11..12,
id: "y",
ctx: Store,
},
),
iter: Tuple(
ExprTuple {
range: 16..25,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 17..18,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 20..21,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 23..24,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
ifs: [],
is_async: false,
},
],
},
),
},
),
]

View file

@ -1,53 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..13,
targets: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
],
value: Tuple(
ExprTuple {
range: 4..13,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 5..6,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 8..9,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 11..12,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,39 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
If(
StmtIf {
range: 0..14,
test: Named(
ExprNamed {
range: 3..8,
target: Name(
ExprName {
range: 3..4,
id: "x",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 7..8,
value: Int(
1,
),
},
),
},
),
body: [
Pass(
StmtPass {
range: 10..14,
},
),
],
elif_else_clauses: [],
},
),
]

View file

@ -1,79 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..26,
targets: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
],
value: SetComp(
ExprSetComp {
range: 4..26,
elt: Name(
ExprName {
range: 5..6,
id: "y",
ctx: Load,
},
),
generators: [
Comprehension {
range: 7..25,
target: Name(
ExprName {
range: 11..12,
id: "y",
ctx: Store,
},
),
iter: Tuple(
ExprTuple {
range: 16..25,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 17..18,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 20..21,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 23..24,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
ifs: [],
is_async: false,
},
],
},
),
},
),
]

View file

@ -1,75 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..19,
targets: [
Tuple(
ExprTuple {
range: 0..7,
elts: [
Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
Starred(
ExprStarred {
range: 4..6,
value: Name(
ExprName {
range: 5..6,
id: "y",
ctx: Store,
},
),
ctx: Store,
},
),
],
ctx: Store,
parenthesized: true,
},
),
],
value: Tuple(
ExprTuple {
range: 10..19,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 11..12,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 14..15,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 17..18,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,66 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..16,
targets: [
Subscript(
ExprSubscript {
range: 0..4,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 2..3,
id: "y",
ctx: Load,
},
),
ctx: Store,
},
),
],
value: Tuple(
ExprTuple {
range: 7..16,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 8..9,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 11..12,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 14..15,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,69 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..18,
targets: [
Tuple(
ExprTuple {
range: 0..6,
elts: [
Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
Name(
ExprName {
range: 4..5,
id: "y",
ctx: Store,
},
),
],
ctx: Store,
parenthesized: true,
},
),
],
value: Tuple(
ExprTuple {
range: 9..18,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 10..11,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 13..14,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,41 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
With(
StmtWith {
range: 0..17,
is_async: false,
items: [
WithItem {
range: 5..11,
context_expr: NumberLiteral(
ExprNumberLiteral {
range: 5..6,
value: Int(
1,
),
},
),
optional_vars: Some(
Name(
ExprName {
range: 10..11,
id: "x",
ctx: Store,
},
),
),
},
],
body: [
Pass(
StmtPass {
range: 13..17,
},
),
],
},
),
]

View file

@ -1,62 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
AugAssign(
StmtAugAssign {
range: 0..16,
target: Attribute(
ExprAttribute {
range: 0..3,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
attr: Identifier {
id: "y",
range: 2..3,
},
ctx: Store,
},
),
op: Add,
value: Tuple(
ExprTuple {
range: 7..16,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 8..9,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 11..12,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 14..15,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,27 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
AugAssign(
StmtAugAssign {
range: 0..6,
target: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
op: Add,
value: NumberLiteral(
ExprNumberLiteral {
range: 5..6,
value: Int(
1,
),
},
),
},
),
]

View file

@ -1,65 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
AugAssign(
StmtAugAssign {
range: 0..17,
target: Subscript(
ExprSubscript {
range: 0..4,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 2..3,
id: "y",
ctx: Load,
},
),
ctx: Store,
},
),
op: Add,
value: Tuple(
ExprTuple {
range: 8..17,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 9..10,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 12..13,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 15..16,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,30 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Delete(
StmtDelete {
range: 0..7,
targets: [
Attribute(
ExprAttribute {
range: 4..7,
value: Name(
ExprName {
range: 4..5,
id: "x",
ctx: Load,
},
),
attr: Identifier {
id: "y",
range: 6..7,
},
ctx: Del,
},
),
],
},
),
]

View file

@ -1,20 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Delete(
StmtDelete {
range: 0..5,
targets: [
Name(
ExprName {
range: 4..5,
id: "x",
ctx: Del,
},
),
],
},
),
]

View file

@ -1,33 +0,0 @@
---
source: crates/ruff_python_parser/src/context.rs
expression: parse_ast
---
[
Delete(
StmtDelete {
range: 0..8,
targets: [
Subscript(
ExprSubscript {
range: 4..8,
value: Name(
ExprName {
range: 4..5,
id: "x",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 6..7,
id: "y",
ctx: Load,
},
),
ctx: Del,
},
),
],
},
),
]

View file

@ -1,73 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..23,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..17,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "a",
range: 9..10,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 12..13,
parameter: Parameter {
range: 12..13,
name: Identifier {
id: "b",
range: 12..13,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 19..23,
},
),
],
},
),
],
)

View file

@ -1,91 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..29,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..23,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "a",
range: 9..10,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 12..16,
parameter: Parameter {
range: 12..13,
name: Identifier {
id: "b",
range: 12..13,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 14..16,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 18..22,
parameter: Parameter {
range: 18..19,
name: Identifier {
id: "c",
range: 18..19,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 20..22,
value: Int(
30,
),
},
),
),
},
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 25..29,
},
),
],
},
),
],
)

View file

@ -1,100 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..39,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..33,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "a",
range: 9..10,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 12..16,
parameter: Parameter {
range: 12..13,
name: Identifier {
id: "b",
range: 12..13,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 14..16,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 18..22,
parameter: Parameter {
range: 18..19,
name: Identifier {
id: "c",
range: 18..19,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 20..22,
value: Int(
30,
),
},
),
),
},
],
kwarg: Some(
Parameter {
range: 24..32,
name: Identifier {
id: "kwargs",
range: 26..32,
},
annotation: None,
},
),
},
returns: None,
body: [
Pass(
StmtPass {
range: 35..39,
},
),
],
},
),
],
)

View file

@ -1,100 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..33,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..27,
posonlyargs: [],
args: [],
vararg: Some(
Parameter {
range: 6..11,
name: Identifier {
id: "args",
range: 7..11,
},
annotation: None,
},
),
kwonlyargs: [
ParameterWithDefault {
range: 13..14,
parameter: Parameter {
range: 13..14,
name: Identifier {
id: "a",
range: 13..14,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 16..20,
parameter: Parameter {
range: 16..17,
name: Identifier {
id: "b",
range: 16..17,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 18..20,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 22..26,
parameter: Parameter {
range: 22..23,
name: Identifier {
id: "c",
range: 22..23,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 24..26,
value: Int(
30,
),
},
),
),
},
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 29..33,
},
),
],
},
),
],
)

View file

@ -1,109 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..43,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..37,
posonlyargs: [],
args: [],
vararg: Some(
Parameter {
range: 6..11,
name: Identifier {
id: "args",
range: 7..11,
},
annotation: None,
},
),
kwonlyargs: [
ParameterWithDefault {
range: 13..14,
parameter: Parameter {
range: 13..14,
name: Identifier {
id: "a",
range: 13..14,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 16..20,
parameter: Parameter {
range: 16..17,
name: Identifier {
id: "b",
range: 16..17,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 18..20,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 22..26,
parameter: Parameter {
range: 22..23,
name: Identifier {
id: "c",
range: 22..23,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 24..26,
value: Int(
30,
),
},
),
),
},
],
kwarg: Some(
Parameter {
range: 28..36,
name: Identifier {
id: "kwargs",
range: 30..36,
},
annotation: None,
},
),
},
returns: None,
body: [
Pass(
StmtPass {
range: 39..43,
},
),
],
},
),
],
)

View file

@ -1,36 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..13,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 9..13,
},
),
],
},
),
],
)

View file

@ -1,36 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..13,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 9..13,
},
),
],
},
),
],
)

View file

@ -1,111 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..35,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..29,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 21..22,
parameter: Parameter {
range: 21..22,
name: Identifier {
id: "d",
range: 21..22,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 24..25,
parameter: Parameter {
range: 24..25,
name: Identifier {
id: "e",
range: 24..25,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 27..28,
parameter: Parameter {
range: 27..28,
name: Identifier {
id: "f",
range: 27..28,
},
annotation: None,
},
default: None,
},
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 31..35,
},
),
],
},
),
],
)

View file

@ -1,129 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..41,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..35,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 21..22,
parameter: Parameter {
range: 21..22,
name: Identifier {
id: "d",
range: 21..22,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 24..28,
parameter: Parameter {
range: 24..25,
name: Identifier {
id: "e",
range: 24..25,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 26..28,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 30..34,
parameter: Parameter {
range: 30..31,
name: Identifier {
id: "f",
range: 30..31,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 32..34,
value: Int(
30,
),
},
),
),
},
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 37..41,
},
),
],
},
),
],
)

View file

@ -1,138 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..51,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..45,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 21..22,
parameter: Parameter {
range: 21..22,
name: Identifier {
id: "d",
range: 21..22,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 24..28,
parameter: Parameter {
range: 24..25,
name: Identifier {
id: "e",
range: 24..25,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 26..28,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 30..34,
parameter: Parameter {
range: 30..31,
name: Identifier {
id: "f",
range: 30..31,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 32..34,
value: Int(
30,
),
},
),
),
},
],
kwarg: Some(
Parameter {
range: 36..44,
name: Identifier {
id: "kwargs",
range: 38..44,
},
annotation: None,
},
),
},
returns: None,
body: [
Pass(
StmtPass {
range: 47..51,
},
),
],
},
),
],
)

View file

@ -1,138 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..45,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..39,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
vararg: Some(
Parameter {
range: 18..23,
name: Identifier {
id: "args",
range: 19..23,
},
annotation: None,
},
),
kwonlyargs: [
ParameterWithDefault {
range: 25..26,
parameter: Parameter {
range: 25..26,
name: Identifier {
id: "d",
range: 25..26,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 28..32,
parameter: Parameter {
range: 28..29,
name: Identifier {
id: "e",
range: 28..29,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 30..32,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 34..38,
parameter: Parameter {
range: 34..35,
name: Identifier {
id: "f",
range: 34..35,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 36..38,
value: Int(
30,
),
},
),
),
},
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 41..45,
},
),
],
},
),
],
)

View file

@ -1,147 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..55,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..49,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
vararg: Some(
Parameter {
range: 18..23,
name: Identifier {
id: "args",
range: 19..23,
},
annotation: None,
},
),
kwonlyargs: [
ParameterWithDefault {
range: 25..26,
parameter: Parameter {
range: 25..26,
name: Identifier {
id: "d",
range: 25..26,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 28..32,
parameter: Parameter {
range: 28..29,
name: Identifier {
id: "e",
range: 28..29,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 30..32,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 34..38,
parameter: Parameter {
range: 34..35,
name: Identifier {
id: "f",
range: 34..35,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 36..38,
value: Int(
30,
),
},
),
),
},
],
kwarg: Some(
Parameter {
range: 40..48,
name: Identifier {
id: "kwargs",
range: 42..48,
},
annotation: None,
},
),
},
returns: None,
body: [
Pass(
StmtPass {
range: 51..55,
},
),
],
},
),
],
)

View file

@ -1,73 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..20,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..14,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 12..13,
parameter: Parameter {
range: 12..13,
name: Identifier {
id: "c",
range: 12..13,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 16..20,
},
),
],
},
),
],
)

View file

@ -1,92 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..29,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..23,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..13,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 11..13,
value: Int(
20,
),
},
),
),
},
],
args: [
ParameterWithDefault {
range: 18..22,
parameter: Parameter {
range: 18..19,
name: Identifier {
id: "c",
range: 18..19,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 20..22,
value: Int(
30,
),
},
),
),
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 25..29,
},
),
],
},
),
],
)

View file

@ -1,110 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..46,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..40,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..13,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 11..13,
value: Int(
20,
),
},
),
),
},
],
args: [
ParameterWithDefault {
range: 18..22,
parameter: Parameter {
range: 18..19,
name: Identifier {
id: "c",
range: 18..19,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 20..22,
value: Int(
30,
),
},
),
),
},
],
vararg: Some(
Parameter {
range: 24..29,
name: Identifier {
id: "args",
range: 25..29,
},
annotation: None,
},
),
kwonlyargs: [],
kwarg: Some(
Parameter {
range: 31..39,
name: Identifier {
id: "kwargs",
range: 33..39,
},
annotation: None,
},
),
},
returns: None,
body: [
Pass(
StmtPass {
range: 42..46,
},
),
],
},
),
],
)

View file

@ -1,73 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..20,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..14,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "b",
range: 9..10,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 12..13,
parameter: Parameter {
range: 12..13,
name: Identifier {
id: "c",
range: 12..13,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 16..20,
},
),
],
},
),
],
)

View file

@ -1,74 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
FunctionDef(
StmtFunctionDef {
range: 0..23,
is_async: false,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..17,
posonlyargs: [
ParameterWithDefault {
range: 6..7,
parameter: Parameter {
range: 6..7,
name: Identifier {
id: "a",
range: 6..7,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 12..13,
parameter: Parameter {
range: 12..13,
name: Identifier {
id: "b",
range: 12..13,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 15..16,
parameter: Parameter {
range: 15..16,
name: Identifier {
id: "c",
range: 15..16,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 19..23,
},
),
],
},
),
],
)

View file

@ -1,73 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..20,
value: Lambda(
ExprLambda {
range: 0..20,
parameters: Some(
Parameters {
range: 7..17,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "a",
range: 10..11,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 13..14,
parameter: Parameter {
range: 13..14,
name: Identifier {
id: "b",
range: 13..14,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 16..17,
parameter: Parameter {
range: 16..17,
name: Identifier {
id: "c",
range: 16..17,
},
annotation: None,
},
default: None,
},
],
kwarg: None,
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 19..20,
value: Int(
1,
),
},
),
},
),
},
),
],
)

View file

@ -1,91 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..26,
value: Lambda(
ExprLambda {
range: 0..26,
parameters: Some(
Parameters {
range: 7..23,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "a",
range: 10..11,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 13..17,
parameter: Parameter {
range: 13..14,
name: Identifier {
id: "b",
range: 13..14,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 15..17,
value: Int(
20,
),
},
),
),
},
ParameterWithDefault {
range: 19..23,
parameter: Parameter {
range: 19..20,
name: Identifier {
id: "c",
range: 19..20,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 21..23,
value: Int(
30,
),
},
),
),
},
],
kwarg: None,
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 25..26,
value: Int(
1,
),
},
),
},
),
},
),
],
)

View file

@ -1,27 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..9,
value: Lambda(
ExprLambda {
range: 0..9,
parameters: None,
body: NumberLiteral(
ExprNumberLiteral {
range: 8..9,
value: Int(
1,
),
},
),
},
),
},
),
],
)

View file

@ -1,99 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..29,
value: Lambda(
ExprLambda {
range: 0..29,
parameters: Some(
Parameters {
range: 7..26,
posonlyargs: [
ParameterWithDefault {
range: 7..8,
parameter: Parameter {
range: 7..8,
name: Identifier {
id: "a",
range: 7..8,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "b",
range: 10..11,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 16..17,
parameter: Parameter {
range: 16..17,
name: Identifier {
id: "c",
range: 16..17,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
ParameterWithDefault {
range: 22..23,
parameter: Parameter {
range: 22..23,
name: Identifier {
id: "d",
range: 22..23,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 25..26,
parameter: Parameter {
range: 25..26,
name: Identifier {
id: "e",
range: 25..26,
},
annotation: None,
},
default: None,
},
],
kwarg: None,
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 28..29,
value: Int(
0,
),
},
),
},
),
},
),
],
)

View file

@ -1,105 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..32,
value: Lambda(
ExprLambda {
range: 0..32,
parameters: Some(
Parameters {
range: 7..29,
posonlyargs: [
ParameterWithDefault {
range: 7..8,
parameter: Parameter {
range: 7..8,
name: Identifier {
id: "a",
range: 7..8,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "b",
range: 10..11,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 16..17,
parameter: Parameter {
range: 16..17,
name: Identifier {
id: "c",
range: 16..17,
},
annotation: None,
},
default: None,
},
],
vararg: Some(
Parameter {
range: 19..21,
name: Identifier {
id: "d",
range: 20..21,
},
annotation: None,
},
),
kwonlyargs: [
ParameterWithDefault {
range: 23..24,
parameter: Parameter {
range: 23..24,
name: Identifier {
id: "e",
range: 23..24,
},
annotation: None,
},
default: None,
},
],
kwarg: Some(
Parameter {
range: 26..29,
name: Identifier {
id: "f",
range: 28..29,
},
annotation: None,
},
),
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 31..32,
value: Int(
0,
),
},
),
},
),
},
),
],
)

View file

@ -1,73 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..17,
value: Lambda(
ExprLambda {
range: 0..17,
parameters: Some(
Parameters {
range: 7..14,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 7..8,
parameter: Parameter {
range: 7..8,
name: Identifier {
id: "a",
range: 7..8,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "b",
range: 10..11,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 13..14,
parameter: Parameter {
range: 13..14,
name: Identifier {
id: "c",
range: 13..14,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
1,
),
},
),
},
),
},
),
],
)

View file

@ -1,92 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..26,
value: Lambda(
ExprLambda {
range: 0..26,
parameters: Some(
Parameters {
range: 7..23,
posonlyargs: [
ParameterWithDefault {
range: 7..8,
parameter: Parameter {
range: 7..8,
name: Identifier {
id: "a",
range: 7..8,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 10..14,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "b",
range: 10..11,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 12..14,
value: Int(
20,
),
},
),
),
},
],
args: [
ParameterWithDefault {
range: 19..23,
parameter: Parameter {
range: 19..20,
name: Identifier {
id: "c",
range: 19..20,
},
annotation: None,
},
default: Some(
NumberLiteral(
ExprNumberLiteral {
range: 21..23,
value: Int(
30,
),
},
),
),
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 25..26,
value: Int(
1,
),
},
),
},
),
},
),
],
)

View file

@ -1,74 +0,0 @@
---
source: crates/ruff_python_parser/src/function.rs
expression: parse_ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..20,
value: Lambda(
ExprLambda {
range: 0..20,
parameters: Some(
Parameters {
range: 7..17,
posonlyargs: [
ParameterWithDefault {
range: 7..8,
parameter: Parameter {
range: 7..8,
name: Identifier {
id: "a",
range: 7..8,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "b",
range: 10..11,
},
annotation: None,
},
default: None,
},
],
args: [
ParameterWithDefault {
range: 16..17,
parameter: Parameter {
range: 16..17,
name: Identifier {
id: "c",
range: 16..17,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: NumberLiteral(
ExprNumberLiteral {
range: 19..20,
value: Int(
1,
),
},
),
},
),
},
),
],
)

View file

@ -1,33 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Expr(
StmtExpr {
range: 0..8,
value: Named(
ExprNamed {
range: 1..7,
target: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 6..7,
value: Int(
5,
),
},
),
},
),
},
),
],
)

View file

@ -1,40 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..12,
targets: [
Attribute(
ExprAttribute {
range: 0..7,
value: Name(
ExprName {
range: 0..3,
id: "foo",
ctx: Load,
},
),
attr: Identifier {
id: "bar",
range: 4..7,
},
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 10..12,
value: Int(
42,
),
},
),
},
),
],
)

View file

@ -1,51 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..12,
targets: [
Attribute(
ExprAttribute {
range: 0..7,
value: StringLiteral(
ExprStringLiteral {
range: 0..5,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 0..5,
value: "foo",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
attr: Identifier {
id: "y",
range: 6..7,
},
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 10..12,
value: Int(
42,
),
},
),
},
),
],
)

View file

@ -1,20 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
Module(
ModModule {
range: 0..9,
body: [
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 0..9,
kind: Shell,
value: "foo = 42",
},
),
],
},
),
)

View file

@ -1,76 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..21,
targets: [
List(
ExprList {
range: 0..9,
elts: [
Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
Name(
ExprName {
range: 4..5,
id: "y",
ctx: Store,
},
),
Name(
ExprName {
range: 7..8,
id: "z",
ctx: Store,
},
),
],
ctx: Store,
},
),
],
value: List(
ExprList {
range: 12..21,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 13..14,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 19..20,
value: Int(
3,
),
},
),
],
ctx: Load,
},
),
},
),
],
)

View file

@ -1,30 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..8,
targets: [
Name(
ExprName {
range: 0..3,
id: "foo",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 6..8,
value: Int(
42,
),
},
),
},
),
],
)

View file

@ -1,70 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..13,
targets: [
Subscript(
ExprSubscript {
range: 0..6,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
slice: Slice(
ExprSlice {
range: 2..5,
lower: Some(
NumberLiteral(
ExprNumberLiteral {
range: 2..3,
value: Int(
1,
),
},
),
),
upper: Some(
NumberLiteral(
ExprNumberLiteral {
range: 4..5,
value: Int(
2,
),
},
),
),
step: None,
},
),
ctx: Store,
},
),
],
value: List(
ExprList {
range: 9..13,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 10..12,
value: Int(
42,
),
},
),
],
ctx: Load,
},
),
},
),
],
)

View file

@ -1,71 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..13,
targets: [
Subscript(
ExprSubscript {
range: 0..6,
value: NumberLiteral(
ExprNumberLiteral {
range: 0..1,
value: Int(
5,
),
},
),
slice: Slice(
ExprSlice {
range: 2..5,
lower: Some(
NumberLiteral(
ExprNumberLiteral {
range: 2..3,
value: Int(
1,
),
},
),
),
upper: Some(
NumberLiteral(
ExprNumberLiteral {
range: 4..5,
value: Int(
2,
),
},
),
),
step: None,
},
),
ctx: Store,
},
),
],
value: List(
ExprList {
range: 9..13,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 10..12,
value: Int(
42,
),
},
),
],
ctx: Load,
},
),
},
),
],
)

View file

@ -1,36 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..9,
targets: [
Starred(
ExprStarred {
range: 0..4,
value: Name(
ExprName {
range: 1..4,
id: "foo",
ctx: Store,
},
),
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 7..9,
value: Int(
42,
),
},
),
},
),
],
)

View file

@ -1,44 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..9,
targets: [
Subscript(
ExprSubscript {
range: 0..4,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
slice: NumberLiteral(
ExprNumberLiteral {
range: 2..3,
value: Int(
0,
),
},
),
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 7..9,
value: Int(
42,
),
},
),
},
),
],
)

View file

@ -1,45 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..9,
targets: [
Subscript(
ExprSubscript {
range: 0..4,
value: NumberLiteral(
ExprNumberLiteral {
range: 0..1,
value: Int(
5,
),
},
),
slice: NumberLiteral(
ExprNumberLiteral {
range: 2..3,
value: Int(
0,
),
},
),
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 7..9,
value: Int(
42,
),
},
),
},
),
],
)

View file

@ -1,78 +0,0 @@
---
source: crates/ruff_python_parser/src/invalid.rs
expression: ast
---
Ok(
[
Assign(
StmtAssign {
range: 0..21,
targets: [
Tuple(
ExprTuple {
range: 0..9,
elts: [
Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
Name(
ExprName {
range: 4..5,
id: "y",
ctx: Store,
},
),
Name(
ExprName {
range: 7..8,
id: "z",
ctx: Store,
},
),
],
ctx: Store,
parenthesized: true,
},
),
],
value: Tuple(
ExprTuple {
range: 12..21,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 13..14,
value: Int(
1,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
2,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 19..20,
value: Int(
3,
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
],
)

View file

@ -5,8 +5,8 @@ expression: tokens
Err(
LexicalError {
error: OtherError(
"Invalid Token",
"Invalid decimal integer literal",
),
location: 0,
location: 0..85,
},
)

View file

@ -5,8 +5,8 @@ expression: tokens
Err(
LexicalError {
error: OtherError(
"Invalid Token",
"Invalid decimal integer literal",
),
location: 0,
location: 0..3,
},
)

View file

@ -48,7 +48,7 @@ expression: tokens
Err(
LexicalError {
error: IndentationError,
location: 20,
location: 18..20,
},
),
Ok(

View file

@ -1,75 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
FunctionDef(
StmtFunctionDef {
range: 0..34,
is_async: false,
decorator_list: [
Decorator {
range: 0..13,
expression: Name(
ExprName {
range: 1..13,
id: "my_decorator",
ctx: Load,
},
),
},
],
name: Identifier {
id: "test",
range: 18..22,
},
type_params: None,
parameters: Parameters {
range: 22..24,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 30..34,
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 36..73,
decorator_list: [
Decorator {
range: 36..52,
expression: Name(
ExprName {
range: 37..52,
id: "class_decorator",
ctx: Load,
},
),
},
],
name: Identifier {
id: "Abcd",
range: 59..63,
},
type_params: None,
arguments: None,
body: [
Pass(
StmtPass {
range: 69..73,
},
),
],
},
),
]

View file

@ -1,97 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Dict(
ExprDict {
range: 0..25,
keys: [
Some(
StringLiteral(
ExprStringLiteral {
range: 1..4,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 1..4,
value: "a",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
),
None,
Some(
StringLiteral(
ExprStringLiteral {
range: 16..19,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 16..19,
value: "d",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
),
],
values: [
StringLiteral(
ExprStringLiteral {
range: 6..9,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 6..9,
value: "b",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
Name(
ExprName {
range: 13..14,
id: "c",
ctx: Load,
},
),
StringLiteral(
ExprStringLiteral {
range: 21..24,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 21..24,
value: "e",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
],
},
)

View file

@ -1,322 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..29,
value: FString(
ExprFString {
range: 0..29,
value: FStringValue {
inner: Concatenated(
[
Literal(
StringLiteral {
range: 0..6,
value: "foo",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Unicode,
triple_quoted: false,
},
},
),
FString(
FString {
range: 7..15,
elements: [
Expression(
FStringExpressionElement {
range: 9..14,
expression: Name(
ExprName {
range: 10..13,
id: "bar",
ctx: Load,
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Double,
prefix: Regular,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 16..21,
value: "baz",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 22..29,
value: " some",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
],
),
},
},
),
},
),
Expr(
StmtExpr {
range: 30..59,
value: FString(
ExprFString {
range: 30..59,
value: FStringValue {
inner: Concatenated(
[
Literal(
StringLiteral {
range: 30..35,
value: "foo",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
FString(
FString {
range: 36..44,
elements: [
Expression(
FStringExpressionElement {
range: 38..43,
expression: Name(
ExprName {
range: 39..42,
id: "bar",
ctx: Load,
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Double,
prefix: Regular,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 45..51,
value: "baz",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Unicode,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 52..59,
value: " some",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
],
),
},
},
),
},
),
Expr(
StmtExpr {
range: 60..89,
value: FString(
ExprFString {
range: 60..89,
value: FStringValue {
inner: Concatenated(
[
Literal(
StringLiteral {
range: 60..65,
value: "foo",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
FString(
FString {
range: 66..74,
elements: [
Expression(
FStringExpressionElement {
range: 68..73,
expression: Name(
ExprName {
range: 69..72,
id: "bar",
ctx: Load,
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Double,
prefix: Regular,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 75..80,
value: "baz",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 81..89,
value: " some",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Unicode,
triple_quoted: false,
},
},
),
],
),
},
},
),
},
),
Expr(
StmtExpr {
range: 90..128,
value: FString(
ExprFString {
range: 90..128,
value: FStringValue {
inner: Concatenated(
[
Literal(
StringLiteral {
range: 90..96,
value: "foo",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Unicode,
triple_quoted: false,
},
},
),
FString(
FString {
range: 97..116,
elements: [
Literal(
FStringLiteralElement {
range: 99..103,
value: "bar ",
},
),
Expression(
FStringExpressionElement {
range: 103..108,
expression: Name(
ExprName {
range: 104..107,
id: "baz",
ctx: Load,
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
Literal(
FStringLiteralElement {
range: 108..115,
value: " really",
},
),
],
flags: FStringFlags {
quote_style: Double,
prefix: Regular,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 117..123,
value: "bar",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Unicode,
triple_quoted: false,
},
},
),
Literal(
StringLiteral {
range: 124..128,
value: "no",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
],
),
},
},
),
},
),
]

View file

@ -1,175 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Call(
ExprCall {
range: 0..141,
func: Attribute(
ExprAttribute {
range: 0..8,
value: StringLiteral(
ExprStringLiteral {
range: 0..3,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 0..3,
value: " ",
flags: StringLiteralFlags {
quote_style: Single,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
attr: Identifier {
id: "join",
range: 4..8,
},
ctx: Load,
},
),
arguments: Arguments {
range: 8..141,
args: [
Generator(
ExprGenerator {
range: 14..139,
elt: Name(
ExprName {
range: 14..17,
id: "sql",
ctx: Load,
},
),
generators: [
Comprehension {
range: 22..139,
target: Name(
ExprName {
range: 26..29,
id: "sql",
ctx: Store,
},
),
iter: Tuple(
ExprTuple {
range: 33..139,
elts: [
If(
ExprIf {
range: 43..80,
test: Name(
ExprName {
range: 65..70,
id: "limit",
ctx: Load,
},
),
body: BinOp(
ExprBinOp {
range: 43..61,
left: StringLiteral(
ExprStringLiteral {
range: 43..53,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 43..53,
value: "LIMIT %d",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
op: Mod,
right: Name(
ExprName {
range: 56..61,
id: "limit",
ctx: Load,
},
),
},
),
orelse: NoneLiteral(
ExprNoneLiteral {
range: 76..80,
},
),
},
),
If(
ExprIf {
range: 90..132,
test: Name(
ExprName {
range: 116..122,
id: "offset",
ctx: Load,
},
),
body: BinOp(
ExprBinOp {
range: 91..111,
left: StringLiteral(
ExprStringLiteral {
range: 91..102,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 91..102,
value: "OFFSET %d",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
op: Mod,
right: Name(
ExprName {
range: 105..111,
id: "offset",
ctx: Load,
},
),
},
),
orelse: NoneLiteral(
ExprNoneLiteral {
range: 128..132,
},
),
},
),
],
ctx: Load,
parenthesized: true,
},
),
ifs: [],
is_async: false,
},
],
parenthesized: false,
},
),
],
keywords: [],
},
},
)

View file

@ -1,399 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Module(
ModModule {
range: 0..929,
body: [
Expr(
StmtExpr {
range: 21..42,
value: BinOp(
ExprBinOp {
range: 27..40,
left: Name(
ExprName {
range: 27..28,
id: "a",
ctx: Load,
},
),
op: Mod,
right: Name(
ExprName {
range: 39..40,
id: "b",
ctx: Load,
},
),
},
),
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 66..73,
kind: Help2,
value: "a.foo",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 74..80,
kind: Help,
value: "a.foo",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 81..88,
kind: Help,
value: "a.foo",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 89..100,
kind: Help2,
value: "a.foo()",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 115..128,
kind: Magic,
value: "timeit a = b",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 129..147,
kind: Magic,
value: "timeit foo(b) % 3",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 148..176,
kind: Magic,
value: "alias showPath pwd && ls -a",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 177..205,
kind: Magic,
value: "timeit a = foo(b); b = 2",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 206..226,
kind: Magic,
value: "matplotlib --inline",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 227..253,
kind: Magic,
value: "matplotlib --inline",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 277..309,
kind: Shell,
value: "pwd && ls -a | sed 's/^/\\ /'",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 310..347,
kind: Shell,
value: "pwd && ls -a | sed 's/^/\\\\ /'",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 348..393,
kind: ShCap,
value: "cd /Users/foo/Library/Application\\ Support/",
},
),
FunctionDef(
StmtFunctionDef {
range: 566..626,
is_async: false,
decorator_list: [],
name: Identifier {
id: "foo",
range: 570..573,
},
type_params: None,
parameters: Parameters {
range: 573..575,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Return(
StmtReturn {
range: 581..626,
value: Some(
Compare(
ExprCompare {
range: 598..620,
left: Name(
ExprName {
range: 598..599,
id: "a",
ctx: Load,
},
),
ops: [
NotEq,
],
comparators: [
Name(
ExprName {
range: 619..620,
id: "b",
ctx: Load,
},
),
],
},
),
),
},
),
],
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 656..664,
kind: Paren,
value: "foo 1 2",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 665..673,
kind: Quote2,
value: "foo 1 2",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 674..682,
kind: Quote,
value: "foo 1 2",
},
),
For(
StmtFor {
range: 711..737,
is_async: false,
target: Name(
ExprName {
range: 715..716,
id: "a",
ctx: Store,
},
),
iter: Call(
ExprCall {
range: 720..728,
func: Name(
ExprName {
range: 720..725,
id: "range",
ctx: Load,
},
),
arguments: Arguments {
range: 725..728,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 726..727,
value: Int(
5,
),
},
),
],
keywords: [],
},
},
),
body: [
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 734..737,
kind: Shell,
value: "ls",
},
),
],
orelse: [],
},
),
Assign(
StmtAssign {
range: 739..748,
targets: [
Name(
ExprName {
range: 739..741,
id: "p1",
ctx: Store,
},
),
],
value: IpyEscapeCommand(
ExprIpyEscapeCommand {
range: 744..748,
kind: Shell,
value: "pwd",
},
),
},
),
AnnAssign(
StmtAnnAssign {
range: 749..763,
target: Name(
ExprName {
range: 749..751,
id: "p2",
ctx: Store,
},
),
annotation: Name(
ExprName {
range: 753..756,
id: "str",
ctx: Load,
},
),
value: Some(
IpyEscapeCommand(
ExprIpyEscapeCommand {
range: 759..763,
kind: Shell,
value: "pwd",
},
),
),
simple: true,
},
),
Assign(
StmtAssign {
range: 764..784,
targets: [
Name(
ExprName {
range: 764..767,
id: "foo",
ctx: Store,
},
),
],
value: IpyEscapeCommand(
ExprIpyEscapeCommand {
range: 770..784,
kind: Magic,
value: "foo bar",
},
),
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 786..791,
kind: Magic,
value: " foo",
},
),
Assign(
StmtAssign {
range: 792..813,
targets: [
Name(
ExprName {
range: 792..795,
id: "foo",
ctx: Store,
},
),
],
value: IpyEscapeCommand(
ExprIpyEscapeCommand {
range: 798..813,
kind: Magic,
value: "foo # comment",
},
),
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 838..842,
kind: Help,
value: "foo",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 843..852,
kind: Help2,
value: "foo.bar",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 853..865,
kind: Help,
value: "foo.bar.baz",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 866..874,
kind: Help2,
value: "foo[0]",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 875..885,
kind: Help,
value: "foo[0][1]",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 886..905,
kind: Help2,
value: "foo.bar[0].baz[1]",
},
),
IpyEscapeCommand(
StmtIpyEscapeCommand {
range: 906..929,
kind: Help2,
value: "foo.bar[0].baz[2].egg",
},
),
],
},
)

View file

@ -1,624 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Match(
StmtMatch {
range: 1..73,
subject: Dict(
ExprDict {
range: 7..18,
keys: [
Some(
StringLiteral(
ExprStringLiteral {
range: 8..14,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 8..14,
value: "test",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
),
],
values: [
NumberLiteral(
ExprNumberLiteral {
range: 16..17,
value: Int(
1,
),
},
),
],
},
),
cases: [
MatchCase {
range: 24..73,
pattern: MatchMapping(
PatternMatchMapping {
range: 29..52,
keys: [],
patterns: [],
rest: Some(
Identifier {
id: "rest",
range: 41..45,
},
),
},
),
guard: None,
body: [
Expr(
StmtExpr {
range: 62..73,
value: Call(
ExprCall {
range: 62..73,
func: Name(
ExprName {
range: 62..67,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 67..73,
args: [
Name(
ExprName {
range: 68..72,
id: "rest",
ctx: Load,
},
),
],
keywords: [],
},
},
),
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 74..177,
subject: Dict(
ExprDict {
range: 80..97,
keys: [
Some(
StringLiteral(
ExprStringLiteral {
range: 81..88,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 81..88,
value: "label",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
),
],
values: [
StringLiteral(
ExprStringLiteral {
range: 90..96,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 90..96,
value: "test",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
],
},
),
cases: [
MatchCase {
range: 103..177,
pattern: MatchMapping(
PatternMatchMapping {
range: 108..155,
keys: [
StringLiteral(
ExprStringLiteral {
range: 118..125,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 118..125,
value: "label",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
],
patterns: [
MatchAs(
PatternMatchAs {
range: 127..148,
pattern: Some(
MatchOr(
PatternMatchOr {
range: 127..139,
patterns: [
MatchClass(
PatternMatchClass {
range: 127..132,
cls: Name(
ExprName {
range: 127..130,
id: "str",
ctx: Load,
},
),
arguments: PatternArguments {
range: 130..132,
patterns: [],
keywords: [],
},
},
),
MatchSingleton(
PatternMatchSingleton {
range: 135..139,
value: None,
},
),
],
},
),
),
name: Some(
Identifier {
id: "label",
range: 143..148,
},
),
},
),
],
rest: None,
},
),
guard: None,
body: [
Expr(
StmtExpr {
range: 165..177,
value: Call(
ExprCall {
range: 165..177,
func: Name(
ExprName {
range: 165..170,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 170..177,
args: [
Name(
ExprName {
range: 171..176,
id: "label",
ctx: Load,
},
),
],
keywords: [],
},
},
),
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 178..218,
subject: Name(
ExprName {
range: 184..185,
id: "x",
ctx: Load,
},
),
cases: [
MatchCase {
range: 191..218,
pattern: MatchSequence(
PatternMatchSequence {
range: 196..203,
patterns: [
MatchValue(
PatternMatchValue {
range: 197..198,
value: NumberLiteral(
ExprNumberLiteral {
range: 197..198,
value: Int(
0,
),
},
),
},
),
MatchValue(
PatternMatchValue {
range: 200..201,
value: NumberLiteral(
ExprNumberLiteral {
range: 200..201,
value: Int(
1,
),
},
),
},
),
],
},
),
guard: None,
body: [
Assign(
StmtAssign {
range: 213..218,
targets: [
Name(
ExprName {
range: 213..214,
id: "y",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 217..218,
value: Int(
0,
),
},
),
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 219..259,
subject: Name(
ExprName {
range: 225..226,
id: "x",
ctx: Load,
},
),
cases: [
MatchCase {
range: 232..259,
pattern: MatchSequence(
PatternMatchSequence {
range: 237..244,
patterns: [
MatchValue(
PatternMatchValue {
range: 238..239,
value: NumberLiteral(
ExprNumberLiteral {
range: 238..239,
value: Int(
0,
),
},
),
},
),
MatchValue(
PatternMatchValue {
range: 241..242,
value: NumberLiteral(
ExprNumberLiteral {
range: 241..242,
value: Int(
1,
),
},
),
},
),
],
},
),
guard: None,
body: [
Assign(
StmtAssign {
range: 254..259,
targets: [
Name(
ExprName {
range: 254..255,
id: "y",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 258..259,
value: Int(
0,
),
},
),
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 260..297,
subject: Name(
ExprName {
range: 266..267,
id: "x",
ctx: Load,
},
),
cases: [
MatchCase {
range: 273..297,
pattern: MatchSequence(
PatternMatchSequence {
range: 278..282,
patterns: [
MatchValue(
PatternMatchValue {
range: 279..280,
value: NumberLiteral(
ExprNumberLiteral {
range: 279..280,
value: Int(
0,
),
},
),
},
),
],
},
),
guard: None,
body: [
Assign(
StmtAssign {
range: 292..297,
targets: [
Name(
ExprName {
range: 292..293,
id: "y",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 296..297,
value: Int(
0,
),
},
),
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 298..332,
subject: Tuple(
ExprTuple {
range: 304..306,
elts: [
Name(
ExprName {
range: 304..305,
id: "x",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
cases: [
MatchCase {
range: 312..332,
pattern: MatchAs(
PatternMatchAs {
range: 317..318,
pattern: None,
name: Some(
Identifier {
id: "z",
range: 317..318,
},
),
},
),
guard: None,
body: [
Pass(
StmtPass {
range: 328..332,
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 333..369,
subject: Tuple(
ExprTuple {
range: 339..343,
elts: [
Name(
ExprName {
range: 339..340,
id: "x",
ctx: Load,
},
),
Name(
ExprName {
range: 342..343,
id: "y",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
cases: [
MatchCase {
range: 349..369,
pattern: MatchAs(
PatternMatchAs {
range: 354..355,
pattern: None,
name: Some(
Identifier {
id: "z",
range: 354..355,
},
),
},
),
guard: None,
body: [
Pass(
StmtPass {
range: 365..369,
},
),
],
},
],
},
),
Match(
StmtMatch {
range: 370..407,
subject: Tuple(
ExprTuple {
range: 376..381,
elts: [
Name(
ExprName {
range: 376..377,
id: "x",
ctx: Load,
},
),
Name(
ExprName {
range: 379..380,
id: "y",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
cases: [
MatchCase {
range: 387..407,
pattern: MatchAs(
PatternMatchAs {
range: 392..393,
pattern: None,
name: Some(
Identifier {
id: "z",
range: 392..393,
},
),
},
),
guard: None,
body: [
Pass(
StmtPass {
range: 403..407,
},
),
],
},
],
},
),
]

View file

@ -1,833 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
Expr(
StmtExpr {
range: 2..17,
value: Tuple(
ExprTuple {
range: 2..17,
elts: [
BinOp(
ExprBinOp {
range: 2..14,
left: BinOp(
ExprBinOp {
range: 2..10,
left: Name(
ExprName {
range: 2..7,
id: "match",
ctx: Load,
},
),
op: Mult,
right: Name(
ExprName {
range: 9..10,
id: "a",
ctx: Load,
},
),
},
),
op: Add,
right: Name(
ExprName {
range: 13..14,
id: "b",
ctx: Load,
},
),
},
),
Name(
ExprName {
range: 16..17,
id: "c",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
},
),
Expr(
StmtExpr {
range: 43..60,
value: Tuple(
ExprTuple {
range: 43..60,
elts: [
BinOp(
ExprBinOp {
range: 43..57,
left: Name(
ExprName {
range: 43..48,
id: "match",
ctx: Load,
},
),
op: Mult,
right: BinOp(
ExprBinOp {
range: 51..56,
left: Name(
ExprName {
range: 51..52,
id: "a",
ctx: Load,
},
),
op: Add,
right: Name(
ExprName {
range: 55..56,
id: "b",
ctx: Load,
},
),
},
),
},
),
Name(
ExprName {
range: 59..60,
id: "c",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
},
),
Expr(
StmtExpr {
range: 86..103,
value: Call(
ExprCall {
range: 86..103,
func: Name(
ExprName {
range: 86..91,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 92..103,
args: [
Starred(
ExprStarred {
range: 93..99,
value: BinOp(
ExprBinOp {
range: 94..99,
left: Name(
ExprName {
range: 94..95,
id: "a",
ctx: Load,
},
),
op: Add,
right: Name(
ExprName {
range: 98..99,
id: "b",
ctx: Load,
},
),
},
),
ctx: Load,
},
),
Name(
ExprName {
range: 101..102,
id: "c",
ctx: Load,
},
),
],
keywords: [],
},
},
),
},
),
Expr(
StmtExpr {
range: 130..146,
value: BinOp(
ExprBinOp {
range: 130..146,
left: BinOp(
ExprBinOp {
range: 130..142,
left: Name(
ExprName {
range: 130..135,
id: "match",
ctx: Load,
},
),
op: Sub,
right: BinOp(
ExprBinOp {
range: 137..142,
left: Name(
ExprName {
range: 137..138,
id: "a",
ctx: Load,
},
),
op: Mult,
right: Name(
ExprName {
range: 141..142,
id: "b",
ctx: Load,
},
),
},
),
},
),
op: Add,
right: Name(
ExprName {
range: 145..146,
id: "c",
ctx: Load,
},
),
},
),
},
),
Expr(
StmtExpr {
range: 173..191,
value: BinOp(
ExprBinOp {
range: 173..191,
left: BinOp(
ExprBinOp {
range: 173..187,
left: Name(
ExprName {
range: 173..178,
id: "match",
ctx: Load,
},
),
op: Sub,
right: BinOp(
ExprBinOp {
range: 181..186,
left: Name(
ExprName {
range: 181..182,
id: "a",
ctx: Load,
},
),
op: Mult,
right: Name(
ExprName {
range: 185..186,
id: "b",
ctx: Load,
},
),
},
),
},
),
op: Add,
right: Name(
ExprName {
range: 190..191,
id: "c",
ctx: Load,
},
),
},
),
},
),
Expr(
StmtExpr {
range: 218..236,
value: BinOp(
ExprBinOp {
range: 218..236,
left: BinOp(
ExprBinOp {
range: 218..232,
left: Call(
ExprCall {
range: 218..228,
func: Name(
ExprName {
range: 218..223,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 224..228,
args: [
UnaryOp(
ExprUnaryOp {
range: 225..227,
op: USub,
operand: Name(
ExprName {
range: 226..227,
id: "a",
ctx: Load,
},
),
},
),
],
keywords: [],
},
},
),
op: Mult,
right: Name(
ExprName {
range: 231..232,
id: "b",
ctx: Load,
},
),
},
),
op: Add,
right: Name(
ExprName {
range: 235..236,
id: "c",
ctx: Load,
},
),
},
),
},
),
Expr(
StmtExpr {
range: 264..274,
value: Attribute(
ExprAttribute {
range: 264..274,
value: Call(
ExprCall {
range: 264..272,
func: Name(
ExprName {
range: 264..269,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 270..272,
args: [],
keywords: [],
},
},
),
attr: Identifier {
id: "a",
range: 273..274,
},
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 291..303,
value: Attribute(
ExprAttribute {
range: 291..303,
value: Call(
ExprCall {
range: 291..301,
func: Name(
ExprName {
range: 291..296,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 297..301,
args: [
Tuple(
ExprTuple {
range: 298..300,
elts: [],
ctx: Load,
parenthesized: true,
},
),
],
keywords: [],
},
},
),
attr: Identifier {
id: "a",
range: 302..303,
},
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 322..335,
value: Attribute(
ExprAttribute {
range: 322..335,
value: Call(
ExprCall {
range: 322..333,
func: Name(
ExprName {
range: 322..327,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 328..333,
args: [
Tuple(
ExprTuple {
range: 329..331,
elts: [],
ctx: Load,
parenthesized: true,
},
),
],
keywords: [],
},
},
),
attr: Identifier {
id: "a",
range: 334..335,
},
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 354..365,
value: Attribute(
ExprAttribute {
range: 354..365,
value: Subscript(
ExprSubscript {
range: 354..363,
value: Name(
ExprName {
range: 354..359,
id: "match",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 361..362,
id: "a",
ctx: Load,
},
),
ctx: Load,
},
),
attr: Identifier {
id: "b",
range: 364..365,
},
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 383..395,
value: Attribute(
ExprAttribute {
range: 383..395,
value: Subscript(
ExprSubscript {
range: 383..393,
value: Name(
ExprName {
range: 383..388,
id: "match",
ctx: Load,
},
),
slice: Tuple(
ExprTuple {
range: 390..392,
elts: [
Name(
ExprName {
range: 390..391,
id: "a",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
ctx: Load,
},
),
attr: Identifier {
id: "b",
range: 394..395,
},
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 436..450,
value: Attribute(
ExprAttribute {
range: 436..450,
value: Subscript(
ExprSubscript {
range: 436..448,
value: Name(
ExprName {
range: 436..441,
id: "match",
ctx: Load,
},
),
slice: Tuple(
ExprTuple {
range: 443..447,
elts: [
Name(
ExprName {
range: 444..445,
id: "a",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
ctx: Load,
},
),
attr: Identifier {
id: "b",
range: 449..450,
},
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 471..488,
value: Subscript(
ExprSubscript {
range: 471..488,
value: Call(
ExprCall {
range: 471..478,
func: Name(
ExprName {
range: 471..476,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 476..478,
args: [],
keywords: [],
},
},
),
slice: Slice(
ExprSlice {
range: 479..487,
lower: Some(
Name(
ExprName {
range: 479..480,
id: "a",
ctx: Load,
},
),
),
upper: Some(
Name(
ExprName {
range: 486..487,
id: "b",
ctx: Load,
},
),
),
step: None,
},
),
ctx: Load,
},
),
},
),
If(
StmtIf {
range: 508..527,
test: Named(
ExprNamed {
range: 511..521,
target: Name(
ExprName {
range: 511..516,
id: "match",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 520..521,
value: Int(
1,
),
},
),
},
),
body: [
Pass(
StmtPass {
range: 523..527,
},
),
],
elif_else_clauses: [],
},
),
Match(
StmtMatch {
range: 528..582,
subject: Name(
ExprName {
range: 534..539,
id: "match",
ctx: Load,
},
),
cases: [
MatchCase {
range: 545..557,
pattern: MatchValue(
PatternMatchValue {
range: 550..551,
value: NumberLiteral(
ExprNumberLiteral {
range: 550..551,
value: Int(
1,
),
},
),
},
),
guard: None,
body: [
Pass(
StmtPass {
range: 553..557,
},
),
],
},
MatchCase {
range: 562..582,
pattern: MatchValue(
PatternMatchValue {
range: 567..568,
value: NumberLiteral(
ExprNumberLiteral {
range: 567..568,
value: Int(
2,
),
},
),
},
),
guard: None,
body: [
Pass(
StmtPass {
range: 578..582,
},
),
],
},
],
},
),
Assign(
StmtAssign {
range: 583..619,
targets: [
Name(
ExprName {
range: 583..588,
id: "match",
ctx: Store,
},
),
],
value: Lambda(
ExprLambda {
range: 591..619,
parameters: Some(
Parameters {
range: 598..603,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 598..603,
parameter: Parameter {
range: 598..603,
name: Identifier {
id: "query",
range: 598..603,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: Compare(
ExprCompare {
range: 605..619,
left: Name(
ExprName {
range: 605..610,
id: "query",
ctx: Load,
},
),
ops: [
Eq,
],
comparators: [
Name(
ExprName {
range: 614..619,
id: "event",
ctx: Load,
},
),
],
},
),
},
),
},
),
Expr(
StmtExpr {
range: 620..636,
value: Call(
ExprCall {
range: 620..636,
func: Name(
ExprName {
range: 620..625,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 625..636,
args: [
Call(
ExprCall {
range: 626..635,
func: Name(
ExprName {
range: 626..631,
id: "match",
ctx: Load,
},
),
arguments: Arguments {
range: 631..635,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 632..634,
value: Int(
12,
),
},
),
],
keywords: [],
},
},
),
],
keywords: [],
},
},
),
},
),
]

View file

@ -1,36 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Named(
ExprNamed {
range: 1..15,
target: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
value: BinOp(
ExprBinOp {
range: 8..13,
left: Name(
ExprName {
range: 8..9,
id: "y",
ctx: Load,
},
),
op: Mult,
right: Name(
ExprName {
range: 12..13,
id: "z",
ctx: Load,
},
),
},
),
},
)

View file

@ -1,404 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: "parse_suite(source, \"<test>\").unwrap()"
---
[
Assign(
StmtAssign {
range: 0..13,
targets: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 4..13,
value: Int(
123456789,
),
},
),
},
),
Assign(
StmtAssign {
range: 14..24,
targets: [
Name(
ExprName {
range: 14..15,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 18..24,
value: Int(
123456,
),
},
),
},
),
Assign(
StmtAssign {
range: 25..31,
targets: [
Name(
ExprName {
range: 25..26,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 29..31,
value: Float(
0.1,
),
},
),
},
),
Assign(
StmtAssign {
range: 32..38,
targets: [
Name(
ExprName {
range: 32..33,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 36..38,
value: Float(
1.0,
),
},
),
},
),
Assign(
StmtAssign {
range: 39..47,
targets: [
Name(
ExprName {
range: 39..40,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 43..47,
value: Float(
10.0,
),
},
),
},
),
Assign(
StmtAssign {
range: 48..56,
targets: [
Name(
ExprName {
range: 48..49,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 52..56,
value: Float(
0.1,
),
},
),
},
),
Assign(
StmtAssign {
range: 57..73,
targets: [
Name(
ExprName {
range: 57..58,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 61..73,
value: Float(
1.00000001,
),
},
),
},
),
Assign(
StmtAssign {
range: 74..97,
targets: [
Name(
ExprName {
range: 74..75,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 78..97,
value: Float(
123456789.12345679,
),
},
),
},
),
Assign(
StmtAssign {
range: 98..131,
targets: [
Name(
ExprName {
range: 98..99,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 102..131,
value: Float(
inf,
),
},
),
},
),
Assign(
StmtAssign {
range: 132..155,
targets: [
Name(
ExprName {
range: 132..133,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 136..155,
value: Float(
inf,
),
},
),
},
),
Assign(
StmtAssign {
range: 156..170,
targets: [
Name(
ExprName {
range: 156..157,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 160..170,
value: Complex {
real: 0.0,
imag: 123456789.0,
},
},
),
},
),
Assign(
StmtAssign {
range: 171..195,
targets: [
Name(
ExprName {
range: 171..172,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 175..195,
value: Complex {
real: 0.0,
imag: 123456789.12345679,
},
},
),
},
),
Assign(
StmtAssign {
range: 196..207,
targets: [
Name(
ExprName {
range: 196..197,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 200..207,
value: Int(
727756,
),
},
),
},
),
Assign(
StmtAssign {
range: 208..218,
targets: [
Name(
ExprName {
range: 208..209,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 212..218,
value: Int(
11,
),
},
),
},
),
Assign(
StmtAssign {
range: 219..228,
targets: [
Name(
ExprName {
range: 219..220,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 223..228,
value: Int(
511,
),
},
),
},
),
Assign(
StmtAssign {
range: 229..244,
targets: [
Name(
ExprName {
range: 229..230,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 233..244,
value: Float(
6e-9,
),
},
),
},
),
Assign(
StmtAssign {
range: 245..254,
targets: [
Name(
ExprName {
range: 245..246,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 249..254,
value: Int(
10000,
),
},
),
},
),
Assign(
StmtAssign {
range: 255..265,
targets: [
Name(
ExprName {
range: 255..256,
id: "x",
ctx: Store,
},
),
],
value: NumberLiteral(
ExprNumberLiteral {
range: 259..265,
value: Int(
133333,
),
},
),
},
),
]

View file

@ -1,663 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: "parse_suite(source, \"<test>\").unwrap()"
---
[
Assign(
StmtAssign {
range: 0..19,
targets: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 4..19,
func: Attribute(
ExprAttribute {
range: 4..17,
value: NumberLiteral(
ExprNumberLiteral {
range: 4..6,
value: Float(
0.1,
),
},
),
attr: Identifier {
id: "is_integer",
range: 7..17,
},
ctx: Load,
},
),
arguments: Arguments {
range: 17..19,
args: [],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 20..32,
targets: [
Name(
ExprName {
range: 20..21,
id: "x",
ctx: Store,
},
),
],
value: Attribute(
ExprAttribute {
range: 24..32,
value: NumberLiteral(
ExprNumberLiteral {
range: 24..26,
value: Float(
1.0,
),
},
),
attr: Identifier {
id: "imag",
range: 28..32,
},
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 33..46,
targets: [
Name(
ExprName {
range: 33..34,
id: "x",
ctx: Store,
},
),
],
value: Attribute(
ExprAttribute {
range: 37..46,
value: NumberLiteral(
ExprNumberLiteral {
range: 37..41,
value: Float(
10.0,
),
},
),
attr: Identifier {
id: "imag",
range: 42..46,
},
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 47..60,
targets: [
Name(
ExprName {
range: 47..48,
id: "x",
ctx: Store,
},
),
],
value: Attribute(
ExprAttribute {
range: 51..60,
value: NumberLiteral(
ExprNumberLiteral {
range: 51..55,
value: Float(
0.1,
),
},
),
attr: Identifier {
id: "real",
range: 56..60,
},
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 61..90,
targets: [
Name(
ExprName {
range: 61..62,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 65..90,
func: Attribute(
ExprAttribute {
range: 65..88,
value: NumberLiteral(
ExprNumberLiteral {
range: 65..84,
value: Float(
123456789.12345679,
),
},
),
attr: Identifier {
id: "hex",
range: 85..88,
},
ctx: Load,
},
),
arguments: Arguments {
range: 88..90,
args: [],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 91..130,
targets: [
Name(
ExprName {
range: 91..92,
id: "x",
ctx: Store,
},
),
],
value: Attribute(
ExprAttribute {
range: 95..130,
value: NumberLiteral(
ExprNumberLiteral {
range: 95..124,
value: Float(
inf,
),
},
),
attr: Identifier {
id: "real",
range: 126..130,
},
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 131..167,
targets: [
Name(
ExprName {
range: 131..132,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 135..167,
func: Attribute(
ExprAttribute {
range: 135..165,
value: NumberLiteral(
ExprNumberLiteral {
range: 135..154,
value: Float(
inf,
),
},
),
attr: Identifier {
id: "conjugate",
range: 156..165,
},
ctx: Load,
},
),
arguments: Arguments {
range: 165..167,
args: [],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 168..187,
targets: [
Name(
ExprName {
range: 168..169,
id: "x",
ctx: Store,
},
),
],
value: Attribute(
ExprAttribute {
range: 172..187,
value: NumberLiteral(
ExprNumberLiteral {
range: 172..182,
value: Complex {
real: 0.0,
imag: 123456789.0,
},
},
),
attr: Identifier {
id: "real",
range: 183..187,
},
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 188..241,
targets: [
Name(
ExprName {
range: 188..189,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 192..241,
func: Attribute(
ExprAttribute {
range: 192..220,
value: NumberLiteral(
ExprNumberLiteral {
range: 192..212,
value: Complex {
real: 0.0,
imag: 123456789.12345679,
},
},
),
attr: Identifier {
id: "__add__",
range: 213..220,
},
ctx: Load,
},
),
arguments: Arguments {
range: 220..241,
args: [
Call(
ExprCall {
range: 221..240,
func: Attribute(
ExprAttribute {
range: 221..238,
value: NumberLiteral(
ExprNumberLiteral {
range: 221..227,
value: Int(
11,
),
},
),
attr: Identifier {
id: "bit_length",
range: 228..238,
},
ctx: Load,
},
),
arguments: Arguments {
range: 238..240,
args: [],
keywords: [],
},
},
),
],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 242..265,
targets: [
Name(
ExprName {
range: 242..243,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 246..265,
func: Attribute(
ExprAttribute {
range: 246..263,
value: NumberLiteral(
ExprNumberLiteral {
range: 246..253,
value: Int(
727756,
),
},
),
attr: Identifier {
id: "conjugate",
range: 254..263,
},
ctx: Load,
},
),
arguments: Arguments {
range: 263..265,
args: [],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 266..289,
targets: [
Name(
ExprName {
range: 266..267,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 270..289,
func: Attribute(
ExprAttribute {
range: 270..287,
value: NumberLiteral(
ExprNumberLiteral {
range: 270..276,
value: Int(
11,
),
},
),
attr: Identifier {
id: "conjugate",
range: 278..287,
},
ctx: Load,
},
),
arguments: Arguments {
range: 287..289,
args: [],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 290..305,
targets: [
Name(
ExprName {
range: 290..291,
id: "x",
ctx: Store,
},
),
],
value: Attribute(
ExprAttribute {
range: 294..305,
value: NumberLiteral(
ExprNumberLiteral {
range: 294..299,
value: Int(
511,
),
},
),
attr: Identifier {
id: "real",
range: 301..305,
},
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 306..329,
targets: [
Name(
ExprName {
range: 306..307,
id: "x",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 310..329,
func: Attribute(
ExprAttribute {
range: 310..327,
value: NumberLiteral(
ExprNumberLiteral {
range: 310..321,
value: Float(
6e-9,
),
},
),
attr: Identifier {
id: "hex",
range: 324..327,
},
ctx: Load,
},
),
arguments: Arguments {
range: 327..329,
args: [],
keywords: [],
},
},
),
},
),
Assign(
StmtAssign {
range: 330..344,
targets: [
Name(
ExprName {
range: 330..331,
id: "x",
ctx: Store,
},
),
],
value: UnaryOp(
ExprUnaryOp {
range: 334..344,
op: USub,
operand: NumberLiteral(
ExprNumberLiteral {
range: 335..344,
value: Complex {
real: 0.0,
imag: 100.0,
},
},
),
},
),
},
),
If(
StmtIf {
range: 346..366,
test: Attribute(
ExprAttribute {
range: 349..357,
value: NumberLiteral(
ExprNumberLiteral {
range: 349..351,
value: Int(
10,
),
},
),
attr: Identifier {
id: "real",
range: 353..357,
},
ctx: Load,
},
),
body: [
Expr(
StmtExpr {
range: 363..366,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 363..366,
},
),
},
),
],
elif_else_clauses: [],
},
),
Assign(
StmtAssign {
range: 368..379,
targets: [
Name(
ExprName {
range: 368..369,
id: "y",
ctx: Store,
},
),
],
value: Subscript(
ExprSubscript {
range: 372..379,
value: NumberLiteral(
ExprNumberLiteral {
range: 372..375,
value: Int(
100,
),
},
),
slice: Name(
ExprName {
range: 376..378,
id: "no",
ctx: Load,
},
),
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 380..391,
targets: [
Name(
ExprName {
range: 380..381,
id: "y",
ctx: Store,
},
),
],
value: Call(
ExprCall {
range: 384..391,
func: NumberLiteral(
ExprNumberLiteral {
range: 384..387,
value: Int(
100,
),
},
),
arguments: Arguments {
range: 387..391,
args: [
Name(
ExprName {
range: 388..390,
id: "no",
ctx: Load,
},
),
],
keywords: [],
},
},
),
},
),
]

View file

@ -1,678 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
With(
StmtWith {
range: 0..21,
is_async: false,
items: [
WithItem {
range: 6..9,
context_expr: Name(
ExprName {
range: 7..8,
id: "a",
ctx: Load,
},
),
optional_vars: None,
},
WithItem {
range: 11..14,
context_expr: Name(
ExprName {
range: 12..13,
id: "b",
ctx: Load,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 17..21,
},
),
],
},
),
With(
StmtWith {
range: 22..56,
is_async: false,
items: [
WithItem {
range: 28..31,
context_expr: Name(
ExprName {
range: 29..30,
id: "a",
ctx: Load,
},
),
optional_vars: None,
},
WithItem {
range: 33..36,
context_expr: Name(
ExprName {
range: 34..35,
id: "b",
ctx: Load,
},
),
optional_vars: None,
},
WithItem {
range: 38..44,
context_expr: Name(
ExprName {
range: 38..39,
id: "c",
ctx: Load,
},
),
optional_vars: Some(
Name(
ExprName {
range: 43..44,
id: "d",
ctx: Store,
},
),
),
},
WithItem {
range: 46..49,
context_expr: Name(
ExprName {
range: 47..48,
id: "e",
ctx: Load,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 52..56,
},
),
],
},
),
With(
StmtWith {
range: 57..74,
is_async: false,
items: [
WithItem {
range: 63..64,
context_expr: Name(
ExprName {
range: 63..64,
id: "a",
ctx: Load,
},
),
optional_vars: None,
},
WithItem {
range: 66..67,
context_expr: Name(
ExprName {
range: 66..67,
id: "b",
ctx: Load,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 70..74,
},
),
],
},
),
With(
StmtWith {
range: 75..97,
is_async: false,
items: [
WithItem {
range: 80..91,
context_expr: Tuple(
ExprTuple {
range: 80..86,
elts: [
Name(
ExprName {
range: 81..82,
id: "a",
ctx: Load,
},
),
Name(
ExprName {
range: 84..85,
id: "b",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
optional_vars: Some(
Name(
ExprName {
range: 90..91,
id: "c",
ctx: Store,
},
),
),
},
],
body: [
Pass(
StmtPass {
range: 93..97,
},
),
],
},
),
With(
StmtWith {
range: 98..122,
is_async: false,
items: [
WithItem {
range: 104..115,
context_expr: Tuple(
ExprTuple {
range: 104..110,
elts: [
Name(
ExprName {
range: 105..106,
id: "a",
ctx: Load,
},
),
Name(
ExprName {
range: 108..109,
id: "b",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
optional_vars: Some(
Name(
ExprName {
range: 114..115,
id: "c",
ctx: Store,
},
),
),
},
],
body: [
Pass(
StmtPass {
range: 118..122,
},
),
],
},
),
With(
StmtWith {
range: 123..142,
is_async: false,
items: [
WithItem {
range: 129..135,
context_expr: Name(
ExprName {
range: 129..130,
id: "a",
ctx: Load,
},
),
optional_vars: Some(
Name(
ExprName {
range: 134..135,
id: "b",
ctx: Store,
},
),
),
},
],
body: [
Pass(
StmtPass {
range: 138..142,
},
),
],
},
),
With(
StmtWith {
range: 143..157,
is_async: false,
items: [
WithItem {
range: 149..150,
context_expr: Name(
ExprName {
range: 149..150,
id: "a",
ctx: Load,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 153..157,
},
),
],
},
),
With(
StmtWith {
range: 158..177,
is_async: false,
items: [
WithItem {
range: 164..170,
context_expr: Named(
ExprNamed {
range: 164..170,
target: Name(
ExprName {
range: 164..165,
id: "a",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 169..170,
value: Int(
0,
),
},
),
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 173..177,
},
),
],
},
),
With(
StmtWith {
range: 178..202,
is_async: false,
items: [
WithItem {
range: 183..196,
context_expr: Named(
ExprNamed {
range: 184..190,
target: Name(
ExprName {
range: 184..185,
id: "a",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 189..190,
value: Int(
0,
),
},
),
},
),
optional_vars: Some(
Name(
ExprName {
range: 195..196,
id: "x",
ctx: Store,
},
),
),
},
],
body: [
Pass(
StmtPass {
range: 198..202,
},
),
],
},
),
With(
StmtWith {
range: 203..219,
is_async: false,
items: [
WithItem {
range: 209..212,
context_expr: Name(
ExprName {
range: 210..211,
id: "a",
ctx: Load,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 215..219,
},
),
],
},
),
With(
StmtWith {
range: 220..241,
is_async: false,
items: [
WithItem {
range: 226..234,
context_expr: Named(
ExprNamed {
range: 227..233,
target: Name(
ExprName {
range: 227..228,
id: "a",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 232..233,
value: Int(
0,
),
},
),
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 237..241,
},
),
],
},
),
With(
StmtWith {
range: 242..271,
is_async: false,
items: [
WithItem {
range: 248..254,
context_expr: Name(
ExprName {
range: 248..249,
id: "a",
ctx: Load,
},
),
optional_vars: Some(
Name(
ExprName {
range: 253..254,
id: "b",
ctx: Store,
},
),
),
},
WithItem {
range: 256..264,
context_expr: Named(
ExprNamed {
range: 257..263,
target: Name(
ExprName {
range: 257..258,
id: "a",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 262..263,
value: Int(
0,
),
},
),
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 267..271,
},
),
],
},
),
With(
StmtWith {
range: 272..296,
is_async: false,
items: [
WithItem {
range: 278..279,
context_expr: Name(
ExprName {
range: 278..279,
id: "a",
ctx: Load,
},
),
optional_vars: None,
},
WithItem {
range: 281..289,
context_expr: Named(
ExprNamed {
range: 282..288,
target: Name(
ExprName {
range: 282..283,
id: "a",
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 287..288,
value: Int(
0,
),
},
),
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 292..296,
},
),
],
},
),
With(
StmtWith {
range: 297..315,
is_async: false,
items: [
WithItem {
range: 303..308,
context_expr: Yield(
ExprYield {
range: 303..308,
value: None,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 311..315,
},
),
],
},
),
With(
StmtWith {
range: 316..341,
is_async: false,
items: [
WithItem {
range: 322..334,
context_expr: YieldFrom(
ExprYieldFrom {
range: 322..334,
value: Name(
ExprName {
range: 333..334,
id: "a",
ctx: Load,
},
),
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 337..341,
},
),
],
},
),
With(
StmtWith {
range: 342..362,
is_async: false,
items: [
WithItem {
range: 348..355,
context_expr: Yield(
ExprYield {
range: 349..354,
value: None,
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 358..362,
},
),
],
},
),
With(
StmtWith {
range: 363..390,
is_async: false,
items: [
WithItem {
range: 369..383,
context_expr: YieldFrom(
ExprYieldFrom {
range: 370..382,
value: Name(
ExprName {
range: 381..382,
id: "a",
ctx: Load,
},
),
},
),
optional_vars: None,
},
],
body: [
Pass(
StmtPass {
range: 386..390,
},
),
],
},
),
]

View file

@ -1,26 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
BoolOp(
ExprBoolOp {
range: 0..7,
op: And,
values: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
Name(
ExprName {
range: 6..7,
id: "y",
ctx: Load,
},
),
],
},
)

View file

@ -1,26 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
BoolOp(
ExprBoolOp {
range: 0..6,
op: Or,
values: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
Name(
ExprName {
range: 5..6,
id: "y",
ctx: Load,
},
),
],
},
)

View file

@ -1,154 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
ClassDef(
StmtClassDef {
range: 0..98,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 6..9,
},
type_params: None,
arguments: Some(
Arguments {
range: 9..15,
args: [
Name(
ExprName {
range: 10..11,
id: "A",
ctx: Load,
},
),
Name(
ExprName {
range: 13..14,
id: "B",
ctx: Load,
},
),
],
keywords: [],
},
),
body: [
FunctionDef(
StmtFunctionDef {
range: 18..44,
is_async: false,
decorator_list: [],
name: Identifier {
id: "__init__",
range: 22..30,
},
type_params: None,
parameters: Parameters {
range: 30..36,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 31..35,
parameter: Parameter {
range: 31..35,
name: Identifier {
id: "self",
range: 31..35,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 40..44,
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 46..98,
is_async: false,
decorator_list: [],
name: Identifier {
id: "method_with_default",
range: 50..69,
},
type_params: None,
parameters: Parameters {
range: 69..90,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 70..74,
parameter: Parameter {
range: 70..74,
name: Identifier {
id: "self",
range: 70..74,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 76..89,
parameter: Parameter {
range: 76..79,
name: Identifier {
id: "arg",
range: 76..79,
},
annotation: None,
},
default: Some(
StringLiteral(
ExprStringLiteral {
range: 80..89,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 80..89,
value: "default",
flags: StringLiteralFlags {
quote_style: Single,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
),
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 94..98,
},
),
],
},
),
],
},
),
]

View file

@ -1,455 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
ClassDef(
StmtClassDef {
range: 10..29,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 16..19,
},
type_params: Some(
TypeParams {
range: 19..22,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 20..21,
name: Identifier {
id: "T",
range: 20..21,
},
bound: None,
},
),
],
},
),
arguments: Some(
Arguments {
range: 22..24,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 26..29,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 26..29,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 52..76,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 58..61,
},
type_params: Some(
TypeParams {
range: 61..69,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 62..68,
name: Identifier {
id: "T",
range: 62..63,
},
bound: Some(
Name(
ExprName {
range: 65..68,
id: "str",
ctx: Load,
},
),
),
},
),
],
},
),
arguments: Some(
Arguments {
range: 69..71,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 73..76,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 73..76,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 105..138,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 111..114,
},
type_params: Some(
TypeParams {
range: 114..131,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 115..130,
name: Identifier {
id: "T",
range: 115..116,
},
bound: Some(
Tuple(
ExprTuple {
range: 118..130,
elts: [
Name(
ExprName {
range: 119..122,
id: "str",
ctx: Load,
},
),
Name(
ExprName {
range: 124..129,
id: "bytes",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
),
},
),
],
},
),
arguments: Some(
Arguments {
range: 131..133,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 135..138,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 135..138,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 159..181,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 165..168,
},
type_params: Some(
TypeParams {
range: 168..174,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 169..170,
name: Identifier {
id: "T",
range: 169..170,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 172..173,
name: Identifier {
id: "U",
range: 172..173,
},
bound: None,
},
),
],
},
),
arguments: Some(
Arguments {
range: 174..176,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 178..181,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 178..181,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 200..223,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 206..209,
},
type_params: Some(
TypeParams {
range: 209..216,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 210..211,
name: Identifier {
id: "T",
range: 210..211,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 213..214,
name: Identifier {
id: "U",
range: 213..214,
},
bound: None,
},
),
],
},
),
arguments: Some(
Arguments {
range: 216..218,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 220..223,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 220..223,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 240..261,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 246..249,
},
type_params: Some(
TypeParams {
range: 249..254,
type_params: [
TypeVarTuple(
TypeParamTypeVarTuple {
range: 250..253,
name: Identifier {
id: "Ts",
range: 251..253,
},
},
),
],
},
),
arguments: Some(
Arguments {
range: 254..256,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 258..261,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 258..261,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 275..296,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 281..284,
},
type_params: Some(
TypeParams {
range: 284..289,
type_params: [
ParamSpec(
TypeParamParamSpec {
range: 285..288,
name: Identifier {
id: "P",
range: 287..288,
},
},
),
],
},
),
arguments: Some(
Arguments {
range: 289..291,
args: [],
keywords: [],
},
),
body: [
Expr(
StmtExpr {
range: 293..296,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 293..296,
},
),
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 312..351,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 318..321,
},
type_params: Some(
TypeParams {
range: 321..341,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 322..323,
name: Identifier {
id: "X",
range: 322..323,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 325..331,
name: Identifier {
id: "Y",
range: 325..326,
},
bound: Some(
Name(
ExprName {
range: 328..331,
id: "str",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 333..335,
name: Identifier {
id: "U",
range: 334..335,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 337..340,
name: Identifier {
id: "P",
range: 339..340,
},
},
),
],
},
),
arguments: Some(
Arguments {
range: 341..343,
args: [],
keywords: [],
},
),
body: [
Pass(
StmtPass {
range: 347..351,
},
),
],
},
),
]

View file

@ -1,44 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
DictComp(
ExprDictComp {
range: 0..19,
key: Name(
ExprName {
range: 1..3,
id: "x1",
ctx: Load,
},
),
value: Name(
ExprName {
range: 5..7,
id: "x2",
ctx: Load,
},
),
generators: [
Comprehension {
range: 8..18,
target: Name(
ExprName {
range: 12..13,
id: "y",
ctx: Store,
},
),
iter: Name(
ExprName {
range: 17..18,
id: "z",
ctx: Load,
},
),
ifs: [],
is_async: false,
},
],
},
)

View file

@ -1,123 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
ListComp(
ExprListComp {
range: 0..48,
elt: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Load,
},
),
generators: [
Comprehension {
range: 3..17,
target: Tuple(
ExprTuple {
range: 7..12,
elts: [
Name(
ExprName {
range: 7..8,
id: "y",
ctx: Store,
},
),
Name(
ExprName {
range: 10..12,
id: "y2",
ctx: Store,
},
),
],
ctx: Store,
parenthesized: false,
},
),
iter: Name(
ExprName {
range: 16..17,
id: "z",
ctx: Load,
},
),
ifs: [],
is_async: false,
},
Comprehension {
range: 18..47,
target: Name(
ExprName {
range: 22..23,
id: "a",
ctx: Store,
},
),
iter: Name(
ExprName {
range: 27..28,
id: "b",
ctx: Load,
},
),
ifs: [
Compare(
ExprCompare {
range: 32..37,
left: Name(
ExprName {
range: 32..33,
id: "a",
ctx: Load,
},
),
ops: [
Lt,
],
comparators: [
NumberLiteral(
ExprNumberLiteral {
range: 36..37,
value: Int(
5,
),
},
),
],
},
),
Compare(
ExprCompare {
range: 41..47,
left: Name(
ExprName {
range: 41..42,
id: "a",
ctx: Load,
},
),
ops: [
Gt,
],
comparators: [
NumberLiteral(
ExprNumberLiteral {
range: 45..47,
value: Int(
10,
),
},
),
],
},
),
],
is_async: false,
},
],
},
)

View file

@ -1,5 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[]

View file

@ -1,38 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..14,
value: FString(
ExprFString {
range: 0..14,
value: FStringValue {
inner: Single(
FString(
FString {
range: 0..14,
elements: [
Literal(
FStringLiteralElement {
range: 2..13,
value: "Hello world",
},
),
],
flags: FStringFlags {
quote_style: Single,
prefix: Regular,
triple_quoted: false,
},
},
),
),
},
},
),
},
),
]

View file

@ -1,571 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
FunctionDef(
StmtFunctionDef {
range: 0..20,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 4..8,
},
type_params: None,
parameters: Parameters {
range: 8..11,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 9..10,
parameter: Parameter {
range: 9..10,
name: Identifier {
id: "a",
range: 9..10,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Expr(
StmtExpr {
range: 17..20,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 17..20,
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 22..53,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 26..30,
},
type_params: Some(
TypeParams {
range: 30..33,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 31..32,
name: Identifier {
id: "T",
range: 31..32,
},
bound: None,
},
),
],
},
),
parameters: Parameters {
range: 33..39,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 34..38,
parameter: Parameter {
range: 34..38,
name: Identifier {
id: "a",
range: 34..35,
},
annotation: Some(
Name(
ExprName {
range: 37..38,
id: "T",
ctx: Load,
},
),
),
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: Some(
Name(
ExprName {
range: 43..44,
id: "T",
ctx: Load,
},
),
),
body: [
Expr(
StmtExpr {
range: 50..53,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 50..53,
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 55..91,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 59..63,
},
type_params: Some(
TypeParams {
range: 63..71,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 64..70,
name: Identifier {
id: "T",
range: 64..65,
},
bound: Some(
Name(
ExprName {
range: 67..70,
id: "str",
ctx: Load,
},
),
),
},
),
],
},
),
parameters: Parameters {
range: 71..77,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 72..76,
parameter: Parameter {
range: 72..76,
name: Identifier {
id: "a",
range: 72..73,
},
annotation: Some(
Name(
ExprName {
range: 75..76,
id: "T",
ctx: Load,
},
),
),
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: Some(
Name(
ExprName {
range: 81..82,
id: "T",
ctx: Load,
},
),
),
body: [
Expr(
StmtExpr {
range: 88..91,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 88..91,
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 93..138,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 97..101,
},
type_params: Some(
TypeParams {
range: 101..118,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 102..117,
name: Identifier {
id: "T",
range: 102..103,
},
bound: Some(
Tuple(
ExprTuple {
range: 105..117,
elts: [
Name(
ExprName {
range: 106..109,
id: "str",
ctx: Load,
},
),
Name(
ExprName {
range: 111..116,
id: "bytes",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
),
},
),
],
},
),
parameters: Parameters {
range: 118..124,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 119..123,
parameter: Parameter {
range: 119..123,
name: Identifier {
id: "a",
range: 119..120,
},
annotation: Some(
Name(
ExprName {
range: 122..123,
id: "T",
ctx: Load,
},
),
),
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: Some(
Name(
ExprName {
range: 128..129,
id: "T",
ctx: Load,
},
),
),
body: [
Expr(
StmtExpr {
range: 135..138,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 135..138,
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 140..171,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 144..148,
},
type_params: Some(
TypeParams {
range: 148..153,
type_params: [
TypeVarTuple(
TypeParamTypeVarTuple {
range: 149..152,
name: Identifier {
id: "Ts",
range: 150..152,
},
},
),
],
},
),
parameters: Parameters {
range: 153..162,
posonlyargs: [],
args: [],
vararg: Some(
Parameter {
range: 154..161,
name: Identifier {
id: "a",
range: 155..156,
},
annotation: Some(
Starred(
ExprStarred {
range: 158..161,
value: Name(
ExprName {
range: 159..161,
id: "Ts",
ctx: Load,
},
),
ctx: Load,
},
),
),
},
),
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Expr(
StmtExpr {
range: 168..171,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 168..171,
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 173..230,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 177..181,
},
type_params: Some(
TypeParams {
range: 181..186,
type_params: [
ParamSpec(
TypeParamParamSpec {
range: 182..185,
name: Identifier {
id: "P",
range: 184..185,
},
},
),
],
},
),
parameters: Parameters {
range: 186..221,
posonlyargs: [],
args: [],
vararg: Some(
Parameter {
range: 187..200,
name: Identifier {
id: "args",
range: 188..192,
},
annotation: Some(
Attribute(
ExprAttribute {
range: 194..200,
value: Name(
ExprName {
range: 194..195,
id: "P",
ctx: Load,
},
),
attr: Identifier {
id: "args",
range: 196..200,
},
ctx: Load,
},
),
),
},
),
kwonlyargs: [],
kwarg: Some(
Parameter {
range: 202..220,
name: Identifier {
id: "kwargs",
range: 204..210,
},
annotation: Some(
Attribute(
ExprAttribute {
range: 212..220,
value: Name(
ExprName {
range: 212..213,
id: "P",
ctx: Load,
},
),
attr: Identifier {
id: "kwargs",
range: 214..220,
},
ctx: Load,
},
),
),
},
),
},
returns: None,
body: [
Expr(
StmtExpr {
range: 227..230,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 227..230,
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 232..273,
is_async: false,
decorator_list: [],
name: Identifier {
id: "func",
range: 236..240,
},
type_params: Some(
TypeParams {
range: 240..261,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 241..242,
name: Identifier {
id: "T",
range: 241..242,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 244..250,
name: Identifier {
id: "U",
range: 244..245,
},
bound: Some(
Name(
ExprName {
range: 247..250,
id: "str",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 252..255,
name: Identifier {
id: "Ts",
range: 253..255,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 257..260,
name: Identifier {
id: "P",
range: 259..260,
},
},
),
],
},
),
parameters: Parameters {
range: 261..263,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
range: 269..273,
},
),
],
},
),
]

View file

@ -1,38 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Generator(
ExprGenerator {
range: 0..14,
elt: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Load,
},
),
generators: [
Comprehension {
range: 3..13,
target: Name(
ExprName {
range: 7..8,
id: "y",
ctx: Store,
},
),
iter: Name(
ExprName {
range: 12..13,
id: "z",
ctx: Load,
},
),
ifs: [],
is_async: false,
},
],
parenthesized: true,
},
)

View file

@ -1,83 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
If(
StmtIf {
range: 0..28,
test: NumberLiteral(
ExprNumberLiteral {
range: 3..4,
value: Int(
1,
),
},
),
body: [
Expr(
StmtExpr {
range: 6..8,
value: NumberLiteral(
ExprNumberLiteral {
range: 6..8,
value: Int(
10,
),
},
),
},
),
],
elif_else_clauses: [
ElifElseClause {
range: 9..19,
test: Some(
NumberLiteral(
ExprNumberLiteral {
range: 14..15,
value: Int(
2,
),
},
),
),
body: [
Expr(
StmtExpr {
range: 17..19,
value: NumberLiteral(
ExprNumberLiteral {
range: 17..19,
value: Int(
20,
),
},
),
},
),
],
},
ElifElseClause {
range: 20..28,
test: None,
body: [
Expr(
StmtExpr {
range: 26..28,
value: NumberLiteral(
ExprNumberLiteral {
range: 26..28,
value: Int(
30,
),
},
),
},
),
],
},
],
},
),
]

View file

@ -1,57 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Generator(
ExprGenerator {
range: 0..26,
elt: If(
ExprIf {
range: 1..14,
test: Name(
ExprName {
range: 6..7,
id: "y",
ctx: Load,
},
),
body: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Load,
},
),
orelse: Name(
ExprName {
range: 13..14,
id: "y",
ctx: Load,
},
),
},
),
generators: [
Comprehension {
range: 15..25,
target: Name(
ExprName {
range: 19..20,
id: "y",
ctx: Store,
},
),
iter: Name(
ExprName {
range: 24..25,
id: "z",
ctx: Load,
},
),
ifs: [],
is_async: false,
},
],
parenthesized: true,
},
)

View file

@ -1,65 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..32,
value: Call(
ExprCall {
range: 0..32,
func: Name(
ExprName {
range: 0..7,
id: "my_func",
ctx: Load,
},
),
arguments: Arguments {
range: 7..32,
args: [
StringLiteral(
ExprStringLiteral {
range: 8..20,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 8..20,
value: "positional",
flags: StringLiteralFlags {
quote_style: Single,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
],
keywords: [
Keyword {
range: 22..31,
arg: Some(
Identifier {
id: "keyword",
range: 22..29,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 30..31,
value: Int(
2,
),
},
),
},
],
},
},
),
},
),
]

View file

@ -1,71 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..18,
value: Lambda(
ExprLambda {
range: 0..18,
parameters: Some(
Parameters {
range: 7..11,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 7..8,
parameter: Parameter {
range: 7..8,
name: Identifier {
id: "x",
range: 7..8,
},
annotation: None,
},
default: None,
},
ParameterWithDefault {
range: 10..11,
parameter: Parameter {
range: 10..11,
name: Identifier {
id: "y",
range: 10..11,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: BinOp(
ExprBinOp {
range: 13..18,
left: Name(
ExprName {
range: 13..14,
id: "x",
ctx: Load,
},
),
op: Mult,
right: Name(
ExprName {
range: 17..18,
id: "y",
ctx: Load,
},
),
},
),
},
),
},
),
]

View file

@ -1,25 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..9,
value: Lambda(
ExprLambda {
range: 0..9,
parameters: None,
body: NumberLiteral(
ExprNumberLiteral {
range: 8..9,
value: Int(
1,
),
},
),
},
),
},
),
]

View file

@ -1,37 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
ListComp(
ExprListComp {
range: 0..14,
elt: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Load,
},
),
generators: [
Comprehension {
range: 3..13,
target: Name(
ExprName {
range: 7..8,
id: "y",
ctx: Store,
},
),
iter: Name(
ExprName {
range: 12..13,
id: "z",
ctx: Load,
},
),
ifs: [],
is_async: false,
},
],
},
)

View file

@ -1,64 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Generator(
ExprGenerator {
range: 0..23,
elt: Named(
ExprNamed {
range: 1..11,
target: Name(
ExprName {
range: 1..2,
id: "x",
ctx: Store,
},
),
value: BinOp(
ExprBinOp {
range: 6..11,
left: Name(
ExprName {
range: 6..7,
id: "y",
ctx: Load,
},
),
op: Add,
right: NumberLiteral(
ExprNumberLiteral {
range: 10..11,
value: Int(
1,
),
},
),
},
),
},
),
generators: [
Comprehension {
range: 12..22,
target: Name(
ExprName {
range: 16..17,
id: "y",
ctx: Store,
},
),
iter: Name(
ExprName {
range: 21..22,
id: "z",
ctx: Load,
},
),
ifs: [],
is_async: false,
},
],
parenthesized: true,
},
)

View file

@ -1,55 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..23,
value: Call(
ExprCall {
range: 0..23,
func: Name(
ExprName {
range: 0..5,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 5..23,
args: [
StringLiteral(
ExprStringLiteral {
range: 6..19,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 6..19,
value: "Hello world",
flags: StringLiteralFlags {
quote_style: Single,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
NumberLiteral(
ExprNumberLiteral {
range: 21..22,
value: Int(
2,
),
},
),
],
keywords: [],
},
},
),
},
),
]

View file

@ -1,47 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..20,
value: Call(
ExprCall {
range: 0..20,
func: Name(
ExprName {
range: 0..5,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 5..20,
args: [
StringLiteral(
ExprStringLiteral {
range: 6..19,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 6..19,
value: "Hello world",
flags: StringLiteralFlags {
quote_style: Single,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
],
keywords: [],
},
},
),
},
),
]

View file

@ -1,29 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..13,
value: StringLiteral(
ExprStringLiteral {
range: 0..13,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 0..13,
value: "Hello world",
flags: StringLiteralFlags {
quote_style: Single,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
},
),
]

View file

@ -1,61 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
Assign(
StmtAssign {
range: 0..11,
targets: [
Tuple(
ExprTuple {
range: 0..4,
elts: [
Name(
ExprName {
range: 0..1,
id: "a",
ctx: Store,
},
),
Name(
ExprName {
range: 3..4,
id: "b",
ctx: Store,
},
),
],
ctx: Store,
parenthesized: false,
},
),
],
value: Tuple(
ExprTuple {
range: 7..11,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 7..8,
value: Int(
4,
),
},
),
NumberLiteral(
ExprNumberLiteral {
range: 10..11,
value: Int(
5,
),
},
),
],
ctx: Load,
parenthesized: false,
},
),
},
),
]

View file

@ -1,954 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_suite(source).unwrap()
---
[
TypeAlias(
StmtTypeAlias {
range: 1..13,
name: Name(
ExprName {
range: 6..7,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 10..13,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 14..32,
name: Name(
ExprName {
range: 19..20,
id: "X",
ctx: Store,
},
),
type_params: None,
value: BinOp(
ExprBinOp {
range: 23..32,
left: Name(
ExprName {
range: 23..26,
id: "int",
ctx: Load,
},
),
op: BitOr,
right: Name(
ExprName {
range: 29..32,
id: "str",
ctx: Load,
},
),
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 33..61,
name: Name(
ExprName {
range: 38..39,
id: "X",
ctx: Store,
},
),
type_params: None,
value: BinOp(
ExprBinOp {
range: 42..61,
left: Name(
ExprName {
range: 42..45,
id: "int",
ctx: Load,
},
),
op: BitOr,
right: StringLiteral(
ExprStringLiteral {
range: 48..61,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 48..61,
value: "ForwardRefY",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 62..88,
name: Name(
ExprName {
range: 67..68,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 68..71,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 69..70,
name: Identifier {
id: "T",
range: 69..70,
},
bound: None,
},
),
],
},
),
value: BinOp(
ExprBinOp {
range: 74..88,
left: Name(
ExprName {
range: 74..75,
id: "T",
ctx: Load,
},
),
op: BitOr,
right: Subscript(
ExprSubscript {
range: 78..88,
value: Name(
ExprName {
range: 78..82,
id: "list",
ctx: Load,
},
),
slice: Subscript(
ExprSubscript {
range: 83..87,
value: Name(
ExprName {
range: 83..84,
id: "X",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 85..86,
id: "T",
ctx: Load,
},
),
ctx: Load,
},
),
ctx: Load,
},
),
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 102..117,
name: Name(
ExprName {
range: 107..108,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 108..111,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 109..110,
name: Identifier {
id: "T",
range: 109..110,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 114..117,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 118..146,
name: Name(
ExprName {
range: 123..124,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 124..127,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 125..126,
name: Identifier {
id: "T",
range: 125..126,
},
bound: None,
},
),
],
},
),
value: BinOp(
ExprBinOp {
range: 130..146,
left: Subscript(
ExprSubscript {
range: 130..137,
value: Name(
ExprName {
range: 130..134,
id: "list",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 135..136,
id: "T",
ctx: Load,
},
),
ctx: Load,
},
),
op: BitOr,
right: Subscript(
ExprSubscript {
range: 140..146,
value: Name(
ExprName {
range: 140..143,
id: "set",
ctx: Load,
},
),
slice: Name(
ExprName {
range: 144..145,
id: "T",
ctx: Load,
},
),
ctx: Load,
},
),
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 147..179,
name: Name(
ExprName {
range: 152..153,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 153..166,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 154..155,
name: Identifier {
id: "T",
range: 154..155,
},
bound: None,
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 157..160,
name: Identifier {
id: "Ts",
range: 158..160,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 162..165,
name: Identifier {
id: "P",
range: 164..165,
},
},
),
],
},
),
value: Tuple(
ExprTuple {
range: 169..179,
elts: [
Name(
ExprName {
range: 170..171,
id: "T",
ctx: Load,
},
),
Name(
ExprName {
range: 173..175,
id: "Ts",
ctx: Load,
},
),
Name(
ExprName {
range: 177..178,
id: "P",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 180..217,
name: Name(
ExprName {
range: 185..186,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 186..204,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 187..193,
name: Identifier {
id: "T",
range: 187..188,
},
bound: Some(
Name(
ExprName {
range: 190..193,
id: "int",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 195..198,
name: Identifier {
id: "Ts",
range: 196..198,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 200..203,
name: Identifier {
id: "P",
range: 202..203,
},
},
),
],
},
),
value: Tuple(
ExprTuple {
range: 207..217,
elts: [
Name(
ExprName {
range: 208..209,
id: "T",
ctx: Load,
},
),
Name(
ExprName {
range: 211..213,
id: "Ts",
ctx: Load,
},
),
Name(
ExprName {
range: 215..216,
id: "P",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 218..262,
name: Name(
ExprName {
range: 223..224,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 224..249,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 225..238,
name: Identifier {
id: "T",
range: 225..226,
},
bound: Some(
Tuple(
ExprTuple {
range: 228..238,
elts: [
Name(
ExprName {
range: 229..232,
id: "int",
ctx: Load,
},
),
Name(
ExprName {
range: 234..237,
id: "str",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 240..243,
name: Identifier {
id: "Ts",
range: 241..243,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 245..248,
name: Identifier {
id: "P",
range: 247..248,
},
},
),
],
},
),
value: Tuple(
ExprTuple {
range: 252..262,
elts: [
Name(
ExprName {
range: 253..254,
id: "T",
ctx: Load,
},
),
Name(
ExprName {
range: 256..258,
id: "Ts",
ctx: Load,
},
),
Name(
ExprName {
range: 260..261,
id: "P",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 293..308,
name: Name(
ExprName {
range: 298..302,
id: "type",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 305..308,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 309..325,
name: Name(
ExprName {
range: 314..319,
id: "match",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 322..325,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 326..341,
name: Name(
ExprName {
range: 331..335,
id: "case",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 338..341,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 367..382,
name: Name(
ExprName {
range: 372..375,
id: "foo",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 378..382,
id: "type",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 383..399,
name: Name(
ExprName {
range: 388..391,
id: "foo",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 394..399,
id: "match",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 400..415,
name: Name(
ExprName {
range: 405..408,
id: "foo",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 411..415,
id: "case",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 439..454,
name: Name(
ExprName {
range: 447..448,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 451..454,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 455..470,
name: Name(
ExprName {
range: 460..461,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 467..470,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 471..486,
name: Name(
ExprName {
range: 476..477,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 483..486,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 487..507,
name: Name(
ExprName {
range: 492..493,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 502..505,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 508..527,
name: Name(
ExprName {
range: 519..520,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 520..523,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 521..522,
name: Identifier {
id: "T",
range: 521..522,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 526..527,
id: "T",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 528..548,
name: Name(
ExprName {
range: 533..534,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 541..544,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 542..543,
name: Identifier {
id: "T",
range: 542..543,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 547..548,
id: "T",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 549..568,
name: Name(
ExprName {
range: 554..555,
id: "X",
ctx: Store,
},
),
type_params: Some(
TypeParams {
range: 555..558,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 556..557,
name: Identifier {
id: "T",
range: 556..557,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 567..568,
id: "T",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 590..602,
name: Name(
ExprName {
range: 595..596,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 599..602,
id: "int",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 604..616,
name: Name(
ExprName {
range: 609..610,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 613..616,
id: "str",
ctx: Load,
},
),
},
),
TypeAlias(
StmtTypeAlias {
range: 618..631,
name: Name(
ExprName {
range: 623..624,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 627..631,
id: "type",
ctx: Load,
},
),
},
),
ClassDef(
StmtClassDef {
range: 632..653,
decorator_list: [],
name: Identifier {
id: "X",
range: 638..639,
},
type_params: None,
arguments: None,
body: [
TypeAlias(
StmtTypeAlias {
range: 641..653,
name: Name(
ExprName {
range: 646..647,
id: "X",
ctx: Store,
},
),
type_params: None,
value: Name(
ExprName {
range: 650..653,
id: "int",
ctx: Load,
},
),
},
),
],
},
),
]

View file

@ -1,52 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
Subscript(
ExprSubscript {
range: 0..8,
value: Name(
ExprName {
range: 0..1,
id: "x",
ctx: Load,
},
),
slice: Slice(
ExprSlice {
range: 2..7,
lower: Some(
NumberLiteral(
ExprNumberLiteral {
range: 2..3,
value: Int(
1,
),
},
),
),
upper: Some(
NumberLiteral(
ExprNumberLiteral {
range: 4..5,
value: Int(
2,
),
},
),
),
step: Some(
NumberLiteral(
ExprNumberLiteral {
range: 6..7,
value: Int(
3,
),
},
),
),
},
),
ctx: Load,
},
)

View file

@ -1,267 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..36,
targets: [
Name(
ExprName {
range: 0..11,
id: "array_slice",
ctx: Store,
},
),
],
value: Subscript(
ExprSubscript {
range: 14..36,
value: Name(
ExprName {
range: 14..19,
id: "array",
ctx: Load,
},
),
slice: Tuple(
ExprTuple {
range: 20..35,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 20..21,
value: Int(
0,
),
},
),
Starred(
ExprStarred {
range: 23..31,
value: Name(
ExprName {
range: 24..31,
id: "indexes",
ctx: Load,
},
),
ctx: Load,
},
),
UnaryOp(
ExprUnaryOp {
range: 33..35,
op: USub,
operand: NumberLiteral(
ExprNumberLiteral {
range: 34..35,
value: Int(
1,
),
},
),
},
),
],
ctx: Load,
parenthesized: false,
},
),
ctx: Load,
},
),
},
),
Assign(
StmtAssign {
range: 37..73,
targets: [
Subscript(
ExprSubscript {
range: 37..59,
value: Name(
ExprName {
range: 37..42,
id: "array",
ctx: Load,
},
),
slice: Tuple(
ExprTuple {
range: 43..58,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 43..44,
value: Int(
0,
),
},
),
Starred(
ExprStarred {
range: 46..54,
value: Name(
ExprName {
range: 47..54,
id: "indexes",
ctx: Load,
},
),
ctx: Load,
},
),
UnaryOp(
ExprUnaryOp {
range: 56..58,
op: USub,
operand: NumberLiteral(
ExprNumberLiteral {
range: 57..58,
value: Int(
1,
),
},
),
},
),
],
ctx: Load,
parenthesized: false,
},
),
ctx: Store,
},
),
],
value: Name(
ExprName {
range: 62..73,
id: "array_slice",
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 74..119,
value: Subscript(
ExprSubscript {
range: 74..119,
value: Name(
ExprName {
range: 74..79,
id: "array",
ctx: Load,
},
),
slice: Tuple(
ExprTuple {
range: 80..118,
elts: [
Starred(
ExprStarred {
range: 80..98,
value: Name(
ExprName {
range: 81..98,
id: "indexes_to_select",
ctx: Load,
},
),
ctx: Load,
},
),
Starred(
ExprStarred {
range: 100..118,
value: Name(
ExprName {
range: 101..118,
id: "indexes_to_select",
ctx: Load,
},
),
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
ctx: Load,
},
),
},
),
Expr(
StmtExpr {
range: 120..150,
value: Subscript(
ExprSubscript {
range: 120..150,
value: Name(
ExprName {
range: 120..125,
id: "array",
ctx: Load,
},
),
slice: Tuple(
ExprTuple {
range: 126..149,
elts: [
Slice(
ExprSlice {
range: 126..129,
lower: Some(
NumberLiteral(
ExprNumberLiteral {
range: 126..127,
value: Int(
3,
),
},
),
),
upper: Some(
NumberLiteral(
ExprNumberLiteral {
range: 128..129,
value: Int(
5,
),
},
),
),
step: None,
},
),
Starred(
ExprStarred {
range: 131..149,
value: Name(
ExprName {
range: 132..149,
id: "indexes_to_select",
ctx: Load,
},
),
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
ctx: Load,
},
),
},
),
]

View file

@ -1,262 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Try(
StmtTry {
range: 0..134,
body: [
Raise(
StmtRaise {
range: 9..28,
exc: Some(
Call(
ExprCall {
range: 15..28,
func: Name(
ExprName {
range: 15..25,
id: "ValueError",
ctx: Load,
},
),
arguments: Arguments {
range: 25..28,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 26..27,
value: Int(
1,
),
},
),
],
keywords: [],
},
},
),
),
cause: None,
},
),
],
handlers: [
ExceptHandler(
ExceptHandlerExceptHandler {
range: 29..82,
type_: Some(
Name(
ExprName {
range: 36..45,
id: "TypeError",
ctx: Load,
},
),
),
name: Some(
Identifier {
id: "e",
range: 49..50,
},
),
body: [
Expr(
StmtExpr {
range: 56..82,
value: Call(
ExprCall {
range: 56..82,
func: Name(
ExprName {
range: 56..61,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 61..82,
args: [
FString(
ExprFString {
range: 62..81,
value: FStringValue {
inner: Single(
FString(
FString {
range: 62..81,
elements: [
Literal(
FStringLiteralElement {
range: 64..71,
value: "caught ",
},
),
Expression(
FStringExpressionElement {
range: 71..80,
expression: Call(
ExprCall {
range: 72..79,
func: Name(
ExprName {
range: 72..76,
id: "type",
ctx: Load,
},
),
arguments: Arguments {
range: 76..79,
args: [
Name(
ExprName {
range: 77..78,
id: "e",
ctx: Load,
},
),
],
keywords: [],
},
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Single,
prefix: Regular,
triple_quoted: false,
},
},
),
),
},
},
),
],
keywords: [],
},
},
),
},
),
],
},
),
ExceptHandler(
ExceptHandlerExceptHandler {
range: 83..134,
type_: Some(
Name(
ExprName {
range: 90..97,
id: "OSError",
ctx: Load,
},
),
),
name: Some(
Identifier {
id: "e",
range: 101..102,
},
),
body: [
Expr(
StmtExpr {
range: 108..134,
value: Call(
ExprCall {
range: 108..134,
func: Name(
ExprName {
range: 108..113,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 113..134,
args: [
FString(
ExprFString {
range: 114..133,
value: FStringValue {
inner: Single(
FString(
FString {
range: 114..133,
elements: [
Literal(
FStringLiteralElement {
range: 116..123,
value: "caught ",
},
),
Expression(
FStringExpressionElement {
range: 123..132,
expression: Call(
ExprCall {
range: 124..131,
func: Name(
ExprName {
range: 124..128,
id: "type",
ctx: Load,
},
),
arguments: Arguments {
range: 128..131,
args: [
Name(
ExprName {
range: 129..130,
id: "e",
ctx: Load,
},
),
],
keywords: [],
},
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Single,
prefix: Regular,
triple_quoted: false,
},
},
),
),
},
},
),
],
keywords: [],
},
},
),
},
),
],
},
),
],
orelse: [],
finalbody: [],
is_star: false,
},
),
]

View file

@ -1,446 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Try(
StmtTry {
range: 0..260,
body: [
Raise(
StmtRaise {
range: 9..98,
exc: Some(
Call(
ExprCall {
range: 15..98,
func: Name(
ExprName {
range: 15..29,
id: "ExceptionGroup",
ctx: Load,
},
),
arguments: Arguments {
range: 29..98,
args: [
StringLiteral(
ExprStringLiteral {
range: 30..34,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 30..34,
value: "eg",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
List(
ExprList {
range: 44..97,
elts: [
Call(
ExprCall {
range: 45..58,
func: Name(
ExprName {
range: 45..55,
id: "ValueError",
ctx: Load,
},
),
arguments: Arguments {
range: 55..58,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 56..57,
value: Int(
1,
),
},
),
],
keywords: [],
},
},
),
Call(
ExprCall {
range: 60..72,
func: Name(
ExprName {
range: 60..69,
id: "TypeError",
ctx: Load,
},
),
arguments: Arguments {
range: 69..72,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 70..71,
value: Int(
2,
),
},
),
],
keywords: [],
},
},
),
Call(
ExprCall {
range: 74..84,
func: Name(
ExprName {
range: 74..81,
id: "OSError",
ctx: Load,
},
),
arguments: Arguments {
range: 81..84,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 82..83,
value: Int(
3,
),
},
),
],
keywords: [],
},
},
),
Call(
ExprCall {
range: 86..96,
func: Name(
ExprName {
range: 86..93,
id: "OSError",
ctx: Load,
},
),
arguments: Arguments {
range: 93..96,
args: [
NumberLiteral(
ExprNumberLiteral {
range: 94..95,
value: Int(
4,
),
},
),
],
keywords: [],
},
},
),
],
ctx: Load,
},
),
],
keywords: [],
},
},
),
),
cause: None,
},
),
],
handlers: [
ExceptHandler(
ExceptHandlerExceptHandler {
range: 99..180,
type_: Some(
Name(
ExprName {
range: 107..116,
id: "TypeError",
ctx: Load,
},
),
),
name: Some(
Identifier {
id: "e",
range: 120..121,
},
),
body: [
Expr(
StmtExpr {
range: 127..180,
value: Call(
ExprCall {
range: 127..180,
func: Name(
ExprName {
range: 127..132,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 132..180,
args: [
FString(
ExprFString {
range: 133..179,
value: FStringValue {
inner: Single(
FString(
FString {
range: 133..179,
elements: [
Literal(
FStringLiteralElement {
range: 135..142,
value: "caught ",
},
),
Expression(
FStringExpressionElement {
range: 142..151,
expression: Call(
ExprCall {
range: 143..150,
func: Name(
ExprName {
range: 143..147,
id: "type",
ctx: Load,
},
),
arguments: Arguments {
range: 147..150,
args: [
Name(
ExprName {
range: 148..149,
id: "e",
ctx: Load,
},
),
],
keywords: [],
},
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
Literal(
FStringLiteralElement {
range: 151..164,
value: " with nested ",
},
),
Expression(
FStringExpressionElement {
range: 164..178,
expression: Attribute(
ExprAttribute {
range: 165..177,
value: Name(
ExprName {
range: 165..166,
id: "e",
ctx: Load,
},
),
attr: Identifier {
id: "exceptions",
range: 167..177,
},
ctx: Load,
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Single,
prefix: Regular,
triple_quoted: false,
},
},
),
),
},
},
),
],
keywords: [],
},
},
),
},
),
],
},
),
ExceptHandler(
ExceptHandlerExceptHandler {
range: 181..260,
type_: Some(
Name(
ExprName {
range: 189..196,
id: "OSError",
ctx: Load,
},
),
),
name: Some(
Identifier {
id: "e",
range: 200..201,
},
),
body: [
Expr(
StmtExpr {
range: 207..260,
value: Call(
ExprCall {
range: 207..260,
func: Name(
ExprName {
range: 207..212,
id: "print",
ctx: Load,
},
),
arguments: Arguments {
range: 212..260,
args: [
FString(
ExprFString {
range: 213..259,
value: FStringValue {
inner: Single(
FString(
FString {
range: 213..259,
elements: [
Literal(
FStringLiteralElement {
range: 215..222,
value: "caught ",
},
),
Expression(
FStringExpressionElement {
range: 222..231,
expression: Call(
ExprCall {
range: 223..230,
func: Name(
ExprName {
range: 223..227,
id: "type",
ctx: Load,
},
),
arguments: Arguments {
range: 227..230,
args: [
Name(
ExprName {
range: 228..229,
id: "e",
ctx: Load,
},
),
],
keywords: [],
},
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
Literal(
FStringLiteralElement {
range: 231..244,
value: " with nested ",
},
),
Expression(
FStringExpressionElement {
range: 244..258,
expression: Attribute(
ExprAttribute {
range: 245..257,
value: Name(
ExprName {
range: 245..246,
id: "e",
ctx: Load,
},
),
attr: Identifier {
id: "exceptions",
range: 247..257,
},
ctx: Load,
},
),
debug_text: None,
conversion: None,
format_spec: None,
},
),
],
flags: FStringFlags {
quote_style: Single,
prefix: Regular,
triple_quoted: false,
},
},
),
),
},
},
),
],
keywords: [],
},
},
),
},
),
],
},
),
],
orelse: [],
finalbody: [],
is_star: true,
},
),
]

View file

@ -1,124 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Expr(
StmtExpr {
range: 0..3,
value: Tuple(
ExprTuple {
range: 0..3,
elts: [
Name(
ExprName {
range: 0..1,
id: "a",
ctx: Load,
},
),
Name(
ExprName {
range: 2..3,
id: "b",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
},
),
Expr(
StmtExpr {
range: 4..9,
value: Tuple(
ExprTuple {
range: 4..9,
elts: [
Name(
ExprName {
range: 5..6,
id: "a",
ctx: Load,
},
),
Name(
ExprName {
range: 7..8,
id: "b",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
Expr(
StmtExpr {
range: 10..12,
value: Tuple(
ExprTuple {
range: 10..12,
elts: [],
ctx: Load,
parenthesized: true,
},
),
},
),
Expr(
StmtExpr {
range: 13..17,
value: Tuple(
ExprTuple {
range: 13..17,
elts: [
Name(
ExprName {
range: 14..15,
id: "a",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
Expr(
StmtExpr {
range: 18..25,
value: Tuple(
ExprTuple {
range: 19..24,
elts: [
Name(
ExprName {
range: 20..21,
id: "a",
ctx: Load,
},
),
Name(
ExprName {
range: 22..23,
id: "b",
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
},
),
]

View file

@ -1,38 +0,0 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: parse_ast
---
[
Assign(
StmtAssign {
range: 0..37,
targets: [
Name(
ExprName {
range: 0..1,
id: "x",
ctx: Store,
},
),
],
value: StringLiteral(
ExprStringLiteral {
range: 4..37,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 4..37,
value: "\u{8}another cool trick",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
},
),
]

Some files were not shown because too many files have changed in this diff Show more