mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-19 02:55:50 +00:00
improve col_offset in new line and lalr
This commit is contained in:
parent
de7acf6f99
commit
1dfa2e5239
6 changed files with 34 additions and 34 deletions
|
@ -35,7 +35,7 @@ pub fn parse_program(source: &str, source_path: &str) -> Result<ast::Suite, Pars
|
|||
/// assert_eq!(
|
||||
/// expr,
|
||||
/// ast::Expr {
|
||||
/// location: ast::Location::new(1, 2),
|
||||
/// location: ast::Location::new(1, 0),
|
||||
/// end_location: Some(ast::Location::new(1, 5)),
|
||||
/// custom: (),
|
||||
/// node: ast::ExprKind::BinOp {
|
||||
|
|
|
@ -11,7 +11,7 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
end_location: Some(
|
||||
Location {
|
||||
row: 5,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -58,12 +58,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 2,
|
||||
column: 2,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 2,
|
||||
column: 1,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -75,12 +75,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 2,
|
||||
column: 15,
|
||||
column: 14,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 19,
|
||||
column: 18,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -101,12 +101,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 3,
|
||||
column: 3,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -121,12 +121,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 4,
|
||||
column: 2,
|
||||
column: 1,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 5,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -138,12 +138,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 4,
|
||||
column: 26,
|
||||
column: 25,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 30,
|
||||
column: 29,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -156,12 +156,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 4,
|
||||
column: 32,
|
||||
column: 31,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 35,
|
||||
column: 34,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -180,12 +180,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 4,
|
||||
column: 36,
|
||||
column: 35,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 4,
|
||||
column: 45,
|
||||
column: 44,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -202,12 +202,12 @@ expression: "parse_program(source, \"<test>\").unwrap()"
|
|||
Located {
|
||||
location: Location {
|
||||
row: 5,
|
||||
column: 3,
|
||||
column: 2,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 5,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
|
|
@ -11,7 +11,7 @@ expression: parse_ast
|
|||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 9,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -75,12 +75,12 @@ expression: parse_ast
|
|||
Located {
|
||||
location: Location {
|
||||
row: 2,
|
||||
column: 1,
|
||||
column: 0,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 1,
|
||||
column: 0,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -88,12 +88,12 @@ expression: parse_ast
|
|||
test: Located {
|
||||
location: Location {
|
||||
row: 2,
|
||||
column: 6,
|
||||
column: 5,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -108,12 +108,12 @@ expression: parse_ast
|
|||
Located {
|
||||
location: Location {
|
||||
row: 2,
|
||||
column: 9,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 11,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -121,12 +121,12 @@ expression: parse_ast
|
|||
value: Located {
|
||||
location: Location {
|
||||
row: 2,
|
||||
column: 9,
|
||||
column: 8,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 2,
|
||||
column: 11,
|
||||
column: 10,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -144,12 +144,12 @@ expression: parse_ast
|
|||
Located {
|
||||
location: Location {
|
||||
row: 3,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 9,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
@ -157,12 +157,12 @@ expression: parse_ast
|
|||
value: Located {
|
||||
location: Location {
|
||||
row: 3,
|
||||
column: 7,
|
||||
column: 6,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
row: 3,
|
||||
column: 9,
|
||||
column: 8,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
|
|
@ -48,7 +48,7 @@ Located {
|
|||
value: Located {
|
||||
location: Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
column: 6,
|
||||
},
|
||||
end_location: Some(
|
||||
Location {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue