New Arguments and Arg/ArgWithDefault AST representation (#59)

This commit is contained in:
Jeong, YunWon 2023-06-01 01:15:23 +09:00 committed by GitHub
parent 3fbf4f6804
commit fdec727f80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 22648 additions and 21711 deletions

View file

@ -66,7 +66,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_assign_list() {
let source = "[x, y] = (1, 2, 3)";
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();
@ -102,7 +102,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_assign_list_comp() {
let source = "x = [y for y in (1, 2, 3)]";
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();
@ -110,7 +110,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_assign_set_comp() {
let source = "x = {y for y in (1, 2, 3)}";
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();
@ -118,7 +118,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_assign_with() {
let source = "with 1 as x: pass";
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();

View file

@ -14,76 +14,55 @@ pub(crate) struct ArgumentList {
pub keywords: Vec<ast::Keyword>,
}
type ParameterDefs = (Vec<ast::Arg>, Vec<ast::Arg>, Vec<ast::Expr>);
type ParameterDef = (ast::Arg, Option<ast::Expr>);
// Perform validation of function/lambda arguments in a function definition.
pub(crate) fn validate_arguments(
arguments: ast::Arguments,
) -> Result<ast::Arguments, LexicalError> {
let mut all_args: Vec<&ast::Arg> = vec![];
all_args.extend(arguments.posonlyargs.iter());
all_args.extend(arguments.args.iter());
if let Some(a) = &arguments.vararg {
all_args.push(a);
}
all_args.extend(arguments.kwonlyargs.iter());
if let Some(a) = &arguments.kwarg {
all_args.push(a);
}
pub(crate) fn validate_arguments(arguments: &ast::Arguments) -> Result<(), LexicalError> {
let mut all_arg_names = FxHashSet::with_hasher(Default::default());
for arg in all_args {
let arg_name = &arg.arg;
// Check for duplicate arguments in the function definition.
let posonlyargs = arguments.posonlyargs.iter();
let args = arguments.args.iter();
let kwonlyargs = arguments.kwonlyargs.iter();
let vararg: Option<&ast::Arg> = arguments.vararg.as_deref();
let kwarg: Option<&ast::Arg> = arguments.kwarg.as_deref();
for arg in posonlyargs
.chain(args)
.chain(kwonlyargs)
.map(|arg| &arg.def)
.chain(vararg)
.chain(kwarg)
{
let range = arg.range;
let arg_name = arg.arg.as_str();
if !all_arg_names.insert(arg_name) {
return Err(LexicalError {
error: LexicalErrorType::DuplicateArgumentError(arg_name.to_string()),
location: arg.start(),
location: range.start(),
});
}
}
Ok(arguments)
Ok(())
}
// Parse parameters as supplied during a function/lambda *definition*.
pub(crate) fn parse_params(
params: (Vec<ParameterDef>, Vec<ParameterDef>),
) -> Result<ParameterDefs, LexicalError> {
let mut pos_only = Vec::with_capacity(params.0.len());
let mut names = Vec::with_capacity(params.1.len());
let mut defaults = vec![];
let mut try_default = |name: &ast::Arg, default| {
if let Some(default) = default {
defaults.push(default);
} else if !defaults.is_empty() {
// Once we have started with defaults, all remaining arguments must
// have defaults.
return Err(LexicalError {
error: LexicalErrorType::DefaultArgumentError,
location: name.start(),
});
}
Ok(())
};
for (name, default) in params.0 {
try_default(&name, default)?;
pos_only.push(name);
pub(crate) fn validate_pos_params(
args: &(Vec<ast::ArgWithDefault>, Vec<ast::ArgWithDefault>),
) -> Result<(), LexicalError> {
let (posonlyargs, args) = args;
#[allow(clippy::skip_while_next)]
let first_invalid = posonlyargs
.iter()
.chain(args.iter()) // for all args
.skip_while(|arg| arg.default.is_none()) // starting with args without default
.skip_while(|arg| arg.default.is_some()) // and then args with default
.next(); // there must not be any more args without default
if let Some(invalid) = first_invalid {
return Err(LexicalError {
error: LexicalErrorType::DefaultArgumentError,
location: invalid.def.range.start(),
});
}
for (name, default) in params.1 {
try_default(&name, default)?;
names.push(name);
}
Ok((pos_only, names, defaults))
Ok(())
}
type FunctionArgument = (
@ -157,7 +136,7 @@ mod tests {
use super::*;
use crate::{ast, parser::ParseErrorType, Parse};
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
macro_rules! function_and_lambda {
($($name:ident: $code:expr,)*) => {
$(
@ -170,7 +149,7 @@ mod tests {
}
}
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
function_and_lambda! {
test_function_no_args: "def f(): pass",
test_function_pos_args: "def f(a, b, c): pass",

View file

@ -610,7 +610,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_lambda() {
let source = "lambda x, y: x * y"; // lambda(x, y): x * y";
let parse_ast = ast::Suite::parse(source, "<test>").unwrap();
@ -625,7 +625,7 @@ mod tests {
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_class() {
let source = "\
class Foo(A, B):
@ -638,7 +638,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_dict_comprehension() {
let source = "{x1: x2 for y in z}";
let parse_ast = ast::Expr::parse(source, "<test>").unwrap();
@ -646,7 +646,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_list_comprehension() {
let source = "[x for y in z]";
let parse_ast = ast::Expr::parse(source, "<test>").unwrap();
@ -654,7 +654,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_double_list_comprehension() {
let source = "[x for y, y2 in z for a in b if a < 5 if a > 10]";
let parse_ast = ast::Expr::parse(source, "<test>").unwrap();
@ -662,7 +662,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_generator_comprehension() {
let source = "(x for y in z)";
let parse_ast = ast::Expr::parse(source, "<test>").unwrap();
@ -670,7 +670,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_named_expression_generator_comprehension() {
let source = "(x := y + 1 for y in z)";
let parse_ast = ast::Expr::parse(source, "<test>").unwrap();
@ -678,7 +678,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_parse_if_else_generator_comprehension() {
let source = "(x if y else y for y in z)";
let parse_ast = ast::Expr::parse(source, "<test>").unwrap();
@ -707,7 +707,7 @@ class Foo(A, B):
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_with_statement() {
let source = "\
with 0: pass
@ -777,7 +777,7 @@ array[3:5, *indexes_to_select]
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_generator_expression_argument() {
let source = r#"' '.join(
sql
@ -837,7 +837,7 @@ except* OSError as e:
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_match_as_identifier() {
let parse_ast = ast::Suite::parse(
r#"
@ -870,7 +870,7 @@ print(match(12))
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_patma() {
let source = r#"# Cases sampled from Lib/test/test_patma.py
@ -1042,7 +1042,7 @@ match w := x,:
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_match() {
let parse_ast = ast::Suite::parse(
r#"
@ -1073,7 +1073,7 @@ match x:
}
#[test]
#[cfg(not(feature = "all-nodes-with-ranges"))]
#[cfg(feature = "all-nodes-with-ranges")]
fn test_variadic_generics() {
let parse_ast = ast::Suite::parse(
r#"

View file

@ -6,7 +6,7 @@
use crate::{
ast::{self as ast, Ranged},
lexer::{LexicalError, LexicalErrorType},
function::{ArgumentList, parse_args, parse_params, validate_arguments},
function::{ArgumentList, parse_args, validate_pos_params, validate_arguments},
context::set_context,
string::parse_strings,
token::{self, StringKind},
@ -980,17 +980,10 @@ FuncDef: ast::Stmt = {
};
Parameters: ast::Arguments = {
<location:@L> "(" <a: (ParameterList<TypedParameter, StarTypedParameter>)?> ")" <end_location:@R> =>? {
let args = a.map(validate_arguments).transpose()?.unwrap_or_else(|| ast::Arguments {
posonlyargs: vec![],
args: vec![],
vararg: None,
kwonlyargs: vec![],
kw_defaults: vec![],
kwarg: None,
defaults: vec![],
range: optional_range(location, end_location)
});
<location:@L> "(" <a: (ParameterList<TypedParameter, StarTypedParameter, DoubleStarTypedParameter>)?> ")" <end_location:@R> =>? {
a.as_ref().map(validate_arguments).transpose()?;
let args = a
.unwrap_or_else(|| ast::Arguments::empty(optional_range(location, end_location)));
Ok(args)
}
@ -998,12 +991,13 @@ Parameters: ast::Arguments = {
// Note that this is a macro which is used once for function defs, and
// once for lambda defs.
ParameterList<ArgType, StarArgType>: ast::Arguments = {
<location:@L> <param1:ParameterDefs<ArgType>> <args2:("," <ParameterListStarArgs<ArgType, StarArgType>>)?> ","? <end_location:@R> =>? {
let (posonlyargs, args, defaults) = parse_params(param1)?;
ParameterList<ArgType, StarArgType, DoubleStarArgType>: ast::Arguments = {
<location:@L> <param1:ParameterDefs<ArgType>> <args2:("," <ParameterListStarArgs<ArgType, StarArgType, DoubleStarArgType>>)?> ","? <end_location:@R> =>? {
validate_pos_params(&param1)?;
let (posonlyargs, args) = param1;
// Now gather rest of parameters:
let (vararg, kwonlyargs, kw_defaults, kwarg) = args2.unwrap_or((None, vec![], vec![], None));
let (vararg, kwonlyargs, kwarg) = args2.unwrap_or((None, vec![], None));
Ok(ast::Arguments {
posonlyargs,
@ -1011,18 +1005,16 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
kwonlyargs,
vararg,
kwarg,
defaults,
kw_defaults,
range: optional_range(location, end_location)
})
},
<location:@L> <param1:ParameterDefs<ArgType>> <kw:("," <KwargParameter<ArgType>>)> ","? <end_location:@R> =>? {
let (posonlyargs, args, defaults) = parse_params(param1)?;
<location:@L> <param1:ParameterDefs<ArgType>> <kw:("," <KwargParameter<DoubleStarArgType>>)> ","? <end_location:@R> =>? {
validate_pos_params(&param1)?;
let (posonlyargs, args) = param1;
// Now gather rest of parameters:
let vararg = None;
let kwonlyargs = vec![];
let kw_defaults = vec![];
let kwarg = kw;
Ok(ast::Arguments {
@ -1031,33 +1023,27 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
kwonlyargs,
vararg,
kwarg,
defaults,
kw_defaults,
range: optional_range(location, end_location)
})
},
<location:@L> <params:ParameterListStarArgs<ArgType, StarArgType>> ","? <end_location:@R> => {
let (vararg, kwonlyargs, kw_defaults, kwarg) = params;
<location:@L> <params:ParameterListStarArgs<ArgType, StarArgType, DoubleStarArgType>> ","? <end_location:@R> => {
let (vararg, kwonlyargs, kwarg) = params;
ast::Arguments {
posonlyargs: vec![],
args: vec![],
kwonlyargs,
vararg,
kwarg,
defaults: vec![],
kw_defaults,
range: optional_range(location, end_location)
}
},
<location:@L> <kwarg:KwargParameter<ArgType>> ","? <end_location:@R> => {
<location:@L> <kwarg:KwargParameter<DoubleStarArgType>> ","? <end_location:@R> => {
ast::Arguments {
posonlyargs: vec![],
args: vec![],
kwonlyargs: vec![],
vararg: None,
kwarg,
defaults: vec![],
kw_defaults: vec![],
range: optional_range(location, end_location)
}
},
@ -1065,34 +1051,51 @@ ParameterList<ArgType, StarArgType>: ast::Arguments = {
// Use inline here to make sure the "," is not creating an ambiguity.
#[inline]
ParameterDefs<ArgType>: (Vec<(ast::Arg, Option<ast::Expr>)>, Vec<(ast::Arg, Option<ast::Expr>)>) = {
ParameterDefs<ArgType>: (Vec<ast::ArgWithDefault>, Vec<ast::ArgWithDefault>) = {
<args:OneOrMore<ParameterDef<ArgType>>> => {
(vec![], args)
},
<pos_args:OneOrMore<ParameterDef<ArgType>>> "," "/" <args:("," <ParameterDef<ArgType>>)*> => {
(pos_args, args)
<posonlyargs:OneOrMore<ParameterDef<ArgType>>> "," "/" <args:("," <ParameterDef<ArgType>>)*> => {
(posonlyargs, args)
},
};
ParameterDef<ArgType>: (ast::Arg, Option<ast::Expr>) = {
<i:ArgType> => (i, None),
<i:ArgType> "=" <e:Test<"all">> => (i, Some(e)),
ParameterDef<ArgType>: ast::ArgWithDefault = {
<i:ArgType> => i,
<mut i:ArgType> "=" <e:Test<"all">> => {
i.default = Some(Box::new(e));
i
},
};
UntypedParameter: ast::Arg = {
UntypedParameter: ast::ArgWithDefault = {
<location:@L> <arg:Identifier> <end_location:@R> => {
let def = ast::Arg { arg, annotation: None, type_comment: None, range: (location..end_location).into() };
ast::ArgWithDefault { def, default: None, range: optional_range(location, end_location) }
},
};
StarUntypedParameter: ast::Arg = {
<location:@L> <arg:Identifier> <end_location:@R> => ast::Arg { arg, annotation: None, type_comment: None, range: (location..end_location).into() },
};
TypedParameter: ast::Arg = {
TypedParameter: ast::ArgWithDefault = {
<location:@L> <arg:Identifier> <a:(":" <Test<"all">>)?> <end_location:@R> => {
let annotation = a.map(|x| Box::new(x));
ast::Arg { arg, annotation, type_comment: None, range: (location..end_location).into() }
let annotation = a.map(Box::new);
let def = ast::Arg { arg, annotation, type_comment: None, range: (location..end_location).into() };
ast::ArgWithDefault { def, default: None, range: optional_range(location, end_location) }
},
};
StarTypedParameter: ast::Arg = {
<location:@L> <arg:Identifier> <a:(":" <TestOrStarExpr>)?> <end_location:@R> => {
let annotation = a.map(|x| Box::new(x));
let annotation = a.map(Box::new);
ast::Arg { arg, annotation, type_comment: None, range: (location..end_location).into() }
},
};
DoubleStarTypedParameter: ast::Arg = {
<location:@L> <arg:Identifier> <a:(":" <Test<"all">>)?> <end_location:@R> => {
let annotation = a.map(Box::new);
ast::Arg { arg, annotation, type_comment: None, range: (location..end_location).into() }
},
};
@ -1100,23 +1103,9 @@ StarTypedParameter: ast::Arg = {
// Use inline here to make sure the "," is not creating an ambiguity.
// TODO: figure out another grammar that makes this inline no longer required.
#[inline]
ParameterListStarArgs<ArgType, StarArgType>: (Option<Box<ast::Arg>>, Vec<ast::Arg>, Vec<ast::Expr>, Option<Box<ast::Arg>>) = {
<location:@L> "*" <va:StarArgType?> <kw:("," <ParameterDef<ArgType>>)*> <kwarg:("," <KwargParameter<ArgType>>)?> =>? {
// Extract keyword arguments:
let mut kwonlyargs = Vec::new();
let mut kw_defaults = Vec::new();
let mut kwargs = Vec::with_capacity(kw.len());
for (name, value) in kw {
if let Some(value) = value {
kwonlyargs.push(name);
kw_defaults.push(value);
} else {
kwargs.push(name);
}
}
kwargs.extend(kwonlyargs.into_iter());
if va.is_none() && kwargs.is_empty() && kwarg.is_none() {
ParameterListStarArgs<ArgType, StarArgType, DoubleStarArgType>: (Option<Box<ast::Arg>>, Vec<ast::ArgWithDefault>, Option<Box<ast::Arg>>) = {
<location:@L> "*" <va:StarArgType?> <kwonlyargs:("," <ParameterDef<ArgType>>)*> <kwarg:("," <KwargParameter<DoubleStarArgType>>)?> =>? {
if va.is_none() && kwonlyargs.is_empty() && kwarg.is_none() {
Err(LexicalError {
error: LexicalErrorType::OtherError("named arguments must follow bare *".to_string()),
location,
@ -1126,7 +1115,7 @@ ParameterListStarArgs<ArgType, StarArgType>: (Option<Box<ast::Arg>>, Vec<ast::Ar
let kwarg = kwarg.flatten();
let va = va.map(Box::new);
Ok((va, kwargs, kw_defaults, kwarg))
Ok((va, kwonlyargs, kwarg))
}
};
@ -1205,21 +1194,10 @@ NamedExpression: ast::Expr = {
};
LambdaDef: ast::Expr = {
<location:@L> "lambda" <p:ParameterList<UntypedParameter, UntypedParameter>?> ":" <body:Test<"all">> <end_location:@R> =>? {
let p = validate_arguments(
p.unwrap_or_else(|| {
ast::Arguments {
posonlyargs: vec![],
args: vec![],
vararg: None,
kwonlyargs: vec![],
kw_defaults: vec![],
kwarg: None,
defaults: vec![],
range: optional_range(location, end_location)
}
}
))?;
<location:@L> "lambda" <p:ParameterList<UntypedParameter, StarUntypedParameter, StarUntypedParameter>?> ":" <body:Test<"all">> <end_location:@R> =>? {
p.as_ref().map(validate_arguments).transpose()?;
let p = p
.unwrap_or_else(|| ast::Arguments::empty(optional_range(location, end_location)));
Ok(ast::Expr::Lambda(
ast::ExprLambda {

41253
parser/src/python.rs generated

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@ expression: parse_ast
),
generators: [
Comprehension {
range: (),
range: 7..25,
target: Name(
ExprName {
range: 11..12,

View file

@ -31,7 +31,7 @@ expression: parse_ast
),
generators: [
Comprehension {
range: (),
range: 7..25,
target: Name(
ExprName {
range: 11..12,

View file

@ -8,7 +8,7 @@ expression: parse_ast
range: 0..17,
items: [
Withitem {
range: (),
range: 5..11,
context_expr: Constant(
ExprConstant {
range: 5..6,

View file

@ -11,39 +11,49 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..16,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 12..13,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 15..16,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 15..16,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,58 +11,69 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..22,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"b",
def: Arg {
range: 12..13,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 14..16,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 18..19,
arg: Identifier(
"c",
def: Arg {
range: 18..19,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 20..22,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
kw_defaults: [
Constant(
ExprConstant {
range: 14..16,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 20..22,
value: Int(
30,
),
kind: None,
},
),
],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,14 +11,12 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 5..7,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,64 +11,86 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..25,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 18..19,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
def: Arg {
range: 18..19,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 21..22,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
def: Arg {
range: 21..22,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 24..25,
arg: Identifier(
"f",
),
annotation: None,
type_comment: None,
def: Arg {
range: 24..25,
arg: Identifier(
"f",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,83 +11,106 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..31,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 18..19,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
def: Arg {
range: 18..19,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 21..22,
arg: Identifier(
"e",
def: Arg {
range: 21..22,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 23..25,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 27..28,
arg: Identifier(
"f",
def: Arg {
range: 27..28,
arg: Identifier(
"f",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 29..31,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
kw_defaults: [
Constant(
ExprConstant {
range: 23..25,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 29..31,
value: Int(
30,
),
kind: None,
},
),
],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,32 +11,44 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..35,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: Some(
@ -50,53 +62,64 @@ Ok(
},
),
kwonlyargs: [
Arg {
ArgWithDefault {
range: 22..23,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
def: Arg {
range: 22..23,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 25..26,
arg: Identifier(
"e",
def: Arg {
range: 25..26,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 27..29,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 31..32,
arg: Identifier(
"f",
def: Arg {
range: 31..32,
arg: Identifier(
"f",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 33..35,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
kw_defaults: [
Constant(
ExprConstant {
range: 27..29,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 33..35,
value: Int(
30,
),
kind: None,
},
),
],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,32 +11,44 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..45,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: Some(
@ -50,51 +62,63 @@ Ok(
},
),
kwonlyargs: [
Arg {
ArgWithDefault {
range: 22..23,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
def: Arg {
range: 22..23,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 25..26,
arg: Identifier(
"e",
def: Arg {
range: 25..26,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 27..29,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 31..32,
arg: Identifier(
"f",
def: Arg {
range: 31..32,
arg: Identifier(
"f",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 33..35,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
kw_defaults: [
Constant(
ExprConstant {
range: 27..29,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 33..35,
value: Int(
30,
),
kind: None,
},
),
],
kwarg: Some(
Arg {
range: 39..45,
@ -105,7 +129,6 @@ Ok(
type_comment: None,
},
),
defaults: [],
},
body: [
Pass(

View file

@ -11,39 +11,49 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..13,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 12..13,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: [
Pass(

View file

@ -11,58 +11,69 @@ Ok(
"f",
),
args: Arguments {
range: (),
range: 6..19,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 6..7,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 9..10,
arg: Identifier(
"b",
def: Arg {
range: 9..10,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 11..13,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 15..16,
arg: Identifier(
"c",
def: Arg {
range: 15..16,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 17..19,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [
Constant(
ExprConstant {
range: 11..13,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 17..19,
value: Int(
30,
),
kind: None,
},
),
],
},
body: [
Pass(

View file

@ -11,39 +11,49 @@ Ok(
ExprLambda {
range: 0..20,
args: Arguments {
range: (),
range: 7..17,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 10..11,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 10..11,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 13..14,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 13..14,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 16..17,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 16..17,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: Constant(
ExprConstant {

View file

@ -11,58 +11,69 @@ Ok(
ExprLambda {
range: 0..26,
args: Arguments {
range: (),
range: 7..23,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 10..11,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 10..11,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 13..14,
arg: Identifier(
"b",
def: Arg {
range: 13..14,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 15..17,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 19..20,
arg: Identifier(
"c",
def: Arg {
range: 19..20,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 21..23,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
kw_defaults: [
Constant(
ExprConstant {
range: 15..17,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 21..23,
value: Int(
30,
),
kind: None,
},
),
],
kwarg: None,
defaults: [],
},
body: Constant(
ExprConstant {

View file

@ -11,14 +11,12 @@ Ok(
ExprLambda {
range: 0..9,
args: Arguments {
range: (),
range: 0..9,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: Constant(
ExprConstant {

View file

@ -11,56 +11,74 @@ Ok(
ExprLambda {
range: 0..26,
args: Arguments {
range: (),
range: 7..23,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 7..8,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 7..8,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 10..11,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 10..11,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 13..14,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 13..14,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [
Arg {
ArgWithDefault {
range: 19..20,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
def: Arg {
range: 19..20,
arg: Identifier(
"d",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 22..23,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
def: Arg {
range: 22..23,
arg: Identifier(
"e",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: Constant(
ExprConstant {

View file

@ -11,39 +11,49 @@ Ok(
ExprLambda {
range: 0..17,
args: Arguments {
range: (),
range: 7..14,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 7..8,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 7..8,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 10..11,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
def: Arg {
range: 10..11,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 13..14,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
def: Arg {
range: 13..14,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: Constant(
ExprConstant {

View file

@ -11,58 +11,69 @@ Ok(
ExprLambda {
range: 0..23,
args: Arguments {
range: (),
range: 7..20,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 7..8,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
def: Arg {
range: 7..8,
arg: Identifier(
"a",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 10..11,
arg: Identifier(
"b",
def: Arg {
range: 10..11,
arg: Identifier(
"b",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 12..14,
value: Int(
20,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
Arg {
ArgWithDefault {
range: 16..17,
arg: Identifier(
"c",
def: Arg {
range: 16..17,
arg: Identifier(
"c",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 18..20,
value: Int(
30,
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [
Constant(
ExprConstant {
range: 12..14,
value: Int(
20,
),
kind: None,
},
),
Constant(
ExprConstant {
range: 18..20,
value: Int(
30,
),
kind: None,
},
),
],
},
body: Constant(
ExprConstant {

View file

@ -38,7 +38,7 @@ Call(
),
generators: [
Comprehension {
range: (),
range: 22..139,
target: Name(
ExprName {
range: 26..29,

View file

@ -37,7 +37,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 24..73,
pattern: MatchMapping(
PatternMatchMapping {
range: 29..52,
@ -122,7 +122,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 103..177,
pattern: MatchMapping(
PatternMatchMapping {
range: 108..155,
@ -236,7 +236,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 191..218,
pattern: MatchSequence(
PatternMatchSequence {
range: 196..203,
@ -319,7 +319,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 232..259,
pattern: MatchSequence(
PatternMatchSequence {
range: 237..244,
@ -402,7 +402,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 273..297,
pattern: MatchSequence(
PatternMatchSequence {
range: 278..282,

View file

@ -712,7 +712,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 544..556,
pattern: MatchValue(
PatternMatchValue {
range: 549..550,
@ -737,7 +737,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 561..581,
pattern: MatchValue(
PatternMatchValue {
range: 566..567,
@ -782,23 +782,25 @@ expression: parse_ast
ExprLambda {
range: 590..618,
args: Arguments {
range: (),
range: 597..602,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 597..602,
arg: Identifier(
"query",
),
annotation: None,
type_comment: None,
def: Arg {
range: 597..602,
arg: Identifier(
"query",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: Compare(
ExprCompare {

View file

@ -38,23 +38,25 @@ expression: "parse_program(source, \"<test>\").unwrap()"
"__init__",
),
args: Arguments {
range: (),
range: 31..35,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 31..35,
arg: Identifier(
"self",
),
annotation: None,
type_comment: None,
def: Arg {
range: 31..35,
arg: Identifier(
"self",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: [
Pass(
@ -75,41 +77,47 @@ expression: "parse_program(source, \"<test>\").unwrap()"
"method_with_default",
),
args: Arguments {
range: (),
range: 70..89,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 70..74,
arg: Identifier(
"self",
),
annotation: None,
type_comment: None,
def: Arg {
range: 70..74,
arg: Identifier(
"self",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 76..79,
arg: Identifier(
"arg",
def: Arg {
range: 76..79,
arg: Identifier(
"arg",
),
annotation: None,
type_comment: None,
},
default: Some(
Constant(
ExprConstant {
range: 80..89,
value: Str(
"default",
),
kind: None,
},
),
),
annotation: None,
type_comment: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [
Constant(
ExprConstant {
range: 80..89,
value: Str(
"default",
),
kind: None,
},
),
],
},
body: [
Pass(

View file

@ -25,7 +25,7 @@ DictComp(
),
generators: [
Comprehension {
range: (),
range: 8..18,
target: Name(
ExprName {
range: 12..13,

View file

@ -16,7 +16,7 @@ ListComp(
),
generators: [
Comprehension {
range: (),
range: 3..17,
target: Tuple(
ExprTuple {
range: 7..12,
@ -56,7 +56,7 @@ ListComp(
is_async: false,
},
Comprehension {
range: (),
range: 18..47,
target: Name(
ExprName {
range: 22..23,

View file

@ -16,7 +16,7 @@ GeneratorExp(
),
generators: [
Comprehension {
range: (),
range: 3..13,
target: Name(
ExprName {
range: 7..8,

View file

@ -39,7 +39,7 @@ GeneratorExp(
),
generators: [
Comprehension {
range: (),
range: 15..25,
target: Name(
ExprName {
range: 19..20,

View file

@ -10,31 +10,37 @@ expression: parse_ast
ExprLambda {
range: 0..18,
args: Arguments {
range: (),
range: 7..11,
posonlyargs: [],
args: [
Arg {
ArgWithDefault {
range: 7..8,
arg: Identifier(
"x",
),
annotation: None,
type_comment: None,
def: Arg {
range: 7..8,
arg: Identifier(
"x",
),
annotation: None,
type_comment: None,
},
default: None,
},
Arg {
ArgWithDefault {
range: 10..11,
arg: Identifier(
"y",
),
annotation: None,
type_comment: None,
def: Arg {
range: 10..11,
arg: Identifier(
"y",
),
annotation: None,
type_comment: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: BinOp(
ExprBinOp {

View file

@ -16,7 +16,7 @@ ListComp(
),
generators: [
Comprehension {
range: (),
range: 3..13,
target: Name(
ExprName {
range: 7..8,

View file

@ -45,7 +45,7 @@ GeneratorExp(
),
generators: [
Comprehension {
range: (),
range: 12..22,
target: Name(
ExprName {
range: 16..17,

View file

@ -17,7 +17,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 80..103,
pattern: MatchValue(
PatternMatchValue {
range: 85..88,
@ -86,7 +86,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 139..167,
pattern: MatchClass(
PatternMatchClass {
range: 144..152,
@ -163,7 +163,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 203..229,
pattern: MatchValue(
PatternMatchValue {
range: 208..209,
@ -219,7 +219,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 234..260,
pattern: MatchValue(
PatternMatchValue {
range: 239..240,
@ -291,7 +291,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 296..332,
pattern: MatchOr(
PatternMatchOr {
range: 301..314,
@ -402,7 +402,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 368..403,
pattern: MatchOr(
PatternMatchOr {
range: 373..388,
@ -527,7 +527,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 458..489,
pattern: MatchSequence(
PatternMatchSequence {
range: 463..467,
@ -562,7 +562,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 494..523,
pattern: MatchMapping(
PatternMatchMapping {
range: 499..501,
@ -608,7 +608,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 559..594,
pattern: MatchMapping(
PatternMatchMapping {
range: 564..579,
@ -702,7 +702,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 599..687,
pattern: MatchOr(
PatternMatchOr {
range: 604..672,
@ -940,7 +940,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 692..714,
pattern: MatchSequence(
PatternMatchSequence {
range: 697..699,
@ -994,7 +994,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 750..782,
pattern: MatchValue(
PatternMatchValue {
range: 755..767,
@ -1072,7 +1072,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 818..841,
pattern: MatchValue(
PatternMatchValue {
range: 823..826,
@ -1141,7 +1141,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 877..913,
pattern: MatchOr(
PatternMatchOr {
range: 882..895,
@ -1252,7 +1252,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 949..975,
pattern: MatchValue(
PatternMatchValue {
range: 954..955,
@ -1324,7 +1324,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1011..1037,
pattern: MatchMapping(
PatternMatchMapping {
range: 1016..1022,
@ -1389,7 +1389,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 1042..1068,
pattern: MatchMapping(
PatternMatchMapping {
range: 1047..1053,
@ -1454,7 +1454,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 1073..1098,
pattern: MatchMapping(
PatternMatchMapping {
range: 1078..1083,
@ -1521,7 +1521,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1138..1162,
pattern: MatchSequence(
PatternMatchSequence {
range: 1143..1147,
@ -1582,7 +1582,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1198..1219,
pattern: MatchValue(
PatternMatchValue {
range: 1203..1204,
@ -1628,7 +1628,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 1224..1245,
pattern: MatchValue(
PatternMatchValue {
range: 1229..1230,
@ -1690,7 +1690,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1281..1315,
pattern: MatchMapping(
PatternMatchMapping {
range: 1286..1298,
@ -1794,7 +1794,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1359..1392,
pattern: MatchSequence(
PatternMatchSequence {
range: 1364..1377,
@ -1901,7 +1901,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1428..1451,
pattern: MatchSequence(
PatternMatchSequence {
range: 1433..1436,
@ -1954,7 +1954,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 1456..1498,
pattern: MatchSequence(
PatternMatchSequence {
range: 1461..1467,
@ -2069,7 +2069,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 1503..1529,
pattern: MatchSequence(
PatternMatchSequence {
range: 1508..1514,
@ -2152,7 +2152,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1565..1595,
pattern: MatchSequence(
PatternMatchSequence {
range: 1570..1580,
@ -2235,7 +2235,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1631..1664,
pattern: MatchValue(
PatternMatchValue {
range: 1636..1649,
@ -2327,7 +2327,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1703..1726,
pattern: MatchSequence(
PatternMatchSequence {
range: 1708..1711,
@ -2393,7 +2393,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1762..1789,
pattern: MatchValue(
PatternMatchValue {
range: 1767..1774,
@ -2482,7 +2482,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1825..1849,
pattern: MatchSingleton(
PatternMatchSingleton {
range: 1830..1834,
@ -2536,7 +2536,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1885..1906,
pattern: MatchValue(
PatternMatchValue {
range: 1890..1891,
@ -2598,7 +2598,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 1942..1967,
pattern: MatchSingleton(
PatternMatchSingleton {
range: 1947..1952,
@ -2654,7 +2654,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2003..2025,
pattern: MatchSequence(
PatternMatchSequence {
range: 2008..2010,
@ -2692,7 +2692,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 2030..2054,
pattern: MatchSequence(
PatternMatchSequence {
range: 2035..2039,
@ -2745,7 +2745,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 2059..2081,
pattern: MatchValue(
PatternMatchValue {
range: 2064..2066,
@ -2807,7 +2807,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2117..2138,
pattern: MatchAs(
PatternMatchAs {
range: 2122..2123,
@ -2866,7 +2866,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2174..2207,
pattern: MatchSequence(
PatternMatchSequence {
range: 2179..2192,
@ -2953,7 +2953,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2243..2307,
pattern: MatchOr(
PatternMatchOr {
range: 2248..2278,
@ -3130,7 +3130,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2343..2378,
pattern: MatchMapping(
PatternMatchMapping {
range: 2348..2363,
@ -3224,7 +3224,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 2383..2472,
pattern: MatchOr(
PatternMatchOr {
range: 2388..2457,
@ -3462,7 +3462,7 @@ expression: parse_ast
],
},
MatchCase {
range: (),
range: 2477..2499,
pattern: MatchSequence(
PatternMatchSequence {
range: 2482..2484,
@ -3542,7 +3542,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2543..2568,
pattern: MatchSequence(
PatternMatchSequence {
range: 2548..2553,
@ -3647,7 +3647,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2612..2638,
pattern: MatchSequence(
PatternMatchSequence {
range: 2617..2623,
@ -3726,7 +3726,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2675..2697,
pattern: MatchSequence(
PatternMatchSequence {
range: 2680..2682,
@ -3809,7 +3809,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2736..2760,
pattern: MatchSequence(
PatternMatchSequence {
range: 2741..2745,
@ -3900,7 +3900,7 @@ expression: parse_ast
),
cases: [
MatchCase {
range: (),
range: 2802..2829,
pattern: MatchSequence(
PatternMatchSequence {
range: 2807..2814,

View file

@ -10,7 +10,7 @@ expression: parse_ast
"args_to_tuple",
),
args: Arguments {
range: (),
range: 19..29,
posonlyargs: [],
args: [],
vararg: Some(
@ -40,9 +40,7 @@ expression: parse_ast
},
),
kwonlyargs: [],
kw_defaults: [],
kwarg: None,
defaults: [],
},
body: [
Expr(

View file

@ -8,7 +8,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 0..12,
items: [
Withitem {
range: (),
range: 5..6,
context_expr: Constant(
ExprConstant {
range: 5..6,
@ -36,7 +36,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 13..30,
items: [
Withitem {
range: (),
range: 18..24,
context_expr: Constant(
ExprConstant {
range: 18..19,
@ -74,7 +74,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 31..46,
items: [
Withitem {
range: (),
range: 36..37,
context_expr: Constant(
ExprConstant {
range: 36..37,
@ -87,7 +87,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
optional_vars: None,
},
Withitem {
range: (),
range: 39..40,
context_expr: Constant(
ExprConstant {
range: 39..40,
@ -115,7 +115,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 47..72,
items: [
Withitem {
range: (),
range: 52..58,
context_expr: Constant(
ExprConstant {
range: 52..53,
@ -138,7 +138,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
),
},
Withitem {
range: (),
range: 60..66,
context_expr: Constant(
ExprConstant {
range: 60..61,
@ -176,7 +176,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 73..97,
items: [
Withitem {
range: (),
range: 78..91,
context_expr: IfExp(
ExprIfExp {
range: 78..91,
@ -227,7 +227,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 98..127,
items: [
Withitem {
range: (),
range: 103..121,
context_expr: IfExp(
ExprIfExp {
range: 103..116,
@ -288,7 +288,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 128..141,
items: [
Withitem {
range: (),
range: 133..135,
context_expr: Tuple(
ExprTuple {
range: 133..135,
@ -314,7 +314,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 142..160,
items: [
Withitem {
range: (),
range: 147..154,
context_expr: Tuple(
ExprTuple {
range: 147..149,
@ -350,7 +350,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 161..175,
items: [
Withitem {
range: (),
range: 167..168,
context_expr: Constant(
ExprConstant {
range: 167..168,
@ -378,7 +378,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 176..195,
items: [
Withitem {
range: (),
range: 181..189,
context_expr: Constant(
ExprConstant {
range: 182..183,
@ -416,7 +416,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 196..211,
items: [
Withitem {
range: (),
range: 202..203,
context_expr: Constant(
ExprConstant {
range: 202..203,
@ -444,7 +444,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 212..232,
items: [
Withitem {
range: (),
range: 217..226,
context_expr: Tuple(
ExprTuple {
range: 217..221,
@ -490,7 +490,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 233..250,
items: [
Withitem {
range: (),
range: 239..243,
context_expr: Constant(
ExprConstant {
range: 239..240,
@ -503,7 +503,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
optional_vars: None,
},
Withitem {
range: (),
range: 239..243,
context_expr: Constant(
ExprConstant {
range: 242..243,
@ -531,7 +531,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 251..273,
items: [
Withitem {
range: (),
range: 256..267,
context_expr: Tuple(
ExprTuple {
range: 256..262,
@ -586,7 +586,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 274..290,
items: [
Withitem {
range: (),
range: 279..284,
context_expr: Tuple(
ExprTuple {
range: 279..284,
@ -628,7 +628,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 291..312,
items: [
Withitem {
range: (),
range: 296..306,
context_expr: Tuple(
ExprTuple {
range: 296..301,
@ -680,7 +680,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 313..331,
items: [
Withitem {
range: (),
range: 318..325,
context_expr: Tuple(
ExprTuple {
range: 318..325,
@ -731,7 +731,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 332..355,
items: [
Withitem {
range: (),
range: 337..349,
context_expr: Tuple(
ExprTuple {
range: 337..344,
@ -792,7 +792,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 356..375,
items: [
Withitem {
range: (),
range: 361..369,
context_expr: NamedExpr(
ExprNamedExpr {
range: 362..368,
@ -834,7 +834,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 376..400,
items: [
Withitem {
range: (),
range: 381..394,
context_expr: NamedExpr(
ExprNamedExpr {
range: 382..388,
@ -886,7 +886,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 401..428,
items: [
Withitem {
range: (),
range: 406..422,
context_expr: Tuple(
ExprTuple {
range: 406..422,
@ -959,7 +959,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 429..461,
items: [
Withitem {
range: (),
range: 434..455,
context_expr: Tuple(
ExprTuple {
range: 434..450,
@ -1042,7 +1042,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 462..481,
items: [
Withitem {
range: (),
range: 468..474,
context_expr: Constant(
ExprConstant {
range: 468..469,
@ -1080,7 +1080,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 482..502,
items: [
Withitem {
range: (),
range: 488..494,
context_expr: Constant(
ExprConstant {
range: 488..489,
@ -1118,7 +1118,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 503..530,
items: [
Withitem {
range: (),
range: 509..515,
context_expr: Constant(
ExprConstant {
range: 509..510,
@ -1141,7 +1141,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
),
},
Withitem {
range: (),
range: 517..523,
context_expr: Constant(
ExprConstant {
range: 517..518,
@ -1179,7 +1179,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
range: 531..559,
items: [
Withitem {
range: (),
range: 537..543,
context_expr: Constant(
ExprConstant {
range: 537..538,
@ -1202,7 +1202,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
),
},
Withitem {
range: (),
range: 545..551,
context_expr: Constant(
ExprConstant {
range: 545..546,