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)
|
||||
}
|
||||
|
||||
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(
|
||||
verify(
|
||||
map(digit1, |number_string: &str| number_string.parse::<u64>()),
|
||||
|parse_result| parse_result.is_ok(),
|
||||
),
|
||||
|parsed_number| RValue::RVPositiveInteger(parsed_number.unwrap()),
|
||||
|parsed_number| parsed_number.unwrap(),
|
||||
)(i)
|
||||
}
|
||||
|
||||
@ -226,6 +227,7 @@ fn rvalue(i: &str) -> IResult<&str, RValue> {
|
||||
alt((
|
||||
map(path, RValue::RVPath),
|
||||
map(quoted_string, RValue::RVString),
|
||||
map(postitive_integer_literal, RValue::RVPositiveInteger),
|
||||
))(i)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user