diff options
| author | Marijn Haverbeke <[email protected]> | 2011-05-12 09:31:06 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-05-12 09:31:06 +0200 |
| commit | 079512494f403657fc6ad26be71e4dec6b9ebaae (patch) | |
| tree | 54f4c9f94269007f6bc2d696684d1a764ef2820b | |
| parent | Provide a more useful message when failing to translate a const (diff) | |
| download | rust-079512494f403657fc6ad26be71e4dec6b9ebaae.tar.xz rust-079512494f403657fc6ad26be71e4dec6b9ebaae.zip | |
Properly lex block comments followed by EOF
| -rw-r--r-- | src/comp/front/lexer.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs index eab62069..32f21531 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); |