about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-05-12 09:31:06 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-05-12 09:31:06 +0200
commit079512494f403657fc6ad26be71e4dec6b9ebaae (patch)
tree54f4c9f94269007f6bc2d696684d1a764ef2820b /src/comp
parentd719b5cae78eda4737250c2e223b73ff8bd9f68b (diff)
downloadrust-079512494f403657fc6ad26be71e4dec6b9ebaae.tar.gz
rust-079512494f403657fc6ad26be71e4dec6b9ebaae.zip
Properly lex block comments followed by EOF
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/front/lexer.rs8
1 files 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);