From 079512494f403657fc6ad26be71e4dec6b9ebaae Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 12 May 2011 09:31:06 +0200 Subject: [PATCH] Properly lex block comments followed by EOF --- src/comp/front/lexer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs index eab62069ba9..32f2153145d 100644 --- a/src/comp/front/lexer.rs +++ b/src/comp/front/lexer.rs @@ -327,6 +327,10 @@ fn consume_any_line_comment(reader rdr) { fn consume_block_comment(reader rdr) { let int level = 1; while (level > 0) { + if (rdr.is_eof()) { + rdr.err("unterminated block comment"); + fail; + } if (rdr.curr() == '/' && rdr.next() == '*') { rdr.bump(); rdr.bump(); @@ -340,10 +344,6 @@ fn consume_block_comment(reader rdr) { rdr.bump(); } } - if (rdr.is_eof()) { - rdr.err("unterminated block comment"); - fail; - } } // restart whitespace munch. be consume_any_whitespace(rdr);