diff --git a/crates/ra_syntax/src/tests.rs b/crates/ra_syntax/src/tests.rs index f79dc4f933e..fb22b9e54c4 100644 --- a/crates/ra_syntax/src/tests.rs +++ b/crates/ra_syntax/src/tests.rs @@ -1,19 +1,28 @@ use std::{ fmt::Write, - path::{Component, PathBuf}, + path::{Component, Path, PathBuf}, }; use test_utils::{collect_tests, dir_tests, project_dir, read_text}; -use crate::{fuzz, SourceFile}; +use crate::{fuzz, tokenize, Location, SourceFile, SyntaxError, TextRange, Token}; #[test] fn lexer_tests() { - dir_tests(&test_data_dir(), &["lexer"], |text, _| { - // FIXME: add tests for errors (their format is up to discussion) - let (tokens, _errors) = crate::tokenize(text); - dump_tokens(&tokens, text) - }) + // FIXME: + // * Add tests for unicode escapes in byte-character and [raw]-byte-string literals + // * Add tests for unescape errors + + dir_tests(&test_data_dir(), &["lexer/ok"], |text, path| { + let (tokens, errors) = tokenize(text); + assert_errors_are_absent(&errors, path); + dump_tokens_and_errors(&tokens, &errors, text) + }); + dir_tests(&test_data_dir(), &["lexer/err"], |text, path| { + let (tokens, errors) = tokenize(text); + assert_errors_are_present(&errors, path); + dump_tokens_and_errors(&tokens, &errors, text) + }); } #[test] @@ -33,18 +42,13 @@ fn parser_tests() { dir_tests(&test_data_dir(), &["parser/inline/ok", "parser/ok"], |text, path| { let parse = SourceFile::parse(text); let errors = parse.errors(); - assert_eq!( - errors, - &[] as &[crate::SyntaxError], - "There should be no errors in the file {:?}", - path.display(), - ); + assert_errors_are_absent(&errors, path); parse.debug_dump() }); dir_tests(&test_data_dir(), &["parser/err", "parser/inline/err"], |text, path| { let parse = SourceFile::parse(text); let errors = parse.errors(); - assert!(!errors.is_empty(), "There should be errors in the file {:?}", path.display()); + assert_errors_are_present(&errors, path); parse.debug_dump() }); } @@ -76,7 +80,7 @@ fn self_hosting_parsing() { .into_iter() .filter_entry(|entry| { !entry.path().components().any(|component| { - // Get all files which are not in the crates/ra_syntax/tests/data folder + // Get all files which are not in the crates/ra_syntax/test_data folder component == Component::Normal(OsStr::new("test_data")) }) }) @@ -102,15 +106,47 @@ fn test_data_dir() -> PathBuf { project_dir().join("crates/ra_syntax/test_data") } -fn dump_tokens(tokens: &[crate::Token], text: &str) -> String { +fn assert_errors_are_present(errors: &[SyntaxError], path: &Path) { + assert!(!errors.is_empty(), "There should be errors in the file {:?}", path.display()); +} +fn assert_errors_are_absent(errors: &[SyntaxError], path: &Path) { + assert_eq!( + errors, + &[] as &[SyntaxError], + "There should be no errors in the file {:?}", + path.display(), + ); +} + +fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str) -> String { let mut acc = String::new(); let mut offset = 0; for token in tokens { - let len: u32 = token.len.into(); - let len = len as usize; - let token_text = &text[offset..offset + len]; - offset += len; - write!(acc, "{:?} {} {:?}\n", token.kind, token.len, token_text).unwrap() + let token_len = token.len.to_usize(); + let token_text = &text[offset..offset + token_len]; + offset += token_len; + writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap(); + } + for err in errors { + let err_range = location_to_range(err.location()); + writeln!( + acc, + "> error{:?} token({:?}) msg({})", + err.location(), + &text[err_range], + err.kind() + ) + .unwrap(); + } + return acc; + + // FIXME: copy-pasted this from `ra_ide/src/diagnostics.rs` + // `Location` will be refactored soon in new PR, see todos here: + // https://github.com/rust-analyzer/rust-analyzer/issues/223 + fn location_to_range(location: Location) -> TextRange { + match location { + Location::Offset(offset) => TextRange::offset_len(offset, 1.into()), + Location::Range(range) => range, + } } - acc } diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 445e3b3e469..8a5f0e4b755 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs @@ -94,6 +94,12 @@ impl From for SyntaxErrorKind { } pub(crate) fn validate(root: &SyntaxNode) -> Vec { + // FIXME: + // * Add validation of character literal containing only a single char + // * Add validation of `crate` keyword not appearing in the middle of the symbol path + // * Add validation of doc comments are being attached to nodes + // * Remove validation of unterminated literals (it is already implemented in `tokenize()`) + let mut errors = Vec::new(); for node in root.descendants() { match_ast! { diff --git a/crates/ra_syntax/test_data/lexer/0010_comments.rs b/crates/ra_syntax/test_data/lexer/0010_comments.rs deleted file mode 100644 index 71bdd1f9c32..00000000000 --- a/crates/ra_syntax/test_data/lexer/0010_comments.rs +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -// hello -//! World diff --git a/crates/ra_syntax/test_data/lexer/0010_comments.txt b/crates/ra_syntax/test_data/lexer/0010_comments.txt deleted file mode 100644 index 3c997de3f1d..00000000000 --- a/crates/ra_syntax/test_data/lexer/0010_comments.txt +++ /dev/null @@ -1,6 +0,0 @@ -SHEBANG 19 "#!/usr/bin/env bash" -WHITESPACE 1 "\n" -COMMENT 8 "// hello" -WHITESPACE 1 "\n" -COMMENT 9 "//! World" -WHITESPACE 1 "\n" diff --git a/crates/ra_syntax/test_data/lexer/0014_unclosed_char.rs b/crates/ra_syntax/test_data/lexer/0014_unclosed_char.rs deleted file mode 100644 index 9c000707726..00000000000 --- a/crates/ra_syntax/test_data/lexer/0014_unclosed_char.rs +++ /dev/null @@ -1 +0,0 @@ -'1 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/0014_unclosed_char.txt b/crates/ra_syntax/test_data/lexer/0014_unclosed_char.txt deleted file mode 100644 index 737a300ee78..00000000000 --- a/crates/ra_syntax/test_data/lexer/0014_unclosed_char.txt +++ /dev/null @@ -1 +0,0 @@ -LIFETIME 2 "\'1" diff --git a/crates/ra_syntax/test_data/lexer/0015_unclosed_string.rs b/crates/ra_syntax/test_data/lexer/0015_unclosed_string.rs deleted file mode 100644 index d771a26d499..00000000000 --- a/crates/ra_syntax/test_data/lexer/0015_unclosed_string.rs +++ /dev/null @@ -1 +0,0 @@ -"hello diff --git a/crates/ra_syntax/test_data/lexer/0015_unclosed_string.txt b/crates/ra_syntax/test_data/lexer/0015_unclosed_string.txt deleted file mode 100644 index 728c40b6624..00000000000 --- a/crates/ra_syntax/test_data/lexer/0015_unclosed_string.txt +++ /dev/null @@ -1 +0,0 @@ -STRING 7 "\"hello\n" diff --git a/crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs new file mode 100644 index 00000000000..ad2823b48f7 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.rs @@ -0,0 +1 @@ +' \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt new file mode 100644 index 00000000000..f24e1fd32a5 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0001_unclosed_char_at_eof.txt @@ -0,0 +1,2 @@ +CHAR 1 "\'" +> error[0; 1) token("\'") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs b/crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs new file mode 100644 index 00000000000..e264a415280 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.rs @@ -0,0 +1 @@ +'🦀 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt b/crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt new file mode 100644 index 00000000000..bd08cfc4489 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0002_unclosed_char_with_ferris.txt @@ -0,0 +1,2 @@ +CHAR 5 "\'🦀" +> error[0; 5) token("\'🦀") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs b/crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs new file mode 100644 index 00000000000..cf74b4dad3b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.rs @@ -0,0 +1 @@ +'\x7f \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt b/crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt new file mode 100644 index 00000000000..0ee22912d14 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0003_unclosed_char_with_ascii_escape.txt @@ -0,0 +1,2 @@ +CHAR 5 "\'\\x7f" +> error[0; 5) token("\'\\x7f") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs b/crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs new file mode 100644 index 00000000000..50be91f6852 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.rs @@ -0,0 +1 @@ +'\u{20AA} \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt b/crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt new file mode 100644 index 00000000000..96fac42ce79 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0004_unclosed_char_with_unicode_escape.txt @@ -0,0 +1,2 @@ +CHAR 9 "\'\\u{20AA}" +> error[0; 9) token("\'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs b/crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs new file mode 100644 index 00000000000..309ecfe4786 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.rs @@ -0,0 +1 @@ +' \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt b/crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt new file mode 100644 index 00000000000..2059f3f81fc --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0005_unclosed_char_with_space.txt @@ -0,0 +1,2 @@ +CHAR 2 "\' " +> error[0; 2) token("\' ") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs b/crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs new file mode 100644 index 00000000000..6ba258b1093 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.rs @@ -0,0 +1 @@ +'\ \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt b/crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt new file mode 100644 index 00000000000..7dd376e5971 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0006_unclosed_char_with_slash.txt @@ -0,0 +1,2 @@ +CHAR 2 "\'\\" +> error[0; 2) token("\'\\") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs b/crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs new file mode 100644 index 00000000000..78bef7e3eb2 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.rs @@ -0,0 +1 @@ +'\n \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt b/crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt new file mode 100644 index 00000000000..ef7a0a147d0 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0007_unclosed_char_with_slash_n.txt @@ -0,0 +1,2 @@ +CHAR 3 "\'\\n" +> error[0; 3) token("\'\\n") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs b/crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs new file mode 100644 index 00000000000..a0e722065bd --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.rs @@ -0,0 +1 @@ +'\' \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt b/crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt new file mode 100644 index 00000000000..13fc5ea9ac4 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0008_unclosed_char_with_slash_single_quote.txt @@ -0,0 +1,2 @@ +CHAR 3 "\'\\\'" +> error[0; 3) token("\'\\\'") msg(Missing trailing `'` symbol to terminate the character literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs new file mode 100644 index 00000000000..795dc7e25c5 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.rs @@ -0,0 +1 @@ +b' \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt new file mode 100644 index 00000000000..269d68c74ac --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0009_unclosed_byte_at_eof.txt @@ -0,0 +1,2 @@ +BYTE 2 "b\'" +> error[0; 2) token("b\'") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs b/crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs new file mode 100644 index 00000000000..c9230dc24ea --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.rs @@ -0,0 +1 @@ +b'🦀 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt b/crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt new file mode 100644 index 00000000000..91a76e479ab --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0010_unclosed_byte_with_ferris.txt @@ -0,0 +1,2 @@ +BYTE 6 "b\'🦀" +> error[0; 6) token("b\'🦀") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs b/crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs new file mode 100644 index 00000000000..d146a8090d1 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.rs @@ -0,0 +1 @@ +b'\x7f \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt b/crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt new file mode 100644 index 00000000000..b8c804a1894 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0011_unclosed_byte_with_ascii_escape.txt @@ -0,0 +1,2 @@ +BYTE 6 "b\'\\x7f" +> error[0; 6) token("b\'\\x7f") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs b/crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs new file mode 100644 index 00000000000..a3dec7c255d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.rs @@ -0,0 +1 @@ +b'\u{20AA} \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt b/crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt new file mode 100644 index 00000000000..dfca22a5982 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0012_unclosed_byte_with_unicode_escape.txt @@ -0,0 +1,2 @@ +BYTE 10 "b\'\\u{20AA}" +> error[0; 10) token("b\'\\u{20AA}") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs b/crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs new file mode 100644 index 00000000000..93b7f9c87c9 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.rs @@ -0,0 +1 @@ +b' \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt b/crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt new file mode 100644 index 00000000000..51a1cceabdf --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0013_unclosed_byte_with_space.txt @@ -0,0 +1,2 @@ +BYTE 3 "b\' " +> error[0; 3) token("b\' ") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs b/crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs new file mode 100644 index 00000000000..abffa5037c0 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.rs @@ -0,0 +1 @@ +b'\ \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt b/crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt new file mode 100644 index 00000000000..24e835c2795 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0014_unclosed_byte_with_slash.txt @@ -0,0 +1,2 @@ +BYTE 3 "b\'\\" +> error[0; 3) token("b\'\\") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs b/crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs new file mode 100644 index 00000000000..4f46836a935 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.rs @@ -0,0 +1 @@ +b'\n \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt b/crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt new file mode 100644 index 00000000000..f1e39a41ba0 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0015_unclosed_byte_with_slash_n.txt @@ -0,0 +1,2 @@ +BYTE 4 "b\'\\n" +> error[0; 4) token("b\'\\n") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs b/crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs new file mode 100644 index 00000000000..645b641eedb --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.rs @@ -0,0 +1 @@ +b'\' \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt b/crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt new file mode 100644 index 00000000000..f8ffe815d42 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0016_unclosed_byte_with_slash_single_quote.txt @@ -0,0 +1,2 @@ +BYTE 4 "b\'\\\'" +> error[0; 4) token("b\'\\\'") msg(Missing trailing `'` symbol to terminate the byte literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs new file mode 100644 index 00000000000..9d68933c44f --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.rs @@ -0,0 +1 @@ +" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt new file mode 100644 index 00000000000..823daaf6f7a --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0017_unclosed_string_at_eof.txt @@ -0,0 +1,2 @@ +STRING 1 "\"" +> error[0; 1) token("\"") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs b/crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs new file mode 100644 index 00000000000..d439b8d2a1d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.rs @@ -0,0 +1 @@ +"🦀 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt b/crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt new file mode 100644 index 00000000000..164580eb35d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0018_unclosed_string_with_ferris.txt @@ -0,0 +1,2 @@ +STRING 5 "\"🦀" +> error[0; 5) token("\"🦀") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs b/crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs new file mode 100644 index 00000000000..56186a34444 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.rs @@ -0,0 +1 @@ +"\x7f \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt b/crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt new file mode 100644 index 00000000000..4453827c303 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0019_unclosed_string_with_ascii_escape.txt @@ -0,0 +1,2 @@ +STRING 5 "\"\\x7f" +> error[0; 5) token("\"\\x7f") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs b/crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs new file mode 100644 index 00000000000..ed24095c3d4 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.rs @@ -0,0 +1 @@ +"\u{20AA} \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt b/crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt new file mode 100644 index 00000000000..aa614f30461 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0020_unclosed_string_with_unicode_escape.txt @@ -0,0 +1,2 @@ +STRING 9 "\"\\u{20AA}" +> error[0; 9) token("\"\\u{20AA}") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs b/crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs new file mode 100644 index 00000000000..72cdc841fbd --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.rs @@ -0,0 +1 @@ +" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt b/crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt new file mode 100644 index 00000000000..b7db1236ffa --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0021_unclosed_string_with_space.txt @@ -0,0 +1,2 @@ +STRING 2 "\" " +> error[0; 2) token("\" ") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs b/crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs new file mode 100644 index 00000000000..00a25840087 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.rs @@ -0,0 +1 @@ +"\ \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt b/crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt new file mode 100644 index 00000000000..9d3df37991a --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0022_unclosed_string_with_slash.txt @@ -0,0 +1,2 @@ +STRING 2 "\"\\" +> error[0; 2) token("\"\\") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs b/crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs new file mode 100644 index 00000000000..a0c29b8cff7 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.rs @@ -0,0 +1 @@ +"\n \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt b/crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt new file mode 100644 index 00000000000..e3eb672b691 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0023_unclosed_string_with_slash_n.txt @@ -0,0 +1,2 @@ +STRING 3 "\"\\n" +> error[0; 3) token("\"\\n") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs b/crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs new file mode 100644 index 00000000000..403c2d6ddc6 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.rs @@ -0,0 +1 @@ +"\" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt b/crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt new file mode 100644 index 00000000000..041d7fb6efc --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0024_unclosed_string_with_slash_double_quote.txt @@ -0,0 +1,2 @@ +STRING 3 "\"\\\"" +> error[0; 3) token("\"\\\"") msg(Missing trailing `"` symbol to terminate the string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs new file mode 100644 index 00000000000..36f4f432187 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.rs @@ -0,0 +1 @@ +b" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt new file mode 100644 index 00000000000..be7970a835b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0025_unclosed_byte_string_at_eof.txt @@ -0,0 +1,2 @@ +BYTE_STRING 2 "b\"" +> error[0; 2) token("b\"") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs b/crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs new file mode 100644 index 00000000000..3c23a037228 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.rs @@ -0,0 +1 @@ +b"🦀 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt b/crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt new file mode 100644 index 00000000000..bf9aab132cb --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0026_unclosed_byte_string_with_ferris.txt @@ -0,0 +1,2 @@ +BYTE_STRING 6 "b\"🦀" +> error[0; 6) token("b\"🦀") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs b/crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs new file mode 100644 index 00000000000..836c112c157 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.rs @@ -0,0 +1 @@ +b"\x7f \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt b/crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt new file mode 100644 index 00000000000..76e16d7d348 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0027_unclosed_byte_string_with_ascii_escape.txt @@ -0,0 +1,2 @@ +BYTE_STRING 6 "b\"\\x7f" +> error[0; 6) token("b\"\\x7f") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs b/crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs new file mode 100644 index 00000000000..1c6df1d00e4 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.rs @@ -0,0 +1 @@ +b"\u{20AA} \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt b/crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt new file mode 100644 index 00000000000..09adffa1601 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0028_unclosed_byte_string_with_unicode_escape.txt @@ -0,0 +1,2 @@ +BYTE_STRING 10 "b\"\\u{20AA}" +> error[0; 10) token("b\"\\u{20AA}") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs b/crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs new file mode 100644 index 00000000000..d6898541e62 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.rs @@ -0,0 +1 @@ +b" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt b/crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt new file mode 100644 index 00000000000..fcb7253c82b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0029_unclosed_byte_string_with_space.txt @@ -0,0 +1,2 @@ +BYTE_STRING 3 "b\" " +> error[0; 3) token("b\" ") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs b/crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs new file mode 100644 index 00000000000..cce6615381d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.rs @@ -0,0 +1 @@ +b"\ \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt b/crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt new file mode 100644 index 00000000000..0a1b3e26993 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0030_unclosed_byte_string_with_slash.txt @@ -0,0 +1,2 @@ +BYTE_STRING 3 "b\"\\" +> error[0; 3) token("b\"\\") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs b/crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs new file mode 100644 index 00000000000..5e680aabb7b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.rs @@ -0,0 +1 @@ +b"\n \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt b/crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt new file mode 100644 index 00000000000..1fb89d2b6d0 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0031_unclosed_byte_string_with_slash_n.txt @@ -0,0 +1,2 @@ +BYTE_STRING 4 "b\"\\n" +> error[0; 4) token("b\"\\n") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs b/crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs new file mode 100644 index 00000000000..f2ff58ba9a8 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.rs @@ -0,0 +1 @@ +b"\" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt b/crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt new file mode 100644 index 00000000000..718d3699299 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0032_unclosed_byte_string_with_slash_double_quote.txt @@ -0,0 +1,2 @@ +BYTE_STRING 4 "b\"\\\"" +> error[0; 4) token("b\"\\\"") msg(Missing trailing `"` symbol to terminate the byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs new file mode 100644 index 00000000000..557c59b6251 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.rs @@ -0,0 +1 @@ +r##" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt new file mode 100644 index 00000000000..93348f548fd --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0033_unclosed_raw_string_at_eof.txt @@ -0,0 +1,2 @@ +RAW_STRING 4 "r##\"" +> error[0; 4) token("r##\"") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs b/crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs new file mode 100644 index 00000000000..bd046e4bb91 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.rs @@ -0,0 +1 @@ +r##"🦀 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt b/crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt new file mode 100644 index 00000000000..42c70dfe836 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0034_unclosed_raw_string_with_ferris.txt @@ -0,0 +1,2 @@ +RAW_STRING 8 "r##\"🦀" +> error[0; 8) token("r##\"🦀") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs b/crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs new file mode 100644 index 00000000000..5bec883dc7a --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.rs @@ -0,0 +1 @@ +r##"\x7f \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt b/crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt new file mode 100644 index 00000000000..2bdeea0ff53 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0035_unclosed_raw_string_with_ascii_escape.txt @@ -0,0 +1,2 @@ +RAW_STRING 8 "r##\"\\x7f" +> error[0; 8) token("r##\"\\x7f") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs b/crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs new file mode 100644 index 00000000000..bf05c39134b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.rs @@ -0,0 +1 @@ +r##"\u{20AA} \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt b/crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt new file mode 100644 index 00000000000..667d4d79f9f --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0036_unclosed_raw_string_with_unicode_escape.txt @@ -0,0 +1,2 @@ +RAW_STRING 12 "r##\"\\u{20AA}" +> error[0; 12) token("r##\"\\u{20AA}") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs b/crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs new file mode 100644 index 00000000000..f104bae4f2c --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.rs @@ -0,0 +1 @@ +r##" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt b/crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt new file mode 100644 index 00000000000..dd9597a1a9e --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0037_unclosed_raw_string_with_space.txt @@ -0,0 +1,2 @@ +RAW_STRING 5 "r##\" " +> error[0; 5) token("r##\" ") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs b/crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs new file mode 100644 index 00000000000..9242077b8b7 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.rs @@ -0,0 +1 @@ +r##"\ \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt b/crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt new file mode 100644 index 00000000000..6ac6e3d623d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0038_unclosed_raw_string_with_slash.txt @@ -0,0 +1,2 @@ +RAW_STRING 5 "r##\"\\" +> error[0; 5) token("r##\"\\") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs b/crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs new file mode 100644 index 00000000000..db1c16f2ba5 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.rs @@ -0,0 +1 @@ +r##"\n \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt b/crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt new file mode 100644 index 00000000000..9d35443f510 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0039_unclosed_raw_string_with_slash_n.txt @@ -0,0 +1,2 @@ +RAW_STRING 6 "r##\"\\n" +> error[0; 6) token("r##\"\\n") msg(Missing trailing `"` with `#` symbols to terminate the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs new file mode 100644 index 00000000000..ae5bae62230 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.rs @@ -0,0 +1 @@ +br##" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt new file mode 100644 index 00000000000..81fa39ea515 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0040_unclosed_raw_byte_string_at_eof.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 5 "br##\"" +> error[0; 5) token("br##\"") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs b/crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs new file mode 100644 index 00000000000..9ef01207a17 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.rs @@ -0,0 +1 @@ +br##"🦀 \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt b/crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt new file mode 100644 index 00000000000..c2503a4d050 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0041_unclosed_raw_byte_string_with_ferris.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 9 "br##\"🦀" +> error[0; 9) token("br##\"🦀") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs b/crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs new file mode 100644 index 00000000000..d50270afe1e --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.rs @@ -0,0 +1 @@ +br##"\x7f \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt b/crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt new file mode 100644 index 00000000000..3bd3d815296 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0042_unclosed_raw_byte_string_with_ascii_escape.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 9 "br##\"\\x7f" +> error[0; 9) token("br##\"\\x7f") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs b/crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs new file mode 100644 index 00000000000..90e299a1a97 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.rs @@ -0,0 +1 @@ +br##"\u{20AA} \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt b/crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt new file mode 100644 index 00000000000..a512f0428f5 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0043_unclosed_raw_byte_string_with_unicode_escape.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 13 "br##\"\\u{20AA}" +> error[0; 13) token("br##\"\\u{20AA}") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs b/crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs new file mode 100644 index 00000000000..14c602fd2b3 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.rs @@ -0,0 +1 @@ +br##" \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt b/crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt new file mode 100644 index 00000000000..dc616a623b2 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0044_unclosed_raw_byte_string_with_space.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 6 "br##\" " +> error[0; 6) token("br##\" ") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs b/crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs new file mode 100644 index 00000000000..0b3c015d74d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.rs @@ -0,0 +1 @@ +br##"\ \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt b/crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt new file mode 100644 index 00000000000..debafe380e4 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0045_unclosed_raw_byte_string_with_slash.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 6 "br##\"\\" +> error[0; 6) token("br##\"\\") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs b/crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs new file mode 100644 index 00000000000..0d8b0e7ab04 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.rs @@ -0,0 +1 @@ +br##"\n \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt b/crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt new file mode 100644 index 00000000000..524e617b77a --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0046_unclosed_raw_byte_string_with_slash_n.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 7 "br##\"\\n" +> error[0; 7) token("br##\"\\n") msg(Missing trailing `"` with `#` symbols to terminate the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs new file mode 100644 index 00000000000..eddf8d08094 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.rs @@ -0,0 +1 @@ +r## \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt new file mode 100644 index 00000000000..00b0468405f --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0047_unstarted_raw_string_at_eof.txt @@ -0,0 +1,2 @@ +RAW_STRING 3 "r##" +> error[0; 3) token("r##") msg(Missing `"` symbol after `#` symbols to begin the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs new file mode 100644 index 00000000000..7e8cadf4f49 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.rs @@ -0,0 +1 @@ +br## \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt new file mode 100644 index 00000000000..33b25e60f8b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0048_unstarted_raw_byte_string_at_eof.txt @@ -0,0 +1,2 @@ +RAW_BYTE_STRING 4 "br##" +> error[0; 4) token("br##") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs new file mode 100644 index 00000000000..534668a9b66 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.rs @@ -0,0 +1 @@ +r## I lack a quote! \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt new file mode 100644 index 00000000000..782dfd974f6 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt @@ -0,0 +1,10 @@ +RAW_STRING 4 "r## " +IDENT 1 "I" +WHITESPACE 1 " " +IDENT 4 "lack" +WHITESPACE 1 " " +IDENT 1 "a" +WHITESPACE 1 " " +IDENT 5 "quote" +EXCL 1 "!" +> error[0; 4) token("r## ") msg(Missing `"` symbol after `#` symbols to begin the raw string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs new file mode 100644 index 00000000000..d9b55455ac4 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.rs @@ -0,0 +1 @@ +br## I lack a quote! \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt new file mode 100644 index 00000000000..59c40cd65ac --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt @@ -0,0 +1,10 @@ +RAW_BYTE_STRING 5 "br## " +IDENT 1 "I" +WHITESPACE 1 " " +IDENT 4 "lack" +WHITESPACE 1 " " +IDENT 1 "a" +WHITESPACE 1 " " +IDENT 5 "quote" +EXCL 1 "!" +> error[0; 5) token("br## ") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal) diff --git a/crates/ra_syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs b/crates/ra_syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs new file mode 100644 index 00000000000..22e83649f7d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.rs @@ -0,0 +1 @@ +/* \ No newline at end of file diff --git a/crates/ra_syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt b/crates/ra_syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt new file mode 100644 index 00000000000..5d04cdaa4b9 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0051_unclosed_block_comment_at_eof.txt @@ -0,0 +1,2 @@ +COMMENT 2 "/*" +> error[0; 2) token("/*") msg(Missing trailing `*/` symbols to terminate the block comment) diff --git a/crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs b/crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs new file mode 100644 index 00000000000..c45c2844dbc --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.rs @@ -0,0 +1 @@ +/* comment diff --git a/crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt b/crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt new file mode 100644 index 00000000000..8c6b678e321 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0052_unclosed_block_comment_with_content.txt @@ -0,0 +1,2 @@ +COMMENT 11 "/* comment\n" +> error[0; 11) token("/* comment\n") msg(Missing trailing `*/` symbols to terminate the block comment) diff --git a/crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs b/crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs new file mode 100644 index 00000000000..3fcfc96600a --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.rs @@ -0,0 +1 @@ +/* /* /* diff --git a/crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt b/crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt new file mode 100644 index 00000000000..250de34d9f0 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0053_unclosed_nested_block_comment_entirely.txt @@ -0,0 +1,2 @@ +COMMENT 9 "/* /* /*\n" +> error[0; 9) token("/* /* /*\n") msg(Missing trailing `*/` symbols to terminate the block comment) diff --git a/crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs b/crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs new file mode 100644 index 00000000000..26c898f019d --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.rs @@ -0,0 +1 @@ +/** /*! /* comment */ */ diff --git a/crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt b/crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt new file mode 100644 index 00000000000..f97f2a8c76b --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0054_unclosed_nested_block_comment_partially.txt @@ -0,0 +1,2 @@ +COMMENT 25 "/** /*! /* comment */ */\n" +> error[0; 25) token("/** /*! /* comment */ */\n") msg(Missing trailing `*/` symbols to terminate the block comment) diff --git a/crates/ra_syntax/test_data/lexer/err/0055_empty_int.rs b/crates/ra_syntax/test_data/lexer/err/0055_empty_int.rs new file mode 100644 index 00000000000..aa2a9fdca17 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0055_empty_int.rs @@ -0,0 +1,17 @@ +0b +0o +0x + +0b_ +0o_ +0x_ + +0bnoDigit +0onoDigit +0xnoDigit + +0xG +0xg + +0x_g +0x_G diff --git a/crates/ra_syntax/test_data/lexer/err/0055_empty_int.txt b/crates/ra_syntax/test_data/lexer/err/0055_empty_int.txt new file mode 100644 index 00000000000..2fe5bd950a5 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0055_empty_int.txt @@ -0,0 +1,39 @@ +INT_NUMBER 2 "0b" +WHITESPACE 1 "\n" +INT_NUMBER 2 "0o" +WHITESPACE 1 "\n" +INT_NUMBER 2 "0x" +WHITESPACE 2 "\n\n" +INT_NUMBER 3 "0b_" +WHITESPACE 1 "\n" +INT_NUMBER 3 "0o_" +WHITESPACE 1 "\n" +INT_NUMBER 3 "0x_" +WHITESPACE 2 "\n\n" +INT_NUMBER 9 "0bnoDigit" +WHITESPACE 1 "\n" +INT_NUMBER 9 "0onoDigit" +WHITESPACE 1 "\n" +INT_NUMBER 9 "0xnoDigit" +WHITESPACE 2 "\n\n" +INT_NUMBER 3 "0xG" +WHITESPACE 1 "\n" +INT_NUMBER 3 "0xg" +WHITESPACE 2 "\n\n" +INT_NUMBER 4 "0x_g" +WHITESPACE 1 "\n" +INT_NUMBER 4 "0x_G" +WHITESPACE 1 "\n" +> error[0; 2) token("0b") msg(Missing digits after the integer base prefix) +> error[3; 5) token("0o") msg(Missing digits after the integer base prefix) +> error[6; 8) token("0x") msg(Missing digits after the integer base prefix) +> error[10; 13) token("0b_") msg(Missing digits after the integer base prefix) +> error[14; 17) token("0o_") msg(Missing digits after the integer base prefix) +> error[18; 21) token("0x_") msg(Missing digits after the integer base prefix) +> error[23; 32) token("0bnoDigit") msg(Missing digits after the integer base prefix) +> error[33; 42) token("0onoDigit") msg(Missing digits after the integer base prefix) +> error[43; 52) token("0xnoDigit") msg(Missing digits after the integer base prefix) +> error[54; 57) token("0xG") msg(Missing digits after the integer base prefix) +> error[58; 61) token("0xg") msg(Missing digits after the integer base prefix) +> error[63; 67) token("0x_g") msg(Missing digits after the integer base prefix) +> error[68; 72) token("0x_G") msg(Missing digits after the integer base prefix) diff --git a/crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.rs b/crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.rs new file mode 100644 index 00000000000..286584c887f --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.rs @@ -0,0 +1,22 @@ +0e +0E + +42e+ +42e- +42E+ +42E- + +42.e+ +42.e- +42.E+ +42.E- + +42.2e+ +42.2e- +42.2E+ +42.2E- + +42.2e+f32 +42.2e-f32 +42.2E+f32 +42.2E-f32 diff --git a/crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.txt b/crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.txt new file mode 100644 index 00000000000..ab35e20a5ce --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0056_empty_exponent.txt @@ -0,0 +1,62 @@ +FLOAT_NUMBER 2 "0e" +WHITESPACE 1 "\n" +FLOAT_NUMBER 2 "0E" +WHITESPACE 2 "\n\n" +FLOAT_NUMBER 4 "42e+" +WHITESPACE 1 "\n" +FLOAT_NUMBER 4 "42e-" +WHITESPACE 1 "\n" +FLOAT_NUMBER 4 "42E+" +WHITESPACE 1 "\n" +FLOAT_NUMBER 4 "42E-" +WHITESPACE 2 "\n\n" +INT_NUMBER 2 "42" +DOT 1 "." +IDENT 1 "e" +PLUS 1 "+" +WHITESPACE 1 "\n" +INT_NUMBER 2 "42" +DOT 1 "." +IDENT 1 "e" +MINUS 1 "-" +WHITESPACE 1 "\n" +INT_NUMBER 2 "42" +DOT 1 "." +IDENT 1 "E" +PLUS 1 "+" +WHITESPACE 1 "\n" +INT_NUMBER 2 "42" +DOT 1 "." +IDENT 1 "E" +MINUS 1 "-" +WHITESPACE 2 "\n\n" +FLOAT_NUMBER 6 "42.2e+" +WHITESPACE 1 "\n" +FLOAT_NUMBER 6 "42.2e-" +WHITESPACE 1 "\n" +FLOAT_NUMBER 6 "42.2E+" +WHITESPACE 1 "\n" +FLOAT_NUMBER 6 "42.2E-" +WHITESPACE 2 "\n\n" +FLOAT_NUMBER 9 "42.2e+f32" +WHITESPACE 1 "\n" +FLOAT_NUMBER 9 "42.2e-f32" +WHITESPACE 1 "\n" +FLOAT_NUMBER 9 "42.2E+f32" +WHITESPACE 1 "\n" +FLOAT_NUMBER 9 "42.2E-f32" +WHITESPACE 1 "\n" +> error[0; 2) token("0e") msg(Missing digits after the exponent symbol) +> error[3; 5) token("0E") msg(Missing digits after the exponent symbol) +> error[7; 11) token("42e+") msg(Missing digits after the exponent symbol) +> error[12; 16) token("42e-") msg(Missing digits after the exponent symbol) +> error[17; 21) token("42E+") msg(Missing digits after the exponent symbol) +> error[22; 26) token("42E-") msg(Missing digits after the exponent symbol) +> error[53; 59) token("42.2e+") msg(Missing digits after the exponent symbol) +> error[60; 66) token("42.2e-") msg(Missing digits after the exponent symbol) +> error[67; 73) token("42.2E+") msg(Missing digits after the exponent symbol) +> error[74; 80) token("42.2E-") msg(Missing digits after the exponent symbol) +> error[82; 91) token("42.2e+f32") msg(Missing digits after the exponent symbol) +> error[92; 101) token("42.2e-f32") msg(Missing digits after the exponent symbol) +> error[102; 111) token("42.2E+f32") msg(Missing digits after the exponent symbol) +> error[112; 121) token("42.2E-f32") msg(Missing digits after the exponent symbol) diff --git a/crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs b/crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs new file mode 100644 index 00000000000..a7698a404a8 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs @@ -0,0 +1,2 @@ +'1 +'1lifetime diff --git a/crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt b/crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt new file mode 100644 index 00000000000..89b38bfacfa --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt @@ -0,0 +1,6 @@ +LIFETIME 2 "\'1" +WHITESPACE 1 "\n" +LIFETIME 10 "\'1lifetime" +WHITESPACE 1 "\n" +> error[0; 2) token("\'1") msg(Lifetime name cannot start with a number) +> error[3; 13) token("\'1lifetime") msg(Lifetime name cannot start with a number) diff --git a/crates/ra_syntax/test_data/lexer/0001_hello.rs b/crates/ra_syntax/test_data/lexer/ok/0001_hello.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0001_hello.rs rename to crates/ra_syntax/test_data/lexer/ok/0001_hello.rs diff --git a/crates/ra_syntax/test_data/lexer/0001_hello.txt b/crates/ra_syntax/test_data/lexer/ok/0001_hello.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0001_hello.txt rename to crates/ra_syntax/test_data/lexer/ok/0001_hello.txt diff --git a/crates/ra_syntax/test_data/lexer/0002_whitespace.rs b/crates/ra_syntax/test_data/lexer/ok/0002_whitespace.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0002_whitespace.rs rename to crates/ra_syntax/test_data/lexer/ok/0002_whitespace.rs diff --git a/crates/ra_syntax/test_data/lexer/0002_whitespace.txt b/crates/ra_syntax/test_data/lexer/ok/0002_whitespace.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0002_whitespace.txt rename to crates/ra_syntax/test_data/lexer/ok/0002_whitespace.txt diff --git a/crates/ra_syntax/test_data/lexer/0003_ident.rs b/crates/ra_syntax/test_data/lexer/ok/0003_ident.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0003_ident.rs rename to crates/ra_syntax/test_data/lexer/ok/0003_ident.rs diff --git a/crates/ra_syntax/test_data/lexer/0003_ident.txt b/crates/ra_syntax/test_data/lexer/ok/0003_ident.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0003_ident.txt rename to crates/ra_syntax/test_data/lexer/ok/0003_ident.txt diff --git a/crates/ra_syntax/test_data/lexer/0004_numbers.rs b/crates/ra_syntax/test_data/lexer/ok/0004_numbers.rs similarity index 73% rename from crates/ra_syntax/test_data/lexer/0004_numbers.rs rename to crates/ra_syntax/test_data/lexer/ok/0004_numbers.rs index dc974b553b0..bc761c235d8 100644 --- a/crates/ra_syntax/test_data/lexer/0004_numbers.rs +++ b/crates/ra_syntax/test_data/lexer/ok/0004_numbers.rs @@ -1,4 +1,4 @@ -0 0b 0o 0x 00 0_ 0. 0e 0E 0z +0 00 0_ 0. 0z 01790 0b1790 0o1790 0x1790aAbBcCdDeEfF 001279 0_1279 0.1279 0e1279 0E1279 0..2 0.foo() @@ -6,4 +6,4 @@ 0.e+1 0.0E-2 0___0.10000____0000e+111__ -1i64 92.0f32 11__s \ No newline at end of file +1i64 92.0f32 11__s diff --git a/crates/ra_syntax/test_data/lexer/0004_numbers.txt b/crates/ra_syntax/test_data/lexer/ok/0004_numbers.txt similarity index 85% rename from crates/ra_syntax/test_data/lexer/0004_numbers.txt rename to crates/ra_syntax/test_data/lexer/ok/0004_numbers.txt index 7bb89b8ae8e..e19fc5789e3 100644 --- a/crates/ra_syntax/test_data/lexer/0004_numbers.txt +++ b/crates/ra_syntax/test_data/lexer/ok/0004_numbers.txt @@ -1,21 +1,11 @@ INT_NUMBER 1 "0" WHITESPACE 1 " " -INT_NUMBER 2 "0b" -WHITESPACE 1 " " -INT_NUMBER 2 "0o" -WHITESPACE 1 " " -INT_NUMBER 2 "0x" -WHITESPACE 1 " " INT_NUMBER 2 "00" WHITESPACE 1 " " INT_NUMBER 2 "0_" WHITESPACE 1 " " FLOAT_NUMBER 2 "0." WHITESPACE 1 " " -FLOAT_NUMBER 2 "0e" -WHITESPACE 1 " " -FLOAT_NUMBER 2 "0E" -WHITESPACE 1 " " INT_NUMBER 2 "0z" WHITESPACE 1 "\n" INT_NUMBER 5 "01790" @@ -64,3 +54,4 @@ WHITESPACE 1 " " FLOAT_NUMBER 7 "92.0f32" WHITESPACE 1 " " INT_NUMBER 5 "11__s" +WHITESPACE 1 "\n" diff --git a/crates/ra_syntax/test_data/lexer/0005_symbols.rs b/crates/ra_syntax/test_data/lexer/ok/0005_symbols.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0005_symbols.rs rename to crates/ra_syntax/test_data/lexer/ok/0005_symbols.rs diff --git a/crates/ra_syntax/test_data/lexer/0005_symbols.txt b/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0005_symbols.txt rename to crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt diff --git a/crates/ra_syntax/test_data/lexer/0006_chars.rs b/crates/ra_syntax/test_data/lexer/ok/0006_chars.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0006_chars.rs rename to crates/ra_syntax/test_data/lexer/ok/0006_chars.rs diff --git a/crates/ra_syntax/test_data/lexer/0006_chars.txt b/crates/ra_syntax/test_data/lexer/ok/0006_chars.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0006_chars.txt rename to crates/ra_syntax/test_data/lexer/ok/0006_chars.txt diff --git a/crates/ra_syntax/test_data/lexer/0007_lifetimes.rs b/crates/ra_syntax/test_data/lexer/ok/0007_lifetimes.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0007_lifetimes.rs rename to crates/ra_syntax/test_data/lexer/ok/0007_lifetimes.rs diff --git a/crates/ra_syntax/test_data/lexer/0007_lifetimes.txt b/crates/ra_syntax/test_data/lexer/ok/0007_lifetimes.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0007_lifetimes.txt rename to crates/ra_syntax/test_data/lexer/ok/0007_lifetimes.txt diff --git a/crates/ra_syntax/test_data/lexer/0008_byte_strings.rs b/crates/ra_syntax/test_data/lexer/ok/0008_byte_strings.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0008_byte_strings.rs rename to crates/ra_syntax/test_data/lexer/ok/0008_byte_strings.rs diff --git a/crates/ra_syntax/test_data/lexer/0008_byte_strings.txt b/crates/ra_syntax/test_data/lexer/ok/0008_byte_strings.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0008_byte_strings.txt rename to crates/ra_syntax/test_data/lexer/ok/0008_byte_strings.txt diff --git a/crates/ra_syntax/test_data/lexer/0009_strings.rs b/crates/ra_syntax/test_data/lexer/ok/0009_strings.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0009_strings.rs rename to crates/ra_syntax/test_data/lexer/ok/0009_strings.rs diff --git a/crates/ra_syntax/test_data/lexer/0009_strings.txt b/crates/ra_syntax/test_data/lexer/ok/0009_strings.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0009_strings.txt rename to crates/ra_syntax/test_data/lexer/ok/0009_strings.txt diff --git a/crates/ra_syntax/test_data/lexer/ok/0010_single_line_comments.rs b/crates/ra_syntax/test_data/lexer/ok/0010_single_line_comments.rs new file mode 100644 index 00000000000..4b6653f9cc9 --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/ok/0010_single_line_comments.rs @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +// hello +//! World +//!! Inner line doc +/// Outer line doc +//// Just a comment + +// +//! +//!! +/// +//// diff --git a/crates/ra_syntax/test_data/lexer/ok/0010_single_line_comments.txt b/crates/ra_syntax/test_data/lexer/ok/0010_single_line_comments.txt new file mode 100644 index 00000000000..98a3818c06c --- /dev/null +++ b/crates/ra_syntax/test_data/lexer/ok/0010_single_line_comments.txt @@ -0,0 +1,22 @@ +SHEBANG 19 "#!/usr/bin/env bash" +WHITESPACE 1 "\n" +COMMENT 8 "// hello" +WHITESPACE 1 "\n" +COMMENT 9 "//! World" +WHITESPACE 1 "\n" +COMMENT 19 "//!! Inner line doc" +WHITESPACE 1 "\n" +COMMENT 18 "/// Outer line doc" +WHITESPACE 1 "\n" +COMMENT 19 "//// Just a comment" +WHITESPACE 2 "\n\n" +COMMENT 2 "//" +WHITESPACE 1 "\n" +COMMENT 3 "//!" +WHITESPACE 1 "\n" +COMMENT 4 "//!!" +WHITESPACE 1 "\n" +COMMENT 3 "///" +WHITESPACE 1 "\n" +COMMENT 4 "////" +WHITESPACE 1 "\n" diff --git a/crates/ra_syntax/test_data/lexer/0011_keywords.rs b/crates/ra_syntax/test_data/lexer/ok/0011_keywords.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0011_keywords.rs rename to crates/ra_syntax/test_data/lexer/ok/0011_keywords.rs diff --git a/crates/ra_syntax/test_data/lexer/0011_keywords.txt b/crates/ra_syntax/test_data/lexer/ok/0011_keywords.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0011_keywords.txt rename to crates/ra_syntax/test_data/lexer/ok/0011_keywords.txt diff --git a/crates/ra_syntax/test_data/lexer/00012_block_comment.rs b/crates/ra_syntax/test_data/lexer/ok/0012_block_comment.rs similarity index 88% rename from crates/ra_syntax/test_data/lexer/00012_block_comment.rs rename to crates/ra_syntax/test_data/lexer/ok/0012_block_comment.rs index 708aac197f2..b880a59d952 100644 --- a/crates/ra_syntax/test_data/lexer/00012_block_comment.rs +++ b/crates/ra_syntax/test_data/lexer/ok/0012_block_comment.rs @@ -1,4 +1,3 @@ /* */ /**/ /* /* */ */ -/* diff --git a/crates/ra_syntax/test_data/lexer/00012_block_comment.txt b/crates/ra_syntax/test_data/lexer/ok/0012_block_comment.txt similarity index 87% rename from crates/ra_syntax/test_data/lexer/00012_block_comment.txt rename to crates/ra_syntax/test_data/lexer/ok/0012_block_comment.txt index 9958b25187d..2618e287e63 100644 --- a/crates/ra_syntax/test_data/lexer/00012_block_comment.txt +++ b/crates/ra_syntax/test_data/lexer/ok/0012_block_comment.txt @@ -4,4 +4,3 @@ COMMENT 4 "/**/" WHITESPACE 1 "\n" COMMENT 11 "/* /* */ */" WHITESPACE 1 "\n" -COMMENT 3 "/*\n" diff --git a/crates/ra_syntax/test_data/lexer/0013_raw_strings.rs b/crates/ra_syntax/test_data/lexer/ok/0013_raw_strings.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0013_raw_strings.rs rename to crates/ra_syntax/test_data/lexer/ok/0013_raw_strings.rs diff --git a/crates/ra_syntax/test_data/lexer/0013_raw_strings.txt b/crates/ra_syntax/test_data/lexer/ok/0013_raw_strings.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0013_raw_strings.txt rename to crates/ra_syntax/test_data/lexer/ok/0013_raw_strings.txt diff --git a/crates/ra_syntax/test_data/lexer/0016_raw_ident.rs b/crates/ra_syntax/test_data/lexer/ok/0014_raw_ident.rs similarity index 100% rename from crates/ra_syntax/test_data/lexer/0016_raw_ident.rs rename to crates/ra_syntax/test_data/lexer/ok/0014_raw_ident.rs diff --git a/crates/ra_syntax/test_data/lexer/0016_raw_ident.txt b/crates/ra_syntax/test_data/lexer/ok/0014_raw_ident.txt similarity index 100% rename from crates/ra_syntax/test_data/lexer/0016_raw_ident.txt rename to crates/ra_syntax/test_data/lexer/ok/0014_raw_ident.txt