aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/lexer/numbers.rs
diff options
context:
space:
mode:
authorZach Lute <[email protected]>2018-09-05 06:56:16 +0100
committerZach Lute <[email protected]>2018-09-05 06:56:16 +0100
commitaf0ae9ee0409ce2296dafebf977e353a5b871d80 (patch)
tree58a5db64a5279bf6586481224e8a772c3f965bfc /crates/libsyntax2/src/lexer/numbers.rs
parentf87771092c5df9e9c07bcb5052e662bde0a0fa59 (diff)
Updated Ptr methods to better match Parser method names.
Diffstat (limited to 'crates/libsyntax2/src/lexer/numbers.rs')
-rw-r--r--crates/libsyntax2/src/lexer/numbers.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/libsyntax2/src/lexer/numbers.rs b/crates/libsyntax2/src/lexer/numbers.rs
index 5c4641a2d..22e7d4e99 100644
--- a/crates/libsyntax2/src/lexer/numbers.rs
+++ b/crates/libsyntax2/src/lexer/numbers.rs
@@ -5,7 +5,7 @@ use SyntaxKind::{self, *};
5 5
6pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind { 6pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind {
7 if c == '0' { 7 if c == '0' {
8 match ptr.next().unwrap_or('\0') { 8 match ptr.current().unwrap_or('\0') {
9 'b' | 'o' => { 9 'b' | 'o' => {
10 ptr.bump(); 10 ptr.bump();
11 scan_digits(ptr, false); 11 scan_digits(ptr, false);
@@ -26,7 +26,7 @@ pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind {
26 // might be a float, but don't be greedy if this is actually an 26 // might be a float, but don't be greedy if this is actually an
27 // integer literal followed by field/method access or a range pattern 27 // integer literal followed by field/method access or a range pattern
28 // (`0..2` and `12.foo()`) 28 // (`0..2` and `12.foo()`)
29 if ptr.next_is('.') && !(ptr.nnext_is('.') || ptr.nnext_is_p(is_ident_start)) { 29 if ptr.at('.') && !(ptr.at_str("..") || ptr.nth_is_p(1, is_ident_start)) {
30 // might have stuff after the ., and if it does, it needs to start 30 // might have stuff after the ., and if it does, it needs to start
31 // with a number 31 // with a number
32 ptr.bump(); 32 ptr.bump();
@@ -35,7 +35,7 @@ pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind {
35 return FLOAT_NUMBER; 35 return FLOAT_NUMBER;
36 } 36 }
37 // it might be a float if it has an exponent 37 // it might be a float if it has an exponent
38 if ptr.next_is('e') || ptr.next_is('E') { 38 if ptr.at('e') || ptr.at('E') {
39 scan_float_exponent(ptr); 39 scan_float_exponent(ptr);
40 return FLOAT_NUMBER; 40 return FLOAT_NUMBER;
41 } 41 }
@@ -43,7 +43,7 @@ pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind {
43} 43}
44 44
45fn scan_digits(ptr: &mut Ptr, allow_hex: bool) { 45fn scan_digits(ptr: &mut Ptr, allow_hex: bool) {
46 while let Some(c) = ptr.next() { 46 while let Some(c) = ptr.current() {
47 match c { 47 match c {
48 '_' | '0'...'9' => { 48 '_' | '0'...'9' => {
49 ptr.bump(); 49 ptr.bump();
@@ -57,9 +57,9 @@ fn scan_digits(ptr: &mut Ptr, allow_hex: bool) {
57} 57}
58 58
59fn scan_float_exponent(ptr: &mut Ptr) { 59fn scan_float_exponent(ptr: &mut Ptr) {
60 if ptr.next_is('e') || ptr.next_is('E') { 60 if ptr.at('e') || ptr.at('E') {
61 ptr.bump(); 61 ptr.bump();
62 if ptr.next_is('-') || ptr.next_is('+') { 62 if ptr.at('-') || ptr.at('+') {
63 ptr.bump(); 63 ptr.bump();
64 } 64 }
65 scan_digits(ptr, false); 65 scan_digits(ptr, false);