Add empty ;-statement
This commit is contained in:
parent
8bb49321ae
commit
fb82ce6feb
@ -278,6 +278,7 @@ pub enum Statement {
|
|||||||
Break,
|
Break,
|
||||||
Label(Node<String>),
|
Label(Node<String>),
|
||||||
GoTo(Node<String>),
|
GoTo(Node<String>),
|
||||||
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for Statement {
|
impl Parse for Statement {
|
||||||
@ -451,6 +452,9 @@ impl Parse for Statement {
|
|||||||
} else if let Some(Token::Keyword(Keyword::GoTo)) = stream.peek() {
|
} else if let Some(Token::Keyword(Keyword::GoTo)) = stream.peek() {
|
||||||
stream.next();
|
stream.next();
|
||||||
Ok(Self::GoTo(stream.parse()?))
|
Ok(Self::GoTo(stream.parse()?))
|
||||||
|
} else if let Some(Token::Symbol(';')) = stream.peek() {
|
||||||
|
stream.next();
|
||||||
|
Ok(Self::Empty)
|
||||||
} else {
|
} else {
|
||||||
Err(stream.expecting_err("statement"))
|
Err(stream.expecting_err("statement"))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,6 +245,7 @@ impl Statement {
|
|||||||
Statement::Break => HashSet::new(),
|
Statement::Break => HashSet::new(),
|
||||||
Statement::Label(_) => HashSet::new(),
|
Statement::Label(_) => HashSet::new(),
|
||||||
Statement::GoTo(_) => HashSet::new(),
|
Statement::GoTo(_) => HashSet::new(),
|
||||||
|
Statement::Empty => HashSet::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,6 +653,7 @@ impl Statement {
|
|||||||
Statement::Break => instructions.push(PreInstr::Break),
|
Statement::Break => instructions.push(PreInstr::Break),
|
||||||
Statement::Label(node) => instructions.push(PreInstr::Label(node.kind.clone())),
|
Statement::Label(node) => instructions.push(PreInstr::Label(node.kind.clone())),
|
||||||
Statement::GoTo(node) => instructions.push(PreInstr::GoTo(node.kind.clone())),
|
Statement::GoTo(node) => instructions.push(PreInstr::GoTo(node.kind.clone())),
|
||||||
|
Statement::Empty => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
for reg in 0..scope.register_counter.0 {
|
for reg in 0..scope.register_counter.0 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user