Hook in the integer parser.
This commit is contained in:
parent
9ee8f41022
commit
c88cab8316
@ -211,13 +211,14 @@ fn path(i: &str) -> IResult<&str, Path> {
|
|||||||
))(i)
|
))(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn postitive_integer_literal(i: &str) -> IResult<&str, RValue> {
|
/// Just digits, no signs or decimals
|
||||||
|
fn postitive_integer_literal(i: &str) -> IResult<&str, u64> {
|
||||||
map(
|
map(
|
||||||
verify(
|
verify(
|
||||||
map(digit1, |number_string: &str| number_string.parse::<u64>()),
|
map(digit1, |number_string: &str| number_string.parse::<u64>()),
|
||||||
|parse_result| parse_result.is_ok(),
|
|parse_result| parse_result.is_ok(),
|
||||||
),
|
),
|
||||||
|parsed_number| RValue::RVPositiveInteger(parsed_number.unwrap()),
|
|parsed_number| parsed_number.unwrap(),
|
||||||
)(i)
|
)(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,6 +227,7 @@ fn rvalue(i: &str) -> IResult<&str, RValue> {
|
|||||||
alt((
|
alt((
|
||||||
map(path, RValue::RVPath),
|
map(path, RValue::RVPath),
|
||||||
map(quoted_string, RValue::RVString),
|
map(quoted_string, RValue::RVString),
|
||||||
|
map(postitive_integer_literal, RValue::RVPositiveInteger),
|
||||||
))(i)
|
))(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user