Fix ArgWithDefault TextRange (#13)

This commit is contained in:
Micha Reiser 2023-06-20 18:21:09 +02:00 committed by GitHub
parent ed3b4eb72b
commit 08ebbe40d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 12591 additions and 5493 deletions

View File

@ -22,7 +22,7 @@ mod ranged;
#[cfg(feature = "malachite-bigint")]
pub use malachite_bigint as bigint;
#[cfg(feature = "num-bigint")]
#[cfg(all(feature = "num-bigint", not(feature = "malachite-bigint")))]
pub use num_bigint as bigint;
pub use builtin::*;

View File

@ -15,3 +15,6 @@ itertools = "0.10.5"
num-traits = { workspace = true }
num-bigint = { workspace = true, optional = true }
malachite-bigint = { workspace = true, optional = true }
[features]
default = ["malachite-bigint"]

View File

@ -1,6 +1,6 @@
#[cfg(feature = "malachite-bigint")]
pub use malachite_bigint as bigint;
#[cfg(feature = "num-bigint")]
#[cfg(all(feature = "num-bigint", not(feature = "malachite-bigint")))]
pub use num_bigint as bigint;
pub use crate::format::*;

View File

@ -1067,8 +1067,12 @@ ParameterDefs<ArgType>: (Vec<ast::ArgWithDefault>, Vec<ast::ArgWithDefault>) = {
ParameterDef<ArgType>: ast::ArgWithDefault = {
<i:ArgType> => i,
<mut i:ArgType> "=" <e:Test<"all">> => {
<mut i:ArgType> "=" <e:Test<"all">> <end_location:@R> => {
i.default = Some(Box::new(e));
#[cfg(feature = "all-nodes-with-ranges")]
{
i.range = optional_range(i.range.start(), end_location);
}
i
},
};

18041
parser/src/python.rs generated

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 12..13,
range: 12..16,
def: Arg {
range: 12..13,
arg: Identifier {
@ -54,7 +54,7 @@ Ok(
),
},
ArgWithDefault {
range: 18..19,
range: 18..22,
def: Arg {
range: 18..19,
arg: Identifier {

View File

@ -71,7 +71,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 21..22,
range: 21..25,
def: Arg {
range: 21..22,
arg: Identifier {
@ -94,7 +94,7 @@ Ok(
),
},
ArgWithDefault {
range: 27..28,
range: 27..31,
def: Arg {
range: 27..28,
arg: Identifier {

View File

@ -81,7 +81,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 25..26,
range: 25..29,
def: Arg {
range: 25..26,
arg: Identifier {
@ -104,7 +104,7 @@ Ok(
),
},
ArgWithDefault {
range: 31..32,
range: 31..35,
def: Arg {
range: 31..32,
arg: Identifier {

View File

@ -81,7 +81,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 25..26,
range: 25..29,
def: Arg {
range: 25..26,
arg: Identifier {
@ -104,7 +104,7 @@ Ok(
),
},
ArgWithDefault {
range: 31..32,
range: 31..35,
def: Arg {
range: 31..32,
arg: Identifier {

View File

@ -29,7 +29,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 9..10,
range: 9..13,
def: Arg {
range: 9..10,
arg: Identifier {
@ -52,7 +52,7 @@ Ok(
),
},
ArgWithDefault {
range: 15..16,
range: 15..19,
def: Arg {
range: 15..16,
arg: Identifier {

View File

@ -30,7 +30,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 13..14,
range: 13..17,
def: Arg {
range: 13..14,
arg: Identifier {
@ -53,7 +53,7 @@ Ok(
),
},
ArgWithDefault {
range: 19..20,
range: 19..23,
def: Arg {
range: 19..20,
arg: Identifier {

View File

@ -28,7 +28,7 @@ Ok(
default: None,
},
ArgWithDefault {
range: 10..11,
range: 10..14,
def: Arg {
range: 10..11,
arg: Identifier {
@ -51,7 +51,7 @@ Ok(
),
},
ArgWithDefault {
range: 16..17,
range: 16..20,
def: Arg {
range: 16..17,
arg: Identifier {

View File

@ -94,7 +94,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
default: None,
},
ArgWithDefault {
range: 76..79,
range: 76..89,
def: Arg {
range: 76..79,
arg: Identifier {