Update parser to treat all string rvalues as templates.

This commit is contained in:
Tom Alexander 2020-05-30 15:49:13 -04:00
parent 3352b777ae
commit 581f9f7e97
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -111,13 +111,12 @@ pub struct Partial<'a> {
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub enum OwnedLiteral { pub enum OwnedLiteral {
LPositiveInteger(u64), LPositiveInteger(u64),
LString(String),
} }
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub enum RValue<'a> { pub enum RValue<'a> {
RVPath(Path<'a>), RVPath(Path<'a>),
// RVTemplate(Vec<PartialNameElement>), RVTemplate(Vec<PartialNameElement>),
RVLiteral(OwnedLiteral), RVLiteral(OwnedLiteral),
} }
@ -327,9 +326,7 @@ fn template_string_rvalue(i: &str) -> IResult<&str, Vec<PartialNameElement>> {
fn rvalue(i: &str) -> IResult<&str, RValue> { fn rvalue(i: &str) -> IResult<&str, RValue> {
alt(( alt((
map(path, RValue::RVPath), map(path, RValue::RVPath),
map(quoted_string, |s| { map(template_string_rvalue, RValue::RVTemplate),
RValue::RVLiteral(OwnedLiteral::LString(s))
}),
map(postitive_integer_literal, |num| { map(postitive_integer_literal, |num| {
RValue::RVLiteral(OwnedLiteral::LPositiveInteger(num)) RValue::RVLiteral(OwnedLiteral::LPositiveInteger(num))
}), }),