Transition to new literals compiling.
Tests still need work, as does the implementation for json.
This commit is contained in:
@@ -7,6 +7,7 @@ pub use parser::Body;
|
||||
pub use parser::DustTag;
|
||||
pub use parser::Filter;
|
||||
pub use parser::KVPair;
|
||||
pub use parser::OwnedLiteral;
|
||||
pub use parser::RValue;
|
||||
pub use parser::Special;
|
||||
pub use parser::Template;
|
||||
|
||||
@@ -118,11 +118,16 @@ pub struct Partial<'a> {
|
||||
pub params: Vec<KVPair<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum OwnedLiteral {
|
||||
LString(String),
|
||||
LPositiveInteger(u64),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum RValue<'a> {
|
||||
RVPath(Path<'a>),
|
||||
RVString(String),
|
||||
RVPositiveInteger(u64),
|
||||
RVLiteral(OwnedLiteral),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -226,8 +231,12 @@ fn postitive_integer_literal(i: &str) -> IResult<&str, u64> {
|
||||
fn rvalue(i: &str) -> IResult<&str, RValue> {
|
||||
alt((
|
||||
map(path, RValue::RVPath),
|
||||
map(quoted_string, RValue::RVString),
|
||||
map(postitive_integer_literal, RValue::RVPositiveInteger),
|
||||
map(quoted_string, |s| {
|
||||
RValue::RVLiteral(OwnedLiteral::LString(s))
|
||||
}),
|
||||
map(postitive_integer_literal, |num| {
|
||||
RValue::RVLiteral(OwnedLiteral::LPositiveInteger(num))
|
||||
}),
|
||||
))(i)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user