lexer: show correct span on unrecognized token start
Fixes part of #7048.
This commit is contained in:
parent
6bdd4c8545
commit
1ac90bb74b
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user