Empty program is valid too
This commit is contained in:
parent
1ae61287c1
commit
a97cce184c
@ -52,6 +52,10 @@ pub fn parse(input: Vec<Token>) -> ParseResult {
|
|||||||
|
|
||||||
let mut tokens: Tokens = input.iter().peekable();
|
let mut tokens: Tokens = input.iter().peekable();
|
||||||
|
|
||||||
|
if let Some(&&EOF) = tokens.peek() {
|
||||||
|
return ParseResult::Ok(AST::Statements(vec!()));
|
||||||
|
}
|
||||||
|
|
||||||
match statements(&mut tokens) {
|
match statements(&mut tokens) {
|
||||||
ok@ParseResult::Ok(_) => {
|
ok@ParseResult::Ok(_) => {
|
||||||
expect!(EOF, &mut tokens);
|
expect!(EOF, &mut tokens);
|
||||||
|
Loading…
Reference in New Issue
Block a user