authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-02-12 01:38:10+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-02-12 02:12:43+02:00
logbb22490fcc8ed7c96d665242cd18934f9d547555
tree5703427c6d2830c87b001fdd8b57fbb63a22a46b
parente2289961c6b53451e5bdcdfb6eec27e27f6553ca
signaturelock-open Commit is signed but in an unrecognized format.

snake_case Node.Tag


3 files changed, 1003 insertions(+), 1003 deletions(-)

lib/std/zig/ast.zig+576-576
......@@ -199,148 +199,148 @@ pub const Tree = struct {
199199 var end_offset: TokenIndex = 0;
200200 var n = node;
201201 while (true) switch (tags[n]) {
202 .Root => return 0,
203
204 .UsingNamespace,
205 .TestDecl,
206 .ErrDefer,
207 .Defer,
208 .BoolNot,
209 .Negation,
210 .BitNot,
211 .NegationWrap,
212 .AddressOf,
213 .Try,
214 .Await,
215 .OptionalType,
216 .Switch,
217 .SwitchComma,
218 .IfSimple,
219 .If,
220 .Suspend,
221 .Resume,
222 .Continue,
223 .Break,
224 .Return,
225 .AnyFrameType,
226 .Identifier,
227 .AnyFrameLiteral,
228 .CharLiteral,
229 .IntegerLiteral,
230 .FloatLiteral,
231 .FalseLiteral,
232 .TrueLiteral,
233 .NullLiteral,
234 .UndefinedLiteral,
235 .UnreachableLiteral,
236 .StringLiteral,
237 .GroupedExpression,
238 .BuiltinCallTwo,
239 .BuiltinCallTwoComma,
240 .BuiltinCall,
241 .BuiltinCallComma,
242 .ErrorSetDecl,
243 .AnyType,
244 .Comptime,
245 .Nosuspend,
246 .AsmSimple,
247 .Asm,
248 .FnProtoSimple,
249 .FnProtoMulti,
250 .FnProtoOne,
251 .FnProto,
252 .ArrayType,
253 .ArrayTypeSentinel,
254 .ErrorValue,
202 .root => return 0,
203
204 .@"usingnamespace",
205 .test_decl,
206 .@"errdefer",
207 .@"defer",
208 .bool_not,
209 .negation,
210 .bit_not,
211 .negation_wrap,
212 .address_of,
213 .@"try",
214 .@"await",
215 .optional_type,
216 .@"switch",
217 .switch_comma,
218 .if_simple,
219 .@"if",
220 .@"suspend",
221 .@"resume",
222 .@"continue",
223 .@"break",
224 .@"return",
225 .anyframe_type,
226 .identifier,
227 .anyframe_literal,
228 .char_literal,
229 .integer_literal,
230 .float_literal,
231 .false_literal,
232 .true_literal,
233 .null_literal,
234 .undefined_literal,
235 .unreachable_literal,
236 .string_literal,
237 .grouped_expression,
238 .builtin_call_two,
239 .builtin_call_two_comma,
240 .builtin_call,
241 .builtin_call_comma,
242 .error_set_decl,
243 .@"anytype",
244 .@"comptime",
245 .@"nosuspend",
246 .asm_simple,
247 .@"asm",
248 .fn_proto_simple,
249 .fn_proto_multi,
250 .fn_proto_one,
251 .fn_proto,
252 .array_type,
253 .array_type_sentinel,
254 .error_value,
255255 => return main_tokens[n] - end_offset,
256256
257 .ArrayInitDot,
258 .ArrayInitDotComma,
259 .ArrayInitDotTwo,
260 .ArrayInitDotTwoComma,
261 .StructInitDot,
262 .StructInitDotComma,
263 .StructInitDotTwo,
264 .StructInitDotTwoComma,
265 .EnumLiteral,
257 .array_init_dot,
258 .array_init_dot_comma,
259 .array_init_dot_two,
260 .array_init_dot_two_comma,
261 .struct_init_dot,
262 .struct_init_dot_comma,
263 .struct_init_dot_two,
264 .struct_init_dot_two_comma,
265 .enum_literal,
266266 => return main_tokens[n] - 1 - end_offset,
267267
268 .Catch,
269 .FieldAccess,
270 .UnwrapOptional,
271 .EqualEqual,
272 .BangEqual,
273 .LessThan,
274 .GreaterThan,
275 .LessOrEqual,
276 .GreaterOrEqual,
277 .AssignMul,
278 .AssignDiv,
279 .AssignMod,
280 .AssignAdd,
281 .AssignSub,
282 .AssignBitShiftLeft,
283 .AssignBitShiftRight,
284 .AssignBitAnd,
285 .AssignBitXor,
286 .AssignBitOr,
287 .AssignMulWrap,
288 .AssignAddWrap,
289 .AssignSubWrap,
290 .Assign,
291 .MergeErrorSets,
292 .Mul,
293 .Div,
294 .Mod,
295 .ArrayMult,
296 .MulWrap,
297 .Add,
298 .Sub,
299 .ArrayCat,
300 .AddWrap,
301 .SubWrap,
302 .BitShiftLeft,
303 .BitShiftRight,
304 .BitAnd,
305 .BitXor,
306 .BitOr,
307 .OrElse,
308 .BoolAnd,
309 .BoolOr,
310 .SliceOpen,
311 .Slice,
312 .SliceSentinel,
313 .Deref,
314 .ArrayAccess,
315 .ArrayInitOne,
316 .ArrayInitOneComma,
317 .ArrayInit,
318 .ArrayInitComma,
319 .StructInitOne,
320 .StructInitOneComma,
321 .StructInit,
322 .StructInitComma,
323 .CallOne,
324 .CallOneComma,
325 .Call,
326 .CallComma,
327 .SwitchRange,
328 .FnDecl,
329 .ErrorUnion,
268 .@"catch",
269 .field_access,
270 .unwrap_optional,
271 .equal_equal,
272 .bang_equal,
273 .less_than,
274 .greater_than,
275 .less_or_equal,
276 .greater_or_equal,
277 .assign_mul,
278 .assign_div,
279 .assign_mod,
280 .assign_add,
281 .assign_sub,
282 .assign_bit_shift_left,
283 .assign_bit_shift_right,
284 .assign_bit_and,
285 .assign_bit_xor,
286 .assign_bit_or,
287 .assign_mul_wrap,
288 .assign_add_wrap,
289 .assign_sub_wrap,
290 .assign,
291 .merge_error_sets,
292 .mul,
293 .div,
294 .mod,
295 .array_mult,
296 .mul_wrap,
297 .add,
298 .sub,
299 .array_cat,
300 .add_wrap,
301 .sub_wrap,
302 .bit_shift_left,
303 .bit_shift_right,
304 .bit_and,
305 .bit_xor,
306 .bit_or,
307 .@"orelse",
308 .bool_and,
309 .bool_or,
310 .slice_open,
311 .slice,
312 .slice_sentinel,
313 .deref,
314 .array_access,
315 .array_init_one,
316 .array_init_one_comma,
317 .array_init,
318 .array_init_comma,
319 .struct_init_one,
320 .struct_init_one_comma,
321 .struct_init,
322 .struct_init_comma,
323 .call_one,
324 .call_one_comma,
325 .call,
326 .call_comma,
327 .switch_range,
328 .fn_decl,
329 .error_union,
330330 => n = datas[n].lhs,
331331
332 .AsyncCallOne,
333 .AsyncCallOneComma,
334 .AsyncCall,
335 .AsyncCallComma,
332 .async_call_one,
333 .async_call_one_comma,
334 .async_call,
335 .async_call_comma,
336336 => {
337337 end_offset += 1; // async token
338338 n = datas[n].lhs;
339339 },
340340
341 .ContainerFieldInit,
342 .ContainerFieldAlign,
343 .ContainerField,
341 .container_field_init,
342 .container_field_align,
343 .container_field,
344344 => {
345345 const name_token = main_tokens[n];
346346 if (name_token > 0 and token_tags[name_token - 1] == .keyword_comptime) {
......@@ -349,10 +349,10 @@ pub const Tree = struct {
349349 return name_token - end_offset;
350350 },
351351
352 .GlobalVarDecl,
353 .LocalVarDecl,
354 .SimpleVarDecl,
355 .AlignedVarDecl,
352 .global_var_decl,
353 .local_var_decl,
354 .simple_var_decl,
355 .aligned_var_decl,
356356 => {
357357 var i = main_tokens[n]; // mut token
358358 while (i > 0) {
......@@ -372,10 +372,10 @@ pub const Tree = struct {
372372 return i - end_offset;
373373 },
374374
375 .Block,
376 .BlockSemicolon,
377 .BlockTwo,
378 .BlockTwoSemicolon,
375 .block,
376 .block_semicolon,
377 .block_two,
378 .block_two_semicolon,
379379 => {
380380 // Look for a label.
381381 const lbrace = main_tokens[n];
......@@ -385,18 +385,18 @@ pub const Tree = struct {
385385 return lbrace - end_offset;
386386 },
387387
388 .ContainerDecl,
389 .ContainerDeclComma,
390 .ContainerDeclTwo,
391 .ContainerDeclTwoComma,
392 .ContainerDeclArg,
393 .ContainerDeclArgComma,
394 .TaggedUnion,
395 .TaggedUnionComma,
396 .TaggedUnionTwo,
397 .TaggedUnionTwoComma,
398 .TaggedUnionEnumTag,
399 .TaggedUnionEnumTagComma,
388 .container_decl,
389 .container_decl_comma,
390 .container_decl_two,
391 .container_decl_two_comma,
392 .container_decl_arg,
393 .container_decl_arg_comma,
394 .tagged_union,
395 .tagged_union_comma,
396 .tagged_union_two,
397 .tagged_union_two_comma,
398 .tagged_union_enum_tag,
399 .tagged_union_enum_tag_comma,
400400 => {
401401 const main_token = main_tokens[n];
402402 switch (token_tags[main_token - 1]) {
......@@ -406,10 +406,10 @@ pub const Tree = struct {
406406 return main_token - end_offset;
407407 },
408408
409 .PtrTypeAligned,
410 .PtrTypeSentinel,
411 .PtrType,
412 .PtrTypeBitRange,
409 .ptr_type_aligned,
410 .ptr_type_sentinel,
411 .ptr_type,
412 .ptr_type_bit_range,
413413 => {
414414 const main_token = main_tokens[n];
415415 return switch (token_tags[main_token]) {
......@@ -424,29 +424,29 @@ pub const Tree = struct {
424424 } - end_offset;
425425 },
426426
427 .SwitchCaseOne => {
427 .switch_case_one => {
428428 if (datas[n].lhs == 0) {
429429 return main_tokens[n] - 1 - end_offset; // else token
430430 } else {
431431 n = datas[n].lhs;
432432 }
433433 },
434 .SwitchCase => {
434 .switch_case => {
435435 const extra = tree.extraData(datas[n].lhs, Node.SubRange);
436436 assert(extra.end - extra.start > 0);
437437 n = extra.start;
438438 },
439439
440 .AsmOutput, .AsmInput => {
440 .asm_output, .asm_input => {
441441 assert(token_tags[main_tokens[n] - 1] == .l_bracket);
442442 return main_tokens[n] - 1 - end_offset;
443443 },
444444
445 .WhileSimple,
446 .WhileCont,
447 .While,
448 .ForSimple,
449 .For,
445 .while_simple,
446 .while_cont,
447 .@"while",
448 .for_simple,
449 .@"for",
450450 => {
451451 const main_token = main_tokens[n];
452452 return switch (token_tags[main_token - 1]) {
......@@ -465,115 +465,115 @@ pub const Tree = struct {
465465 var n = node;
466466 var end_offset: TokenIndex = 0;
467467 while (true) switch (tags[n]) {
468 .Root => return @intCast(TokenIndex, tree.tokens.len - 1),
469
470 .UsingNamespace,
471 .BoolNot,
472 .Negation,
473 .BitNot,
474 .NegationWrap,
475 .AddressOf,
476 .Try,
477 .Await,
478 .OptionalType,
479 .Resume,
480 .Nosuspend,
481 .Comptime,
468 .root => return @intCast(TokenIndex, tree.tokens.len - 1),
469
470 .@"usingnamespace",
471 .bool_not,
472 .negation,
473 .bit_not,
474 .negation_wrap,
475 .address_of,
476 .@"try",
477 .@"await",
478 .optional_type,
479 .@"resume",
480 .@"nosuspend",
481 .@"comptime",
482482 => n = datas[n].lhs,
483483
484 .TestDecl,
485 .ErrDefer,
486 .Defer,
487 .Catch,
488 .EqualEqual,
489 .BangEqual,
490 .LessThan,
491 .GreaterThan,
492 .LessOrEqual,
493 .GreaterOrEqual,
494 .AssignMul,
495 .AssignDiv,
496 .AssignMod,
497 .AssignAdd,
498 .AssignSub,
499 .AssignBitShiftLeft,
500 .AssignBitShiftRight,
501 .AssignBitAnd,
502 .AssignBitXor,
503 .AssignBitOr,
504 .AssignMulWrap,
505 .AssignAddWrap,
506 .AssignSubWrap,
507 .Assign,
508 .MergeErrorSets,
509 .Mul,
510 .Div,
511 .Mod,
512 .ArrayMult,
513 .MulWrap,
514 .Add,
515 .Sub,
516 .ArrayCat,
517 .AddWrap,
518 .SubWrap,
519 .BitShiftLeft,
520 .BitShiftRight,
521 .BitAnd,
522 .BitXor,
523 .BitOr,
524 .OrElse,
525 .BoolAnd,
526 .BoolOr,
527 .AnyFrameType,
528 .ErrorUnion,
529 .IfSimple,
530 .WhileSimple,
531 .ForSimple,
532 .FnProtoSimple,
533 .FnProtoMulti,
534 .PtrTypeAligned,
535 .PtrTypeSentinel,
536 .PtrType,
537 .PtrTypeBitRange,
538 .ArrayType,
539 .SwitchCaseOne,
540 .SwitchCase,
541 .SwitchRange,
484 .test_decl,
485 .@"errdefer",
486 .@"defer",
487 .@"catch",
488 .equal_equal,
489 .bang_equal,
490 .less_than,
491 .greater_than,
492 .less_or_equal,
493 .greater_or_equal,
494 .assign_mul,
495 .assign_div,
496 .assign_mod,
497 .assign_add,
498 .assign_sub,
499 .assign_bit_shift_left,
500 .assign_bit_shift_right,
501 .assign_bit_and,
502 .assign_bit_xor,
503 .assign_bit_or,
504 .assign_mul_wrap,
505 .assign_add_wrap,
506 .assign_sub_wrap,
507 .assign,
508 .merge_error_sets,
509 .mul,
510 .div,
511 .mod,
512 .array_mult,
513 .mul_wrap,
514 .add,
515 .sub,
516 .array_cat,
517 .add_wrap,
518 .sub_wrap,
519 .bit_shift_left,
520 .bit_shift_right,
521 .bit_and,
522 .bit_xor,
523 .bit_or,
524 .@"orelse",
525 .bool_and,
526 .bool_or,
527 .anyframe_type,
528 .error_union,
529 .if_simple,
530 .while_simple,
531 .for_simple,
532 .fn_proto_simple,
533 .fn_proto_multi,
534 .ptr_type_aligned,
535 .ptr_type_sentinel,
536 .ptr_type,
537 .ptr_type_bit_range,
538 .array_type,
539 .switch_case_one,
540 .switch_case,
541 .switch_range,
542542 => n = datas[n].rhs,
543543
544 .FieldAccess,
545 .UnwrapOptional,
546 .GroupedExpression,
547 .StringLiteral,
548 .ErrorSetDecl,
549 .AsmSimple,
550 .AsmOutput,
551 .AsmInput,
552 .ErrorValue,
544 .field_access,
545 .unwrap_optional,
546 .grouped_expression,
547 .string_literal,
548 .error_set_decl,
549 .asm_simple,
550 .asm_output,
551 .asm_input,
552 .error_value,
553553 => return datas[n].rhs + end_offset,
554554
555 .AnyType,
556 .AnyFrameLiteral,
557 .CharLiteral,
558 .IntegerLiteral,
559 .FloatLiteral,
560 .FalseLiteral,
561 .TrueLiteral,
562 .NullLiteral,
563 .UndefinedLiteral,
564 .UnreachableLiteral,
565 .Identifier,
566 .Deref,
567 .EnumLiteral,
555 .@"anytype",
556 .anyframe_literal,
557 .char_literal,
558 .integer_literal,
559 .float_literal,
560 .false_literal,
561 .true_literal,
562 .null_literal,
563 .undefined_literal,
564 .unreachable_literal,
565 .identifier,
566 .deref,
567 .enum_literal,
568568 => return main_tokens[n] + end_offset,
569569
570 .Return => if (datas[n].lhs != 0) {
570 .@"return" => if (datas[n].lhs != 0) {
571571 n = datas[n].lhs;
572572 } else {
573573 return main_tokens[n] + end_offset;
574574 },
575575
576 .Call, .AsyncCall => {
576 .call, .async_call => {
577577 end_offset += 1; // for the rparen
578578 const params = tree.extraData(datas[n].rhs, Node.SubRange);
579579 if (params.end - params.start == 0) {
......@@ -581,7 +581,7 @@ pub const Tree = struct {
581581 }
582582 n = tree.extra_data[params.end - 1]; // last parameter
583583 },
584 .TaggedUnionEnumTag => {
584 .tagged_union_enum_tag => {
585585 const members = tree.extraData(datas[n].rhs, Node.SubRange);
586586 if (members.end - members.start == 0) {
587587 end_offset += 4; // for the rparen + rparen + lbrace + rbrace
......@@ -591,16 +591,16 @@ pub const Tree = struct {
591591 n = tree.extra_data[members.end - 1]; // last parameter
592592 }
593593 },
594 .CallComma,
595 .AsyncCallComma,
596 .TaggedUnionEnumTagComma,
594 .call_comma,
595 .async_call_comma,
596 .tagged_union_enum_tag_comma,
597597 => {
598598 end_offset += 2; // for the comma + rparen/rbrace
599599 const params = tree.extraData(datas[n].rhs, Node.SubRange);
600600 assert(params.end > params.start);
601601 n = tree.extra_data[params.end - 1]; // last parameter
602602 },
603 .Switch => {
603 .@"switch" => {
604604 const cases = tree.extraData(datas[n].rhs, Node.SubRange);
605605 if (cases.end - cases.start == 0) {
606606 end_offset += 3; // rparen, lbrace, rbrace
......@@ -610,7 +610,7 @@ pub const Tree = struct {
610610 n = tree.extra_data[cases.end - 1]; // last case
611611 }
612612 },
613 .ContainerDeclArg => {
613 .container_decl_arg => {
614614 const members = tree.extraData(datas[n].rhs, Node.SubRange);
615615 if (members.end - members.start == 0) {
616616 end_offset += 1; // for the rparen
......@@ -620,53 +620,53 @@ pub const Tree = struct {
620620 n = tree.extra_data[members.end - 1]; // last parameter
621621 }
622622 },
623 .Asm => {
623 .@"asm" => {
624624 const extra = tree.extraData(datas[n].rhs, Node.Asm);
625625 return extra.rparen + end_offset;
626626 },
627 .ArrayInit,
628 .StructInit,
627 .array_init,
628 .struct_init,
629629 => {
630630 const elements = tree.extraData(datas[n].rhs, Node.SubRange);
631631 assert(elements.end - elements.start > 0);
632632 end_offset += 1; // for the rbrace
633633 n = tree.extra_data[elements.end - 1]; // last element
634634 },
635 .ArrayInitComma,
636 .StructInitComma,
637 .ContainerDeclArgComma,
638 .SwitchComma,
635 .array_init_comma,
636 .struct_init_comma,
637 .container_decl_arg_comma,
638 .switch_comma,
639639 => {
640640 const members = tree.extraData(datas[n].rhs, Node.SubRange);
641641 assert(members.end - members.start > 0);
642642 end_offset += 2; // for the comma + rbrace
643643 n = tree.extra_data[members.end - 1]; // last parameter
644644 },
645 .ArrayInitDot,
646 .StructInitDot,
647 .Block,
648 .ContainerDecl,
649 .TaggedUnion,
650 .BuiltinCall,
645 .array_init_dot,
646 .struct_init_dot,
647 .block,
648 .container_decl,
649 .tagged_union,
650 .builtin_call,
651651 => {
652652 assert(datas[n].rhs - datas[n].lhs > 0);
653653 end_offset += 1; // for the rbrace
654654 n = tree.extra_data[datas[n].rhs - 1]; // last statement
655655 },
656 .ArrayInitDotComma,
657 .StructInitDotComma,
658 .BlockSemicolon,
659 .ContainerDeclComma,
660 .TaggedUnionComma,
661 .BuiltinCallComma,
656 .array_init_dot_comma,
657 .struct_init_dot_comma,
658 .block_semicolon,
659 .container_decl_comma,
660 .tagged_union_comma,
661 .builtin_call_comma,
662662 => {
663663 assert(datas[n].rhs - datas[n].lhs > 0);
664664 end_offset += 2; // for the comma/semicolon + rbrace/rparen
665665 n = tree.extra_data[datas[n].rhs - 1]; // last member
666666 },
667 .CallOne,
668 .AsyncCallOne,
669 .ArrayAccess,
667 .call_one,
668 .async_call_one,
669 .array_access,
670670 => {
671671 end_offset += 1; // for the rparen/rbracket
672672 if (datas[n].rhs == 0) {
......@@ -674,12 +674,12 @@ pub const Tree = struct {
674674 }
675675 n = datas[n].rhs;
676676 },
677 .ArrayInitDotTwo,
678 .BlockTwo,
679 .BuiltinCallTwo,
680 .StructInitDotTwo,
681 .ContainerDeclTwo,
682 .TaggedUnionTwo,
677 .array_init_dot_two,
678 .block_two,
679 .builtin_call_two,
680 .struct_init_dot_two,
681 .container_decl_two,
682 .tagged_union_two,
683683 => {
684684 if (datas[n].rhs != 0) {
685685 end_offset += 1; // for the rparen/rbrace
......@@ -689,25 +689,25 @@ pub const Tree = struct {
689689 n = datas[n].lhs;
690690 } else {
691691 switch (tags[n]) {
692 .ArrayInitDotTwo,
693 .BlockTwo,
694 .StructInitDotTwo,
692 .array_init_dot_two,
693 .block_two,
694 .struct_init_dot_two,
695695 => end_offset += 1, // rbrace
696 .BuiltinCallTwo,
697 .ContainerDeclTwo,
696 .builtin_call_two,
697 .container_decl_two,
698698 => end_offset += 2, // lparen/lbrace + rparen/rbrace
699 .TaggedUnionTwo => end_offset += 5, // (enum) {}
699 .tagged_union_two => end_offset += 5, // (enum) {}
700700 else => unreachable,
701701 }
702702 return main_tokens[n] + end_offset;
703703 }
704704 },
705 .ArrayInitDotTwoComma,
706 .BuiltinCallTwoComma,
707 .BlockTwoSemicolon,
708 .StructInitDotTwoComma,
709 .ContainerDeclTwoComma,
710 .TaggedUnionTwoComma,
705 .array_init_dot_two_comma,
706 .builtin_call_two_comma,
707 .block_two_semicolon,
708 .struct_init_dot_two_comma,
709 .container_decl_two_comma,
710 .tagged_union_two_comma,
711711 => {
712712 end_offset += 2; // for the comma/semicolon + rbrace/rparen
713713 if (datas[n].rhs != 0) {
......@@ -718,7 +718,7 @@ pub const Tree = struct {
718718 unreachable;
719719 }
720720 },
721 .SimpleVarDecl => {
721 .simple_var_decl => {
722722 if (datas[n].rhs != 0) {
723723 n = datas[n].rhs;
724724 } else if (datas[n].lhs != 0) {
......@@ -728,7 +728,7 @@ pub const Tree = struct {
728728 return main_tokens[n] + end_offset;
729729 }
730730 },
731 .AlignedVarDecl => {
731 .aligned_var_decl => {
732732 if (datas[n].rhs != 0) {
733733 n = datas[n].rhs;
734734 } else if (datas[n].lhs != 0) {
......@@ -739,7 +739,7 @@ pub const Tree = struct {
739739 return main_tokens[n] + end_offset;
740740 }
741741 },
742 .GlobalVarDecl => {
742 .global_var_decl => {
743743 if (datas[n].rhs != 0) {
744744 n = datas[n].rhs;
745745 } else {
......@@ -758,7 +758,7 @@ pub const Tree = struct {
758758 }
759759 }
760760 },
761 .LocalVarDecl => {
761 .local_var_decl => {
762762 if (datas[n].rhs != 0) {
763763 n = datas[n].rhs;
764764 } else {
......@@ -774,7 +774,7 @@ pub const Tree = struct {
774774 }
775775 }
776776 },
777 .ContainerFieldInit => {
777 .container_field_init => {
778778 if (datas[n].rhs != 0) {
779779 n = datas[n].rhs;
780780 } else if (datas[n].lhs != 0) {
......@@ -783,7 +783,7 @@ pub const Tree = struct {
783783 return main_tokens[n] + end_offset;
784784 }
785785 },
786 .ContainerFieldAlign => {
786 .container_field_align => {
787787 if (datas[n].rhs != 0) {
788788 end_offset += 1; // for the rparen
789789 n = datas[n].rhs;
......@@ -793,7 +793,7 @@ pub const Tree = struct {
793793 return main_tokens[n] + end_offset;
794794 }
795795 },
796 .ContainerField => {
796 .container_field => {
797797 const extra = tree.extraData(datas[n].rhs, Node.ContainerField);
798798 if (extra.value_expr != 0) {
799799 n = extra.value_expr;
......@@ -807,8 +807,8 @@ pub const Tree = struct {
807807 }
808808 },
809809
810 .ArrayInitOne,
811 .StructInitOne,
810 .array_init_one,
811 .struct_init_one,
812812 => {
813813 end_offset += 1; // rbrace
814814 if (datas[n].rhs == 0) {
......@@ -817,37 +817,37 @@ pub const Tree = struct {
817817 n = datas[n].rhs;
818818 }
819819 },
820 .SliceOpen,
821 .CallOneComma,
822 .AsyncCallOneComma,
823 .ArrayInitOneComma,
824 .StructInitOneComma,
820 .slice_open,
821 .call_one_comma,
822 .async_call_one_comma,
823 .array_init_one_comma,
824 .struct_init_one_comma,
825825 => {
826826 end_offset += 2; // ellipsis2 + rbracket, or comma + rparen
827827 n = datas[n].rhs;
828828 assert(n != 0);
829829 },
830 .Slice => {
830 .slice => {
831831 const extra = tree.extraData(datas[n].rhs, Node.Slice);
832832 assert(extra.end != 0); // should have used SliceOpen
833833 end_offset += 1; // rbracket
834834 n = extra.end;
835835 },
836 .SliceSentinel => {
836 .slice_sentinel => {
837837 const extra = tree.extraData(datas[n].rhs, Node.SliceSentinel);
838838 assert(extra.sentinel != 0); // should have used Slice
839839 end_offset += 1; // rbracket
840840 n = extra.sentinel;
841841 },
842842
843 .Continue => {
843 .@"continue" => {
844844 if (datas[n].lhs != 0) {
845845 return datas[n].lhs + end_offset;
846846 } else {
847847 return main_tokens[n] + end_offset;
848848 }
849849 },
850 .Break => {
850 .@"break" => {
851851 if (datas[n].rhs != 0) {
852852 n = datas[n].rhs;
853853 } else if (datas[n].lhs != 0) {
......@@ -856,14 +856,14 @@ pub const Tree = struct {
856856 return main_tokens[n] + end_offset;
857857 }
858858 },
859 .FnDecl => {
859 .fn_decl => {
860860 if (datas[n].rhs != 0) {
861861 n = datas[n].rhs;
862862 } else {
863863 n = datas[n].lhs;
864864 }
865865 },
866 .FnProtoOne => {
866 .fn_proto_one => {
867867 const extra = tree.extraData(datas[n].lhs, Node.FnProtoOne);
868868 // linksection, callconv, align can appear in any order, so we
869869 // find the last one here.
......@@ -897,7 +897,7 @@ pub const Tree = struct {
897897 n = max_node;
898898 end_offset += max_offset;
899899 },
900 .FnProto => {
900 .fn_proto => {
901901 const extra = tree.extraData(datas[n].lhs, Node.FnProto);
902902 // linksection, callconv, align can appear in any order, so we
903903 // find the last one here.
......@@ -931,29 +931,29 @@ pub const Tree = struct {
931931 n = max_node;
932932 end_offset += max_offset;
933933 },
934 .WhileCont => {
934 .while_cont => {
935935 const extra = tree.extraData(datas[n].rhs, Node.WhileCont);
936936 assert(extra.then_expr != 0);
937937 n = extra.then_expr;
938938 },
939 .While => {
939 .@"while" => {
940940 const extra = tree.extraData(datas[n].rhs, Node.While);
941941 assert(extra.else_expr != 0);
942942 n = extra.else_expr;
943943 },
944 .If, .For => {
944 .@"if", .@"for" => {
945945 const extra = tree.extraData(datas[n].rhs, Node.If);
946946 assert(extra.else_expr != 0);
947947 n = extra.else_expr;
948948 },
949 .Suspend => {
949 .@"suspend" => {
950950 if (datas[n].lhs != 0) {
951951 n = datas[n].lhs;
952952 } else {
953953 return main_tokens[n] + end_offset;
954954 }
955955 },
956 .ArrayTypeSentinel => {
956 .array_type_sentinel => {
957957 const extra = tree.extraData(datas[n].rhs, Node.ArrayTypeSentinel);
958958 n = extra.elem_type;
959959 },
......@@ -967,7 +967,7 @@ pub const Tree = struct {
967967 }
968968
969969 pub fn globalVarDecl(tree: Tree, node: Node.Index) full.VarDecl {
970 assert(tree.nodes.items(.tag)[node] == .GlobalVarDecl);
970 assert(tree.nodes.items(.tag)[node] == .global_var_decl);
971971 const data = tree.nodes.items(.data)[node];
972972 const extra = tree.extraData(data.lhs, Node.GlobalVarDecl);
973973 return tree.fullVarDecl(.{
......@@ -980,7 +980,7 @@ pub const Tree = struct {
980980 }
981981
982982 pub fn localVarDecl(tree: Tree, node: Node.Index) full.VarDecl {
983 assert(tree.nodes.items(.tag)[node] == .LocalVarDecl);
983 assert(tree.nodes.items(.tag)[node] == .local_var_decl);
984984 const data = tree.nodes.items(.data)[node];
985985 const extra = tree.extraData(data.lhs, Node.LocalVarDecl);
986986 return tree.fullVarDecl(.{
......@@ -993,7 +993,7 @@ pub const Tree = struct {
993993 }
994994
995995 pub fn simpleVarDecl(tree: Tree, node: Node.Index) full.VarDecl {
996 assert(tree.nodes.items(.tag)[node] == .SimpleVarDecl);
996 assert(tree.nodes.items(.tag)[node] == .simple_var_decl);
997997 const data = tree.nodes.items(.data)[node];
998998 return tree.fullVarDecl(.{
999999 .type_node = data.lhs,
......@@ -1005,7 +1005,7 @@ pub const Tree = struct {
10051005 }
10061006
10071007 pub fn alignedVarDecl(tree: Tree, node: Node.Index) full.VarDecl {
1008 assert(tree.nodes.items(.tag)[node] == .AlignedVarDecl);
1008 assert(tree.nodes.items(.tag)[node] == .aligned_var_decl);
10091009 const data = tree.nodes.items(.data)[node];
10101010 return tree.fullVarDecl(.{
10111011 .type_node = 0,
......@@ -1017,7 +1017,7 @@ pub const Tree = struct {
10171017 }
10181018
10191019 pub fn ifSimple(tree: Tree, node: Node.Index) full.If {
1020 assert(tree.nodes.items(.tag)[node] == .IfSimple);
1020 assert(tree.nodes.items(.tag)[node] == .if_simple);
10211021 const data = tree.nodes.items(.data)[node];
10221022 return tree.fullIf(.{
10231023 .cond_expr = data.lhs,
......@@ -1028,7 +1028,7 @@ pub const Tree = struct {
10281028 }
10291029
10301030 pub fn ifFull(tree: Tree, node: Node.Index) full.If {
1031 assert(tree.nodes.items(.tag)[node] == .If);
1031 assert(tree.nodes.items(.tag)[node] == .@"if");
10321032 const data = tree.nodes.items(.data)[node];
10331033 const extra = tree.extraData(data.rhs, Node.If);
10341034 return tree.fullIf(.{
......@@ -1040,7 +1040,7 @@ pub const Tree = struct {
10401040 }
10411041
10421042 pub fn containerField(tree: Tree, node: Node.Index) full.ContainerField {
1043 assert(tree.nodes.items(.tag)[node] == .ContainerField);
1043 assert(tree.nodes.items(.tag)[node] == .container_field);
10441044 const data = tree.nodes.items(.data)[node];
10451045 const extra = tree.extraData(data.rhs, Node.ContainerField);
10461046 return tree.fullContainerField(.{
......@@ -1052,7 +1052,7 @@ pub const Tree = struct {
10521052 }
10531053
10541054 pub fn containerFieldInit(tree: Tree, node: Node.Index) full.ContainerField {
1055 assert(tree.nodes.items(.tag)[node] == .ContainerFieldInit);
1055 assert(tree.nodes.items(.tag)[node] == .container_field_init);
10561056 const data = tree.nodes.items(.data)[node];
10571057 return tree.fullContainerField(.{
10581058 .name_token = tree.nodes.items(.main_token)[node],
......@@ -1063,7 +1063,7 @@ pub const Tree = struct {
10631063 }
10641064
10651065 pub fn containerFieldAlign(tree: Tree, node: Node.Index) full.ContainerField {
1066 assert(tree.nodes.items(.tag)[node] == .ContainerFieldAlign);
1066 assert(tree.nodes.items(.tag)[node] == .container_field_align);
10671067 const data = tree.nodes.items(.data)[node];
10681068 return tree.fullContainerField(.{
10691069 .name_token = tree.nodes.items(.main_token)[node],
......@@ -1074,7 +1074,7 @@ pub const Tree = struct {
10741074 }
10751075
10761076 pub fn fnProtoSimple(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.FnProto {
1077 assert(tree.nodes.items(.tag)[node] == .FnProtoSimple);
1077 assert(tree.nodes.items(.tag)[node] == .fn_proto_simple);
10781078 const data = tree.nodes.items(.data)[node];
10791079 buffer[0] = data.lhs;
10801080 const params = if (data.lhs == 0) buffer[0..0] else buffer[0..1];
......@@ -1089,7 +1089,7 @@ pub const Tree = struct {
10891089 }
10901090
10911091 pub fn fnProtoMulti(tree: Tree, node: Node.Index) full.FnProto {
1092 assert(tree.nodes.items(.tag)[node] == .FnProtoMulti);
1092 assert(tree.nodes.items(.tag)[node] == .fn_proto_multi);
10931093 const data = tree.nodes.items(.data)[node];
10941094 const params_range = tree.extraData(data.lhs, Node.SubRange);
10951095 const params = tree.extra_data[params_range.start..params_range.end];
......@@ -1104,7 +1104,7 @@ pub const Tree = struct {
11041104 }
11051105
11061106 pub fn fnProtoOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.FnProto {
1107 assert(tree.nodes.items(.tag)[node] == .FnProtoOne);
1107 assert(tree.nodes.items(.tag)[node] == .fn_proto_one);
11081108 const data = tree.nodes.items(.data)[node];
11091109 const extra = tree.extraData(data.lhs, Node.FnProtoOne);
11101110 buffer[0] = extra.param;
......@@ -1120,7 +1120,7 @@ pub const Tree = struct {
11201120 }
11211121
11221122 pub fn fnProto(tree: Tree, node: Node.Index) full.FnProto {
1123 assert(tree.nodes.items(.tag)[node] == .FnProto);
1123 assert(tree.nodes.items(.tag)[node] == .fn_proto);
11241124 const data = tree.nodes.items(.data)[node];
11251125 const extra = tree.extraData(data.lhs, Node.FnProto);
11261126 const params = tree.extra_data[extra.params_start..extra.params_end];
......@@ -1135,8 +1135,8 @@ pub const Tree = struct {
11351135 }
11361136
11371137 pub fn structInitOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.StructInit {
1138 assert(tree.nodes.items(.tag)[node] == .StructInitOne or
1139 tree.nodes.items(.tag)[node] == .StructInitOneComma);
1138 assert(tree.nodes.items(.tag)[node] == .struct_init_one or
1139 tree.nodes.items(.tag)[node] == .struct_init_one_comma);
11401140 const data = tree.nodes.items(.data)[node];
11411141 buffer[0] = data.rhs;
11421142 const fields = if (data.rhs == 0) buffer[0..0] else buffer[0..1];
......@@ -1148,8 +1148,8 @@ pub const Tree = struct {
11481148 }
11491149
11501150 pub fn structInitDotTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.StructInit {
1151 assert(tree.nodes.items(.tag)[node] == .StructInitDotTwo or
1152 tree.nodes.items(.tag)[node] == .StructInitDotTwoComma);
1151 assert(tree.nodes.items(.tag)[node] == .struct_init_dot_two or
1152 tree.nodes.items(.tag)[node] == .struct_init_dot_two_comma);
11531153 const data = tree.nodes.items(.data)[node];
11541154 buffer.* = .{ data.lhs, data.rhs };
11551155 const fields = if (data.rhs != 0)
......@@ -1166,8 +1166,8 @@ pub const Tree = struct {
11661166 }
11671167
11681168 pub fn structInitDot(tree: Tree, node: Node.Index) full.StructInit {
1169 assert(tree.nodes.items(.tag)[node] == .StructInitDot or
1170 tree.nodes.items(.tag)[node] == .StructInitDotComma);
1169 assert(tree.nodes.items(.tag)[node] == .struct_init_dot or
1170 tree.nodes.items(.tag)[node] == .struct_init_dot_comma);
11711171 const data = tree.nodes.items(.data)[node];
11721172 return tree.fullStructInit(.{
11731173 .lbrace = tree.nodes.items(.main_token)[node],
......@@ -1177,8 +1177,8 @@ pub const Tree = struct {
11771177 }
11781178
11791179 pub fn structInit(tree: Tree, node: Node.Index) full.StructInit {
1180 assert(tree.nodes.items(.tag)[node] == .StructInit or
1181 tree.nodes.items(.tag)[node] == .StructInitComma);
1180 assert(tree.nodes.items(.tag)[node] == .struct_init or
1181 tree.nodes.items(.tag)[node] == .struct_init_comma);
11821182 const data = tree.nodes.items(.data)[node];
11831183 const fields_range = tree.extraData(data.rhs, Node.SubRange);
11841184 return tree.fullStructInit(.{
......@@ -1189,8 +1189,8 @@ pub const Tree = struct {
11891189 }
11901190
11911191 pub fn arrayInitOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.ArrayInit {
1192 assert(tree.nodes.items(.tag)[node] == .ArrayInitOne or
1193 tree.nodes.items(.tag)[node] == .ArrayInitOneComma);
1192 assert(tree.nodes.items(.tag)[node] == .array_init_one or
1193 tree.nodes.items(.tag)[node] == .array_init_one_comma);
11941194 const data = tree.nodes.items(.data)[node];
11951195 buffer[0] = data.rhs;
11961196 const elements = if (data.rhs == 0) buffer[0..0] else buffer[0..1];
......@@ -1204,8 +1204,8 @@ pub const Tree = struct {
12041204 }
12051205
12061206 pub fn arrayInitDotTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.ArrayInit {
1207 assert(tree.nodes.items(.tag)[node] == .ArrayInitDotTwo or
1208 tree.nodes.items(.tag)[node] == .ArrayInitDotTwoComma);
1207 assert(tree.nodes.items(.tag)[node] == .array_init_dot_two or
1208 tree.nodes.items(.tag)[node] == .array_init_dot_two_comma);
12091209 const data = tree.nodes.items(.data)[node];
12101210 buffer.* = .{ data.lhs, data.rhs };
12111211 const elements = if (data.rhs != 0)
......@@ -1224,8 +1224,8 @@ pub const Tree = struct {
12241224 }
12251225
12261226 pub fn arrayInitDot(tree: Tree, node: Node.Index) full.ArrayInit {
1227 assert(tree.nodes.items(.tag)[node] == .ArrayInitDot or
1228 tree.nodes.items(.tag)[node] == .ArrayInitDotComma);
1227 assert(tree.nodes.items(.tag)[node] == .array_init_dot or
1228 tree.nodes.items(.tag)[node] == .array_init_dot_comma);
12291229 const data = tree.nodes.items(.data)[node];
12301230 return .{
12311231 .ast = .{
......@@ -1237,8 +1237,8 @@ pub const Tree = struct {
12371237 }
12381238
12391239 pub fn arrayInit(tree: Tree, node: Node.Index) full.ArrayInit {
1240 assert(tree.nodes.items(.tag)[node] == .ArrayInit or
1241 tree.nodes.items(.tag)[node] == .ArrayInitComma);
1240 assert(tree.nodes.items(.tag)[node] == .array_init or
1241 tree.nodes.items(.tag)[node] == .array_init_comma);
12421242 const data = tree.nodes.items(.data)[node];
12431243 const elem_range = tree.extraData(data.rhs, Node.SubRange);
12441244 return .{
......@@ -1251,7 +1251,7 @@ pub const Tree = struct {
12511251 }
12521252
12531253 pub fn arrayType(tree: Tree, node: Node.Index) full.ArrayType {
1254 assert(tree.nodes.items(.tag)[node] == .ArrayType);
1254 assert(tree.nodes.items(.tag)[node] == .array_type);
12551255 const data = tree.nodes.items(.data)[node];
12561256 return .{
12571257 .ast = .{
......@@ -1264,7 +1264,7 @@ pub const Tree = struct {
12641264 }
12651265
12661266 pub fn arrayTypeSentinel(tree: Tree, node: Node.Index) full.ArrayType {
1267 assert(tree.nodes.items(.tag)[node] == .ArrayTypeSentinel);
1267 assert(tree.nodes.items(.tag)[node] == .array_type_sentinel);
12681268 const data = tree.nodes.items(.data)[node];
12691269 const extra = tree.extraData(data.rhs, Node.ArrayTypeSentinel);
12701270 return .{
......@@ -1278,7 +1278,7 @@ pub const Tree = struct {
12781278 }
12791279
12801280 pub fn ptrTypeAligned(tree: Tree, node: Node.Index) full.PtrType {
1281 assert(tree.nodes.items(.tag)[node] == .PtrTypeAligned);
1281 assert(tree.nodes.items(.tag)[node] == .ptr_type_aligned);
12821282 const data = tree.nodes.items(.data)[node];
12831283 return tree.fullPtrType(.{
12841284 .main_token = tree.nodes.items(.main_token)[node],
......@@ -1291,7 +1291,7 @@ pub const Tree = struct {
12911291 }
12921292
12931293 pub fn ptrTypeSentinel(tree: Tree, node: Node.Index) full.PtrType {
1294 assert(tree.nodes.items(.tag)[node] == .PtrTypeSentinel);
1294 assert(tree.nodes.items(.tag)[node] == .ptr_type_sentinel);
12951295 const data = tree.nodes.items(.data)[node];
12961296 return tree.fullPtrType(.{
12971297 .main_token = tree.nodes.items(.main_token)[node],
......@@ -1304,7 +1304,7 @@ pub const Tree = struct {
13041304 }
13051305
13061306 pub fn ptrType(tree: Tree, node: Node.Index) full.PtrType {
1307 assert(tree.nodes.items(.tag)[node] == .PtrType);
1307 assert(tree.nodes.items(.tag)[node] == .ptr_type);
13081308 const data = tree.nodes.items(.data)[node];
13091309 const extra = tree.extraData(data.lhs, Node.PtrType);
13101310 return tree.fullPtrType(.{
......@@ -1318,7 +1318,7 @@ pub const Tree = struct {
13181318 }
13191319
13201320 pub fn ptrTypeBitRange(tree: Tree, node: Node.Index) full.PtrType {
1321 assert(tree.nodes.items(.tag)[node] == .PtrTypeBitRange);
1321 assert(tree.nodes.items(.tag)[node] == .ptr_type_bit_range);
13221322 const data = tree.nodes.items(.data)[node];
13231323 const extra = tree.extraData(data.lhs, Node.PtrTypeBitRange);
13241324 return tree.fullPtrType(.{
......@@ -1332,7 +1332,7 @@ pub const Tree = struct {
13321332 }
13331333
13341334 pub fn sliceOpen(tree: Tree, node: Node.Index) full.Slice {
1335 assert(tree.nodes.items(.tag)[node] == .SliceOpen);
1335 assert(tree.nodes.items(.tag)[node] == .slice_open);
13361336 const data = tree.nodes.items(.data)[node];
13371337 return .{
13381338 .ast = .{
......@@ -1346,7 +1346,7 @@ pub const Tree = struct {
13461346 }
13471347
13481348 pub fn slice(tree: Tree, node: Node.Index) full.Slice {
1349 assert(tree.nodes.items(.tag)[node] == .Slice);
1349 assert(tree.nodes.items(.tag)[node] == .slice);
13501350 const data = tree.nodes.items(.data)[node];
13511351 const extra = tree.extraData(data.rhs, Node.Slice);
13521352 return .{
......@@ -1361,7 +1361,7 @@ pub const Tree = struct {
13611361 }
13621362
13631363 pub fn sliceSentinel(tree: Tree, node: Node.Index) full.Slice {
1364 assert(tree.nodes.items(.tag)[node] == .SliceSentinel);
1364 assert(tree.nodes.items(.tag)[node] == .slice_sentinel);
13651365 const data = tree.nodes.items(.data)[node];
13661366 const extra = tree.extraData(data.rhs, Node.SliceSentinel);
13671367 return .{
......@@ -1376,8 +1376,8 @@ pub const Tree = struct {
13761376 }
13771377
13781378 pub fn containerDeclTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl {
1379 assert(tree.nodes.items(.tag)[node] == .ContainerDeclTwo or
1380 tree.nodes.items(.tag)[node] == .ContainerDeclTwoComma);
1379 assert(tree.nodes.items(.tag)[node] == .container_decl_two or
1380 tree.nodes.items(.tag)[node] == .container_decl_two_comma);
13811381 const data = tree.nodes.items(.data)[node];
13821382 buffer.* = .{ data.lhs, data.rhs };
13831383 const members = if (data.rhs != 0)
......@@ -1395,8 +1395,8 @@ pub const Tree = struct {
13951395 }
13961396
13971397 pub fn containerDecl(tree: Tree, node: Node.Index) full.ContainerDecl {
1398 assert(tree.nodes.items(.tag)[node] == .ContainerDecl or
1399 tree.nodes.items(.tag)[node] == .ContainerDeclComma);
1398 assert(tree.nodes.items(.tag)[node] == .container_decl or
1399 tree.nodes.items(.tag)[node] == .container_decl_comma);
14001400 const data = tree.nodes.items(.data)[node];
14011401 return tree.fullContainerDecl(.{
14021402 .main_token = tree.nodes.items(.main_token)[node],
......@@ -1407,8 +1407,8 @@ pub const Tree = struct {
14071407 }
14081408
14091409 pub fn containerDeclArg(tree: Tree, node: Node.Index) full.ContainerDecl {
1410 assert(tree.nodes.items(.tag)[node] == .ContainerDeclArg or
1411 tree.nodes.items(.tag)[node] == .ContainerDeclArgComma);
1410 assert(tree.nodes.items(.tag)[node] == .container_decl_arg or
1411 tree.nodes.items(.tag)[node] == .container_decl_arg_comma);
14121412 const data = tree.nodes.items(.data)[node];
14131413 const members_range = tree.extraData(data.rhs, Node.SubRange);
14141414 return tree.fullContainerDecl(.{
......@@ -1420,8 +1420,8 @@ pub const Tree = struct {
14201420 }
14211421
14221422 pub fn taggedUnionTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl {
1423 assert(tree.nodes.items(.tag)[node] == .TaggedUnionTwo or
1424 tree.nodes.items(.tag)[node] == .TaggedUnionTwoComma);
1423 assert(tree.nodes.items(.tag)[node] == .tagged_union_two or
1424 tree.nodes.items(.tag)[node] == .tagged_union_two_comma);
14251425 const data = tree.nodes.items(.data)[node];
14261426 buffer.* = .{ data.lhs, data.rhs };
14271427 const members = if (data.rhs != 0)
......@@ -1440,8 +1440,8 @@ pub const Tree = struct {
14401440 }
14411441
14421442 pub fn taggedUnion(tree: Tree, node: Node.Index) full.ContainerDecl {
1443 assert(tree.nodes.items(.tag)[node] == .TaggedUnion or
1444 tree.nodes.items(.tag)[node] == .TaggedUnionComma);
1443 assert(tree.nodes.items(.tag)[node] == .tagged_union or
1444 tree.nodes.items(.tag)[node] == .tagged_union_comma);
14451445 const data = tree.nodes.items(.data)[node];
14461446 const main_token = tree.nodes.items(.main_token)[node];
14471447 return tree.fullContainerDecl(.{
......@@ -1453,8 +1453,8 @@ pub const Tree = struct {
14531453 }
14541454
14551455 pub fn taggedUnionEnumTag(tree: Tree, node: Node.Index) full.ContainerDecl {
1456 assert(tree.nodes.items(.tag)[node] == .TaggedUnionEnumTag or
1457 tree.nodes.items(.tag)[node] == .TaggedUnionEnumTagComma);
1456 assert(tree.nodes.items(.tag)[node] == .tagged_union_enum_tag or
1457 tree.nodes.items(.tag)[node] == .tagged_union_enum_tag_comma);
14581458 const data = tree.nodes.items(.data)[node];
14591459 const members_range = tree.extraData(data.rhs, Node.SubRange);
14601460 const main_token = tree.nodes.items(.main_token)[node];
......@@ -1765,7 +1765,7 @@ pub const Tree = struct {
17651765 }
17661766 const outputs_end: usize = for (info.items) |item, i| {
17671767 switch (node_tags[item]) {
1768 .AsmOutput => continue,
1768 .asm_output => continue,
17691769 else => break i,
17701770 }
17711771 } else info.items.len;
......@@ -2162,7 +2162,7 @@ pub const Error = union(enum) {
21622162
21632163 pub fn render(self: ExpectedCall, tree: Tree, stream: anytype) !void {
21642164 const node_tag = tree.nodes.items(.tag)[self.node];
2165 return stream.print("expected " ++ @tagName(Node.Tag.Call) ++ ", found {s}", .{
2165 return stream.print("expected " ++ @tagName(Node.Tag.call) ++ ", found {s}", .{
21662166 @tagName(node_tag),
21672167 });
21682168 }
......@@ -2173,8 +2173,8 @@ pub const Error = union(enum) {
21732173
21742174 pub fn render(self: ExpectedCallOrFnProto, tree: Tree, stream: anytype) !void {
21752175 const node_tag = tree.nodes.items(.tag)[self.node];
2176 return stream.print("expected " ++ @tagName(Node.Tag.Call) ++ " or " ++
2177 @tagName(Node.Tag.FnProto) ++ ", found {s}", .{@tagName(node_tag)});
2176 return stream.print("expected " ++ @tagName(Node.Tag.call) ++ " or " ++
2177 @tagName(Node.Tag.fn_proto) ++ ", found {s}", .{@tagName(node_tag)});
21782178 }
21792179 };
21802180
......@@ -2305,433 +2305,433 @@ pub const Node = struct {
23052305 /// Tree.lastToken()
23062306 pub const Tag = enum {
23072307 /// sub_list[lhs...rhs]
2308 Root,
2308 root,
23092309 /// `usingnamespace lhs;`. rhs unused. main_token is `usingnamespace`.
2310 UsingNamespace,
2310 @"usingnamespace",
23112311 /// lhs is test name token (must be string literal), if any.
23122312 /// rhs is the body node.
2313 TestDecl,
2313 test_decl,
23142314 /// lhs is the index into extra_data.
23152315 /// rhs is the initialization expression, if any.
23162316 /// main_token is `var` or `const`.
2317 GlobalVarDecl,
2317 global_var_decl,
23182318 /// `var a: x align(y) = rhs`
23192319 /// lhs is the index into extra_data.
23202320 /// main_token is `var` or `const`.
2321 LocalVarDecl,
2321 local_var_decl,
23222322 /// `var a: lhs = rhs`. lhs and rhs may be unused.
23232323 /// Can be local or global.
23242324 /// main_token is `var` or `const`.
2325 SimpleVarDecl,
2325 simple_var_decl,
23262326 /// `var a align(lhs) = rhs`. lhs and rhs may be unused.
23272327 /// Can be local or global.
23282328 /// main_token is `var` or `const`.
2329 AlignedVarDecl,
2329 aligned_var_decl,
23302330 /// lhs is the identifier token payload if any,
23312331 /// rhs is the deferred expression.
2332 ErrDefer,
2332 @"errdefer",
23332333 /// lhs is unused.
23342334 /// rhs is the deferred expression.
2335 Defer,
2335 @"defer",
23362336 /// lhs catch rhs
23372337 /// lhs catch |err| rhs
23382338 /// main_token is the catch
23392339 /// payload is determined by looking at the prev tokens before rhs.
2340 Catch,
2340 @"catch",
23412341 /// `lhs.a`. main_token is the dot. rhs is the identifier token index.
2342 FieldAccess,
2342 field_access,
23432343 /// `lhs.?`. main_token is the dot. rhs is the `?` token index.
2344 UnwrapOptional,
2344 unwrap_optional,
23452345 /// `lhs == rhs`. main_token is op.
2346 EqualEqual,
2346 equal_equal,
23472347 /// `lhs != rhs`. main_token is op.
2348 BangEqual,
2348 bang_equal,
23492349 /// `lhs < rhs`. main_token is op.
2350 LessThan,
2350 less_than,
23512351 /// `lhs > rhs`. main_token is op.
2352 GreaterThan,
2352 greater_than,
23532353 /// `lhs <= rhs`. main_token is op.
2354 LessOrEqual,
2354 less_or_equal,
23552355 /// `lhs >= rhs`. main_token is op.
2356 GreaterOrEqual,
2356 greater_or_equal,
23572357 /// `lhs *= rhs`. main_token is op.
2358 AssignMul,
2358 assign_mul,
23592359 /// `lhs /= rhs`. main_token is op.
2360 AssignDiv,
2360 assign_div,
23612361 /// `lhs *= rhs`. main_token is op.
2362 AssignMod,
2362 assign_mod,
23632363 /// `lhs += rhs`. main_token is op.
2364 AssignAdd,
2364 assign_add,
23652365 /// `lhs -= rhs`. main_token is op.
2366 AssignSub,
2366 assign_sub,
23672367 /// `lhs <<= rhs`. main_token is op.
2368 AssignBitShiftLeft,
2368 assign_bit_shift_left,
23692369 /// `lhs >>= rhs`. main_token is op.
2370 AssignBitShiftRight,
2370 assign_bit_shift_right,
23712371 /// `lhs &= rhs`. main_token is op.
2372 AssignBitAnd,
2372 assign_bit_and,
23732373 /// `lhs ^= rhs`. main_token is op.
2374 AssignBitXor,
2374 assign_bit_xor,
23752375 /// `lhs |= rhs`. main_token is op.
2376 AssignBitOr,
2376 assign_bit_or,
23772377 /// `lhs *%= rhs`. main_token is op.
2378 AssignMulWrap,
2378 assign_mul_wrap,
23792379 /// `lhs +%= rhs`. main_token is op.
2380 AssignAddWrap,
2380 assign_add_wrap,
23812381 /// `lhs -%= rhs`. main_token is op.
2382 AssignSubWrap,
2382 assign_sub_wrap,
23832383 /// `lhs = rhs`. main_token is op.
2384 Assign,
2384 assign,
23852385 /// `lhs || rhs`. main_token is the `||`.
2386 MergeErrorSets,
2386 merge_error_sets,
23872387 /// `lhs * rhs`. main_token is the `*`.
2388 Mul,
2388 mul,
23892389 /// `lhs / rhs`. main_token is the `/`.
2390 Div,
2390 div,
23912391 /// `lhs % rhs`. main_token is the `%`.
2392 Mod,
2392 mod,
23932393 /// `lhs ** rhs`. main_token is the `**`.
2394 ArrayMult,
2394 array_mult,
23952395 /// `lhs *% rhs`. main_token is the `*%`.
2396 MulWrap,
2396 mul_wrap,
23972397 /// `lhs + rhs`. main_token is the `+`.
2398 Add,
2398 add,
23992399 /// `lhs - rhs`. main_token is the `-`.
2400 Sub,
2400 sub,
24012401 /// `lhs ++ rhs`. main_token is the `++`.
2402 ArrayCat,
2402 array_cat,
24032403 /// `lhs +% rhs`. main_token is the `+%`.
2404 AddWrap,
2404 add_wrap,
24052405 /// `lhs -% rhs`. main_token is the `-%`.
2406 SubWrap,
2406 sub_wrap,
24072407 /// `lhs << rhs`. main_token is the `<<`.
2408 BitShiftLeft,
2408 bit_shift_left,
24092409 /// `lhs >> rhs`. main_token is the `>>`.
2410 BitShiftRight,
2410 bit_shift_right,
24112411 /// `lhs & rhs`. main_token is the `&`.
2412 BitAnd,
2412 bit_and,
24132413 /// `lhs ^ rhs`. main_token is the `^`.
2414 BitXor,
2414 bit_xor,
24152415 /// `lhs | rhs`. main_token is the `|`.
2416 BitOr,
2416 bit_or,
24172417 /// `lhs orelse rhs`. main_token is the `orelse`.
2418 OrElse,
2418 @"orelse",
24192419 /// `lhs and rhs`. main_token is the `and`.
2420 BoolAnd,
2420 bool_and,
24212421 /// `lhs or rhs`. main_token is the `or`.
2422 BoolOr,
2422 bool_or,
24232423 /// `op lhs`. rhs unused. main_token is op.
2424 BoolNot,
2424 bool_not,
24252425 /// `op lhs`. rhs unused. main_token is op.
2426 Negation,
2426 negation,
24272427 /// `op lhs`. rhs unused. main_token is op.
2428 BitNot,
2428 bit_not,
24292429 /// `op lhs`. rhs unused. main_token is op.
2430 NegationWrap,
2430 negation_wrap,
24312431 /// `op lhs`. rhs unused. main_token is op.
2432 AddressOf,
2432 address_of,
24332433 /// `op lhs`. rhs unused. main_token is op.
2434 Try,
2434 @"try",
24352435 /// `op lhs`. rhs unused. main_token is op.
2436 Await,
2436 @"await",
24372437 /// `?lhs`. rhs unused. main_token is the `?`.
2438 OptionalType,
2438 optional_type,
24392439 /// `[lhs]rhs`. lhs can be omitted to make it a slice.
2440 ArrayType,
2441 /// `[lhs:a]b`. `ArrayTypeSentinel[rhs]`.
2442 ArrayTypeSentinel,
2440 array_type,
2441 /// `[lhs:a]b`. `array_type_sentinel[rhs]`.
2442 array_type_sentinel,
24432443 /// `[*]align(lhs) rhs`. lhs can be omitted.
24442444 /// `*align(lhs) rhs`. lhs can be omitted.
24452445 /// `[]rhs`.
24462446 /// main_token is the asterisk if a pointer or the lbracket if a slice
24472447 /// main_token might be a ** token, which is shared with a parent/child
24482448 /// pointer type and may require special handling.
2449 PtrTypeAligned,
2449 ptr_type_aligned,
24502450 /// `[*:lhs]rhs`. lhs can be omitted.
24512451 /// `*rhs`.
24522452 /// `[:lhs]rhs`.
24532453 /// main_token is the asterisk if a pointer or the lbracket if a slice
24542454 /// main_token might be a ** token, which is shared with a parent/child
24552455 /// pointer type and may require special handling.
2456 PtrTypeSentinel,
2457 /// lhs is index into PtrType. rhs is the element type expression.
2456 ptr_type_sentinel,
2457 /// lhs is index into ptr_type. rhs is the element type expression.
24582458 /// main_token is the asterisk if a pointer or the lbracket if a slice
24592459 /// main_token might be a ** token, which is shared with a parent/child
24602460 /// pointer type and may require special handling.
2461 PtrType,
2462 /// lhs is index into PtrTypeBitRange. rhs is the element type expression.
2461 ptr_type,
2462 /// lhs is index into ptr_type_bit_range. rhs is the element type expression.
24632463 /// main_token is the asterisk if a pointer or the lbracket if a slice
24642464 /// main_token might be a ** token, which is shared with a parent/child
24652465 /// pointer type and may require special handling.
2466 PtrTypeBitRange,
2466 ptr_type_bit_range,
24672467 /// `lhs[rhs..]`
24682468 /// main_token is the lbracket.
2469 SliceOpen,
2469 slice_open,
24702470 /// `lhs[b..c]`. rhs is index into Slice
24712471 /// main_token is the lbracket.
2472 Slice,
2472 slice,
24732473 /// `lhs[b..c :d]`. rhs is index into SliceSentinel
24742474 /// main_token is the lbracket.
2475 SliceSentinel,
2475 slice_sentinel,
24762476 /// `lhs.*`. rhs is unused.
2477 Deref,
2477 deref,
24782478 /// `lhs[rhs]`.
2479 ArrayAccess,
2479 array_access,
24802480 /// `lhs{rhs}`. rhs can be omitted.
2481 ArrayInitOne,
2481 array_init_one,
24822482 /// `lhs{rhs,}`. rhs can *not* be omitted
2483 ArrayInitOneComma,
2483 array_init_one_comma,
24842484 /// `.{lhs, rhs}`. lhs and rhs can be omitted.
2485 ArrayInitDotTwo,
2486 /// Same as `ArrayInitDotTwo` except there is known to be a trailing comma
2485 array_init_dot_two,
2486 /// Same as `array_init_dot_two` except there is known to be a trailing comma
24872487 /// before the final rbrace.
2488 ArrayInitDotTwoComma,
2488 array_init_dot_two_comma,
24892489 /// `.{a, b}`. `sub_list[lhs..rhs]`.
2490 ArrayInitDot,
2491 /// Same as `ArrayInitDot` except there is known to be a trailing comma
2490 array_init_dot,
2491 /// Same as `array_init_dot` except there is known to be a trailing comma
24922492 /// before the final rbrace.
2493 ArrayInitDotComma,
2493 array_init_dot_comma,
24942494 /// `lhs{a, b}`. `sub_range_list[rhs]`. lhs can be omitted which means `.{a, b}`.
2495 ArrayInit,
2496 /// Same as `ArrayInit` except there is known to be a trailing comma
2495 array_init,
2496 /// Same as `array_init` except there is known to be a trailing comma
24972497 /// before the final rbrace.
2498 ArrayInitComma,
2498 array_init_comma,
24992499 /// `lhs{.a = rhs}`. rhs can be omitted making it empty.
25002500 /// main_token is the lbrace.
2501 StructInitOne,
2501 struct_init_one,
25022502 /// `lhs{.a = rhs,}`. rhs can *not* be omitted.
25032503 /// main_token is the lbrace.
2504 StructInitOneComma,
2504 struct_init_one_comma,
25052505 /// `.{.a = lhs, .b = rhs}`. lhs and rhs can be omitted.
25062506 /// main_token is the lbrace.
25072507 /// No trailing comma before the rbrace.
2508 StructInitDotTwo,
2509 /// Same as `StructInitDotTwo` except there is known to be a trailing comma
2508 struct_init_dot_two,
2509 /// Same as `struct_init_dot_two` except there is known to be a trailing comma
25102510 /// before the final rbrace.
2511 StructInitDotTwoComma,
2511 struct_init_dot_two_comma,
25122512 /// `.{.a = b, .c = d}`. `sub_list[lhs..rhs]`.
25132513 /// main_token is the lbrace.
2514 StructInitDot,
2515 /// Same as `StructInitDot` except there is known to be a trailing comma
2514 struct_init_dot,
2515 /// Same as `struct_init_dot` except there is known to be a trailing comma
25162516 /// before the final rbrace.
2517 StructInitDotComma,
2517 struct_init_dot_comma,
25182518 /// `lhs{.a = b, .c = d}`. `sub_range_list[rhs]`.
25192519 /// lhs can be omitted which means `.{.a = b, .c = d}`.
25202520 /// main_token is the lbrace.
2521 StructInit,
2522 /// Same as `StructInit` except there is known to be a trailing comma
2521 struct_init,
2522 /// Same as `struct_init` except there is known to be a trailing comma
25232523 /// before the final rbrace.
2524 StructInitComma,
2524 struct_init_comma,
25252525 /// `lhs(rhs)`. rhs can be omitted.
2526 CallOne,
2526 call_one,
25272527 /// `lhs(rhs,)`. rhs can be omitted.
2528 CallOneComma,
2528 call_one_comma,
25292529 /// `async lhs(rhs)`. rhs can be omitted.
2530 AsyncCallOne,
2530 async_call_one,
25312531 /// `async lhs(rhs,)`.
2532 AsyncCallOneComma,
2532 async_call_one_comma,
25332533 /// `lhs(a, b, c)`. `SubRange[rhs]`.
25342534 /// main_token is the `(`.
2535 Call,
2535 call,
25362536 /// `lhs(a, b, c,)`. `SubRange[rhs]`.
25372537 /// main_token is the `(`.
2538 CallComma,
2538 call_comma,
25392539 /// `async lhs(a, b, c)`. `SubRange[rhs]`.
25402540 /// main_token is the `(`.
2541 AsyncCall,
2541 async_call,
25422542 /// `async lhs(a, b, c,)`. `SubRange[rhs]`.
25432543 /// main_token is the `(`.
2544 AsyncCallComma,
2544 async_call_comma,
25452545 /// `switch(lhs) {}`. `SubRange[rhs]`.
2546 Switch,
2547 /// Same as Switch except there is known to be a trailing comma
2546 @"switch",
2547 /// Same as switch except there is known to be a trailing comma
25482548 /// before the final rbrace
2549 SwitchComma,
2549 switch_comma,
25502550 /// `lhs => rhs`. If lhs is omitted it means `else`.
25512551 /// main_token is the `=>`
2552 SwitchCaseOne,
2552 switch_case_one,
25532553 /// `a, b, c => rhs`. `SubRange[lhs]`.
25542554 /// main_token is the `=>`
2555 SwitchCase,
2555 switch_case,
25562556 /// `lhs...rhs`.
2557 SwitchRange,
2557 switch_range,
25582558 /// `while (lhs) rhs`.
25592559 /// `while (lhs) |x| rhs`.
2560 WhileSimple,
2560 while_simple,
25612561 /// `while (lhs) : (a) b`. `WhileCont[rhs]`.
25622562 /// `while (lhs) : (a) b`. `WhileCont[rhs]`.
2563 WhileCont,
2563 while_cont,
25642564 /// `while (lhs) : (a) b else c`. `While[rhs]`.
25652565 /// `while (lhs) |x| : (a) b else c`. `While[rhs]`.
25662566 /// `while (lhs) |x| : (a) b else |y| c`. `While[rhs]`.
2567 While,
2567 @"while",
25682568 /// `for (lhs) rhs`.
2569 ForSimple,
2569 for_simple,
25702570 /// `for (lhs) a else b`. `if_list[rhs]`.
2571 For,
2571 @"for",
25722572 /// `if (lhs) rhs`.
25732573 /// `if (lhs) |a| rhs`.
2574 IfSimple,
2574 if_simple,
25752575 /// `if (lhs) a else b`. `If[rhs]`.
25762576 /// `if (lhs) |x| a else b`. `If[rhs]`.
25772577 /// `if (lhs) |x| a else |y| b`. `If[rhs]`.
2578 If,
2578 @"if",
25792579 /// `suspend lhs`. lhs can be omitted. rhs is unused.
2580 Suspend,
2580 @"suspend",
25812581 /// `resume lhs`. rhs is unused.
2582 Resume,
2582 @"resume",
25832583 /// `continue`. lhs is token index of label if any. rhs is unused.
2584 Continue,
2584 @"continue",
25852585 /// `break :lhs rhs`
25862586 /// both lhs and rhs may be omitted.
2587 Break,
2587 @"break",
25882588 /// `return lhs`. lhs can be omitted. rhs is unused.
2589 Return,
2589 @"return",
25902590 /// `fn(a: lhs) rhs`. lhs can be omitted.
25912591 /// anytype and ... parameters are omitted from the AST tree.
2592 FnProtoSimple,
2592 fn_proto_simple,
25932593 /// `fn(a: b, c: d) rhs`. `sub_range_list[lhs]`.
25942594 /// anytype and ... parameters are omitted from the AST tree.
2595 FnProtoMulti,
2595 fn_proto_multi,
25962596 /// `fn(a: b) rhs linksection(e) callconv(f)`. `FnProtoOne[lhs]`.
25972597 /// zero or one parameters.
25982598 /// anytype and ... parameters are omitted from the AST tree.
2599 FnProtoOne,
2599 fn_proto_one,
26002600 /// `fn(a: b, c: d) rhs linksection(e) callconv(f)`. `FnProto[lhs]`.
26012601 /// anytype and ... parameters are omitted from the AST tree.
2602 FnProto,
2603 /// lhs is the FnProto.
2602 fn_proto,
2603 /// lhs is the fn_proto.
26042604 /// rhs is the function body block if non-zero.
2605 /// if rhs is zero, the funtion decl has no body (e.g. an extern function)
2606 FnDecl,
2605 /// if rhs is zero, the function decl has no body (e.g. an extern function)
2606 fn_decl,
26072607 /// `anyframe->rhs`. main_token is `anyframe`. `lhs` is arrow token index.
2608 AnyFrameType,
2608 anyframe_type,
26092609 /// Both lhs and rhs unused.
2610 AnyFrameLiteral,
2610 anyframe_literal,
26112611 /// Both lhs and rhs unused.
2612 CharLiteral,
2612 char_literal,
26132613 /// Both lhs and rhs unused.
2614 IntegerLiteral,
2614 integer_literal,
26152615 /// Both lhs and rhs unused.
2616 FloatLiteral,
2616 float_literal,
26172617 /// Both lhs and rhs unused.
2618 FalseLiteral,
2618 false_literal,
26192619 /// Both lhs and rhs unused.
2620 TrueLiteral,
2620 true_literal,
26212621 /// Both lhs and rhs unused.
2622 NullLiteral,
2622 null_literal,
26232623 /// Both lhs and rhs unused.
2624 UndefinedLiteral,
2624 undefined_literal,
26252625 /// Both lhs and rhs unused.
2626 UnreachableLiteral,
2626 unreachable_literal,
26272627 /// Both lhs and rhs unused.
26282628 /// Most identifiers will not have explicit AST nodes, however for expressions
26292629 /// which could be one of many different kinds of AST nodes, there will be an
2630 /// Identifier AST node for it.
2631 Identifier,
2630 /// identifier AST node for it.
2631 identifier,
26322632 /// lhs is the dot token index, rhs unused, main_token is the identifier.
2633 EnumLiteral,
2633 enum_literal,
26342634 /// main_token is the first token index (redundant with lhs)
26352635 /// lhs is the first token index; rhs is the last token index.
2636 /// Could be a series of MultilineStringLiteralLine tokens, or a single
2637 /// StringLiteral token.
2638 StringLiteral,
2636 /// Could be a series of multiline_string_literal_line tokens, or a single
2637 /// string_literal token.
2638 string_literal,
26392639 /// `(lhs)`. main_token is the `(`; rhs is the token index of the `)`.
2640 GroupedExpression,
2640 grouped_expression,
26412641 /// `@a(lhs, rhs)`. lhs and rhs may be omitted.
2642 BuiltinCallTwo,
2643 /// Same as BuiltinCallTwo but there is known to be a trailing comma before the rparen.
2644 BuiltinCallTwoComma,
2642 builtin_call_two,
2643 /// Same as builtin_call_two but there is known to be a trailing comma before the rparen.
2644 builtin_call_two_comma,
26452645 /// `@a(b, c)`. `sub_list[lhs..rhs]`.
2646 BuiltinCall,
2647 /// Same as BuiltinCall but there is known to be a trailing comma before the rparen.
2648 BuiltinCallComma,
2646 builtin_call,
2647 /// Same as builtin_call but there is known to be a trailing comma before the rparen.
2648 builtin_call_comma,
26492649 /// `error{a, b}`.
26502650 /// rhs is the rbrace, lhs is unused.
2651 ErrorSetDecl,
2651 error_set_decl,
26522652 /// `struct {}`, `union {}`, `opaque {}`, `enum {}`. `extra_data[lhs..rhs]`.
26532653 /// main_token is `struct`, `union`, `opaque`, `enum` keyword.
2654 ContainerDecl,
2654 container_decl,
26552655 /// Same as ContainerDecl but there is known to be a trailing comma before the rbrace.
2656 ContainerDeclComma,
2656 container_decl_comma,
26572657 /// `struct {lhs, rhs}`, `union {lhs, rhs}`, `opaque {lhs, rhs}`, `enum {lhs, rhs}`.
26582658 /// lhs or rhs can be omitted.
26592659 /// main_token is `struct`, `union`, `opaque`, `enum` keyword.
2660 ContainerDeclTwo,
2660 container_decl_two,
26612661 /// Same as ContainerDeclTwo except there is known to be a trailing comma
26622662 /// before the rbrace.
2663 ContainerDeclTwoComma,
2663 container_decl_two_comma,
26642664 /// `union(lhs)` / `enum(lhs)`. `SubRange[rhs]`.
2665 ContainerDeclArg,
2666 /// Same as ContainerDeclArg but there is known to be a trailing comma before the rbrace.
2667 ContainerDeclArgComma,
2665 container_decl_arg,
2666 /// Same as container_decl_arg but there is known to be a trailing comma before the rbrace.
2667 container_decl_arg_comma,
26682668 /// `union(enum) {}`. `sub_list[lhs..rhs]`.
26692669 /// Note that tagged unions with explicitly provided enums are represented
2670 /// by `ContainerDeclArg`.
2671 TaggedUnion,
2672 /// Same as TaggedUnion but there is known to be a trailing comma before the rbrace.
2673 TaggedUnionComma,
2670 /// by `container_decl_arg`.
2671 tagged_union,
2672 /// Same as tagged_union but there is known to be a trailing comma before the rbrace.
2673 tagged_union_comma,
26742674 /// `union(enum) {lhs, rhs}`. lhs or rhs may be omitted.
26752675 /// Note that tagged unions with explicitly provided enums are represented
2676 /// by `ContainerDeclArg`.
2677 TaggedUnionTwo,
2678 /// Same as TaggedUnionTwo but there is known to be a trailing comma before the rbrace.
2679 TaggedUnionTwoComma,
2676 /// by `container_decl_arg`.
2677 tagged_union_two,
2678 /// Same as tagged_union_two but there is known to be a trailing comma before the rbrace.
2679 tagged_union_two_comma,
26802680 /// `union(enum(lhs)) {}`. `SubRange[rhs]`.
2681 TaggedUnionEnumTag,
2682 /// Same as TaggedUnionEnumTag but there is known to be a trailing comma
2681 tagged_union_enum_tag,
2682 /// Same as tagged_union_enum_tag but there is known to be a trailing comma
26832683 /// before the rbrace.
2684 TaggedUnionEnumTagComma,
2684 tagged_union_enum_tag_comma,
26852685 /// `a: lhs = rhs,`. lhs and rhs can be omitted.
26862686 /// main_token is the field name identifier.
26872687 /// lastToken() does not include the possible trailing comma.
2688 ContainerFieldInit,
2688 container_field_init,
26892689 /// `a: lhs align(rhs),`. rhs can be omitted.
26902690 /// main_token is the field name identifier.
26912691 /// lastToken() does not include the possible trailing comma.
2692 ContainerFieldAlign,
2692 container_field_align,
26932693 /// `a: lhs align(c) = d,`. `container_field_list[rhs]`.
26942694 /// main_token is the field name identifier.
26952695 /// lastToken() does not include the possible trailing comma.
2696 ContainerField,
2696 container_field,
26972697 /// `anytype`. both lhs and rhs unused.
26982698 /// Used by `ContainerField`.
2699 AnyType,
2699 @"anytype",
27002700 /// `comptime lhs`. rhs unused.
2701 Comptime,
2701 @"comptime",
27022702 /// `nosuspend lhs`. rhs unused.
2703 Nosuspend,
2703 @"nosuspend",
27042704 /// `{lhs rhs}`. rhs or lhs can be omitted.
27052705 /// main_token points at the lbrace.
2706 BlockTwo,
2707 /// Same as BlockTwo but there is known to be a semicolon before the rbrace.
2708 BlockTwoSemicolon,
2706 block_two,
2707 /// Same as block_two but there is known to be a semicolon before the rbrace.
2708 block_two_semicolon,
27092709 /// `{}`. `sub_list[lhs..rhs]`.
27102710 /// main_token points at the lbrace.
2711 Block,
2712 /// Same as Block but there is known to be a semicolon before the rbrace.
2713 BlockSemicolon,
2711 block,
2712 /// Same as block but there is known to be a semicolon before the rbrace.
2713 block_semicolon,
27142714 /// `asm(lhs)`. rhs is the token index of the rparen.
2715 AsmSimple,
2715 asm_simple,
27162716 /// `asm(lhs, a)`. `Asm[rhs]`.
2717 Asm,
2717 @"asm",
27182718 /// `[a] "b" (c)`. lhs is 0, rhs is token index of the rparen.
27192719 /// `[a] "b" (-> lhs)`. rhs is token index of the rparen.
27202720 /// main_token is `a`.
2721 AsmOutput,
2721 asm_output,
27222722 /// `[a] "b" (lhs)`. rhs is token index of the rparen.
27232723 /// main_token is `a`.
2724 AsmInput,
2724 asm_input,
27252725 /// `error.a`. lhs is token index of `.`. rhs is token index of `a`.
2726 ErrorValue,
2726 error_value,
27272727 /// `lhs!rhs`. main_token is the `!`.
2728 ErrorUnion,
2728 error_union,
27292729
27302730 pub fn isContainerField(tag: Tag) bool {
27312731 return switch (tag) {
2732 .ContainerFieldInit,
2733 .ContainerFieldAlign,
2734 .ContainerField,
2732 .container_field_init,
2733 .container_field_align,
2734 .container_field,
27352735 => true,
27362736
27372737 else => false,
lib/std/zig/parse.zig+199-199
......@@ -57,7 +57,7 @@ pub fn parse(gpa: *Allocator, source: []const u8) Allocator.Error!Tree {
5757 // Root node must be index 0.
5858 // Root <- skip ContainerMembers eof
5959 parser.nodes.appendAssumeCapacity(.{
60 .tag = .Root,
60 .tag = .root,
6161 .main_token = 0,
6262 .data = .{
6363 .lhs = undefined,
......@@ -251,7 +251,7 @@ const Parser = struct {
251251 };
252252 if (block != 0) {
253253 const comptime_node = try p.addNode(.{
254 .tag = .Comptime,
254 .tag = .@"comptime",
255255 .main_token = comptime_token,
256256 .data = .{
257257 .lhs = block,
......@@ -477,7 +477,7 @@ const Parser = struct {
477477 const block_node = try p.parseBlock();
478478 if (block_node == 0) return p.fail(.{ .ExpectedLBrace = .{ .token = p.tok_i } });
479479 return p.addNode(.{
480 .tag = .TestDecl,
480 .tag = .test_decl,
481481 .main_token = test_token,
482482 .data = .{
483483 .lhs = name_token orelse 0,
......@@ -517,7 +517,7 @@ const Parser = struct {
517517 const semicolon_token = p.nextToken();
518518 try p.parseAppendedDocComment(semicolon_token);
519519 return p.addNode(.{
520 .tag = .FnDecl,
520 .tag = .fn_decl,
521521 .main_token = p.nodes.items(.main_token)[fn_proto],
522522 .data = .{
523523 .lhs = fn_proto,
......@@ -529,7 +529,7 @@ const Parser = struct {
529529 const body_block = try p.parseBlock();
530530 assert(body_block != 0);
531531 return p.addNode(.{
532 .tag = .FnDecl,
532 .tag = .fn_decl,
533533 .main_token = p.nodes.items(.main_token)[fn_proto],
534534 .data = .{
535535 .lhs = fn_proto,
......@@ -587,7 +587,7 @@ const Parser = struct {
587587 const semicolon_token = try p.expectToken(.semicolon);
588588 try p.parseAppendedDocComment(semicolon_token);
589589 return p.addNode(.{
590 .tag = .UsingNamespace,
590 .tag = .@"usingnamespace",
591591 .main_token = usingnamespace_token,
592592 .data = .{
593593 .lhs = expr,
......@@ -627,7 +627,7 @@ const Parser = struct {
627627 if (align_expr == 0 and section_expr == 0 and callconv_expr == 0) {
628628 switch (params) {
629629 .zero_or_one => |param| return p.addNode(.{
630 .tag = .FnProtoSimple,
630 .tag = .fn_proto_simple,
631631 .main_token = fn_token,
632632 .data = .{
633633 .lhs = param,
......@@ -637,7 +637,7 @@ const Parser = struct {
637637 .multi => |list| {
638638 const span = try p.listToSpan(list);
639639 return p.addNode(.{
640 .tag = .FnProtoMulti,
640 .tag = .fn_proto_multi,
641641 .main_token = fn_token,
642642 .data = .{
643643 .lhs = try p.addExtra(Node.SubRange{
......@@ -652,7 +652,7 @@ const Parser = struct {
652652 }
653653 switch (params) {
654654 .zero_or_one => |param| return p.addNode(.{
655 .tag = .FnProtoOne,
655 .tag = .fn_proto_one,
656656 .main_token = fn_token,
657657 .data = .{
658658 .lhs = try p.addExtra(Node.FnProtoOne{
......@@ -667,7 +667,7 @@ const Parser = struct {
667667 .multi => |list| {
668668 const span = try p.listToSpan(list);
669669 return p.addNode(.{
670 .tag = .FnProto,
670 .tag = .fn_proto,
671671 .main_token = fn_token,
672672 .data = .{
673673 .lhs = try p.addExtra(Node.FnProto{
......@@ -698,7 +698,7 @@ const Parser = struct {
698698 if (section_node == 0) {
699699 if (align_node == 0) {
700700 return p.addNode(.{
701 .tag = .SimpleVarDecl,
701 .tag = .simple_var_decl,
702702 .main_token = mut_token,
703703 .data = .{
704704 .lhs = type_node,
......@@ -707,7 +707,7 @@ const Parser = struct {
707707 });
708708 } else if (type_node == 0) {
709709 return p.addNode(.{
710 .tag = .AlignedVarDecl,
710 .tag = .aligned_var_decl,
711711 .main_token = mut_token,
712712 .data = .{
713713 .lhs = align_node,
......@@ -716,7 +716,7 @@ const Parser = struct {
716716 });
717717 } else {
718718 return p.addNode(.{
719 .tag = .LocalVarDecl,
719 .tag = .local_var_decl,
720720 .main_token = mut_token,
721721 .data = .{
722722 .lhs = try p.addExtra(Node.LocalVarDecl{
......@@ -729,7 +729,7 @@ const Parser = struct {
729729 }
730730 } else {
731731 return p.addNode(.{
732 .tag = .GlobalVarDecl,
732 .tag = .global_var_decl,
733733 .main_token = mut_token,
734734 .data = .{
735735 .lhs = try p.addExtra(Node.GlobalVarDecl{
......@@ -753,7 +753,7 @@ const Parser = struct {
753753 if (p.eatToken(.colon)) |_| {
754754 if (p.eatToken(.keyword_anytype)) |anytype_tok| {
755755 type_expr = try p.addNode(.{
756 .tag = .AnyType,
756 .tag = .@"anytype",
757757 .main_token = anytype_tok,
758758 .data = .{
759759 .lhs = undefined,
......@@ -770,7 +770,7 @@ const Parser = struct {
770770
771771 if (align_expr == 0) {
772772 return p.addNode(.{
773 .tag = .ContainerFieldInit,
773 .tag = .container_field_init,
774774 .main_token = name_token,
775775 .data = .{
776776 .lhs = type_expr,
......@@ -779,7 +779,7 @@ const Parser = struct {
779779 });
780780 } else if (value_expr == 0) {
781781 return p.addNode(.{
782 .tag = .ContainerFieldAlign,
782 .tag = .container_field_align,
783783 .main_token = name_token,
784784 .data = .{
785785 .lhs = type_expr,
......@@ -788,7 +788,7 @@ const Parser = struct {
788788 });
789789 } else {
790790 return p.addNode(.{
791 .tag = .ContainerField,
791 .tag = .container_field,
792792 .main_token = name_token,
793793 .data = .{
794794 .lhs = type_expr,
......@@ -833,7 +833,7 @@ const Parser = struct {
833833
834834 if (comptime_token) |token| {
835835 return p.addNode(.{
836 .tag = .Comptime,
836 .tag = .@"comptime",
837837 .main_token = token,
838838 .data = .{
839839 .lhs = try p.expectBlockExprStatement(),
......@@ -845,7 +845,7 @@ const Parser = struct {
845845 switch (p.token_tags[p.tok_i]) {
846846 .keyword_nosuspend => {
847847 return p.addNode(.{
848 .tag = .Nosuspend,
848 .tag = .@"nosuspend",
849849 .main_token = p.nextToken(),
850850 .data = .{
851851 .lhs = try p.expectBlockExprStatement(),
......@@ -860,7 +860,7 @@ const Parser = struct {
860860 else
861861 try p.expectBlockExprStatement();
862862 return p.addNode(.{
863 .tag = .Suspend,
863 .tag = .@"suspend",
864864 .main_token = token,
865865 .data = .{
866866 .lhs = block_expr,
......@@ -869,7 +869,7 @@ const Parser = struct {
869869 });
870870 },
871871 .keyword_defer => return p.addNode(.{
872 .tag = .Defer,
872 .tag = .@"defer",
873873 .main_token = p.nextToken(),
874874 .data = .{
875875 .lhs = undefined,
......@@ -877,7 +877,7 @@ const Parser = struct {
877877 },
878878 }),
879879 .keyword_errdefer => return p.addNode(.{
880 .tag = .ErrDefer,
880 .tag = .@"errdefer",
881881 .main_token = p.nextToken(),
882882 .data = .{
883883 .lhs = try p.parsePayload(),
......@@ -947,7 +947,7 @@ const Parser = struct {
947947 }
948948 if (p.eatToken(.semicolon)) |_| {
949949 return p.addNode(.{
950 .tag = .IfSimple,
950 .tag = .if_simple,
951951 .main_token = if_token,
952952 .data = .{
953953 .lhs = condition,
......@@ -963,7 +963,7 @@ const Parser = struct {
963963 return p.fail(.{ .ExpectedSemiOrElse = .{ .token = p.tok_i } });
964964 }
965965 return p.addNode(.{
966 .tag = .IfSimple,
966 .tag = .if_simple,
967967 .main_token = if_token,
968968 .data = .{
969969 .lhs = condition,
......@@ -974,7 +974,7 @@ const Parser = struct {
974974 const else_payload = try p.parsePayload();
975975 const else_expr = try p.expectStatement();
976976 return p.addNode(.{
977 .tag = .If,
977 .tag = .@"if",
978978 .main_token = if_token,
979979 .data = .{
980980 .lhs = condition,
......@@ -1041,7 +1041,7 @@ const Parser = struct {
10411041 }
10421042 if (p.eatToken(.semicolon)) |_| {
10431043 return p.addNode(.{
1044 .tag = .ForSimple,
1044 .tag = .for_simple,
10451045 .main_token = for_token,
10461046 .data = .{
10471047 .lhs = array_expr,
......@@ -1057,7 +1057,7 @@ const Parser = struct {
10571057 return p.fail(.{ .ExpectedSemiOrElse = .{ .token = p.tok_i } });
10581058 }
10591059 return p.addNode(.{
1060 .tag = .ForSimple,
1060 .tag = .for_simple,
10611061 .main_token = for_token,
10621062 .data = .{
10631063 .lhs = array_expr,
......@@ -1066,7 +1066,7 @@ const Parser = struct {
10661066 });
10671067 };
10681068 return p.addNode(.{
1069 .tag = .For,
1069 .tag = .@"for",
10701070 .main_token = for_token,
10711071 .data = .{
10721072 .lhs = array_expr,
......@@ -1103,7 +1103,7 @@ const Parser = struct {
11031103 if (p.eatToken(.semicolon)) |_| {
11041104 if (cont_expr == 0) {
11051105 return p.addNode(.{
1106 .tag = .WhileSimple,
1106 .tag = .while_simple,
11071107 .main_token = while_token,
11081108 .data = .{
11091109 .lhs = condition,
......@@ -1112,7 +1112,7 @@ const Parser = struct {
11121112 });
11131113 } else {
11141114 return p.addNode(.{
1115 .tag = .WhileCont,
1115 .tag = .while_cont,
11161116 .main_token = while_token,
11171117 .data = .{
11181118 .lhs = condition,
......@@ -1133,7 +1133,7 @@ const Parser = struct {
11331133 }
11341134 if (cont_expr == 0) {
11351135 return p.addNode(.{
1136 .tag = .WhileSimple,
1136 .tag = .while_simple,
11371137 .main_token = while_token,
11381138 .data = .{
11391139 .lhs = condition,
......@@ -1142,7 +1142,7 @@ const Parser = struct {
11421142 });
11431143 } else {
11441144 return p.addNode(.{
1145 .tag = .WhileCont,
1145 .tag = .while_cont,
11461146 .main_token = while_token,
11471147 .data = .{
11481148 .lhs = condition,
......@@ -1157,7 +1157,7 @@ const Parser = struct {
11571157 const else_payload = try p.parsePayload();
11581158 const else_expr = try p.expectStatement();
11591159 return p.addNode(.{
1160 .tag = .While,
1160 .tag = .@"while",
11611161 .main_token = while_token,
11621162 .data = .{
11631163 .lhs = condition,
......@@ -1233,20 +1233,20 @@ const Parser = struct {
12331233 if (expr == 0) return null_node;
12341234
12351235 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1236 .asterisk_equal => .AssignMul,
1237 .slash_equal => .AssignDiv,
1238 .percent_equal => .AssignMod,
1239 .plus_equal => .AssignAdd,
1240 .minus_equal => .AssignSub,
1241 .angle_bracket_angle_bracket_left_equal => .AssignBitShiftLeft,
1242 .angle_bracket_angle_bracket_right_equal => .AssignBitShiftRight,
1243 .ampersand_equal => .AssignBitAnd,
1244 .caret_equal => .AssignBitXor,
1245 .pipe_equal => .AssignBitOr,
1246 .asterisk_percent_equal => .AssignMulWrap,
1247 .plus_percent_equal => .AssignAddWrap,
1248 .minus_percent_equal => .AssignSubWrap,
1249 .equal => .Assign,
1236 .asterisk_equal => .assign_mul,
1237 .slash_equal => .assign_div,
1238 .percent_equal => .assign_mod,
1239 .plus_equal => .assign_add,
1240 .minus_equal => .assign_sub,
1241 .angle_bracket_angle_bracket_left_equal => .assign_bit_shift_left,
1242 .angle_bracket_angle_bracket_right_equal => .assign_bit_shift_right,
1243 .ampersand_equal => .assign_bit_and,
1244 .caret_equal => .assign_bit_xor,
1245 .pipe_equal => .assign_bit_or,
1246 .asterisk_percent_equal => .assign_mul_wrap,
1247 .plus_percent_equal => .assign_add_wrap,
1248 .minus_percent_equal => .assign_sub_wrap,
1249 .equal => .assign,
12501250 else => return expr,
12511251 };
12521252 return p.addNode(.{
......@@ -1295,7 +1295,7 @@ const Parser = struct {
12951295 return p.fail(.{ .InvalidToken = .{ .token = p.tok_i } });
12961296 }
12971297 res = try p.addNode(.{
1298 .tag = .BoolOr,
1298 .tag = .bool_or,
12991299 .main_token = or_token,
13001300 .data = .{
13011301 .lhs = res,
......@@ -1322,7 +1322,7 @@ const Parser = struct {
13221322 return p.fail(.{ .InvalidToken = .{ .token = p.tok_i } });
13231323 }
13241324 res = try p.addNode(.{
1325 .tag = .BoolAnd,
1325 .tag = .bool_and,
13261326 .main_token = and_token,
13271327 .data = .{
13281328 .lhs = res,
......@@ -1348,12 +1348,12 @@ const Parser = struct {
13481348 if (expr == 0) return null_node;
13491349
13501350 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1351 .equal_equal => .EqualEqual,
1352 .bang_equal => .BangEqual,
1353 .angle_bracket_left => .LessThan,
1354 .angle_bracket_right => .GreaterThan,
1355 .angle_bracket_left_equal => .LessOrEqual,
1356 .angle_bracket_right_equal => .GreaterOrEqual,
1351 .equal_equal => .equal_equal,
1352 .bang_equal => .bang_equal,
1353 .angle_bracket_left => .less_than,
1354 .angle_bracket_right => .greater_than,
1355 .angle_bracket_left_equal => .less_or_equal,
1356 .angle_bracket_right_equal => .greater_or_equal,
13571357 else => return expr,
13581358 };
13591359 return p.addNode(.{
......@@ -1379,10 +1379,10 @@ const Parser = struct {
13791379
13801380 while (true) {
13811381 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1382 .ampersand => .BitAnd,
1383 .caret => .BitXor,
1384 .pipe => .BitOr,
1385 .keyword_orelse => .OrElse,
1382 .ampersand => .bit_and,
1383 .caret => .bit_xor,
1384 .pipe => .bit_or,
1385 .keyword_orelse => .@"orelse",
13861386 .keyword_catch => {
13871387 const catch_token = p.nextToken();
13881388 _ = try p.parsePayload();
......@@ -1391,7 +1391,7 @@ const Parser = struct {
13911391 return p.fail(.{ .InvalidToken = .{ .token = p.tok_i } });
13921392 }
13931393 res = try p.addNode(.{
1394 .tag = .Catch,
1394 .tag = .@"catch",
13951395 .main_token = catch_token,
13961396 .data = .{
13971397 .lhs = res,
......@@ -1432,8 +1432,8 @@ const Parser = struct {
14321432
14331433 while (true) {
14341434 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1435 .angle_bracket_angle_bracket_left => .BitShiftLeft,
1436 .angle_bracket_angle_bracket_right => .BitShiftRight,
1435 .angle_bracket_angle_bracket_left => .bit_shift_left,
1436 .angle_bracket_angle_bracket_right => .bit_shift_right,
14371437 else => return res,
14381438 };
14391439 res = try p.addNode(.{
......@@ -1469,11 +1469,11 @@ const Parser = struct {
14691469
14701470 while (true) {
14711471 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1472 .plus => .Add,
1473 .minus => .Sub,
1474 .plus_plus => .ArrayCat,
1475 .plus_percent => .AddWrap,
1476 .minus_percent => .SubWrap,
1472 .plus => .add,
1473 .minus => .sub,
1474 .plus_plus => .array_cat,
1475 .plus_percent => .add_wrap,
1476 .minus_percent => .sub_wrap,
14771477 else => return res,
14781478 };
14791479 res = try p.addNode(.{
......@@ -1509,12 +1509,12 @@ const Parser = struct {
15091509
15101510 while (true) {
15111511 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1512 .pipe_pipe => .MergeErrorSets,
1513 .asterisk => .Mul,
1514 .slash => .Div,
1515 .percent => .Mod,
1516 .asterisk_asterisk => .ArrayMult,
1517 .asterisk_percent => .MulWrap,
1512 .pipe_pipe => .merge_error_sets,
1513 .asterisk => .mul,
1514 .slash => .div,
1515 .percent => .mod,
1516 .asterisk_asterisk => .array_mult,
1517 .asterisk_percent => .mul_wrap,
15181518 else => return res,
15191519 };
15201520 res = try p.addNode(.{
......@@ -1547,13 +1547,13 @@ const Parser = struct {
15471547 /// / KEYWORD_await
15481548 fn parsePrefixExpr(p: *Parser) Error!Node.Index {
15491549 const tag: Node.Tag = switch (p.token_tags[p.tok_i]) {
1550 .bang => .BoolNot,
1551 .minus => .Negation,
1552 .tilde => .BitNot,
1553 .minus_percent => .NegationWrap,
1554 .ampersand => .AddressOf,
1555 .keyword_try => .Try,
1556 .keyword_await => .Await,
1550 .bang => .bool_not,
1551 .minus => .negation,
1552 .tilde => .bit_not,
1553 .minus_percent => .negation_wrap,
1554 .ampersand => .address_of,
1555 .keyword_try => .@"try",
1556 .keyword_await => .@"await",
15571557 else => return p.parsePrimaryExpr(),
15581558 };
15591559 return p.addNode(.{
......@@ -1588,7 +1588,7 @@ const Parser = struct {
15881588 fn parseTypeExpr(p: *Parser) Error!Node.Index {
15891589 switch (p.token_tags[p.tok_i]) {
15901590 .question_mark => return p.addNode(.{
1591 .tag = .OptionalType,
1591 .tag = .optional_type,
15921592 .main_token = p.nextToken(),
15931593 .data = .{
15941594 .lhs = try p.expectTypeExpr(),
......@@ -1597,7 +1597,7 @@ const Parser = struct {
15971597 }),
15981598 .keyword_anyframe => switch (p.token_tags[p.tok_i + 1]) {
15991599 .arrow => return p.addNode(.{
1600 .tag = .AnyFrameType,
1600 .tag = .anyframe_type,
16011601 .main_token = p.nextToken(),
16021602 .data = .{
16031603 .lhs = p.nextToken(),
......@@ -1612,7 +1612,7 @@ const Parser = struct {
16121612 const elem_type = try p.expectTypeExpr();
16131613 if (mods.bit_range_start == 0) {
16141614 return p.addNode(.{
1615 .tag = .PtrTypeAligned,
1615 .tag = .ptr_type_aligned,
16161616 .main_token = asterisk,
16171617 .data = .{
16181618 .lhs = mods.align_node,
......@@ -1621,7 +1621,7 @@ const Parser = struct {
16211621 });
16221622 } else {
16231623 return p.addNode(.{
1624 .tag = .PtrTypeBitRange,
1624 .tag = .ptr_type_bit_range,
16251625 .main_token = asterisk,
16261626 .data = .{
16271627 .lhs = try p.addExtra(Node.PtrTypeBitRange{
......@@ -1642,7 +1642,7 @@ const Parser = struct {
16421642 const inner: Node.Index = inner: {
16431643 if (mods.bit_range_start == 0) {
16441644 break :inner try p.addNode(.{
1645 .tag = .PtrTypeAligned,
1645 .tag = .ptr_type_aligned,
16461646 .main_token = asterisk,
16471647 .data = .{
16481648 .lhs = mods.align_node,
......@@ -1651,7 +1651,7 @@ const Parser = struct {
16511651 });
16521652 } else {
16531653 break :inner try p.addNode(.{
1654 .tag = .PtrTypeBitRange,
1654 .tag = .ptr_type_bit_range,
16551655 .main_token = asterisk,
16561656 .data = .{
16571657 .lhs = try p.addExtra(Node.PtrTypeBitRange{
......@@ -1666,7 +1666,7 @@ const Parser = struct {
16661666 }
16671667 };
16681668 return p.addNode(.{
1669 .tag = .PtrTypeAligned,
1669 .tag = .ptr_type_aligned,
16701670 .main_token = asterisk,
16711671 .data = .{
16721672 .lhs = 0,
......@@ -1698,7 +1698,7 @@ const Parser = struct {
16981698 if (mods.bit_range_start == 0) {
16991699 if (sentinel == 0) {
17001700 return p.addNode(.{
1701 .tag = .PtrTypeAligned,
1701 .tag = .ptr_type_aligned,
17021702 .main_token = asterisk,
17031703 .data = .{
17041704 .lhs = mods.align_node,
......@@ -1707,7 +1707,7 @@ const Parser = struct {
17071707 });
17081708 } else if (mods.align_node == 0) {
17091709 return p.addNode(.{
1710 .tag = .PtrTypeSentinel,
1710 .tag = .ptr_type_sentinel,
17111711 .main_token = asterisk,
17121712 .data = .{
17131713 .lhs = sentinel,
......@@ -1716,7 +1716,7 @@ const Parser = struct {
17161716 });
17171717 } else {
17181718 return p.addNode(.{
1719 .tag = .PtrType,
1719 .tag = .ptr_type,
17201720 .main_token = asterisk,
17211721 .data = .{
17221722 .lhs = try p.addExtra(Node.PtrType{
......@@ -1729,7 +1729,7 @@ const Parser = struct {
17291729 }
17301730 } else {
17311731 return p.addNode(.{
1732 .tag = .PtrTypeBitRange,
1732 .tag = .ptr_type_bit_range,
17331733 .main_token = asterisk,
17341734 .data = .{
17351735 .lhs = try p.addExtra(Node.PtrTypeBitRange{
......@@ -1762,7 +1762,7 @@ const Parser = struct {
17621762 if (len_expr == 0) {
17631763 if (sentinel == 0) {
17641764 return p.addNode(.{
1765 .tag = .PtrTypeAligned,
1765 .tag = .ptr_type_aligned,
17661766 .main_token = lbracket,
17671767 .data = .{
17681768 .lhs = mods.align_node,
......@@ -1771,7 +1771,7 @@ const Parser = struct {
17711771 });
17721772 } else if (mods.align_node == 0) {
17731773 return p.addNode(.{
1774 .tag = .PtrTypeSentinel,
1774 .tag = .ptr_type_sentinel,
17751775 .main_token = lbracket,
17761776 .data = .{
17771777 .lhs = sentinel,
......@@ -1780,7 +1780,7 @@ const Parser = struct {
17801780 });
17811781 } else {
17821782 return p.addNode(.{
1783 .tag = .PtrType,
1783 .tag = .ptr_type,
17841784 .main_token = lbracket,
17851785 .data = .{
17861786 .lhs = try p.addExtra(Node.PtrType{
......@@ -1800,7 +1800,7 @@ const Parser = struct {
18001800 }
18011801 if (sentinel == 0) {
18021802 return p.addNode(.{
1803 .tag = .ArrayType,
1803 .tag = .array_type,
18041804 .main_token = lbracket,
18051805 .data = .{
18061806 .lhs = len_expr,
......@@ -1809,7 +1809,7 @@ const Parser = struct {
18091809 });
18101810 } else {
18111811 return p.addNode(.{
1812 .tag = .ArrayTypeSentinel,
1812 .tag = .array_type_sentinel,
18131813 .main_token = lbracket,
18141814 .data = .{
18151815 .lhs = len_expr,
......@@ -1854,7 +1854,7 @@ const Parser = struct {
18541854 .keyword_break => {
18551855 p.tok_i += 1;
18561856 return p.addNode(.{
1857 .tag = .Break,
1857 .tag = .@"break",
18581858 .main_token = p.tok_i - 1,
18591859 .data = .{
18601860 .lhs = try p.parseBreakLabel(),
......@@ -1865,7 +1865,7 @@ const Parser = struct {
18651865 .keyword_continue => {
18661866 p.tok_i += 1;
18671867 return p.addNode(.{
1868 .tag = .Continue,
1868 .tag = .@"continue",
18691869 .main_token = p.tok_i - 1,
18701870 .data = .{
18711871 .lhs = try p.parseBreakLabel(),
......@@ -1876,7 +1876,7 @@ const Parser = struct {
18761876 .keyword_comptime => {
18771877 p.tok_i += 1;
18781878 return p.addNode(.{
1879 .tag = .Comptime,
1879 .tag = .@"comptime",
18801880 .main_token = p.tok_i - 1,
18811881 .data = .{
18821882 .lhs = try p.expectExpr(),
......@@ -1887,7 +1887,7 @@ const Parser = struct {
18871887 .keyword_nosuspend => {
18881888 p.tok_i += 1;
18891889 return p.addNode(.{
1890 .tag = .Nosuspend,
1890 .tag = .@"nosuspend",
18911891 .main_token = p.tok_i - 1,
18921892 .data = .{
18931893 .lhs = try p.expectExpr(),
......@@ -1898,7 +1898,7 @@ const Parser = struct {
18981898 .keyword_resume => {
18991899 p.tok_i += 1;
19001900 return p.addNode(.{
1901 .tag = .Resume,
1901 .tag = .@"resume",
19021902 .main_token = p.tok_i - 1,
19031903 .data = .{
19041904 .lhs = try p.expectExpr(),
......@@ -1909,7 +1909,7 @@ const Parser = struct {
19091909 .keyword_return => {
19101910 p.tok_i += 1;
19111911 return p.addNode(.{
1912 .tag = .Return,
1912 .tag = .@"return",
19131913 .main_token = p.tok_i - 1,
19141914 .data = .{
19151915 .lhs = try p.parseExpr(),
......@@ -1976,7 +1976,7 @@ const Parser = struct {
19761976
19771977 if (p.eatToken(.r_brace)) |_| {
19781978 return p.addNode(.{
1979 .tag = .BlockTwo,
1979 .tag = .block_two,
19801980 .main_token = lbrace,
19811981 .data = .{
19821982 .lhs = 0,
......@@ -1989,7 +1989,7 @@ const Parser = struct {
19891989 if (p.eatToken(.r_brace)) |_| {
19901990 const semicolon = p.token_tags[p.tok_i - 2] == .semicolon;
19911991 return p.addNode(.{
1992 .tag = if (semicolon) .BlockTwoSemicolon else .BlockTwo,
1992 .tag = if (semicolon) .block_two_semicolon else .block_two,
19931993 .main_token = lbrace,
19941994 .data = .{
19951995 .lhs = stmt_one,
......@@ -2001,7 +2001,7 @@ const Parser = struct {
20012001 if (p.eatToken(.r_brace)) |_| {
20022002 const semicolon = p.token_tags[p.tok_i - 2] == .semicolon;
20032003 return p.addNode(.{
2004 .tag = if (semicolon) .BlockTwoSemicolon else .BlockTwo,
2004 .tag = if (semicolon) .block_two_semicolon else .block_two,
20052005 .main_token = lbrace,
20062006 .data = .{
20072007 .lhs = stmt_one,
......@@ -2025,7 +2025,7 @@ const Parser = struct {
20252025 const semicolon = p.token_tags[p.tok_i - 2] == .semicolon;
20262026 const statements_span = try p.listToSpan(statements.items);
20272027 return p.addNode(.{
2028 .tag = if (semicolon) .BlockSemicolon else .Block,
2028 .tag = if (semicolon) .block_semicolon else .block,
20292029 .main_token = lbrace,
20302030 .data = .{
20312031 .lhs = statements_span.start,
......@@ -2046,7 +2046,7 @@ const Parser = struct {
20462046 const then_expr = try p.expectExpr();
20472047 const else_token = p.eatToken(.keyword_else) orelse {
20482048 return p.addNode(.{
2049 .tag = .ForSimple,
2049 .tag = .for_simple,
20502050 .main_token = for_token,
20512051 .data = .{
20522052 .lhs = array_expr,
......@@ -2056,7 +2056,7 @@ const Parser = struct {
20562056 };
20572057 const else_expr = try p.expectExpr();
20582058 return p.addNode(.{
2059 .tag = .For,
2059 .tag = .@"for",
20602060 .main_token = for_token,
20612061 .data = .{
20622062 .lhs = array_expr,
......@@ -2082,7 +2082,7 @@ const Parser = struct {
20822082 const else_token = p.eatToken(.keyword_else) orelse {
20832083 if (cont_expr == 0) {
20842084 return p.addNode(.{
2085 .tag = .WhileSimple,
2085 .tag = .while_simple,
20862086 .main_token = while_token,
20872087 .data = .{
20882088 .lhs = condition,
......@@ -2091,7 +2091,7 @@ const Parser = struct {
20912091 });
20922092 } else {
20932093 return p.addNode(.{
2094 .tag = .WhileCont,
2094 .tag = .while_cont,
20952095 .main_token = while_token,
20962096 .data = .{
20972097 .lhs = condition,
......@@ -2106,7 +2106,7 @@ const Parser = struct {
21062106 const else_payload = try p.parsePayload();
21072107 const else_expr = try p.expectExpr();
21082108 return p.addNode(.{
2109 .tag = .While,
2109 .tag = .@"while",
21102110 .main_token = while_token,
21112111 .data = .{
21122112 .lhs = condition,
......@@ -2134,7 +2134,7 @@ const Parser = struct {
21342134
21352135 if (p.eatToken(.r_brace)) |_| {
21362136 return p.addNode(.{
2137 .tag = .StructInitOne,
2137 .tag = .struct_init_one,
21382138 .main_token = lbrace,
21392139 .data = .{
21402140 .lhs = lhs,
......@@ -2147,7 +2147,7 @@ const Parser = struct {
21472147 const comma_one = p.eatToken(.comma);
21482148 if (p.eatToken(.r_brace)) |_| {
21492149 return p.addNode(.{
2150 .tag = if (comma_one != null) .StructInitOneComma else .StructInitOne,
2150 .tag = if (comma_one != null) .struct_init_one_comma else .struct_init_one,
21512151 .main_token = lbrace,
21522152 .data = .{
21532153 .lhs = lhs,
......@@ -2192,7 +2192,7 @@ const Parser = struct {
21922192 }
21932193 const span = try p.listToSpan(init_list.items);
21942194 return p.addNode(.{
2195 .tag = if (p.token_tags[p.tok_i - 2] == .comma) .StructInitComma else .StructInit,
2195 .tag = if (p.token_tags[p.tok_i - 2] == .comma) .struct_init_comma else .struct_init,
21962196 .main_token = lbrace,
21972197 .data = .{
21982198 .lhs = lhs,
......@@ -2208,7 +2208,7 @@ const Parser = struct {
22082208 const comma_one = p.eatToken(.comma);
22092209 if (p.eatToken(.r_brace)) |_| {
22102210 return p.addNode(.{
2211 .tag = if (comma_one != null) .ArrayInitOneComma else .ArrayInitOne,
2211 .tag = if (comma_one != null) .array_init_one_comma else .array_init_one,
22122212 .main_token = lbrace,
22132213 .data = .{
22142214 .lhs = lhs,
......@@ -2239,7 +2239,7 @@ const Parser = struct {
22392239 _ = try p.expectToken(.r_brace);
22402240 const span = try p.listToSpan(init_list.items);
22412241 return p.addNode(.{
2242 .tag = if (trailing_comma) .ArrayInitComma else .ArrayInit,
2242 .tag = if (trailing_comma) .array_init_comma else .array_init,
22432243 .main_token = lbrace,
22442244 .data = .{
22452245 .lhs = lhs,
......@@ -2257,7 +2257,7 @@ const Parser = struct {
22572257 if (suffix_expr == 0) return null_node;
22582258 const bang = p.eatToken(.bang) orelse return suffix_expr;
22592259 return p.addNode(.{
2260 .tag = .ErrorUnion,
2260 .tag = .error_union,
22612261 .main_token = bang,
22622262 .data = .{
22632263 .lhs = suffix_expr,
......@@ -2286,7 +2286,7 @@ const Parser = struct {
22862286 };
22872287 if (p.eatToken(.r_paren)) |_| {
22882288 return p.addNode(.{
2289 .tag = .AsyncCallOne,
2289 .tag = .async_call_one,
22902290 .main_token = lparen,
22912291 .data = .{
22922292 .lhs = res,
......@@ -2298,7 +2298,7 @@ const Parser = struct {
22982298 const comma_one = p.eatToken(.comma);
22992299 if (p.eatToken(.r_paren)) |_| {
23002300 return p.addNode(.{
2301 .tag = if (comma_one == null) .AsyncCallOne else .AsyncCallOneComma,
2301 .tag = if (comma_one == null) .async_call_one else .async_call_one_comma,
23022302 .main_token = lparen,
23032303 .data = .{
23042304 .lhs = res,
......@@ -2325,7 +2325,7 @@ const Parser = struct {
23252325 if (p.eatToken(.r_paren)) |_| {
23262326 const span = try p.listToSpan(param_list.items);
23272327 return p.addNode(.{
2328 .tag = .AsyncCallComma,
2328 .tag = .async_call_comma,
23292329 .main_token = lparen,
23302330 .data = .{
23312331 .lhs = res,
......@@ -2342,7 +2342,7 @@ const Parser = struct {
23422342 .r_paren => {
23432343 const span = try p.listToSpan(param_list.items);
23442344 return p.addNode(.{
2345 .tag = .AsyncCall,
2345 .tag = .async_call,
23462346 .main_token = lparen,
23472347 .data = .{
23482348 .lhs = res,
......@@ -2387,7 +2387,7 @@ const Parser = struct {
23872387 const lparen = p.eatToken(.l_paren) orelse return res;
23882388 if (p.eatToken(.r_paren)) |_| {
23892389 break :res try p.addNode(.{
2390 .tag = .CallOne,
2390 .tag = .call_one,
23912391 .main_token = lparen,
23922392 .data = .{
23932393 .lhs = res,
......@@ -2399,7 +2399,7 @@ const Parser = struct {
23992399 const comma_one = p.eatToken(.comma);
24002400 if (p.eatToken(.r_paren)) |_| {
24012401 break :res try p.addNode(.{
2402 .tag = if (comma_one == null) .CallOne else .CallOneComma,
2402 .tag = if (comma_one == null) .call_one else .call_one_comma,
24032403 .main_token = lparen,
24042404 .data = .{
24052405 .lhs = res,
......@@ -2426,7 +2426,7 @@ const Parser = struct {
24262426 if (p.eatToken(.r_paren)) |_| {
24272427 const span = try p.listToSpan(param_list.items);
24282428 break :res try p.addNode(.{
2429 .tag = .CallComma,
2429 .tag = .call_comma,
24302430 .main_token = lparen,
24312431 .data = .{
24322432 .lhs = res,
......@@ -2443,7 +2443,7 @@ const Parser = struct {
24432443 .r_paren => {
24442444 const span = try p.listToSpan(param_list.items);
24452445 break :res try p.addNode(.{
2446 .tag = .Call,
2446 .tag = .call,
24472447 .main_token = lparen,
24482448 .data = .{
24492449 .lhs = res,
......@@ -2518,7 +2518,7 @@ const Parser = struct {
25182518 fn parsePrimaryTypeExpr(p: *Parser) !Node.Index {
25192519 switch (p.token_tags[p.tok_i]) {
25202520 .char_literal => return p.addNode(.{
2521 .tag = .CharLiteral,
2521 .tag = .char_literal,
25222522 .main_token = p.nextToken(),
25232523 .data = .{
25242524 .lhs = undefined,
......@@ -2526,7 +2526,7 @@ const Parser = struct {
25262526 },
25272527 }),
25282528 .integer_literal => return p.addNode(.{
2529 .tag = .IntegerLiteral,
2529 .tag = .integer_literal,
25302530 .main_token = p.nextToken(),
25312531 .data = .{
25322532 .lhs = undefined,
......@@ -2534,7 +2534,7 @@ const Parser = struct {
25342534 },
25352535 }),
25362536 .float_literal => return p.addNode(.{
2537 .tag = .FloatLiteral,
2537 .tag = .float_literal,
25382538 .main_token = p.nextToken(),
25392539 .data = .{
25402540 .lhs = undefined,
......@@ -2542,7 +2542,7 @@ const Parser = struct {
25422542 },
25432543 }),
25442544 .keyword_false => return p.addNode(.{
2545 .tag = .FalseLiteral,
2545 .tag = .false_literal,
25462546 .main_token = p.nextToken(),
25472547 .data = .{
25482548 .lhs = undefined,
......@@ -2550,7 +2550,7 @@ const Parser = struct {
25502550 },
25512551 }),
25522552 .keyword_true => return p.addNode(.{
2553 .tag = .TrueLiteral,
2553 .tag = .true_literal,
25542554 .main_token = p.nextToken(),
25552555 .data = .{
25562556 .lhs = undefined,
......@@ -2558,7 +2558,7 @@ const Parser = struct {
25582558 },
25592559 }),
25602560 .keyword_null => return p.addNode(.{
2561 .tag = .NullLiteral,
2561 .tag = .null_literal,
25622562 .main_token = p.nextToken(),
25632563 .data = .{
25642564 .lhs = undefined,
......@@ -2566,7 +2566,7 @@ const Parser = struct {
25662566 },
25672567 }),
25682568 .keyword_undefined => return p.addNode(.{
2569 .tag = .UndefinedLiteral,
2569 .tag = .undefined_literal,
25702570 .main_token = p.nextToken(),
25712571 .data = .{
25722572 .lhs = undefined,
......@@ -2574,7 +2574,7 @@ const Parser = struct {
25742574 },
25752575 }),
25762576 .keyword_unreachable => return p.addNode(.{
2577 .tag = .UnreachableLiteral,
2577 .tag = .unreachable_literal,
25782578 .main_token = p.nextToken(),
25792579 .data = .{
25802580 .lhs = undefined,
......@@ -2582,7 +2582,7 @@ const Parser = struct {
25822582 },
25832583 }),
25842584 .keyword_anyframe => return p.addNode(.{
2585 .tag = .AnyFrameLiteral,
2585 .tag = .anyframe_literal,
25862586 .main_token = p.nextToken(),
25872587 .data = .{
25882588 .lhs = undefined,
......@@ -2592,7 +2592,7 @@ const Parser = struct {
25922592 .string_literal => {
25932593 const main_token = p.nextToken();
25942594 return p.addNode(.{
2595 .tag = .StringLiteral,
2595 .tag = .string_literal,
25962596 .main_token = main_token,
25972597 .data = .{
25982598 .lhs = main_token,
......@@ -2620,7 +2620,7 @@ const Parser = struct {
26202620 => return p.parseContainerDeclAuto(),
26212621
26222622 .keyword_comptime => return p.addNode(.{
2623 .tag = .Comptime,
2623 .tag = .@"comptime",
26242624 .main_token = p.nextToken(),
26252625 .data = .{
26262626 .lhs = try p.expectTypeExpr(),
......@@ -2633,7 +2633,7 @@ const Parser = struct {
26332633 p.tok_i += 1;
26342634 }
26352635 return p.addNode(.{
2636 .tag = .StringLiteral,
2636 .tag = .string_literal,
26372637 .main_token = first_line,
26382638 .data = .{
26392639 .lhs = first_line,
......@@ -2662,7 +2662,7 @@ const Parser = struct {
26622662 return p.parseWhileTypeExpr();
26632663 },
26642664 else => return p.addNode(.{
2665 .tag = .Identifier,
2665 .tag = .identifier,
26662666 .main_token = p.nextToken(),
26672667 .data = .{
26682668 .lhs = undefined,
......@@ -2671,7 +2671,7 @@ const Parser = struct {
26712671 }),
26722672 },
26732673 else => return p.addNode(.{
2674 .tag = .Identifier,
2674 .tag = .identifier,
26752675 .main_token = p.nextToken(),
26762676 .data = .{
26772677 .lhs = undefined,
......@@ -2681,7 +2681,7 @@ const Parser = struct {
26812681 },
26822682 .period => switch (p.token_tags[p.tok_i + 1]) {
26832683 .identifier => return p.addNode(.{
2684 .tag = .EnumLiteral,
2684 .tag = .enum_literal,
26852685 .data = .{
26862686 .lhs = p.nextToken(), // dot
26872687 .rhs = undefined,
......@@ -2697,7 +2697,7 @@ const Parser = struct {
26972697
26982698 if (p.eatToken(.r_brace)) |_| {
26992699 return p.addNode(.{
2700 .tag = .StructInitDotTwo,
2700 .tag = .struct_init_dot_two,
27012701 .main_token = lbrace,
27022702 .data = .{
27032703 .lhs = 0,
......@@ -2710,7 +2710,7 @@ const Parser = struct {
27102710 const comma_one = p.eatToken(.comma);
27112711 if (p.eatToken(.r_brace)) |_| {
27122712 return p.addNode(.{
2713 .tag = if (comma_one != null) .StructInitDotTwoComma else .StructInitDotTwo,
2713 .tag = if (comma_one != null) .struct_init_dot_two_comma else .struct_init_dot_two,
27142714 .main_token = lbrace,
27152715 .data = .{
27162716 .lhs = field_init_one,
......@@ -2727,7 +2727,7 @@ const Parser = struct {
27272727 const comma_two = p.eatToken(.comma);
27282728 if (p.eatToken(.r_brace)) |_| {
27292729 return p.addNode(.{
2730 .tag = if (comma_two != null) .StructInitDotTwoComma else .StructInitDotTwo,
2730 .tag = if (comma_two != null) .struct_init_dot_two_comma else .struct_init_dot_two,
27312731 .main_token = lbrace,
27322732 .data = .{
27332733 .lhs = field_init_one,
......@@ -2778,7 +2778,7 @@ const Parser = struct {
27782778 const span = try p.listToSpan(init_list.items);
27792779 const trailing_comma = p.token_tags[p.tok_i - 2] == .comma;
27802780 return p.addNode(.{
2781 .tag = if (trailing_comma) .StructInitDotComma else .StructInitDot,
2781 .tag = if (trailing_comma) .struct_init_dot_comma else .struct_init_dot,
27822782 .main_token = lbrace,
27832783 .data = .{
27842784 .lhs = span.start,
......@@ -2791,7 +2791,7 @@ const Parser = struct {
27912791 const comma_one = p.eatToken(.comma);
27922792 if (p.eatToken(.r_brace)) |_| {
27932793 return p.addNode(.{
2794 .tag = if (comma_one != null) .ArrayInitDotTwoComma else .ArrayInitDotTwo,
2794 .tag = if (comma_one != null) .array_init_dot_two_comma else .array_init_dot_two,
27952795 .main_token = lbrace,
27962796 .data = .{
27972797 .lhs = elem_init_one,
......@@ -2808,7 +2808,7 @@ const Parser = struct {
28082808 const comma_two = p.eatToken(.comma);
28092809 if (p.eatToken(.r_brace)) |_| {
28102810 return p.addNode(.{
2811 .tag = if (comma_two != null) .ArrayInitDotTwoComma else .ArrayInitDotTwo,
2811 .tag = if (comma_two != null) .array_init_dot_two_comma else .array_init_dot_two,
28122812 .main_token = lbrace,
28132813 .data = .{
28142814 .lhs = elem_init_one,
......@@ -2858,7 +2858,7 @@ const Parser = struct {
28582858 }
28592859 const span = try p.listToSpan(init_list.items);
28602860 return p.addNode(.{
2861 .tag = if (p.token_tags[p.tok_i - 2] == .comma) .ArrayInitDotComma else .ArrayInitDot,
2861 .tag = if (p.token_tags[p.tok_i - 2] == .comma) .array_init_dot_comma else .array_init_dot,
28622862 .main_token = lbrace,
28632863 .data = .{
28642864 .lhs = span.start,
......@@ -2875,7 +2875,7 @@ const Parser = struct {
28752875
28762876 if (p.eatToken(.r_brace)) |rbrace| {
28772877 return p.addNode(.{
2878 .tag = .ErrorSetDecl,
2878 .tag = .error_set_decl,
28792879 .main_token = error_token,
28802880 .data = .{
28812881 .lhs = undefined,
......@@ -2913,7 +2913,7 @@ const Parser = struct {
29132913 }
29142914 }
29152915 return p.addNode(.{
2916 .tag = .ErrorSetDecl,
2916 .tag = .error_set_decl,
29172917 .main_token = error_token,
29182918 .data = .{
29192919 .lhs = undefined,
......@@ -2922,7 +2922,7 @@ const Parser = struct {
29222922 });
29232923 },
29242924 else => return p.addNode(.{
2925 .tag = .ErrorValue,
2925 .tag = .error_value,
29262926 .main_token = p.nextToken(),
29272927 .data = .{
29282928 .lhs = try p.expectToken(.period),
......@@ -2931,7 +2931,7 @@ const Parser = struct {
29312931 }),
29322932 },
29332933 .l_paren => return p.addNode(.{
2934 .tag = .GroupedExpression,
2934 .tag = .grouped_expression,
29352935 .main_token = p.nextToken(),
29362936 .data = .{
29372937 .lhs = try p.expectExpr(),
......@@ -2962,7 +2962,7 @@ const Parser = struct {
29622962 const then_expr = try p.expectExpr();
29632963 const else_token = p.eatToken(.keyword_else) orelse {
29642964 return p.addNode(.{
2965 .tag = .ForSimple,
2965 .tag = .for_simple,
29662966 .main_token = for_token,
29672967 .data = .{
29682968 .lhs = array_expr,
......@@ -2972,7 +2972,7 @@ const Parser = struct {
29722972 };
29732973 const else_expr = try p.expectTypeExpr();
29742974 return p.addNode(.{
2975 .tag = .For,
2975 .tag = .@"for",
29762976 .main_token = for_token,
29772977 .data = .{
29782978 .lhs = array_expr,
......@@ -2998,7 +2998,7 @@ const Parser = struct {
29982998 const else_token = p.eatToken(.keyword_else) orelse {
29992999 if (cont_expr == 0) {
30003000 return p.addNode(.{
3001 .tag = .WhileSimple,
3001 .tag = .while_simple,
30023002 .main_token = while_token,
30033003 .data = .{
30043004 .lhs = condition,
......@@ -3007,7 +3007,7 @@ const Parser = struct {
30073007 });
30083008 } else {
30093009 return p.addNode(.{
3010 .tag = .WhileCont,
3010 .tag = .while_cont,
30113011 .main_token = while_token,
30123012 .data = .{
30133013 .lhs = condition,
......@@ -3022,7 +3022,7 @@ const Parser = struct {
30223022 const else_payload = try p.parsePayload();
30233023 const else_expr = try p.expectTypeExpr();
30243024 return p.addNode(.{
3025 .tag = .While,
3025 .tag = .@"while",
30263026 .main_token = while_token,
30273027 .data = .{
30283028 .lhs = condition,
......@@ -3047,7 +3047,7 @@ const Parser = struct {
30473047 _ = try p.expectToken(.r_brace);
30483048
30493049 return p.addNode(.{
3050 .tag = if (trailing_comma) .SwitchComma else .Switch,
3050 .tag = if (trailing_comma) .switch_comma else .@"switch",
30513051 .main_token = switch_token,
30523052 .data = .{
30533053 .lhs = expr_node,
......@@ -3074,7 +3074,7 @@ const Parser = struct {
30743074
30753075 if (p.eatToken(.r_paren)) |rparen| {
30763076 return p.addNode(.{
3077 .tag = .AsmSimple,
3077 .tag = .asm_simple,
30783078 .main_token = asm_token,
30793079 .data = .{
30803080 .lhs = template,
......@@ -3140,7 +3140,7 @@ const Parser = struct {
31403140 const rparen = try p.expectToken(.r_paren);
31413141 const span = try p.listToSpan(list.items);
31423142 return p.addNode(.{
3143 .tag = .Asm,
3143 .tag = .@"asm",
31443144 .main_token = asm_token,
31453145 .data = .{
31463146 .lhs = template,
......@@ -3170,7 +3170,7 @@ const Parser = struct {
31703170 };
31713171 const rparen = try p.expectToken(.r_paren);
31723172 return p.addNode(.{
3173 .tag = .AsmOutput,
3173 .tag = .asm_output,
31743174 .main_token = identifier,
31753175 .data = .{
31763176 .lhs = type_expr,
......@@ -3189,7 +3189,7 @@ const Parser = struct {
31893189 const expr = try p.expectExpr();
31903190 const rparen = try p.expectToken(.r_paren);
31913191 return p.addNode(.{
3192 .tag = .AsmInput,
3192 .tag = .asm_input,
31933193 .main_token = identifier,
31943194 .data = .{
31953195 .lhs = expr,
......@@ -3336,7 +3336,7 @@ const Parser = struct {
33363336 const arrow_token = try p.expectToken(.equal_angle_bracket_right);
33373337 _ = try p.parsePtrPayload();
33383338 return p.addNode(.{
3339 .tag = .SwitchCaseOne,
3339 .tag = .switch_case_one,
33403340 .main_token = arrow_token,
33413341 .data = .{
33423342 .lhs = 0,
......@@ -3350,7 +3350,7 @@ const Parser = struct {
33503350 if (p.eatToken(.equal_angle_bracket_right)) |arrow_token| {
33513351 _ = try p.parsePtrPayload();
33523352 return p.addNode(.{
3353 .tag = .SwitchCaseOne,
3353 .tag = .switch_case_one,
33543354 .main_token = arrow_token,
33553355 .data = .{
33563356 .lhs = first_item,
......@@ -3372,7 +3372,7 @@ const Parser = struct {
33723372 const arrow_token = try p.expectToken(.equal_angle_bracket_right);
33733373 _ = try p.parsePtrPayload();
33743374 return p.addNode(.{
3375 .tag = .SwitchCase,
3375 .tag = .switch_case,
33763376 .main_token = arrow_token,
33773377 .data = .{
33783378 .lhs = try p.addExtra(Node.SubRange{
......@@ -3391,7 +3391,7 @@ const Parser = struct {
33913391
33923392 if (p.eatToken(.ellipsis3)) |token| {
33933393 return p.addNode(.{
3394 .tag = .SwitchRange,
3394 .tag = .switch_range,
33953395 .main_token = token,
33963396 .data = .{
33973397 .lhs = expr,
......@@ -3485,7 +3485,7 @@ const Parser = struct {
34853485 if (end_expr == 0) {
34863486 _ = try p.expectToken(.r_bracket);
34873487 return p.addNode(.{
3488 .tag = .SliceOpen,
3488 .tag = .slice_open,
34893489 .main_token = lbracket,
34903490 .data = .{
34913491 .lhs = lhs,
......@@ -3497,7 +3497,7 @@ const Parser = struct {
34973497 const sentinel = try p.parseExpr();
34983498 _ = try p.expectToken(.r_bracket);
34993499 return p.addNode(.{
3500 .tag = .SliceSentinel,
3500 .tag = .slice_sentinel,
35013501 .main_token = lbracket,
35023502 .data = .{
35033503 .lhs = lhs,
......@@ -3511,7 +3511,7 @@ const Parser = struct {
35113511 } else {
35123512 _ = try p.expectToken(.r_bracket);
35133513 return p.addNode(.{
3514 .tag = .Slice,
3514 .tag = .slice,
35153515 .main_token = lbracket,
35163516 .data = .{
35173517 .lhs = lhs,
......@@ -3525,7 +3525,7 @@ const Parser = struct {
35253525 }
35263526 _ = try p.expectToken(.r_bracket);
35273527 return p.addNode(.{
3528 .tag = .ArrayAccess,
3528 .tag = .array_access,
35293529 .main_token = lbracket,
35303530 .data = .{
35313531 .lhs = lhs,
......@@ -3534,7 +3534,7 @@ const Parser = struct {
35343534 });
35353535 },
35363536 .period_asterisk => return p.addNode(.{
3537 .tag = .Deref,
3537 .tag = .deref,
35383538 .main_token = p.nextToken(),
35393539 .data = .{
35403540 .lhs = lhs,
......@@ -3545,7 +3545,7 @@ const Parser = struct {
35453545 const period_asterisk = p.nextToken();
35463546 try p.warn(.{ .AsteriskAfterPointerDereference = .{ .token = period_asterisk } });
35473547 return p.addNode(.{
3548 .tag = .Deref,
3548 .tag = .deref,
35493549 .main_token = period_asterisk,
35503550 .data = .{
35513551 .lhs = lhs,
......@@ -3555,7 +3555,7 @@ const Parser = struct {
35553555 },
35563556 .period => switch (p.token_tags[p.tok_i + 1]) {
35573557 .identifier => return p.addNode(.{
3558 .tag = .FieldAccess,
3558 .tag = .field_access,
35593559 .main_token = p.nextToken(),
35603560 .data = .{
35613561 .lhs = lhs,
......@@ -3563,7 +3563,7 @@ const Parser = struct {
35633563 },
35643564 }),
35653565 .question_mark => return p.addNode(.{
3566 .tag = .UnwrapOptional,
3566 .tag = .unwrap_optional,
35673567 .main_token = p.nextToken(),
35683568 .data = .{
35693569 .lhs = lhs,
......@@ -3613,8 +3613,8 @@ const Parser = struct {
36133613 _ = try p.expectToken(.r_brace);
36143614 return p.addNode(.{
36153615 .tag = switch (members.trailing_comma) {
3616 true => .TaggedUnionEnumTagComma,
3617 false => .TaggedUnionEnumTag,
3616 true => .tagged_union_enum_tag_comma,
3617 false => .tagged_union_enum_tag,
36183618 },
36193619 .main_token = main_token,
36203620 .data = .{
......@@ -3631,8 +3631,8 @@ const Parser = struct {
36313631 if (members.len <= 2) {
36323632 return p.addNode(.{
36333633 .tag = switch (members.trailing_comma) {
3634 true => .TaggedUnionTwoComma,
3635 false => .TaggedUnionTwo,
3634 true => .tagged_union_two_comma,
3635 false => .tagged_union_two,
36363636 },
36373637 .main_token = main_token,
36383638 .data = .{
......@@ -3644,8 +3644,8 @@ const Parser = struct {
36443644 const span = try members.toSpan(p);
36453645 return p.addNode(.{
36463646 .tag = switch (members.trailing_comma) {
3647 true => .TaggedUnionComma,
3648 false => .TaggedUnion,
3647 true => .tagged_union_comma,
3648 false => .tagged_union,
36493649 },
36503650 .main_token = main_token,
36513651 .data = .{
......@@ -3673,8 +3673,8 @@ const Parser = struct {
36733673 if (members.len <= 2) {
36743674 return p.addNode(.{
36753675 .tag = switch (members.trailing_comma) {
3676 true => .ContainerDeclTwoComma,
3677 false => .ContainerDeclTwo,
3676 true => .container_decl_two_comma,
3677 false => .container_decl_two,
36783678 },
36793679 .main_token = main_token,
36803680 .data = .{
......@@ -3686,8 +3686,8 @@ const Parser = struct {
36863686 const span = try members.toSpan(p);
36873687 return p.addNode(.{
36883688 .tag = switch (members.trailing_comma) {
3689 true => .ContainerDeclComma,
3690 false => .ContainerDecl,
3689 true => .container_decl_comma,
3690 false => .container_decl,
36913691 },
36923692 .main_token = main_token,
36933693 .data = .{
......@@ -3700,8 +3700,8 @@ const Parser = struct {
37003700 const span = try members.toSpan(p);
37013701 return p.addNode(.{
37023702 .tag = switch (members.trailing_comma) {
3703 true => .ContainerDeclArgComma,
3704 false => .ContainerDeclArg,
3703 true => .container_decl_arg_comma,
3704 false => .container_decl_arg,
37053705 },
37063706 .main_token = main_token,
37073707 .data = .{
......@@ -3860,7 +3860,7 @@ const Parser = struct {
38603860 });
38613861 // Pretend this was an identifier so we can continue parsing.
38623862 return p.addNode(.{
3863 .tag = .Identifier,
3863 .tag = .identifier,
38643864 .main_token = builtin_token,
38653865 .data = .{
38663866 .lhs = undefined,
......@@ -3870,7 +3870,7 @@ const Parser = struct {
38703870 };
38713871 if (p.eatToken(.r_paren)) |_| {
38723872 return p.addNode(.{
3873 .tag = .BuiltinCallTwo,
3873 .tag = .builtin_call_two,
38743874 .main_token = builtin_token,
38753875 .data = .{
38763876 .lhs = 0,
......@@ -3883,7 +3883,7 @@ const Parser = struct {
38833883 .comma => {
38843884 if (p.eatToken(.r_paren)) |_| {
38853885 return p.addNode(.{
3886 .tag = .BuiltinCallTwoComma,
3886 .tag = .builtin_call_two_comma,
38873887 .main_token = builtin_token,
38883888 .data = .{
38893889 .lhs = param_one,
......@@ -3893,7 +3893,7 @@ const Parser = struct {
38933893 }
38943894 },
38953895 .r_paren => return p.addNode(.{
3896 .tag = .BuiltinCallTwo,
3896 .tag = .builtin_call_two,
38973897 .main_token = builtin_token,
38983898 .data = .{
38993899 .lhs = param_one,
......@@ -3914,7 +3914,7 @@ const Parser = struct {
39143914 .comma => {
39153915 if (p.eatToken(.r_paren)) |_| {
39163916 return p.addNode(.{
3917 .tag = .BuiltinCallTwoComma,
3917 .tag = .builtin_call_two_comma,
39183918 .main_token = builtin_token,
39193919 .data = .{
39203920 .lhs = param_one,
......@@ -3924,7 +3924,7 @@ const Parser = struct {
39243924 }
39253925 },
39263926 .r_paren => return p.addNode(.{
3927 .tag = .BuiltinCallTwo,
3927 .tag = .builtin_call_two,
39283928 .main_token = builtin_token,
39293929 .data = .{
39303930 .lhs = param_one,
......@@ -3954,7 +3954,7 @@ const Parser = struct {
39543954 if (p.eatToken(.r_paren)) |_| {
39553955 const params = try p.listToSpan(list.items);
39563956 return p.addNode(.{
3957 .tag = .BuiltinCallComma,
3957 .tag = .builtin_call_comma,
39583958 .main_token = builtin_token,
39593959 .data = .{
39603960 .lhs = params.start,
......@@ -3967,7 +3967,7 @@ const Parser = struct {
39673967 .r_paren => {
39683968 const params = try p.listToSpan(list.items);
39693969 return p.addNode(.{
3970 .tag = .BuiltinCall,
3970 .tag = .builtin_call,
39713971 .main_token = builtin_token,
39723972 .data = .{
39733973 .lhs = params.start,
......@@ -3993,7 +3993,7 @@ const Parser = struct {
39933993 .string_literal => {
39943994 const main_token = p.nextToken();
39953995 return p.addNode(.{
3996 .tag = .StringLiteral,
3996 .tag = .string_literal,
39973997 .main_token = main_token,
39983998 .data = .{
39993999 .lhs = main_token,
......@@ -4007,7 +4007,7 @@ const Parser = struct {
40074007 p.tok_i += 1;
40084008 }
40094009 return p.addNode(.{
4010 .tag = .StringLiteral,
4010 .tag = .string_literal,
40114011 .main_token = first_line,
40124012 .data = .{
40134013 .lhs = first_line,
......@@ -4029,7 +4029,7 @@ const Parser = struct {
40294029
40304030 fn expectIntegerLiteral(p: *Parser) !Node.Index {
40314031 return p.addNode(.{
4032 .tag = .IntegerLiteral,
4032 .tag = .integer_literal,
40334033 .main_token = try p.expectToken(.integer_literal),
40344034 .data = .{
40354035 .lhs = undefined,
......@@ -4050,7 +4050,7 @@ const Parser = struct {
40504050 if (then_expr == 0) return p.fail(.{ .InvalidToken = .{ .token = p.tok_i } });
40514051
40524052 const else_token = p.eatToken(.keyword_else) orelse return p.addNode(.{
4053 .tag = .IfSimple,
4053 .tag = .if_simple,
40544054 .main_token = if_token,
40554055 .data = .{
40564056 .lhs = condition,
......@@ -4062,7 +4062,7 @@ const Parser = struct {
40624062 if (else_expr == 0) return p.fail(.{ .InvalidToken = .{ .token = p.tok_i } });
40634063
40644064 return p.addNode(.{
4065 .tag = .If,
4065 .tag = .@"if",
40664066 .main_token = if_token,
40674067 .data = .{
40684068 .lhs = condition,
lib/std/zig/render.zig+228-228
......@@ -96,7 +96,7 @@ fn renderMember(ais: *Ais, tree: ast.Tree, decl: ast.Node.Index, space: Space) E
9696 const datas = tree.nodes.items(.data);
9797 try renderDocComments(ais, tree, tree.firstToken(decl));
9898 switch (tree.nodes.items(.tag)[decl]) {
99 .FnDecl => {
99 .fn_decl => {
100100 // Some examples:
101101 // pub extern "foo" fn ...
102102 // export fn ...
......@@ -132,16 +132,16 @@ fn renderMember(ais: *Ais, tree: ast.Tree, decl: ast.Node.Index, space: Space) E
132132 return renderToken(ais, tree, tree.lastToken(fn_proto) + 1, space); // semicolon
133133 }
134134 },
135 .FnProtoSimple,
136 .FnProtoMulti,
137 .FnProtoOne,
138 .FnProto,
135 .fn_proto_simple,
136 .fn_proto_multi,
137 .fn_proto_one,
138 .fn_proto,
139139 => {
140140 try renderExpression(ais, tree, decl, .None);
141141 return renderToken(ais, tree, tree.lastToken(decl) + 1, space); // semicolon
142142 },
143143
144 .UsingNamespace => {
144 .@"usingnamespace" => {
145145 const main_token = main_tokens[decl];
146146 const expr = datas[decl].lhs;
147147 if (main_token > 0 and token_tags[main_token - 1] == .keyword_pub) {
......@@ -152,12 +152,12 @@ fn renderMember(ais: *Ais, tree: ast.Tree, decl: ast.Node.Index, space: Space) E
152152 return renderToken(ais, tree, tree.lastToken(expr) + 1, space); // ;
153153 },
154154
155 .GlobalVarDecl => return renderVarDecl(ais, tree, tree.globalVarDecl(decl)),
156 .LocalVarDecl => return renderVarDecl(ais, tree, tree.localVarDecl(decl)),
157 .SimpleVarDecl => return renderVarDecl(ais, tree, tree.simpleVarDecl(decl)),
158 .AlignedVarDecl => return renderVarDecl(ais, tree, tree.alignedVarDecl(decl)),
155 .global_var_decl => return renderVarDecl(ais, tree, tree.globalVarDecl(decl)),
156 .local_var_decl => return renderVarDecl(ais, tree, tree.localVarDecl(decl)),
157 .simple_var_decl => return renderVarDecl(ais, tree, tree.simpleVarDecl(decl)),
158 .aligned_var_decl => return renderVarDecl(ais, tree, tree.alignedVarDecl(decl)),
159159
160 .TestDecl => {
160 .test_decl => {
161161 const test_token = main_tokens[decl];
162162 try renderToken(ais, tree, test_token, .Space);
163163 if (token_tags[test_token + 1] == .string_literal) {
......@@ -166,12 +166,12 @@ fn renderMember(ais: *Ais, tree: ast.Tree, decl: ast.Node.Index, space: Space) E
166166 try renderExpression(ais, tree, datas[decl].rhs, space);
167167 },
168168
169 .ContainerFieldInit => return renderContainerField(ais, tree, tree.containerFieldInit(decl), space),
170 .ContainerFieldAlign => return renderContainerField(ais, tree, tree.containerFieldAlign(decl), space),
171 .ContainerField => return renderContainerField(ais, tree, tree.containerField(decl), space),
172 .Comptime => return renderExpression(ais, tree, decl, space),
169 .container_field_init => return renderContainerField(ais, tree, tree.containerFieldInit(decl), space),
170 .container_field_align => return renderContainerField(ais, tree, tree.containerFieldAlign(decl), space),
171 .container_field => return renderContainerField(ais, tree, tree.containerField(decl), space),
172 .@"comptime" => return renderExpression(ais, tree, decl, space),
173173
174 .Root => unreachable,
174 .root => unreachable,
175175 else => unreachable,
176176 }
177177}
......@@ -182,29 +182,29 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
182182 const node_tags = tree.nodes.items(.tag);
183183 const datas = tree.nodes.items(.data);
184184 switch (node_tags[node]) {
185 .Identifier,
186 .IntegerLiteral,
187 .FloatLiteral,
188 .StringLiteral,
189 .CharLiteral,
190 .TrueLiteral,
191 .FalseLiteral,
192 .NullLiteral,
193 .UnreachableLiteral,
194 .UndefinedLiteral,
195 .AnyFrameLiteral,
185 .identifier,
186 .integer_literal,
187 .float_literal,
188 .string_literal,
189 .char_literal,
190 .true_literal,
191 .false_literal,
192 .null_literal,
193 .unreachable_literal,
194 .undefined_literal,
195 .anyframe_literal,
196196 => return renderToken(ais, tree, main_tokens[node], space),
197197
198 .ErrorValue => {
198 .error_value => {
199199 try renderToken(ais, tree, main_tokens[node], .None);
200200 try renderToken(ais, tree, main_tokens[node] + 1, .None);
201201 return renderToken(ais, tree, main_tokens[node] + 2, space);
202202 },
203203
204 .AnyType => return renderToken(ais, tree, main_tokens[node], space),
204 .@"anytype" => return renderToken(ais, tree, main_tokens[node], space),
205205
206 .BlockTwo,
207 .BlockTwoSemicolon,
206 .block_two,
207 .block_two_semicolon,
208208 => {
209209 const statements = [2]ast.Node.Index{ datas[node].lhs, datas[node].rhs };
210210 if (datas[node].lhs == 0) {
......@@ -215,14 +215,14 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
215215 return renderBlock(ais, tree, node, statements[0..2], space);
216216 }
217217 },
218 .Block,
219 .BlockSemicolon,
218 .block,
219 .block_semicolon,
220220 => {
221221 const statements = tree.extra_data[datas[node].lhs..datas[node].rhs];
222222 return renderBlock(ais, tree, node, statements, space);
223223 },
224224
225 .ErrDefer => {
225 .@"errdefer" => {
226226 const defer_token = main_tokens[node];
227227 const payload_token = datas[node].lhs;
228228 const expr = datas[node].rhs;
......@@ -236,20 +236,20 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
236236 return renderExpression(ais, tree, expr, space);
237237 },
238238
239 .Defer => {
239 .@"defer" => {
240240 const defer_token = main_tokens[node];
241241 const expr = datas[node].rhs;
242242 try renderToken(ais, tree, defer_token, .Space);
243243 return renderExpression(ais, tree, expr, space);
244244 },
245 .Comptime, .Nosuspend => {
245 .@"comptime", .@"nosuspend" => {
246246 const comptime_token = main_tokens[node];
247247 const block = datas[node].lhs;
248248 try renderToken(ais, tree, comptime_token, .Space);
249249 return renderExpression(ais, tree, block, space);
250250 },
251251
252 .Suspend => {
252 .@"suspend" => {
253253 const suspend_token = main_tokens[node];
254254 const body = datas[node].lhs;
255255 if (body != 0) {
......@@ -260,7 +260,7 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
260260 }
261261 },
262262
263 .Catch => {
263 .@"catch" => {
264264 const main_token = main_tokens[node];
265265 const fallback_first = tree.firstToken(datas[node].rhs);
266266
......@@ -283,15 +283,15 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
283283 try renderExpression(ais, tree, datas[node].rhs, space); // fallback
284284 },
285285
286 .FieldAccess => {
286 .field_access => {
287287 const field_access = datas[node];
288288 try renderExpression(ais, tree, field_access.lhs, .None);
289289 try renderToken(ais, tree, main_tokens[node], .None);
290290 return renderToken(ais, tree, field_access.rhs, space);
291291 },
292292
293 .ErrorUnion,
294 .SwitchRange,
293 .error_union,
294 .switch_range,
295295 => {
296296 const infix = datas[node];
297297 try renderExpression(ais, tree, infix.lhs, .None);
......@@ -299,45 +299,45 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
299299 return renderExpression(ais, tree, infix.rhs, space);
300300 },
301301
302 .Add,
303 .AddWrap,
304 .ArrayCat,
305 .ArrayMult,
306 .Assign,
307 .AssignBitAnd,
308 .AssignBitOr,
309 .AssignBitShiftLeft,
310 .AssignBitShiftRight,
311 .AssignBitXor,
312 .AssignDiv,
313 .AssignSub,
314 .AssignSubWrap,
315 .AssignMod,
316 .AssignAdd,
317 .AssignAddWrap,
318 .AssignMul,
319 .AssignMulWrap,
320 .BangEqual,
321 .BitAnd,
322 .BitOr,
323 .BitShiftLeft,
324 .BitShiftRight,
325 .BitXor,
326 .BoolAnd,
327 .BoolOr,
328 .Div,
329 .EqualEqual,
330 .GreaterOrEqual,
331 .GreaterThan,
332 .LessOrEqual,
333 .LessThan,
334 .MergeErrorSets,
335 .Mod,
336 .Mul,
337 .MulWrap,
338 .Sub,
339 .SubWrap,
340 .OrElse,
302 .add,
303 .add_wrap,
304 .array_cat,
305 .array_mult,
306 .assign,
307 .assign_bit_and,
308 .assign_bit_or,
309 .assign_bit_shift_left,
310 .assign_bit_shift_right,
311 .assign_bit_xor,
312 .assign_div,
313 .assign_sub,
314 .assign_sub_wrap,
315 .assign_mod,
316 .assign_add,
317 .assign_add_wrap,
318 .assign_mul,
319 .assign_mul_wrap,
320 .bang_equal,
321 .bit_and,
322 .bit_or,
323 .bit_shift_left,
324 .bit_shift_right,
325 .bit_xor,
326 .bool_and,
327 .bool_or,
328 .div,
329 .equal_equal,
330 .greater_or_equal,
331 .greater_than,
332 .less_or_equal,
333 .less_than,
334 .merge_error_sets,
335 .mod,
336 .mul,
337 .mul_wrap,
338 .sub,
339 .sub_wrap,
340 .@"orelse",
341341 => {
342342 const infix = datas[node];
343343 try renderExpression(ais, tree, infix.lhs, .Space);
......@@ -353,75 +353,75 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
353353 return renderExpression(ais, tree, infix.rhs, space);
354354 },
355355
356 .BitNot,
357 .BoolNot,
358 .Negation,
359 .NegationWrap,
360 .OptionalType,
361 .AddressOf,
356 .bit_not,
357 .bool_not,
358 .negation,
359 .negation_wrap,
360 .optional_type,
361 .address_of,
362362 => {
363363 try renderToken(ais, tree, main_tokens[node], .None);
364364 return renderExpression(ais, tree, datas[node].lhs, space);
365365 },
366366
367 .Try,
368 .Resume,
369 .Await,
367 .@"try",
368 .@"resume",
369 .@"await",
370370 => {
371371 try renderToken(ais, tree, main_tokens[node], .Space);
372372 return renderExpression(ais, tree, datas[node].lhs, space);
373373 },
374374
375 .ArrayType => return renderArrayType(ais, tree, tree.arrayType(node), space),
376 .ArrayTypeSentinel => return renderArrayType(ais, tree, tree.arrayTypeSentinel(node), space),
375 .array_type => return renderArrayType(ais, tree, tree.arrayType(node), space),
376 .array_type_sentinel => return renderArrayType(ais, tree, tree.arrayTypeSentinel(node), space),
377377
378 .PtrTypeAligned => return renderPtrType(ais, tree, tree.ptrTypeAligned(node), space),
379 .PtrTypeSentinel => return renderPtrType(ais, tree, tree.ptrTypeSentinel(node), space),
380 .PtrType => return renderPtrType(ais, tree, tree.ptrType(node), space),
381 .PtrTypeBitRange => return renderPtrType(ais, tree, tree.ptrTypeBitRange(node), space),
378 .ptr_type_aligned => return renderPtrType(ais, tree, tree.ptrTypeAligned(node), space),
379 .ptr_type_sentinel => return renderPtrType(ais, tree, tree.ptrTypeSentinel(node), space),
380 .ptr_type => return renderPtrType(ais, tree, tree.ptrType(node), space),
381 .ptr_type_bit_range => return renderPtrType(ais, tree, tree.ptrTypeBitRange(node), space),
382382
383 .ArrayInitOne, .ArrayInitOneComma => {
383 .array_init_one, .array_init_one_comma => {
384384 var elements: [1]ast.Node.Index = undefined;
385385 return renderArrayInit(ais, tree, tree.arrayInitOne(&elements, node), space);
386386 },
387 .ArrayInitDotTwo, .ArrayInitDotTwoComma => {
387 .array_init_dot_two, .array_init_dot_two_comma => {
388388 var elements: [2]ast.Node.Index = undefined;
389389 return renderArrayInit(ais, tree, tree.arrayInitDotTwo(&elements, node), space);
390390 },
391 .ArrayInitDot,
392 .ArrayInitDotComma,
391 .array_init_dot,
392 .array_init_dot_comma,
393393 => return renderArrayInit(ais, tree, tree.arrayInitDot(node), space),
394 .ArrayInit,
395 .ArrayInitComma,
394 .array_init,
395 .array_init_comma,
396396 => return renderArrayInit(ais, tree, tree.arrayInit(node), space),
397397
398 .StructInitOne, .StructInitOneComma => {
398 .struct_init_one, .struct_init_one_comma => {
399399 var fields: [1]ast.Node.Index = undefined;
400400 return renderStructInit(ais, tree, tree.structInitOne(&fields, node), space);
401401 },
402 .StructInitDotTwo, .StructInitDotTwoComma => {
402 .struct_init_dot_two, .struct_init_dot_two_comma => {
403403 var fields: [2]ast.Node.Index = undefined;
404404 return renderStructInit(ais, tree, tree.structInitDotTwo(&fields, node), space);
405405 },
406 .StructInitDot,
407 .StructInitDotComma,
406 .struct_init_dot,
407 .struct_init_dot_comma,
408408 => return renderStructInit(ais, tree, tree.structInitDot(node), space),
409 .StructInit,
410 .StructInitComma,
409 .struct_init,
410 .struct_init_comma,
411411 => return renderStructInit(ais, tree, tree.structInit(node), space),
412412
413 .CallOne, .CallOneComma, .AsyncCallOne, .AsyncCallOneComma => {
413 .call_one, .call_one_comma, .async_call_one, .async_call_one_comma => {
414414 var params: [1]ast.Node.Index = undefined;
415415 return renderCall(ais, tree, tree.callOne(&params, node), space);
416416 },
417417
418 .Call,
419 .CallComma,
420 .AsyncCall,
421 .AsyncCallComma,
418 .call,
419 .call_comma,
420 .async_call,
421 .async_call_comma,
422422 => return renderCall(ais, tree, tree.callFull(node), space),
423423
424 .ArrayAccess => {
424 .array_access => {
425425 const suffix = datas[node];
426426 const lbracket = tree.firstToken(suffix.rhs) - 1;
427427 const rbracket = tree.lastToken(suffix.rhs) + 1;
......@@ -431,22 +431,22 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
431431 return renderToken(ais, tree, rbracket, space); // ]
432432 },
433433
434 .SliceOpen => try renderSlice(ais, tree, tree.sliceOpen(node), space),
435 .Slice => try renderSlice(ais, tree, tree.slice(node), space),
436 .SliceSentinel => try renderSlice(ais, tree, tree.sliceSentinel(node), space),
434 .slice_open => try renderSlice(ais, tree, tree.sliceOpen(node), space),
435 .slice => try renderSlice(ais, tree, tree.slice(node), space),
436 .slice_sentinel => try renderSlice(ais, tree, tree.sliceSentinel(node), space),
437437
438 .Deref => {
438 .deref => {
439439 try renderExpression(ais, tree, datas[node].lhs, .None);
440440 return renderToken(ais, tree, main_tokens[node], space);
441441 },
442442
443 .UnwrapOptional => {
443 .unwrap_optional => {
444444 try renderExpression(ais, tree, datas[node].lhs, .None);
445445 try renderToken(ais, tree, main_tokens[node], .None);
446446 return renderToken(ais, tree, datas[node].rhs, space);
447447 },
448448
449 .Break => {
449 .@"break" => {
450450 const main_token = main_tokens[node];
451451 const label_token = datas[node].lhs;
452452 const target = datas[node].rhs;
......@@ -467,7 +467,7 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
467467 }
468468 },
469469
470 .Continue => {
470 .@"continue" => {
471471 const main_token = main_tokens[node];
472472 const label = datas[node].lhs;
473473 if (label != 0) {
......@@ -479,7 +479,7 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
479479 }
480480 },
481481
482 .Return => {
482 .@"return" => {
483483 if (datas[node].lhs != 0) {
484484 try renderToken(ais, tree, main_tokens[node], .Space);
485485 try renderExpression(ais, tree, datas[node].lhs, space);
......@@ -488,7 +488,7 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
488488 }
489489 },
490490
491 .GroupedExpression => {
491 .grouped_expression => {
492492 ais.pushIndentNextLine();
493493 try renderToken(ais, tree, main_tokens[node], .None); // lparen
494494 try renderExpression(ais, tree, datas[node].lhs, .None);
......@@ -496,32 +496,32 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
496496 return renderToken(ais, tree, datas[node].rhs, space); // rparen
497497 },
498498
499 .ContainerDecl,
500 .ContainerDeclComma,
499 .container_decl,
500 .container_decl_comma,
501501 => return renderContainerDecl(ais, tree, tree.containerDecl(node), space),
502502
503 .ContainerDeclTwo, .ContainerDeclTwoComma => {
503 .container_decl_two, .container_decl_two_comma => {
504504 var buffer: [2]ast.Node.Index = undefined;
505505 return renderContainerDecl(ais, tree, tree.containerDeclTwo(&buffer, node), space);
506506 },
507 .ContainerDeclArg,
508 .ContainerDeclArgComma,
507 .container_decl_arg,
508 .container_decl_arg_comma,
509509 => return renderContainerDecl(ais, tree, tree.containerDeclArg(node), space),
510510
511 .TaggedUnion,
512 .TaggedUnionComma,
511 .tagged_union,
512 .tagged_union_comma,
513513 => return renderContainerDecl(ais, tree, tree.taggedUnion(node), space),
514514
515 .TaggedUnionTwo, .TaggedUnionTwoComma => {
515 .tagged_union_two, .tagged_union_two_comma => {
516516 var buffer: [2]ast.Node.Index = undefined;
517517 return renderContainerDecl(ais, tree, tree.taggedUnionTwo(&buffer, node), space);
518518 },
519 .TaggedUnionEnumTag,
520 .TaggedUnionEnumTagComma,
519 .tagged_union_enum_tag,
520 .tagged_union_enum_tag_comma,
521521 => return renderContainerDecl(ais, tree, tree.taggedUnionEnumTag(node), space),
522522
523523 // TODO: handle comments properly
524 .ErrorSetDecl => {
524 .error_set_decl => {
525525 const error_token = main_tokens[node];
526526 const lbrace = error_token + 1;
527527 const rbrace = datas[node].rhs;
......@@ -569,7 +569,7 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
569569 }
570570 },
571571
572 .BuiltinCallTwo, .BuiltinCallTwoComma => {
572 .builtin_call_two, .builtin_call_two_comma => {
573573 if (datas[node].lhs == 0) {
574574 const params = [_]ast.Node.Index{};
575575 return renderBuiltinCall(ais, tree, main_tokens[node], &params, space);
......@@ -581,23 +581,23 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
581581 return renderBuiltinCall(ais, tree, main_tokens[node], &params, space);
582582 }
583583 },
584 .BuiltinCall, .BuiltinCallComma => {
584 .builtin_call, .builtin_call_comma => {
585585 const params = tree.extra_data[datas[node].lhs..datas[node].rhs];
586586 return renderBuiltinCall(ais, tree, main_tokens[node], params, space);
587587 },
588588
589 .FnProtoSimple => {
589 .fn_proto_simple => {
590590 var params: [1]ast.Node.Index = undefined;
591591 return renderFnProto(ais, tree, tree.fnProtoSimple(&params, node), space);
592592 },
593 .FnProtoMulti => return renderFnProto(ais, tree, tree.fnProtoMulti(node), space),
594 .FnProtoOne => {
593 .fn_proto_multi => return renderFnProto(ais, tree, tree.fnProtoMulti(node), space),
594 .fn_proto_one => {
595595 var params: [1]ast.Node.Index = undefined;
596596 return renderFnProto(ais, tree, tree.fnProtoOne(&params, node), space);
597597 },
598 .FnProto => return renderFnProto(ais, tree, tree.fnProto(node), space),
598 .fn_proto => return renderFnProto(ais, tree, tree.fnProto(node), space),
599599
600 .AnyFrameType => {
600 .anyframe_type => {
601601 const main_token = main_tokens[node];
602602 if (datas[node].rhs != 0) {
603603 try renderToken(ais, tree, main_token, .None); // anyframe
......@@ -608,8 +608,8 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
608608 }
609609 },
610610
611 .Switch,
612 .SwitchComma,
611 .@"switch",
612 .switch_comma,
613613 => {
614614 const switch_token = main_tokens[node];
615615 const condition = datas[node].lhs;
......@@ -635,39 +635,39 @@ fn renderExpression(ais: *Ais, tree: ast.Tree, node: ast.Node.Index, space: Spac
635635 return renderToken(ais, tree, tree.lastToken(node), space); // rbrace
636636 },
637637
638 .SwitchCaseOne => return renderSwitchCase(ais, tree, tree.switchCaseOne(node), space),
639 .SwitchCase => return renderSwitchCase(ais, tree, tree.switchCase(node), space),
638 .switch_case_one => return renderSwitchCase(ais, tree, tree.switchCaseOne(node), space),
639 .switch_case => return renderSwitchCase(ais, tree, tree.switchCase(node), space),
640640
641 .WhileSimple => return renderWhile(ais, tree, tree.whileSimple(node), space),
642 .WhileCont => return renderWhile(ais, tree, tree.whileCont(node), space),
643 .While => return renderWhile(ais, tree, tree.whileFull(node), space),
644 .ForSimple => return renderWhile(ais, tree, tree.forSimple(node), space),
645 .For => return renderWhile(ais, tree, tree.forFull(node), space),
641 .while_simple => return renderWhile(ais, tree, tree.whileSimple(node), space),
642 .while_cont => return renderWhile(ais, tree, tree.whileCont(node), space),
643 .@"while" => return renderWhile(ais, tree, tree.whileFull(node), space),
644 .for_simple => return renderWhile(ais, tree, tree.forSimple(node), space),
645 .@"for" => return renderWhile(ais, tree, tree.forFull(node), space),
646646
647 .IfSimple => return renderIf(ais, tree, tree.ifSimple(node), space),
648 .If => return renderIf(ais, tree, tree.ifFull(node), space),
647 .if_simple => return renderIf(ais, tree, tree.ifSimple(node), space),
648 .@"if" => return renderIf(ais, tree, tree.ifFull(node), space),
649649
650 .AsmSimple => return renderAsm(ais, tree, tree.asmSimple(node), space),
651 .Asm => return renderAsm(ais, tree, tree.asmFull(node), space),
650 .asm_simple => return renderAsm(ais, tree, tree.asmSimple(node), space),
651 .@"asm" => return renderAsm(ais, tree, tree.asmFull(node), space),
652652
653 .EnumLiteral => {
653 .enum_literal => {
654654 try renderToken(ais, tree, main_tokens[node] - 1, .None); // .
655655 return renderToken(ais, tree, main_tokens[node], space); // name
656656 },
657657
658 .FnDecl => unreachable,
659 .ContainerField => unreachable,
660 .ContainerFieldInit => unreachable,
661 .ContainerFieldAlign => unreachable,
662 .Root => unreachable,
663 .GlobalVarDecl => unreachable,
664 .LocalVarDecl => unreachable,
665 .SimpleVarDecl => unreachable,
666 .AlignedVarDecl => unreachable,
667 .UsingNamespace => unreachable,
668 .TestDecl => unreachable,
669 .AsmOutput => unreachable,
670 .AsmInput => unreachable,
658 .fn_decl => unreachable,
659 .container_field => unreachable,
660 .container_field_init => unreachable,
661 .container_field_align => unreachable,
662 .root => unreachable,
663 .global_var_decl => unreachable,
664 .local_var_decl => unreachable,
665 .simple_var_decl => unreachable,
666 .aligned_var_decl => unreachable,
667 .@"usingnamespace" => unreachable,
668 .test_decl => unreachable,
669 .asm_output => unreachable,
670 .asm_input => unreachable,
671671 }
672672}
673673
......@@ -814,7 +814,7 @@ fn renderAsmOutput(
814814 const node_tags = tree.nodes.items(.tag);
815815 const main_tokens = tree.nodes.items(.main_token);
816816 const datas = tree.nodes.items(.data);
817 assert(node_tags[asm_output] == .AsmOutput);
817 assert(node_tags[asm_output] == .asm_output);
818818 const symbolic_name = main_tokens[asm_output];
819819
820820 try renderToken(ais, tree, symbolic_name - 1, .None); // lbracket
......@@ -842,7 +842,7 @@ fn renderAsmInput(
842842 const node_tags = tree.nodes.items(.tag);
843843 const main_tokens = tree.nodes.items(.main_token);
844844 const datas = tree.nodes.items(.data);
845 assert(node_tags[asm_input] == .AsmInput);
845 assert(node_tags[asm_input] == .asm_input);
846846 const symbolic_name = main_tokens[asm_input];
847847
848848 try renderToken(ais, tree, symbolic_name - 1, .None); // lbracket
......@@ -1516,10 +1516,10 @@ fn renderBlock(
15161516 try renderToken(ais, tree, lbrace, .Newline);
15171517 for (statements) |stmt, i| {
15181518 switch (node_tags[stmt]) {
1519 .GlobalVarDecl => try renderVarDecl(ais, tree, tree.globalVarDecl(stmt)),
1520 .LocalVarDecl => try renderVarDecl(ais, tree, tree.localVarDecl(stmt)),
1521 .SimpleVarDecl => try renderVarDecl(ais, tree, tree.simpleVarDecl(stmt)),
1522 .AlignedVarDecl => try renderVarDecl(ais, tree, tree.alignedVarDecl(stmt)),
1519 .global_var_decl => try renderVarDecl(ais, tree, tree.globalVarDecl(stmt)),
1520 .local_var_decl => try renderVarDecl(ais, tree, tree.localVarDecl(stmt)),
1521 .simple_var_decl => try renderVarDecl(ais, tree, tree.simpleVarDecl(stmt)),
1522 .aligned_var_decl => try renderVarDecl(ais, tree, tree.alignedVarDecl(stmt)),
15231523 else => try renderExpression(ais, tree, stmt, .Semicolon),
15241524 }
15251525 }
......@@ -1867,7 +1867,7 @@ fn renderCall(
18671867 try renderExpression(ais, tree, param_node, Space.None);
18681868
18691869 // Unindent the comma for multiline string literals
1870 const is_multiline_string = node_tags[param_node] == .StringLiteral and
1870 const is_multiline_string = node_tags[param_node] == .string_literal and
18711871 token_tags[main_tokens[param_node]] == .multiline_string_literal_line;
18721872 if (is_multiline_string) ais.popIndent();
18731873
......@@ -2031,19 +2031,19 @@ fn renderDocComments(ais: *Ais, tree: ast.Tree, end_token: ast.TokenIndex) Error
20312031
20322032fn nodeIsBlock(tag: ast.Node.Tag) bool {
20332033 return switch (tag) {
2034 .Block,
2035 .BlockSemicolon,
2036 .BlockTwo,
2037 .BlockTwoSemicolon,
2038 .If,
2039 .IfSimple,
2040 .For,
2041 .ForSimple,
2042 .While,
2043 .WhileSimple,
2044 .WhileCont,
2045 .Switch,
2046 .SwitchComma,
2034 .block,
2035 .block_semicolon,
2036 .block_two,
2037 .block_two_semicolon,
2038 .@"if",
2039 .if_simple,
2040 .@"for",
2041 .for_simple,
2042 .@"while",
2043 .while_simple,
2044 .while_cont,
2045 .@"switch",
2046 .switch_comma,
20472047 => true,
20482048 else => false,
20492049 };
......@@ -2051,47 +2051,47 @@ fn nodeIsBlock(tag: ast.Node.Tag) bool {
20512051
20522052fn nodeCausesSliceOpSpace(tag: ast.Node.Tag) bool {
20532053 return switch (tag) {
2054 .Catch,
2055 .Add,
2056 .AddWrap,
2057 .ArrayCat,
2058 .ArrayMult,
2059 .Assign,
2060 .AssignBitAnd,
2061 .AssignBitOr,
2062 .AssignBitShiftLeft,
2063 .AssignBitShiftRight,
2064 .AssignBitXor,
2065 .AssignDiv,
2066 .AssignSub,
2067 .AssignSubWrap,
2068 .AssignMod,
2069 .AssignAdd,
2070 .AssignAddWrap,
2071 .AssignMul,
2072 .AssignMulWrap,
2073 .BangEqual,
2074 .BitAnd,
2075 .BitOr,
2076 .BitShiftLeft,
2077 .BitShiftRight,
2078 .BitXor,
2079 .BoolAnd,
2080 .BoolOr,
2081 .Div,
2082 .EqualEqual,
2083 .ErrorUnion,
2084 .GreaterOrEqual,
2085 .GreaterThan,
2086 .LessOrEqual,
2087 .LessThan,
2088 .MergeErrorSets,
2089 .Mod,
2090 .Mul,
2091 .MulWrap,
2092 .Sub,
2093 .SubWrap,
2094 .OrElse,
2054 .@"catch",
2055 .add,
2056 .add_wrap,
2057 .array_cat,
2058 .array_mult,
2059 .assign,
2060 .assign_bit_and,
2061 .assign_bit_or,
2062 .assign_bit_shift_left,
2063 .assign_bit_shift_right,
2064 .assign_bit_xor,
2065 .assign_div,
2066 .assign_sub,
2067 .assign_sub_wrap,
2068 .assign_mod,
2069 .assign_add,
2070 .assign_add_wrap,
2071 .assign_mul,
2072 .assign_mul_wrap,
2073 .bang_equal,
2074 .bit_and,
2075 .bit_or,
2076 .bit_shift_left,
2077 .bit_shift_right,
2078 .bit_xor,
2079 .bool_and,
2080 .bool_or,
2081 .div,
2082 .equal_equal,
2083 .error_union,
2084 .greater_or_equal,
2085 .greater_than,
2086 .less_or_equal,
2087 .less_than,
2088 .merge_error_sets,
2089 .mod,
2090 .mul,
2091 .mul_wrap,
2092 .sub,
2093 .sub_wrap,
2094 .@"orelse",
20952095 => true,
20962096
20972097 else => false,