diff --git a/parser/src/python.lalrpop b/parser/src/python.lalrpop index f961409872..407a127508 100644 --- a/parser/src/python.lalrpop +++ b/parser/src/python.lalrpop @@ -966,7 +966,7 @@ WithItem: ast::WithItem = { }; FuncDef: ast::Stmt = { - "def" " >)?> ":" => { + "def" " >)?> ":" => { let args = Box::new(args); let returns = r.map(|x| Box::new(x)); let end_location = body.last().unwrap().end(); @@ -1152,7 +1152,7 @@ KwargParameter: Option> = { }; ClassDef: ast::Stmt = { - "class" ":" => { + "class" ":" => { let (bases, keywords) = match a { Some((_, arg, _)) => (arg.args, arg.keywords), None => (vec![], vec![]), diff --git a/parser/src/python.rs b/parser/src/python.rs index bea21289df..e0841f4b33 100644 --- a/parser/src/python.rs +++ b/parser/src/python.rs @@ -1,5 +1,5 @@ // auto-generated: "lalrpop 0.20.0" -// sha3: fb75a0c8eb018485c7dee0a97c87552ada8f64b81475cc02e5036865d3fa45c9 +// sha3: 9e5724a38f8390a2c0d8ec2e482038cf75c50fb170533d93f85cf122a887d14a use crate::{ ast::{self as ast, Ranged, bigint::BigInt}, lexer::{LexicalError, LexicalErrorType}, @@ -32192,8 +32192,8 @@ fn __action157< #[allow(clippy::too_many_arguments)] fn __action158< >( - (_, decorator_list, _): (TextSize, alloc::vec::Vec, TextSize), (_, location, _): (TextSize, TextSize, TextSize), + (_, decorator_list, _): (TextSize, alloc::vec::Vec, TextSize), (_, is_async, _): (TextSize, core::option::Option, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, name, _): (TextSize, ast::Identifier, TextSize), @@ -32353,8 +32353,8 @@ fn __action166< #[allow(clippy::too_many_arguments)] fn __action167< >( - (_, decorator_list, _): (TextSize, alloc::vec::Vec, TextSize), (_, location, _): (TextSize, TextSize, TextSize), + (_, decorator_list, _): (TextSize, alloc::vec::Vec, TextSize), (_, _, _): (TextSize, token::Tok, TextSize), (_, name, _): (TextSize, ast::Identifier, TextSize), (_, type_params, _): (TextSize, core::option::Option>, TextSize), @@ -39208,8 +39208,8 @@ fn __action651< #[allow(clippy::too_many_arguments)] fn __action652< >( - __0: (TextSize, alloc::vec::Vec, TextSize), - __1: (TextSize, TextSize, TextSize), + __0: (TextSize, TextSize, TextSize), + __1: (TextSize, alloc::vec::Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, token::Tok, TextSize), __4: (TextSize, ast::Identifier, TextSize), @@ -39243,8 +39243,8 @@ fn __action652< #[allow(clippy::too_many_arguments)] fn __action653< >( - __0: (TextSize, alloc::vec::Vec, TextSize), - __1: (TextSize, TextSize, TextSize), + __0: (TextSize, TextSize, TextSize), + __1: (TextSize, alloc::vec::Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Identifier, TextSize), __4: (TextSize, core::option::Option>, TextSize), @@ -39415,8 +39415,8 @@ fn __action658< #[allow(clippy::too_many_arguments)] fn __action659< >( - __0: (TextSize, alloc::vec::Vec, TextSize), - __1: (TextSize, TextSize, TextSize), + __0: (TextSize, TextSize, TextSize), + __1: (TextSize, alloc::vec::Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Identifier, TextSize), __4: (TextSize, core::option::Option>, TextSize), @@ -39450,8 +39450,8 @@ fn __action659< #[allow(clippy::too_many_arguments)] fn __action660< >( - __0: (TextSize, alloc::vec::Vec, TextSize), - __1: (TextSize, TextSize, TextSize), + __0: (TextSize, TextSize, TextSize), + __1: (TextSize, alloc::vec::Vec, TextSize), __2: (TextSize, token::Tok, TextSize), __3: (TextSize, ast::Identifier, TextSize), __4: (TextSize, core::option::Option>, TextSize), @@ -41722,16 +41722,16 @@ fn __action753< __8: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt { - let __start0 = __0.2; - let __end0 = __1.0; + let __start0 = __0.0; + let __end0 = __0.0; let __temp0 = __action384( &__start0, &__end0, ); let __temp0 = (__start0, __temp0, __end0); __action659( - __0, __temp0, + __0, __1, __2, __3, @@ -41754,16 +41754,16 @@ fn __action754< __5: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt { - let __start0 = __0.2; - let __end0 = __1.0; + let __start0 = __0.0; + let __end0 = __0.0; let __temp0 = __action384( &__start0, &__end0, ); let __temp0 = (__start0, __temp0, __end0); __action660( - __0, __temp0, + __0, __1, __2, __3, @@ -42818,16 +42818,16 @@ fn __action795< __8: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt { - let __start0 = __0.2; - let __end0 = __1.0; + let __start0 = __0.0; + let __end0 = __0.0; let __temp0 = __action384( &__start0, &__end0, ); let __temp0 = (__start0, __temp0, __end0); __action652( - __0, __temp0, + __0, __1, __2, __3, @@ -42852,16 +42852,16 @@ fn __action796< __7: (TextSize, ast::Suite, TextSize), ) -> ast::Stmt { - let __start0 = __0.2; - let __end0 = __1.0; + let __start0 = __0.0; + let __end0 = __0.0; let __temp0 = __action384( &__start0, &__end0, ); let __temp0 = (__start0, __temp0, __end0); __action653( - __0, __temp0, + __0, __1, __2, __3, diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__decorator_ranges.snap b/parser/src/snapshots/rustpython_parser__parser__tests__decorator_ranges.snap index eabccd9291..14202fb294 100644 --- a/parser/src/snapshots/rustpython_parser__parser__tests__decorator_ranges.snap +++ b/parser/src/snapshots/rustpython_parser__parser__tests__decorator_ranges.snap @@ -5,7 +5,7 @@ expression: parse_ast [ FunctionDef( StmtFunctionDef { - range: 14..34, + range: 0..34, name: Identifier { id: "test", range: 18..22, @@ -44,7 +44,7 @@ expression: parse_ast ), ClassDef( StmtClassDef { - range: 53..73, + range: 36..73, name: Identifier { id: "Abcd", range: 59..63,