mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-24 13:34:52 +00:00
Add end locations to all nodes (#4192)
This commit is contained in:
parent
ca62bd1593
commit
8a32bab00a
61 changed files with 3157 additions and 144 deletions
|
@ -7,17 +7,18 @@ use crate::{
|
|||
use std::{iter, mem, str};
|
||||
|
||||
struct FStringParser {
|
||||
str_location: Location,
|
||||
str_start: Location,
|
||||
str_end: Location,
|
||||
}
|
||||
|
||||
impl FStringParser {
|
||||
fn new(str_location: Location) -> Self {
|
||||
Self { str_location }
|
||||
fn new(str_start: Location, str_end: Location) -> Self {
|
||||
Self { str_start, str_end }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn expr(&self, node: ExprKind) -> Expr {
|
||||
Expr::new(self.str_location, node)
|
||||
Expr::new(self.str_start, self.str_end, node)
|
||||
}
|
||||
|
||||
fn parse_formatted_value<'a>(
|
||||
|
@ -305,11 +306,18 @@ fn parse_fstring_expr(source: &str) -> Result<Expr, ParseError> {
|
|||
|
||||
/// Parse an fstring from a string, located at a certain position in the sourcecode.
|
||||
/// In case of errors, we will get the location and the error returned.
|
||||
pub fn parse_located_fstring(source: &str, location: Location) -> Result<Vec<Expr>, FStringError> {
|
||||
FStringParser::new(location)
|
||||
pub fn parse_located_fstring(
|
||||
source: &str,
|
||||
start: Location,
|
||||
end: Location,
|
||||
) -> Result<Vec<Expr>, FStringError> {
|
||||
FStringParser::new(start, end)
|
||||
.parse(source.chars().peekable(), 0)
|
||||
.map(|(e, _)| e)
|
||||
.map_err(|error| FStringError { error, location })
|
||||
.map_err(|error| FStringError {
|
||||
error,
|
||||
location: start,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -317,7 +325,7 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
fn parse_fstring(source: &str) -> Result<Vec<Expr>, FStringErrorType> {
|
||||
FStringParser::new(Location::default())
|
||||
FStringParser::new(Location::default(), Location::default())
|
||||
.parse(source.chars().peekable(), 0)
|
||||
.map(|(e, _)| e)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,10 @@ pub fn parse_params(
|
|||
Ok((posonly, names, defaults))
|
||||
}
|
||||
|
||||
type FunctionArgument = (Option<(ast::Location, Option<String>)>, ast::Expr);
|
||||
type FunctionArgument = (
|
||||
Option<(ast::Location, ast::Location, Option<String>)>,
|
||||
ast::Expr,
|
||||
);
|
||||
|
||||
pub fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentList, LexicalError> {
|
||||
let mut args = vec![];
|
||||
|
@ -54,12 +57,12 @@ pub fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentList, Lexi
|
|||
let mut keyword_names = HashSet::with_capacity_and_hasher(func_args.len(), RandomState::new());
|
||||
for (name, value) in func_args {
|
||||
match name {
|
||||
Some((location, name)) => {
|
||||
Some((start, end, name)) => {
|
||||
if let Some(keyword_name) = &name {
|
||||
if keyword_names.contains(keyword_name) {
|
||||
return Err(LexicalError {
|
||||
error: LexicalErrorType::DuplicateKeywordArgumentError,
|
||||
location,
|
||||
location: start,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -67,7 +70,8 @@ pub fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentList, Lexi
|
|||
}
|
||||
|
||||
keywords.push(ast::Keyword::new(
|
||||
location,
|
||||
start,
|
||||
end,
|
||||
ast::KeywordData {
|
||||
arg: name,
|
||||
value: Box::new(value),
|
||||
|
|
|
@ -35,10 +35,12 @@ pub fn parse_program(source: &str, source_path: &str) -> Result<ast::Suite, Pars
|
|||
/// expr,
|
||||
/// ast::Expr {
|
||||
/// location: ast::Location::new(1, 3),
|
||||
/// end_location: Some(ast::Location::new(1, 6)),
|
||||
/// custom: (),
|
||||
/// node: ast::ExprKind::BinOp {
|
||||
/// left: Box::new(ast::Expr {
|
||||
/// location: ast::Location::new(1, 1),
|
||||
/// end_location: Some(ast::Location::new(1, 2)),
|
||||
/// custom: (),
|
||||
/// node: ast::ExprKind::Constant {
|
||||
/// value: ast::Constant::Int(1.into()),
|
||||
|
@ -48,6 +50,7 @@ pub fn parse_program(source: &str, source_path: &str) -> Result<ast::Suite, Pars
|
|||
/// op: ast::Operator::Add,
|
||||
/// right: Box::new(ast::Expr {
|
||||
/// location: ast::Location::new(1, 5),
|
||||
/// end_location: Some(ast::Location::new(1, 6)),
|
||||
/// custom: (),
|
||||
/// node: ast::ExprKind::Constant {
|
||||
/// value: ast::Constant::Int(2.into()),
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
custom: (),
|
||||
node: AnnAssign {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
annotation: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "int",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
value: Some(
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
),
|
||||
simple: 1,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,119 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
custom: (),
|
||||
node: Attribute {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
attr: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
custom: (),
|
||||
node: For {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
iter: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
body: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
custom: (),
|
||||
node: Pass,
|
||||
},
|
||||
],
|
||||
orelse: [],
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,135 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: List {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,153 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 27,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 27,
|
||||
},
|
||||
custom: (),
|
||||
node: ListComp {
|
||||
elt: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
generators: [
|
||||
Comprehension {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
iter: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 22,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 24,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
ifs: [],
|
||||
is_async: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: If {
|
||||
test: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
custom: (),
|
||||
node: NamedExpr {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
body: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: Pass,
|
||||
},
|
||||
],
|
||||
orelse: [],
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,153 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 27,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 27,
|
||||
},
|
||||
custom: (),
|
||||
node: SetComp {
|
||||
elt: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
generators: [
|
||||
Comprehension {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
iter: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 22,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 24,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
ifs: [],
|
||||
is_async: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,149 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 20,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Starred {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,133 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
custom: (),
|
||||
node: Subscript {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
slice: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,135 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
],
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: With {
|
||||
items: [
|
||||
Withitem {
|
||||
context_expr: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
optional_vars: Some(
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
],
|
||||
body: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: Pass,
|
||||
},
|
||||
],
|
||||
type_comment: None,
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
custom: (),
|
||||
node: AugAssign {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
custom: (),
|
||||
node: Attribute {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
attr: "y",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
op: Add,
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: AugAssign {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
op: Add,
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,131 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
custom: (),
|
||||
node: AugAssign {
|
||||
target: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
custom: (),
|
||||
node: Subscript {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
slice: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
ctx: Store,
|
||||
},
|
||||
},
|
||||
op: Add,
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
1,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
2,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
3,
|
||||
),
|
||||
kind: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
custom: (),
|
||||
node: Delete {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
custom: (),
|
||||
node: Attribute {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
attr: "y",
|
||||
ctx: Del,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Delete {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Del,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
source: compiler/parser/src/context.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
custom: (),
|
||||
node: Delete {
|
||||
targets: [
|
||||
Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
custom: (),
|
||||
node: Subscript {
|
||||
value: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
slice: Located {
|
||||
start: Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
ctx: Load,
|
||||
},
|
||||
},
|
||||
ctx: Del,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -21,6 +27,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -34,6 +46,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -41,6 +59,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "user",
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -21,6 +27,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -34,6 +46,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -47,6 +65,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -54,6 +78,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "user",
|
||||
|
@ -69,6 +99,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -82,6 +118,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -95,6 +137,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -108,6 +156,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -115,6 +169,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "second",
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -21,6 +27,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -34,6 +46,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -41,6 +59,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "user",
|
||||
|
@ -54,6 +78,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -62,6 +92,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "a",
|
||||
|
@ -30,6 +42,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -37,6 +55,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "b",
|
||||
|
@ -52,6 +76,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Compare {
|
||||
left: Located {
|
||||
|
@ -22,6 +34,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -39,6 +57,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "foo",
|
||||
|
@ -28,6 +40,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -36,6 +54,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -43,6 +67,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "spec",
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Compare {
|
||||
left: Located {
|
||||
|
@ -22,6 +34,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -39,6 +57,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "foo",
|
||||
|
@ -28,6 +40,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -36,6 +54,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -21,6 +27,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -34,6 +46,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -41,6 +59,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -21,6 +27,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -34,6 +46,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -41,6 +59,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 0,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Yield {
|
||||
value: None,
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 5,
|
||||
column: 7,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ClassDef {
|
||||
name: "Foo",
|
||||
|
@ -17,6 +23,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "A",
|
||||
|
@ -28,6 +40,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "B",
|
||||
|
@ -42,6 +60,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 2,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 2,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FunctionDef {
|
||||
name: "__init__",
|
||||
|
@ -53,6 +77,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 2,
|
||||
column: 15,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ArgData {
|
||||
arg: "self",
|
||||
|
@ -73,6 +103,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 3,
|
||||
column: 3,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 7,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Pass,
|
||||
},
|
||||
|
@ -87,6 +123,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 4,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 5,
|
||||
column: 7,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FunctionDef {
|
||||
name: "method_with_default",
|
||||
|
@ -98,6 +140,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 4,
|
||||
column: 26,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 30,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ArgData {
|
||||
arg: "self",
|
||||
|
@ -110,6 +158,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 4,
|
||||
column: 32,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 35,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ArgData {
|
||||
arg: "arg",
|
||||
|
@ -128,6 +182,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 4,
|
||||
column: 36,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 45,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -144,6 +204,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
row: 5,
|
||||
column: 3,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 5,
|
||||
column: 7,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Pass,
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
Located {
|
||||
|
@ -7,6 +7,12 @@ Located {
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 20,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: DictComp {
|
||||
key: Located {
|
||||
|
@ -14,6 +20,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x1",
|
||||
|
@ -25,6 +37,12 @@ Located {
|
|||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x2",
|
||||
|
@ -38,6 +56,12 @@ Located {
|
|||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -49,6 +73,12 @@ Located {
|
|||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "z",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
Located {
|
||||
|
@ -7,6 +7,12 @@ Located {
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 49,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ListComp {
|
||||
elt: Located {
|
||||
|
@ -14,6 +20,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
@ -27,6 +39,12 @@ Located {
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
|
@ -35,6 +53,12 @@ Located {
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -46,6 +70,12 @@ Located {
|
|||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y2",
|
||||
|
@ -61,6 +91,12 @@ Located {
|
|||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "z",
|
||||
|
@ -76,6 +112,12 @@ Located {
|
|||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 24,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "a",
|
||||
|
@ -87,6 +129,12 @@ Located {
|
|||
row: 1,
|
||||
column: 28,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 29,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "b",
|
||||
|
@ -99,6 +147,12 @@ Located {
|
|||
row: 1,
|
||||
column: 35,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 38,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Compare {
|
||||
left: Located {
|
||||
|
@ -106,6 +160,12 @@ Located {
|
|||
row: 1,
|
||||
column: 33,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 34,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "a",
|
||||
|
@ -121,6 +181,12 @@ Located {
|
|||
row: 1,
|
||||
column: 37,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 38,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -137,6 +203,12 @@ Located {
|
|||
row: 1,
|
||||
column: 44,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 48,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Compare {
|
||||
left: Located {
|
||||
|
@ -144,6 +216,12 @@ Located {
|
|||
row: 1,
|
||||
column: 42,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 43,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "a",
|
||||
|
@ -159,6 +237,12 @@ Located {
|
|||
row: 1,
|
||||
column: 46,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 48,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -23,6 +35,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
Located {
|
||||
|
@ -7,6 +7,12 @@ Located {
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: GeneratorExp {
|
||||
elt: Located {
|
||||
|
@ -14,6 +20,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
@ -27,6 +39,12 @@ Located {
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -38,6 +56,12 @@ Located {
|
|||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "z",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
|
||||
---
|
||||
[
|
||||
Located {
|
||||
|
@ -9,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: If {
|
||||
test: Located {
|
||||
|
@ -16,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -30,6 +41,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -37,6 +54,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -54,6 +77,12 @@ expression: parse_ast
|
|||
row: 2,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 1,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: If {
|
||||
test: Located {
|
||||
|
@ -61,6 +90,12 @@ expression: parse_ast
|
|||
row: 2,
|
||||
column: 6,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 7,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -75,6 +110,12 @@ expression: parse_ast
|
|||
row: 2,
|
||||
column: 9,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 11,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -82,6 +123,12 @@ expression: parse_ast
|
|||
row: 2,
|
||||
column: 9,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 11,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -99,6 +146,12 @@ expression: parse_ast
|
|||
row: 3,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -106,6 +159,12 @@ expression: parse_ast
|
|||
row: 3,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
Located {
|
||||
|
@ -7,6 +7,12 @@ Located {
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 27,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: GeneratorExp {
|
||||
elt: Located {
|
||||
|
@ -14,6 +20,12 @@ Located {
|
|||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: IfExp {
|
||||
test: Located {
|
||||
|
@ -21,6 +33,12 @@ Located {
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -32,6 +50,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
@ -43,6 +67,12 @@ Located {
|
|||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -58,6 +88,12 @@ Located {
|
|||
row: 1,
|
||||
column: 20,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -69,6 +105,12 @@ Located {
|
|||
row: 1,
|
||||
column: 25,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 26,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "z",
|
||||
|
|
|
@ -8,13 +8,25 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 33,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
location: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 33,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Call {
|
||||
func: Located {
|
||||
|
@ -22,6 +34,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "my_func",
|
||||
|
@ -34,6 +52,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -49,6 +73,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 32,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: KeywordData {
|
||||
arg: Some(
|
||||
|
@ -59,6 +89,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 31,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 32,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Lambda {
|
||||
args: Arguments {
|
||||
|
@ -25,6 +37,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ArgData {
|
||||
arg: "x",
|
||||
|
@ -37,6 +55,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ArgData {
|
||||
arg: "y",
|
||||
|
@ -56,6 +80,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 16,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: BinOp {
|
||||
left: Located {
|
||||
|
@ -63,6 +93,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
@ -75,6 +111,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
Located {
|
||||
|
@ -7,6 +7,12 @@ Located {
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 15,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: ListComp {
|
||||
elt: Located {
|
||||
|
@ -14,6 +20,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 3,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
@ -27,6 +39,12 @@ Located {
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -38,6 +56,12 @@ Located {
|
|||
row: 1,
|
||||
column: 13,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "z",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
Located {
|
||||
|
@ -7,6 +7,12 @@ Located {
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 24,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: GeneratorExp {
|
||||
elt: Located {
|
||||
|
@ -14,6 +20,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: NamedExpr {
|
||||
target: Located {
|
||||
|
@ -21,6 +33,12 @@ Located {
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "x",
|
||||
|
@ -32,6 +50,12 @@ Located {
|
|||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: BinOp {
|
||||
left: Located {
|
||||
|
@ -39,6 +63,12 @@ Located {
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -51,6 +81,12 @@ Located {
|
|||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -70,6 +106,12 @@ Located {
|
|||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "y",
|
||||
|
@ -81,6 +123,12 @@ Located {
|
|||
row: 1,
|
||||
column: 22,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "z",
|
||||
|
|
|
@ -8,13 +8,25 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 24,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
location: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 24,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Call {
|
||||
func: Located {
|
||||
|
@ -22,6 +34,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "print",
|
||||
|
@ -34,6 +52,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 20,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -47,6 +71,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 22,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -8,13 +8,25 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
location: Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Call {
|
||||
func: Located {
|
||||
|
@ -22,6 +34,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "print",
|
||||
|
@ -34,6 +52,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 7,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 20,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 14,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: parser/src/parser.rs
|
||||
expression: parse_program(&source).unwrap()
|
||||
|
||||
source: compiler/parser/src/parser.rs
|
||||
expression: "parse_program(source, \"<test>\").unwrap()"
|
||||
---
|
||||
[
|
||||
Located {
|
||||
|
@ -9,6 +8,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Assign {
|
||||
targets: [
|
||||
|
@ -17,6 +22,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
|
@ -25,6 +36,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "a",
|
||||
|
@ -36,6 +53,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 4,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Name {
|
||||
id: "b",
|
||||
|
@ -52,6 +75,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Tuple {
|
||||
elts: [
|
||||
|
@ -60,6 +89,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
@ -73,6 +108,12 @@ expression: parse_program(&source).unwrap()
|
|||
row: 1,
|
||||
column: 11,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 12,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Int(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -23,6 +35,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -23,6 +35,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -23,6 +35,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
@ -36,6 +54,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: FormattedValue {
|
||||
value: Located {
|
||||
|
@ -43,6 +67,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 5,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 17,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 21,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 19,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -23,6 +35,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 23,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: JoinedStr {
|
||||
values: [
|
||||
|
@ -23,6 +35,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -8,6 +8,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Expr {
|
||||
value: Located {
|
||||
|
@ -15,6 +21,12 @@ expression: parse_ast
|
|||
row: 1,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
node: Constant {
|
||||
value: Str(
|
||||
|
|
|
@ -6,9 +6,12 @@ use crate::{
|
|||
};
|
||||
use itertools::Itertools;
|
||||
|
||||
pub fn parse_strings(values: Vec<(Location, (String, StringKind))>) -> Result<Expr, LexicalError> {
|
||||
pub fn parse_strings(
|
||||
values: Vec<(Location, (String, StringKind), Location)>,
|
||||
) -> Result<Expr, LexicalError> {
|
||||
// Preserve the initial location and kind.
|
||||
let initial_location = values[0].0;
|
||||
let initial_start = values[0].0;
|
||||
let initial_end = values[0].2;
|
||||
let initial_kind = (values[0].1 .1 == StringKind::U).then(|| "u".to_owned());
|
||||
|
||||
// Determine whether the list of values contains any f-strings. (If not, we can return a
|
||||
|
@ -21,7 +24,8 @@ pub fn parse_strings(values: Vec<(Location, (String, StringKind))>) -> Result<Ex
|
|||
|
||||
let take_current = |current: &mut Vec<String>| -> Expr {
|
||||
Expr::new(
|
||||
initial_location,
|
||||
initial_start,
|
||||
initial_end,
|
||||
ExprKind::Constant {
|
||||
value: Constant::Str(current.drain(..).join("")),
|
||||
kind: initial_kind.clone(),
|
||||
|
@ -29,15 +33,17 @@ pub fn parse_strings(values: Vec<(Location, (String, StringKind))>) -> Result<Ex
|
|||
)
|
||||
};
|
||||
|
||||
for (location, (string, string_kind)) in values {
|
||||
for (start, (string, string_kind), end) in values {
|
||||
match string_kind {
|
||||
StringKind::Normal | StringKind::U => current.push(string),
|
||||
StringKind::F => {
|
||||
has_fstring = true;
|
||||
for value in parse_located_fstring(&string, location).map_err(|e| LexicalError {
|
||||
location,
|
||||
error: LexicalErrorType::FStringError(e.error),
|
||||
})? {
|
||||
for value in
|
||||
parse_located_fstring(&string, start, end).map_err(|e| LexicalError {
|
||||
location: start,
|
||||
error: LexicalErrorType::FStringError(e.error),
|
||||
})?
|
||||
{
|
||||
match value.node {
|
||||
ExprKind::FormattedValue { .. } => {
|
||||
if !current.is_empty() {
|
||||
|
@ -63,7 +69,11 @@ pub fn parse_strings(values: Vec<(Location, (String, StringKind))>) -> Result<Ex
|
|||
}
|
||||
|
||||
Ok(if has_fstring {
|
||||
Expr::new(initial_location, ExprKind::JoinedStr { values: deduped })
|
||||
Expr::new(
|
||||
initial_start,
|
||||
initial_end,
|
||||
ExprKind::JoinedStr { values: deduped },
|
||||
)
|
||||
} else {
|
||||
deduped
|
||||
.into_iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue