Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/comp/syntax/parse/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,14 @@ fn next_token_inner(rdr: reader) -> token::token {
ret token::LIT_CHAR(c2);
}
'"' {
let n = rdr.get_chpos();
rdr.bump();
while rdr.curr() != '"' {
if rdr.is_eof() {
rdr.err(#fmt["unterminated double quote string: %s", rdr.get_str_from(n)]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may show quite a lot of data if the first quote is early in the source code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very true. Sadly we have many errors that spew pages of garbage. If you want to provide a follow-up patch that makes it more sane, that would be fine.

fail;
}

let ch = rdr.curr();
rdr.bump();
alt ch {
Expand Down
8 changes: 8 additions & 0 deletions src/test/compile-fail/unbalanced-doublequote.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// -*- rust -*-

// error-pattern: unterminated double quote string


fn main() {
"
}