diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index 918683556f..320d59de5e 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs @@ -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(); } diff --git a/tests/data/lexer/0004_number.rs b/tests/data/lexer/0004_numbers.rs similarity index 100% rename from tests/data/lexer/0004_number.rs rename to tests/data/lexer/0004_numbers.rs diff --git a/tests/data/lexer/0004_number.txt b/tests/data/lexer/0004_numbers.txt similarity index 100% rename from tests/data/lexer/0004_number.txt rename to tests/data/lexer/0004_numbers.txt diff --git a/tests/data/lexer/0006_chars.rs b/tests/data/lexer/0006_chars.rs new file mode 100644 index 0000000000..03598d9082 --- /dev/null +++ b/tests/data/lexer/0006_chars.rs @@ -0,0 +1 @@ +'x' ' ' '0' diff --git a/tests/data/lexer/0006_chars.txt b/tests/data/lexer/0006_chars.txt new file mode 100644 index 0000000000..ecaf223552 --- /dev/null +++ b/tests/data/lexer/0006_chars.txt @@ -0,0 +1,6 @@ +CHAR 3 "\'x\'" +WHITESPACE 1 " " +CHAR 3 "\' \'" +WHITESPACE 1 " " +CHAR 3 "\'0\'" +WHITESPACE 1 "\n" diff --git a/tests/data/lexer/0007_lifetimes.rs b/tests/data/lexer/0007_lifetimes.rs new file mode 100644 index 0000000000..b764f1dce3 --- /dev/null +++ b/tests/data/lexer/0007_lifetimes.rs @@ -0,0 +1 @@ +'a 'foo 'foo_bar_baz '_ diff --git a/tests/data/lexer/0007_lifetimes.txt b/tests/data/lexer/0007_lifetimes.txt new file mode 100644 index 0000000000..005c29100a --- /dev/null +++ b/tests/data/lexer/0007_lifetimes.txt @@ -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"