Add support for literal string blocks.
This commit is contained in:
@@ -27,6 +27,7 @@ use nom::IResult;
|
||||
pub enum DustTag<'a> {
|
||||
DTSpecial(Special),
|
||||
DTComment(Comment<'a>),
|
||||
DTLiteralStringBlock(&'a str),
|
||||
DTReference(Reference<'a>),
|
||||
DTSection(Container<'a>),
|
||||
DTExists(Container<'a>),
|
||||
@@ -211,6 +212,7 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
||||
alt((
|
||||
map(special, DustTag::DTSpecial),
|
||||
map(comment, DustTag::DTComment),
|
||||
map(literal_string_block, DustTag::DTLiteralStringBlock),
|
||||
map(reference, DustTag::DTReference),
|
||||
conditional("{#", DustTag::DTSection),
|
||||
conditional("{?", DustTag::DTExists),
|
||||
@@ -634,6 +636,10 @@ fn ignore_new_line_leading_whitespace(i: &str) -> IResult<&str, IgnoredWhitespac
|
||||
)(i)
|
||||
}
|
||||
|
||||
fn literal_string_block(i: &str) -> IResult<&str, &str> {
|
||||
delimited(tag("{`"), take_until("`}"), tag("`}"))(i)
|
||||
}
|
||||
|
||||
/// Any text that is not a Dust element or ignored whitespace
|
||||
fn span(i: &str) -> IResult<&str, Span> {
|
||||
let (remaining, line) = verify(
|
||||
|
||||
Reference in New Issue
Block a user