parser: check error early
This commit is contained in:
parent
4cc7d17c99
commit
47607a04fb
1 changed files with 2 additions and 2 deletions
|
@ -25,9 +25,9 @@ impl<'a> Parser<'a> {
|
||||||
),
|
),
|
||||||
TokenKind::StringLiteral => self.node_result(ident.raw, NodeVal::String(val.raw)),
|
TokenKind::StringLiteral => self.node_result(ident.raw, NodeVal::String(val.raw)),
|
||||||
_ => self.lexer.syntax_error(String::from("Expected a value")),
|
_ => self.lexer.syntax_error(String::from("Expected a value")),
|
||||||
};
|
}?;
|
||||||
self.require_kind(TokenKind::Semi)?;
|
self.require_kind(TokenKind::Semi)?;
|
||||||
node
|
Ok(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn require_kind(&mut self, kind: TokenKind) -> Result<Token, SyntaxError> {
|
fn require_kind(&mut self, kind: TokenKind) -> Result<Token, SyntaxError> {
|
||||||
|
|
Loading…
Reference in a new issue