diff options
author | Edwin Cheng <[email protected]> | 2019-12-21 10:29:14 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-21 10:29:14 +0000 |
commit | bea8f581186bb8d933357599468dd7d862ae847b (patch) | |
tree | 995f2d26c585324cd3acdf3edd135deec9255ff7 /crates/ra_syntax/test_data/parser/inline | |
parent | 6eab968c601637361e8fbd1ee93ded1b0d967bee (diff) |
Add macro 2.0 support in parser
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline')
4 files changed, 66 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs new file mode 100644 index 000000000..319a4e2aa --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | macro m { ($i:ident) => {} } | ||
2 | macro m($i:ident) {} | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt new file mode 100644 index 000000000..af1122bfa --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | SOURCE_FILE@[0; 50) | ||
2 | MACRO_DEF@[0; 28) | ||
3 | MACRO_KW@[0; 5) "macro" | ||
4 | WHITESPACE@[5; 6) " " | ||
5 | IDENT@[6; 7) "m" | ||
6 | WHITESPACE@[7; 8) " " | ||
7 | TOKEN_TREE@[8; 28) | ||
8 | L_CURLY@[8; 9) "{" | ||
9 | WHITESPACE@[9; 10) " " | ||
10 | TOKEN_TREE@[10; 20) | ||
11 | L_PAREN@[10; 11) "(" | ||
12 | DOLLAR@[11; 12) "$" | ||
13 | IDENT@[12; 13) "i" | ||
14 | COLON@[13; 14) ":" | ||
15 | IDENT@[14; 19) "ident" | ||
16 | R_PAREN@[19; 20) ")" | ||
17 | WHITESPACE@[20; 21) " " | ||
18 | EQ@[21; 22) "=" | ||
19 | R_ANGLE@[22; 23) ">" | ||
20 | WHITESPACE@[23; 24) " " | ||
21 | TOKEN_TREE@[24; 26) | ||
22 | L_CURLY@[24; 25) "{" | ||
23 | R_CURLY@[25; 26) "}" | ||
24 | WHITESPACE@[26; 27) " " | ||
25 | R_CURLY@[27; 28) "}" | ||
26 | WHITESPACE@[28; 29) "\n" | ||
27 | MACRO_DEF@[29; 49) | ||
28 | MACRO_KW@[29; 34) "macro" | ||
29 | WHITESPACE@[34; 35) " " | ||
30 | IDENT@[35; 36) "m" | ||
31 | TOKEN_TREE@[36; 49) | ||
32 | TOKEN_TREE@[36; 46) | ||
33 | L_PAREN@[36; 37) "(" | ||
34 | DOLLAR@[37; 38) "$" | ||
35 | IDENT@[38; 39) "i" | ||
36 | COLON@[39; 40) ":" | ||
37 | IDENT@[40; 45) "ident" | ||
38 | R_PAREN@[45; 46) ")" | ||
39 | WHITESPACE@[46; 47) " " | ||
40 | TOKEN_TREE@[47; 49) | ||
41 | L_CURLY@[47; 48) "{" | ||
42 | R_CURLY@[48; 49) "}" | ||
43 | WHITESPACE@[49; 50) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs new file mode 100644 index 000000000..3b2be597f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs | |||
@@ -0,0 +1 @@ | |||
pub macro m($:ident) {} | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt new file mode 100644 index 000000000..985f61f89 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | SOURCE_FILE@[0; 24) | ||
2 | MACRO_DEF@[0; 23) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) "pub" | ||
5 | WHITESPACE@[3; 4) " " | ||
6 | MACRO_KW@[4; 9) "macro" | ||
7 | WHITESPACE@[9; 10) " " | ||
8 | IDENT@[10; 11) "m" | ||
9 | TOKEN_TREE@[11; 23) | ||
10 | TOKEN_TREE@[11; 20) | ||
11 | L_PAREN@[11; 12) "(" | ||
12 | DOLLAR@[12; 13) "$" | ||
13 | COLON@[13; 14) ":" | ||
14 | IDENT@[14; 19) "ident" | ||
15 | R_PAREN@[19; 20) ")" | ||
16 | WHITESPACE@[20; 21) " " | ||
17 | TOKEN_TREE@[21; 23) | ||
18 | L_CURLY@[21; 22) "{" | ||
19 | R_CURLY@[22; 23) "}" | ||
20 | WHITESPACE@[23; 24) "\n" | ||