lexer: show correct span on unrecognized token start

Fixes part of #7048.
This commit is contained in:
Philipp Brüschweiler 2013-06-11 11:38:59 +02:00
parent 6bdd4c8545
commit 1ac90bb74b

View File

@ -772,7 +772,11 @@ fn binop(rdr: @mut StringReader, op: token::binop) -> token::Token {
'/' => { return binop(rdr, token::SLASH); }
'^' => { return binop(rdr, token::CARET); }
'%' => { return binop(rdr, token::PERCENT); }
c => { rdr.fatal(fmt!("unknown start of token: %d", c as int)); }
c => {
// So the error span points to the unrecognized character
rdr.peek_span = codemap::mk_sp(rdr.last_pos, rdr.pos);
rdr.fatal(fmt!("unknown start of token: %d", c as int));
}
}
}