Add parsing of simple conditionals
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
ffb5c92b89
commit
974086a877
7 changed files with 392 additions and 119 deletions
|
|
@ -420,7 +420,7 @@ fn parse_ident<'input>(input: &mut Input<'input>) -> PResult<'input, TemplateTok
|
|||
}
|
||||
|
||||
fn ident<'input>(input: &mut Input<'input>) -> PResult<'input, NomoInput> {
|
||||
peek(not(parse_literal))
|
||||
peek(not(alt((parse_literal, parse_condition, parse_end))))
|
||||
.context(ParseError::ctx().msg("Expected an ident, but found a literal instead"))
|
||||
.parse_next(input)?;
|
||||
|
||||
|
|
@ -564,7 +564,7 @@ mod tests {
|
|||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
kind: ConditionalIf,
|
||||
source: "if",
|
||||
},
|
||||
TemplateToken {
|
||||
|
|
@ -608,7 +608,7 @@ mod tests {
|
|||
source: " ",
|
||||
},
|
||||
TemplateToken {
|
||||
kind: Ident,
|
||||
kind: End,
|
||||
source: "end",
|
||||
},
|
||||
TemplateToken {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue