Hook in the integer parser.

This commit is contained in:
Tom Alexander 2020-05-10 23:13:25 -04:00
parent 9ee8f41022
commit c88cab8316
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 4 additions and 2 deletions

View File

@ -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)
} }