aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-21 10:47:47 +0000
committerGitHub <[email protected]>2019-12-21 10:47:47 +0000
commit90ef070db3dce0a7acb9cd11d0b0d72de13c9d79 (patch)
treec6fcc8c77fe4948b356e397fb5fe1f8e8ac39037 /crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs
parent3ebf15c9b29b1fed6319d04f540ad48cd4bd6995 (diff)
parent4195c0e5f9a3db7646d4df28aa8c77a863c35759 (diff)
Merge #2628
2628: Add macro 2.0 support in parser r=matklad a=edwin0cheng This PR added a new syntax kind : `MACRO_DEF` and a keyword `MACRO_KW` there are two syntax for declarative macro 2.0 : 1. Normal : `macro m { ($i:ident) => {} }` , which handle similar to legacy one. 2. Call like: `macro m($i:ident) {}`, it produces a single token tree which have two child token trees : `($i:ident)` and `{}` Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs')
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs
new file mode 100644
index 000000000..781047ba1
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs
@@ -0,0 +1,15 @@
1macro parse_use_trees($($s:expr),* $(,)*) {
2 vec![
3 $(parse_use_tree($s),)*
4 ]
5}
6
7#[test]
8fn test_use_tree_merge() {
9 macro test_merge([$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) {
10 assert_eq!(
11 merge_use_trees(parse_use_trees!($($input,)*)),
12 parse_use_trees!($($output,)*),
13 );
14 }
15}