From 690c78c9c0c405ebe9abe6721511545d8b8816b4 Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 14 Dec 2021 21:10:58 +0100 Subject: [PATCH] Removed a feature which disallowed comments in functios --- ablescript/src/parser.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ablescript/src/parser.rs b/ablescript/src/parser.rs index 4f8bf23..19c3926 100644 --- a/ablescript/src/parser.rs +++ b/ablescript/src/parser.rs @@ -53,9 +53,16 @@ impl<'source> Parser<'source> { /// /// If EOF, return Error instead of None fn checked_next(&mut self) -> Result { - self.lexer - .next() - .ok_or_else(|| Error::unexpected_eof(self.lexer.span().start)) + loop { + match self + .lexer + .next() + .ok_or_else(|| Error::unexpected_eof(self.lexer.span().start))? + { + Token::Comment => (), + token => break Ok(token), + } + } } /// Parse a token