]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/macros/macro-follow.rs
Rollup merge of #58306 - GuillaumeGomez:crate-browser-history, r=QuietMisdreavus
[rust.git] / src / test / run-pass / macros / macro-follow.rs
1 // run-pass
2 #![allow(unused_macros)]
3 // Check the macro follow sets (see corresponding cfail test).
4
5 // FOLLOW(pat) = {FatArrow, Comma, Eq, Or, Ident(if), Ident(in)}
6 macro_rules! follow_pat {
7     ($p:pat =>) => {};
8     ($p:pat ,) => {};
9     ($p:pat =) => {};
10     ($p:pat |) => {};
11     ($p:pat if) => {};
12     ($p:pat in) => {};
13 }
14 // FOLLOW(expr) = {FatArrow, Comma, Semicolon}
15 macro_rules! follow_expr {
16     ($e:expr =>) => {};
17     ($e:expr ,) => {};
18     ($e:expr ;) => {};
19 }
20 // FOLLOW(ty) = {OpenDelim(Brace), Comma, FatArrow, Colon, Eq, Gt, Semi, Or,
21 //               Ident(as), Ident(where), OpenDelim(Bracket), Nonterminal(Block)}
22 macro_rules! follow_ty {
23     ($t:ty {}) => {};
24     ($t:ty ,) => {};
25     ($t:ty =>) => {};
26     ($t:ty :) => {};
27     ($t:ty =) => {};
28     ($t:ty >) => {};
29     ($t:ty ;) => {};
30     ($t:ty |) => {};
31     ($t:ty as) => {};
32     ($t:ty where) => {};
33     ($t:ty []) => {};
34     ($t:ty $b:block) => {};
35 }
36 // FOLLOW(stmt) = FOLLOW(expr)
37 macro_rules! follow_stmt {
38     ($s:stmt =>) => {};
39     ($s:stmt ,) => {};
40     ($s:stmt ;) => {};
41 }
42 // FOLLOW(path) = FOLLOW(ty)
43 macro_rules! follow_path {
44     ($p:path {}) => {};
45     ($p:path ,) => {};
46     ($p:path =>) => {};
47     ($p:path :) => {};
48     ($p:path =) => {};
49     ($p:path >) => {};
50     ($p:path ;) => {};
51     ($p:path |) => {};
52     ($p:path as) => {};
53     ($p:path where) => {};
54     ($p:path []) => {};
55     ($p:path $b:block) => {};
56 }
57 // FOLLOW(block) = any token
58 macro_rules! follow_block {
59     ($b:block ()) => {};
60     ($b:block []) => {};
61     ($b:block {}) => {};
62     ($b:block ,) => {};
63     ($b:block =>) => {};
64     ($b:block :) => {};
65     ($b:block =) => {};
66     ($b:block >) => {};
67     ($b:block ;) => {};
68     ($b:block |) => {};
69     ($b:block +) => {};
70     ($b:block ident) => {};
71     ($b:block $p:pat) => {};
72     ($b:block $e:expr) => {};
73     ($b:block $t:ty) => {};
74     ($b:block $s:stmt) => {};
75     ($b:block $p:path) => {};
76     ($b:block $c:block) => {};
77     ($b:block $i:ident) => {};
78     ($b:block $t:tt) => {};
79     ($b:block $i:item) => {};
80     ($b:block $m:meta) => {};
81 }
82 // FOLLOW(ident) = any token
83 macro_rules! follow_ident {
84     ($i:ident ()) => {};
85     ($i:ident []) => {};
86     ($i:ident {}) => {};
87     ($i:ident ,) => {};
88     ($i:ident =>) => {};
89     ($i:ident :) => {};
90     ($i:ident =) => {};
91     ($i:ident >) => {};
92     ($i:ident ;) => {};
93     ($i:ident |) => {};
94     ($i:ident +) => {};
95     ($i:ident ident) => {};
96     ($i:ident $p:pat) => {};
97     ($i:ident $e:expr) => {};
98     ($i:ident $t:ty) => {};
99     ($i:ident $s:stmt) => {};
100     ($i:ident $p:path) => {};
101     ($i:ident $b:block) => {};
102     ($i:ident $j:ident) => {};
103     ($i:ident $t:tt) => {};
104     ($i:ident $j:item) => {};
105     ($i:ident $m:meta) => {};
106 }
107 // FOLLOW(tt) = any token
108 macro_rules! follow_tt {
109     ($t:tt ()) => {};
110     ($t:tt []) => {};
111     ($t:tt {}) => {};
112     ($t:tt ,) => {};
113     ($t:tt =>) => {};
114     ($t:tt :) => {};
115     ($t:tt =) => {};
116     ($t:tt >) => {};
117     ($t:tt ;) => {};
118     ($t:tt |) => {};
119     ($t:tt +) => {};
120     ($t:tt ident) => {};
121     ($t:tt $p:pat) => {};
122     ($t:tt $e:expr) => {};
123     ($t:tt $v:ty) => {};
124     ($t:tt $s:stmt) => {};
125     ($t:tt $p:path) => {};
126     ($t:tt $b:block) => {};
127     ($t:tt $i:ident) => {};
128     ($t:tt $v:tt) => {};
129     ($t:tt $i:item) => {};
130     ($t:tt $m:meta) => {};
131 }
132 // FOLLOW(item) = any token
133 macro_rules! follow_item {
134     ($i:item ()) => {};
135     ($i:item []) => {};
136     ($i:item {}) => {};
137     ($i:item ,) => {};
138     ($i:item =>) => {};
139     ($i:item :) => {};
140     ($i:item =) => {};
141     ($i:item >) => {};
142     ($i:item ;) => {};
143     ($i:item |) => {};
144     ($i:item +) => {};
145     ($i:item ident) => {};
146     ($i:item $p:pat) => {};
147     ($i:item $e:expr) => {};
148     ($i:item $t:ty) => {};
149     ($i:item $s:stmt) => {};
150     ($i:item $p:path) => {};
151     ($i:item $b:block) => {};
152     ($i:item $j:ident) => {};
153     ($i:item $t:tt) => {};
154     ($i:item $j:item) => {};
155     ($i:item $m:meta) => {};
156 }
157 // FOLLOW(meta) = any token
158 macro_rules! follow_meta {
159     ($m:meta ()) => {};
160     ($m:meta []) => {};
161     ($m:meta {}) => {};
162     ($m:meta ,) => {};
163     ($m:meta =>) => {};
164     ($m:meta :) => {};
165     ($m:meta =) => {};
166     ($m:meta >) => {};
167     ($m:meta ;) => {};
168     ($m:meta |) => {};
169     ($m:meta +) => {};
170     ($m:meta ident) => {};
171     ($m:meta $p:pat) => {};
172     ($m:meta $e:expr) => {};
173     ($m:meta $t:ty) => {};
174     ($m:meta $s:stmt) => {};
175     ($m:meta $p:path) => {};
176     ($m:meta $b:block) => {};
177     ($m:meta $i:ident) => {};
178     ($m:meta $t:tt) => {};
179     ($m:meta $i:item) => {};
180     ($m:meta $n:meta) => {};
181 }
182
183 fn main() {}
184