mirror of https://github.com/astral-sh/ruff
227 lines
8.4 KiB
Plaintext
227 lines
8.4 KiB
Plaintext
---
|
|
source: compiler/parser/src/parser.rs
|
|
expression: "parse_program(source, \"<test>\").unwrap()"
|
|
---
|
|
[
|
|
Located {
|
|
location: Location {
|
|
row: 1,
|
|
column: 0,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 5,
|
|
column: 6,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: ClassDef {
|
|
name: "Foo",
|
|
bases: [
|
|
Located {
|
|
location: Location {
|
|
row: 1,
|
|
column: 10,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 1,
|
|
column: 11,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: Name {
|
|
id: "A",
|
|
ctx: Load,
|
|
},
|
|
},
|
|
Located {
|
|
location: Location {
|
|
row: 1,
|
|
column: 13,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 1,
|
|
column: 14,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: Name {
|
|
id: "B",
|
|
ctx: Load,
|
|
},
|
|
},
|
|
],
|
|
keywords: [],
|
|
body: [
|
|
Located {
|
|
location: Location {
|
|
row: 2,
|
|
column: 1,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 3,
|
|
column: 6,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: FunctionDef {
|
|
name: "__init__",
|
|
args: Arguments {
|
|
posonlyargs: [],
|
|
args: [
|
|
Located {
|
|
location: Location {
|
|
row: 2,
|
|
column: 14,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 2,
|
|
column: 18,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: ArgData {
|
|
arg: "self",
|
|
annotation: None,
|
|
type_comment: None,
|
|
},
|
|
},
|
|
],
|
|
vararg: None,
|
|
kwonlyargs: [],
|
|
kw_defaults: [],
|
|
kwarg: None,
|
|
defaults: [],
|
|
},
|
|
body: [
|
|
Located {
|
|
location: Location {
|
|
row: 3,
|
|
column: 2,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 3,
|
|
column: 6,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: Pass,
|
|
},
|
|
],
|
|
decorator_list: [],
|
|
returns: None,
|
|
type_comment: None,
|
|
},
|
|
},
|
|
Located {
|
|
location: Location {
|
|
row: 4,
|
|
column: 1,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 5,
|
|
column: 6,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: FunctionDef {
|
|
name: "method_with_default",
|
|
args: Arguments {
|
|
posonlyargs: [],
|
|
args: [
|
|
Located {
|
|
location: Location {
|
|
row: 4,
|
|
column: 25,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 4,
|
|
column: 29,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: ArgData {
|
|
arg: "self",
|
|
annotation: None,
|
|
type_comment: None,
|
|
},
|
|
},
|
|
Located {
|
|
location: Location {
|
|
row: 4,
|
|
column: 31,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 4,
|
|
column: 34,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: ArgData {
|
|
arg: "arg",
|
|
annotation: None,
|
|
type_comment: None,
|
|
},
|
|
},
|
|
],
|
|
vararg: None,
|
|
kwonlyargs: [],
|
|
kw_defaults: [],
|
|
kwarg: None,
|
|
defaults: [
|
|
Located {
|
|
location: Location {
|
|
row: 4,
|
|
column: 35,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 4,
|
|
column: 44,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: Constant {
|
|
value: Str(
|
|
"default",
|
|
),
|
|
kind: None,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
body: [
|
|
Located {
|
|
location: Location {
|
|
row: 5,
|
|
column: 2,
|
|
},
|
|
end_location: Some(
|
|
Location {
|
|
row: 5,
|
|
column: 6,
|
|
},
|
|
),
|
|
custom: (),
|
|
node: Pass,
|
|
},
|
|
],
|
|
decorator_list: [],
|
|
returns: None,
|
|
type_comment: None,
|
|
},
|
|
},
|
|
],
|
|
decorator_list: [],
|
|
},
|
|
},
|
|
]
|