Lexer: simplistic char & lifetime tests

This commit is contained in:
Aleksey Kladov 2017-12-31 11:32:49 +03:00
parent 0b49db623f
commit 9d5138bf11
7 changed files with 18 additions and 1 deletions

View file

@ -101,7 +101,7 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind {
_ => NOT,
},
// '\'' => scan_char_or_lifetime(ptr),
'\'' => return scan_char_or_lifetime(ptr),
_ => (),
}
ERROR
@ -159,6 +159,7 @@ fn scan_literal_suffix(ptr: &mut Ptr) {
}
fn scan_char_or_byte(ptr: &mut Ptr) {
//FIXME: deal with escape sequencies
ptr.bump();
}

View file

@ -0,0 +1 @@
'x' ' ' '0'

View file

@ -0,0 +1,6 @@
CHAR 3 "\'x\'"
WHITESPACE 1 " "
CHAR 3 "\' \'"
WHITESPACE 1 " "
CHAR 3 "\'0\'"
WHITESPACE 1 "\n"

View file

@ -0,0 +1 @@
'a 'foo 'foo_bar_baz '_

View 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"