From 0b49db623f74c698a92ee8c686709c5abb9fcfbd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 31 Dec 2017 11:15:27 +0300 Subject: [PATCH] Lexer: literal suffixes --- src/lexer/mod.rs | 5 ++++- tests/data/lexer/0004_number.rs | 3 ++- tests/data/lexer/0004_number.txt | 9 +++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index 3f277bd2b5..918683556f 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs @@ -152,7 +152,10 @@ fn scan_char_or_lifetime(ptr: &mut Ptr) -> SyntaxKind { } fn scan_literal_suffix(ptr: &mut Ptr) { - + if ptr.next_is_p(is_ident_start) { + ptr.bump(); + } + ptr.bump_while(is_ident_continue); } fn scan_char_or_byte(ptr: &mut Ptr) { diff --git a/tests/data/lexer/0004_number.rs b/tests/data/lexer/0004_number.rs index 0c0d376270..dc974b553b 100644 --- a/tests/data/lexer/0004_number.rs +++ b/tests/data/lexer/0004_number.rs @@ -5,4 +5,5 @@ 0e+1 0.e+1 0.0E-2 -0___0.10000____0000e+111__ \ No newline at end of file +0___0.10000____0000e+111__ +1i64 92.0f32 11__s \ No newline at end of file diff --git a/tests/data/lexer/0004_number.txt b/tests/data/lexer/0004_number.txt index ede39aa99c..be8dee48b7 100644 --- a/tests/data/lexer/0004_number.txt +++ b/tests/data/lexer/0004_number.txt @@ -16,8 +16,7 @@ INT_NUMBER 2 "0e" WHITESPACE 1 " " INT_NUMBER 2 "0E" WHITESPACE 1 " " -INT_NUMBER 1 "0" -IDENT 1 "z" +INT_NUMBER 2 "0z" WHITESPACE 1 "\n" INT_NUMBER 5 "01790" WHITESPACE 1 " " @@ -60,3 +59,9 @@ WHITESPACE 1 "\n" FLOAT_NUMBER 6 "0.0E-2" WHITESPACE 1 "\n" FLOAT_NUMBER 26 "0___0.10000____0000e+111__" +WHITESPACE 1 "\n" +INT_NUMBER 4 "1i64" +WHITESPACE 1 " " +FLOAT_NUMBER 7 "92.0f32" +WHITESPACE 1 " " +INT_NUMBER 5 "11__s"