@@ -31,7 +31,7 @@ struct Mod { inner, #[mac_table_seq] items, #[rewrite_ignore] inline }
31
31
32
32
33
33
#[rewrite_print_recover] #[rewrite_seq_item] #[rewrite_extra_strategies=item_header]
34
- #[nonterminal] #[extend_span]
34
+ #[nonterminal] #[extend_span] #[fold_kind=ItemKind] #[boxed]
35
35
struct Item { ident, #[match=ignore] attrs, id, kind, vis, span,
36
36
#[match=ignore] #[rewrite_ignore] tokens }
37
37
enum ItemKind {
@@ -61,9 +61,10 @@ enum UseTreeKind {
61
61
Nested(nested),
62
62
}
63
63
64
+ #[fold_kind=UseTreeKind] #[boxed=both]
64
65
struct UseTree { kind, prefix, span }
65
66
66
- #[nonterminal] #[extend_span]
67
+ #[nonterminal] #[extend_span] #[fold_kind=TraitItemKind]
67
68
struct TraitItem { id, ident, #[match=ignore] attrs, generics, kind, span,
68
69
#[match=ignore] #[rewrite_ignore] tokens }
69
70
enum TraitItemKind {
@@ -73,7 +74,7 @@ enum TraitItemKind {
73
74
Macro(mac),
74
75
}
75
76
76
- #[nonterminal] #[extend_span]
77
+ #[nonterminal] #[extend_span] #[fold_item=ImplItemKind]
77
78
struct ImplItem { id, ident, vis, defaultness, #[match=ignore] attrs, generics, kind, span,
78
79
#[match=ignore] #[rewrite_ignore] tokens }
79
80
enum ImplItemKind {
@@ -102,6 +103,7 @@ struct MethodSig { header, decl }
102
103
103
104
struct ForeignMod { abi, #[mac_table_seq] items }
104
105
#[rewrite_print_recover] #[rewrite_seq_item] #[nonterminal] #[extend_span]
106
+ #[fold_kind=ForeignItemKind]
105
107
struct ForeignItem { ident, #[match=ignore] attrs, kind, id, span, vis }
106
108
enum ForeignItemKind {
107
109
Fn(decl, generics),
@@ -112,7 +114,7 @@ enum ForeignItemKind {
112
114
113
115
114
116
struct Generics { params, where_clause, span }
115
- #[extend_span]
117
+ #[extend_span] #[fold_kind=GenericParamKind]
116
118
struct GenericParam { id, ident, attrs, bounds, kind, is_placeholder }
117
119
enum GenericParamKind {
118
120
Lifetime,
@@ -145,6 +147,7 @@ enum CrateSugar {
145
147
}
146
148
147
149
#[match=custom] #[rewrite_print_recover] #[mac_table_record] #[nonterminal]
150
+ #[fold_kind=TyKind] #[boxed]
148
151
struct Ty { id, kind, span }
149
152
struct MutTy {ty, mutbl}
150
153
enum TyKind {
@@ -167,12 +170,15 @@ enum TyKind {
167
170
CVarArgs,
168
171
}
169
172
170
- flag TraitObjectSyntax;
171
-
173
+ enum TraitObjectSyntax {
174
+ Dyn,
175
+ None,
176
+ }
172
177
173
178
flag LitIntType;
174
179
flag FloatTy;
175
180
181
+ #[boxed]
176
182
struct BareFnTy { unsafety, abi, decl, generic_params }
177
183
struct Lifetime { id, ident }
178
184
enum GenericBound {
@@ -182,6 +188,7 @@ enum GenericBound {
182
188
183
189
struct PolyTraitRef { trait_ref, span, bound_generic_params }
184
190
191
+ #[boxed]
185
192
struct FnDecl { inputs, output }
186
193
struct FnHeader { unsafety, asyncness, constness, abi }
187
194
#[rewrite_print]
@@ -193,6 +200,7 @@ enum FunctionRetTy {
193
200
194
201
195
202
#[match=custom] #[rewrite_print_recover] #[rewrite_seq_item] #[nonterminal]
203
+ #[fold_kind=StmtKind]
196
204
struct Stmt { id, kind, span }
197
205
#[no_debug]
198
206
enum StmtKind {
@@ -203,11 +211,12 @@ enum StmtKind {
203
211
Mac(mac),
204
212
}
205
213
206
- #[extend_span]
214
+ #[extend_span] #[boxed]
207
215
struct Local { pat, ty, init, id, span, #[match=ignore] attrs }
208
216
209
217
210
218
#[match=custom] #[rewrite_print_recover] #[extend_span] #[mac_table_record] #[nonterminal]
219
+ #[fold_kind=ExprKind] #[boxed]
211
220
struct Expr { id, kind, span, #[match=ignore] attrs }
212
221
#[prec_contains_expr]
213
222
enum ExprKind {
@@ -295,11 +304,12 @@ enum BinOpKind {
295
304
struct Field { id, ident, expr, span, is_shorthand, attrs, is_placeholder }
296
305
#[extend_span]
297
306
struct Arm { id, attrs, pat, guard, body, span, is_placeholder }
298
- #[match=custom] #[rewrite_print_recover] #[nonterminal]
307
+ #[match=custom] #[rewrite_print_recover] #[nonterminal] #[boxed]
299
308
struct Block { #[mac_table_seq] stmts, id, rules, span }
300
309
301
310
302
311
#[match=custom] #[mac_table_record] #[nonterminal]
312
+ #[fold_kind=PatKind] #[boxed]
303
313
struct Pat { id, kind, span }
304
314
enum PatKind {
305
315
Wild,
@@ -337,18 +347,28 @@ enum LitKind {
337
347
Err(sym),
338
348
}
339
349
340
- #[no_kind ]
350
+ #[fold_kind=TokenLitKind ]
341
351
struct TokenLit { kind, symbol, suffix }
342
352
343
- flag TokenLitKind;
344
-
353
+ enum TokenLitKind {
354
+ Bool,
355
+ Byte,
356
+ Char,
357
+ Integer,
358
+ Float,
359
+ Str,
360
+ StrRaw(n),
361
+ ByteStr,
362
+ ByteStrRaw(n),
363
+ Err,
364
+ }
345
365
346
366
flag Defaultness;
347
367
flag Constness;
348
368
flag ImplPolarity;
349
369
flag IsAuto;
350
370
flag Unsafety;
351
- flag Abi;
371
+ #[to_lua_custom] flag Abi;
352
372
#[match=eq] flag Mutability;
353
373
enum RangeEnd {
354
374
Included(syntax),
@@ -379,9 +399,11 @@ struct AttrItem { path, tokens }
379
399
flag AttrStyle;
380
400
381
401
382
- #[match=custom] #[nonterminal]
402
+ #[match=custom] #[nonterminal] #[boxed=both]
383
403
struct Path { span, segments }
384
404
struct PathSegment { ident, id, args }
405
+
406
+ #[boxed]
385
407
enum GenericArgs {
386
408
AngleBracketed(abpd),
387
409
Parenthesized(ppd),
@@ -408,11 +430,13 @@ flag MacStmtStyle;
408
430
flag TokenStream;
409
431
struct MacroDef { tokens, legacy }
410
432
411
-
433
+ #[boxed]
412
434
struct InlineAsm {
413
435
asm, asm_str_style, outputs, inputs, clobbers,
414
436
volatile, alignstack, dialect
415
437
}
438
+
439
+ #[boxed]
416
440
struct GlobalAsm { asm }
417
441
struct InlineAsmOutput { constraint, expr, is_rw, is_indirect }
418
442
@@ -429,22 +453,24 @@ struct AnonConst {
429
453
value,
430
454
}
431
455
432
- #[match=custom] #[equiv_mode=custom] struct Ident { name, span }
433
- #[match=eq] flag Name;
456
+ #[match=custom] #[equiv_mode=custom] #[to_lua_custom] struct Ident { name, span }
457
+ #[match=eq] #[to_lua_custom] flag Name;
434
458
#[equiv_mode=ignore] #[match=eq] flag SyntaxContext;
435
459
436
- #[equiv_mode=ignore] #[rewrite_ignore]
460
+ #[equiv_mode=ignore] #[rewrite_ignore] #[to_lua_custom]
437
461
flag Span;
438
462
#[equiv_mode=ignore] #[rewrite_ignore] #[list_node_ids=custom] #[mac_table_custom]
463
+ #[to_lua_custom]
439
464
flag NodeId;
440
- #[equiv_mode=ignore] #[rewrite_ignore]
465
+ #[equiv_mode=ignore] #[rewrite_ignore] #[to_lua_custom]
441
466
flag AttrId;
442
467
443
- flag usize;
444
- #[match=eq] flag bool;
445
- #[match=eq] flag u128;
446
- #[match=eq] flag u8;
447
- #[match=eq] flag char;
468
+ #[to_lua_custom] flag usize;
469
+ #[match=eq] #[to_lua_custom] flag bool;
470
+ #[match=eq] #[to_lua_custom] flag u128;
471
+ #[match=eq] #[to_lua_custom] flag u16;
472
+ #[match=eq] #[to_lua_custom] flag u8;
473
+ #[match=eq] #[to_lua_custom] flag char;
448
474
449
475
450
476
enum Nonterminal {
@@ -476,6 +502,7 @@ struct DelimSpan { open, close }
476
502
flag DelimToken;
477
503
flag Token;
478
504
505
+ #[fold_kind=MetaItemKind]
479
506
struct MetaItem { path, kind, span }
480
507
enum MetaItemKind {
481
508
Word,
0 commit comments