mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Lexer: simplistic char & lifetime tests
This commit is contained in:
parent
0b49db623f
commit
9d5138bf11
7 changed files with 18 additions and 1 deletions
|
@ -101,7 +101,7 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind {
|
||||||
_ => NOT,
|
_ => NOT,
|
||||||
},
|
},
|
||||||
|
|
||||||
// '\'' => scan_char_or_lifetime(ptr),
|
'\'' => return scan_char_or_lifetime(ptr),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
ERROR
|
ERROR
|
||||||
|
@ -159,6 +159,7 @@ fn scan_literal_suffix(ptr: &mut Ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scan_char_or_byte(ptr: &mut Ptr) {
|
fn scan_char_or_byte(ptr: &mut Ptr) {
|
||||||
|
//FIXME: deal with escape sequencies
|
||||||
ptr.bump();
|
ptr.bump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
tests/data/lexer/0006_chars.rs
Normal file
1
tests/data/lexer/0006_chars.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
'x' ' ' '0'
|
6
tests/data/lexer/0006_chars.txt
Normal file
6
tests/data/lexer/0006_chars.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
CHAR 3 "\'x\'"
|
||||||
|
WHITESPACE 1 " "
|
||||||
|
CHAR 3 "\' \'"
|
||||||
|
WHITESPACE 1 " "
|
||||||
|
CHAR 3 "\'0\'"
|
||||||
|
WHITESPACE 1 "\n"
|
1
tests/data/lexer/0007_lifetimes.rs
Normal file
1
tests/data/lexer/0007_lifetimes.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
'a 'foo 'foo_bar_baz '_
|
8
tests/data/lexer/0007_lifetimes.txt
Normal file
8
tests/data/lexer/0007_lifetimes.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
LIFETIME 2 "\'a"
|
||||||
|
WHITESPACE 1 " "
|
||||||
|
LIFETIME 4 "\'foo"
|
||||||
|
WHITESPACE 1 " "
|
||||||
|
LIFETIME 12 "\'foo_bar_baz"
|
||||||
|
WHITESPACE 1 " "
|
||||||
|
LIFETIME 2 "\'_"
|
||||||
|
WHITESPACE 1 "\n"
|
Loading…
Reference in a new issue