aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xixanta/src/parser.rs')
-rw-r--r--lib/xixanta/src/parser.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/xixanta/src/parser.rs b/lib/xixanta/src/parser.rs
index 13594e7..50f2af1 100644
--- a/lib/xixanta/src/parser.rs
+++ b/lib/xixanta/src/parser.rs
@@ -651,14 +651,19 @@ impl Parser {
// If this is an .if already, then we can quit, otherwise we must
// ensure that the next node is an .if/.elsif and continue the loop.
match node.node_type {
- NodeType::Control(ControlType::If) => {
+ NodeType::Control(ControlType::If)
+ | NodeType::Control(ControlType::IfDef)
+ | NodeType::Control(ControlType::IfNDef) => {
nodes.truncate(nodes.len() - count);
return Ok(());
}
NodeType::Control(ControlType::Elsif) => {
if !matches!(
next.node_type,
- NodeType::Control(ControlType::If) | NodeType::Control(ControlType::Elsif)
+ NodeType::Control(ControlType::If)
+ | NodeType::Control(ControlType::IfDef)
+ | NodeType::Control(ControlType::IfNDef)
+ | NodeType::Control(ControlType::Elsif)
) {
return Err(self.parser_error("expecting an .if statement").into());
}
@@ -666,7 +671,10 @@ impl Parser {
NodeType::Control(ControlType::Else) => {
if !matches!(
next.node_type,
- NodeType::Control(ControlType::If) | NodeType::Control(ControlType::Elsif)
+ NodeType::Control(ControlType::If)
+ | NodeType::Control(ControlType::IfDef)
+ | NodeType::Control(ControlType::IfNDef)
+ | NodeType::Control(ControlType::Elsif)
) {
return Err(self.parser_error("expecting an .if statement").into());
}