Skip to content

Make a lexer error message friendlier #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
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
3 changes: 2 additions & 1 deletion src/boot/fe/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ rule token = parse
| '\'' { char lexbuf }
| '"' { let buf = Buffer.create 32 in
str buf lexbuf }

| _ as c { let s = Char.escaped c in
fail lexbuf ("Bad character: " ^ s) }
| eof { EOF }

and str buf = parse
Expand Down
3 changes: 2 additions & 1 deletion src/comp/front/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ impure fn scan_number(mutable char c, reader rdr) -> token.token {
} else {
accum_int = scan_dec_digits(rdr);
}

c = rdr.curr();
n = rdr.next();

Expand Down Expand Up @@ -443,6 +443,7 @@ impure fn scan_number(mutable char c, reader rdr) -> token.token {
}
}
c = rdr.curr();

if (c == '.') {
// Parse a floating-point number.
rdr.bump();
Expand Down
1 change: 1 addition & 0 deletions src/comp/middle/trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4594,6 +4594,7 @@ fn trans_log(@block_ctxt cx, @ast.expr e) -> result {

auto sub = trans_expr(cx, e);
auto e_ty = ty.expr_ty(e);

if (ty.type_is_fp(e_ty)) {
let TypeRef tr;
let bool is32bit = false;
Expand Down