diff --git a/crates/lang/src/parser.rs b/crates/lang/src/parser.rs index 877934cb..a85d4879 100644 --- a/crates/lang/src/parser.rs +++ b/crates/lang/src/parser.rs @@ -47,7 +47,6 @@ pub fn module( false } Token::EmptyLine => { - println!("{:?}", span); extra.empty_lines.push(span.start); false diff --git a/crates/lang/src/parser/lexer.rs b/crates/lang/src/parser/lexer.rs index d845b741..83c7f5a2 100644 --- a/crates/lang/src/parser/lexer.rs +++ b/crates/lang/src/parser/lexer.rs @@ -117,10 +117,17 @@ pub fn lexer() -> impl Parser, Error = ParseError> { .map_with_span(|token, span| (token, span)), ); + let comments_with_trailing_newline = just("//").ignore_then( + take_until(text::newline()) + .then_ignore(text::newline().rewind()) + .to(Token::Comment) + .map_with_span(|token, span| (token, span)), + ); + choice(( module_comments, doc_comments, - comments, + choice((comments_with_trailing_newline, comments)), choice((keyword, int, op, grouping, string)) .or(any().map(Token::Error).validate(|t, span, emit| { emit(ParseError::expected_input_found(