diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-15 13:45:58 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-15 13:45:58 +0100 |
commit | ec7d2f64ade9ffa35a64e82ac53e65ad5cbe9efd (patch) | |
tree | b8693ce808a9ca2e7eaae5013644a1082fc7bb17 /crates/ra_syntax/src/parsing/lexer.rs | |
parent | 64ab5ab10d32e7e8ec085af818d3d94211aea39b (diff) | |
parent | 993abedd77cf23ce2281b6c8e60cab49ab4fa97e (diff) |
Merge #1278
1278: Apply T! macro where posible r=matklad a=pasa
apply T! macro implemented in #1248
Co-authored-by: Sergey Parilin <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/parsing/lexer.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index a3791b503..6eb96f03d 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -7,6 +7,7 @@ mod strings; | |||
7 | use crate::{ | 7 | use crate::{ |
8 | SyntaxKind::{self, *}, | 8 | SyntaxKind::{self, *}, |
9 | TextUnit, | 9 | TextUnit, |
10 | T, | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | use self::{ | 13 | use self::{ |
@@ -90,16 +91,16 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
90 | match c { | 91 | match c { |
91 | // Possiblily multi-byte tokens, | 92 | // Possiblily multi-byte tokens, |
92 | // but we only produce single byte token now | 93 | // but we only produce single byte token now |
93 | // DOTDOTDOT, DOTDOT, DOTDOTEQ, DOT | 94 | // T![...], T![..], T![..=], T![.] |
94 | '.' => return DOT, | 95 | '.' => return T![.], |
95 | // COLONCOLON COLON | 96 | // T![::] T![:] |
96 | ':' => return COLON, | 97 | ':' => return T![:], |
97 | // EQEQ FATARROW EQ | 98 | // T![==] FATARROW T![=] |
98 | '=' => return EQ, | 99 | '=' => return T![=], |
99 | // NEQ EXCL | 100 | // T![!=] T![!] |
100 | '!' => return EXCL, | 101 | '!' => return T![!], |
101 | // THIN_ARROW MINUS | 102 | // T![->] T![-] |
102 | '-' => return MINUS, | 103 | '-' => return T![-], |
103 | 104 | ||
104 | // If the character is an ident start not followed by another single | 105 | // If the character is an ident start not followed by another single |
105 | // quote, then this is a lifetime name: | 106 | // quote, then this is a lifetime name: |
@@ -148,8 +149,8 @@ fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind { | |||
148 | ptr.bump(); | 149 | ptr.bump(); |
149 | true | 150 | true |
150 | } | 151 | } |
151 | ('_', None) => return UNDERSCORE, | 152 | ('_', None) => return T![_], |
152 | ('_', Some(c)) if !is_ident_continue(c) => return UNDERSCORE, | 153 | ('_', Some(c)) if !is_ident_continue(c) => return T![_], |
153 | _ => false, | 154 | _ => false, |
154 | }; | 155 | }; |
155 | ptr.bump_while(is_ident_continue); | 156 | ptr.bump_while(is_ident_continue); |