diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 11 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 2b6f94e6bf5..a6146e0eaea 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -730,6 +730,7 @@ impl fmt::Show for UintTy { pub enum FloatTy { TyF32, TyF64, + TyF128 } impl fmt::Show for FloatTy { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 437f865b449..adb97af7490 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -187,7 +187,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 { } pub fn float_ty_to_str(t: FloatTy) -> ~str { - match t { TyF32 => "f32".to_owned(), TyF64 => "f64".to_owned() } + match t { TyF32 => "f32".to_owned(), TyF64 => "f64".to_owned(), TyF128 => "f128".to_owned() } } pub fn is_call_expr(e: @Expr) -> bool { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 7d86b988077..68b0ef40b16 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -436,7 +436,8 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr { LIT_FLOAT(fident, fty) => { let s_fty = match fty { ast::TyF32 => "TyF32".to_owned(), - ast::TyF64 => "TyF64".to_owned() + ast::TyF64 => "TyF64".to_owned(), + ast::TyF128 => "TyF128".to_owned() }; let e_fty = cx.expr_ident(sp, id_ext(s_fty)); diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index ff087d95e50..992d289b4e9 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -593,10 +593,15 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token { /* FIXME (#2252): if this is out of range for either a 32-bit or 64-bit float, it won't be noticed till the back-end. */ - } else { - fatal_span(rdr, start_bpos, rdr.last_pos, - "expected `f32` or `f64` suffix".to_owned()); + } else if c == '1' && n == '2' && nextnextch(rdr).unwrap_or('\x00') == '8' { + bump(rdr); + bump(rdr); + bump(rdr); + check_float_base(rdr, start_bpos, rdr.last_pos, base); + return token::LIT_FLOAT(str_to_ident(num_str.as_slice()), ast::TyF128); } + fatal_span(rdr, start_bpos, rdr.last_pos, + "expected `f32`, `f64` or `f128` suffix".to_owned()); } if is_float { check_float_base(rdr, start_bpos, rdr.last_pos, base); |
