authorgravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2025-02-24 18:24:59+01:00
committergravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2025-03-07 22:22:01+01:00
logba74af2ae8c660ea3fbe0ea0483aa61bc7aaa06e
tree7535a96f1c24cdc782e86d27efe0ddeae0357351
parentca6fb30e992fd86ee41a6510ef731e86f5de77c9
signaturebadge-check Signed by SSH key SHA256:HYC3SjXQcAt6uwv9pu/6OoVQ2rUH8rb5zKiUHSe9uxk

std.zig.Ast: update doc comments of `Node.Tag`

The existing comment are incomplete, outdated and sometimes incorrect.

1 files changed, 702 insertions(+), 289 deletions(-)

lib/std/zig/Ast.zig+702-289
......@@ -3052,480 +3052,893 @@ pub const Node = struct {
30523052 }
30533053 }
30543054
3055 /// Note: The FooComma/FooSemicolon variants exist to ease the implementation of
3056 /// Ast.lastToken()
3055 /// The FooComma/FooSemicolon variants exist to ease the implementation of
3056 /// `Ast.lastToken()`
30573057 pub const Tag = enum {
3058 /// sub_list[lhs...rhs]
3058 /// The root node which is guaranteed to be at `Node.Index.root`.
3059 /// The meaning of the `data` field depends on whether it is a `.zig` or
3060 /// `.zon` file.
3061 ///
3062 /// The `main_token` field is the first token for the source file.
30593063 root,
3060 /// `usingnamespace lhs;`. rhs unused. main_token is `usingnamespace`.
3064 /// `usingnamespace expr;`.
3065 ///
3066 /// The `data` field is a `.node` to expr.
3067 ///
3068 /// The `main_token` field is the `usingnamespace` token.
30613069 @"usingnamespace",
3062 /// lhs is test name token (must be string literal or identifier), if any.
3063 /// rhs is the body node.
3070 /// `test {}`,
3071 /// `test "name" {}`,
3072 /// `test identifier {}`.
3073 ///
3074 /// The `data` field is a `.opt_token_and_node`:
3075 /// 1. a `OptionalTokenIndex` to the test name token (must be string literal or identifier), if any.
3076 /// 2. a `Node.Index` to the block.
3077 ///
3078 /// The `main_token` field is the `test` token.
30643079 test_decl,
3065 /// lhs is the index into extra_data.
3066 /// rhs is the initialization expression, if any.
3067 /// main_token is `var` or `const`.
3080 /// The `data` field is a `.extra_and_opt_node`:
3081 /// 1. a `ExtraIndex` to `GlobalVarDecl`.
3082 /// 2. a `Node.OptionalIndex` to the initialization expression.
3083 ///
3084 /// The `main_token` field is the `var` or `const` token.
3085 ///
3086 /// The initialization expression can't be `.none` unless it is part of
3087 /// a `assign_destructure` node or a parsing error occured.
30683088 global_var_decl,
3069 /// `var a: x align(y) = rhs`
3070 /// lhs is the index into extra_data.
3071 /// main_token is `var` or `const`.
3089 /// `var a: b align(c) = d`.
3090 /// `const main_token: type_node align(align_node) = init_expr`.
3091 ///
3092 /// The `data` field is a `.extra_and_opt_node`:
3093 /// 1. a `ExtraIndex` to `LocalVarDecl`.
3094 /// 2. a `Node.OptionalIndex` to the initialization expression-
3095 ///
3096 /// The `main_token` field is the `var` or `const` token.
3097 ///
3098 /// The initialization expression can't be `.none` unless it is part of
3099 /// a `assign_destructure` node or a parsing error occured.
30723100 local_var_decl,
3073 /// `var a: lhs = rhs`. lhs and rhs may be unused.
3101 /// `var a: b = c`.
3102 /// `const name_token: type_expr = init_expr`.
30743103 /// Can be local or global.
3075 /// main_token is `var` or `const`.
3104 ///
3105 /// The `data` field is a `.opt_node_and_opt_node`:
3106 /// 1. a `Node.OptionalIndex` to the type expression, if any.
3107 /// 2. a `Node.OptionalIndex` to the initialization expression.
3108 ///
3109 /// The `main_token` field is the `var` or `const` token.
3110 ///
3111 /// The initialization expression can't be `.none` unless it is part of
3112 /// a `assign_destructure` node or a parsing error occured.
30763113 simple_var_decl,
3077 /// `var a align(lhs) = rhs`. lhs and rhs may be unused.
3114 /// `var a align(b) = c`.
3115 /// `const name_token align(align_expr) = init_expr`.
30783116 /// Can be local or global.
3079 /// main_token is `var` or `const`.
3117 ///
3118 /// The `data` field is a `.node_and_opt_node`:
3119 /// 1. a `Node.Index` to the alignment expression.
3120 /// 2. a `Node.OptionalIndex` to the initialization expression.
3121 ///
3122 /// The `main_token` field is the `var` or `const` token.
3123 ///
3124 /// The initialization expression can't be `.none` unless it is part of
3125 /// a `assign_destructure` node or a parsing error occured.
30803126 aligned_var_decl,
3081 /// lhs is the identifier token payload if any,
3082 /// rhs is the deferred expression.
3127 /// `errdefer expr`,
3128 /// `errdefer |payload| expr`.
3129 ///
3130 /// The `data` field is a `.opt_token_and_node`:
3131 /// 1. a `OptionalTokenIndex` to the payload identifier, if any.
3132 /// 2. a `Node.Index` to the deferred expression.
3133 ///
3134 /// The `main_token` field is the `errdefer` token.
30833135 @"errdefer",
3084 /// lhs is unused.
3085 /// rhs is the deferred expression.
3136 /// `defer expr`.
3137 ///
3138 /// The `data` field is a `.node` to the deferred expression.
3139 ///
3140 /// The `main_token` field is the `defer`.
30863141 @"defer",
3087 /// lhs catch rhs
3088 /// lhs catch |err| rhs
3089 /// main_token is the `catch` keyword.
3090 /// payload is determined by looking at the next token after the `catch` keyword.
3142 /// `lhs catch rhs`,
3143 /// `lhs catch |err| rhs`.
3144 ///
3145 /// The `main_token` field is the `catch` token.
3146 ///
3147 /// The error payload is determined by looking at the next token after
3148 /// the `catch` token.
30913149 @"catch",
3092 /// `lhs.a`. main_token is the dot. rhs is the identifier token index.
3150 /// `lhs.a`.
3151 ///
3152 /// The `data` field is a `.node_and_token`:
3153 /// 1. a `Node.Index` to the left side of the field access.
3154 /// 2. a `TokenIndex` to the field name identifier.
3155 ///
3156 /// The `main_token` field is the `.` token.
30933157 field_access,
3094 /// `lhs.?`. main_token is the dot. rhs is the `?` token index.
3158 /// `lhs.?`.
3159 ///
3160 /// The `data` field is a `.node_and_token`:
3161 /// 1. a `Node.Index` to the left side of the optional unwrap.
3162 /// 2. a `TokenIndex` to the `?` token.
3163 ///
3164 /// The `main_token` field is the `.` token.
30953165 unwrap_optional,
3096 /// `lhs == rhs`. main_token is op.
3166 /// `lhs == rhs`. The `main_token` field is the `==` token.
30973167 equal_equal,
3098 /// `lhs != rhs`. main_token is op.
3168 /// `lhs != rhs`. The `main_token` field is the `!=` token.
30993169 bang_equal,
3100 /// `lhs < rhs`. main_token is op.
3170 /// `lhs < rhs`. The `main_token` field is the `<` token.
31013171 less_than,
3102 /// `lhs > rhs`. main_token is op.
3172 /// `lhs > rhs`. The `main_token` field is the `>` token.
31033173 greater_than,
3104 /// `lhs <= rhs`. main_token is op.
3174 /// `lhs <= rhs`. The `main_token` field is the `<=` token.
31053175 less_or_equal,
3106 /// `lhs >= rhs`. main_token is op.
3176 /// `lhs >= rhs`. The `main_token` field is the `>=` token.
31073177 greater_or_equal,
3108 /// `lhs *= rhs`. main_token is op.
3178 /// `lhs *= rhs`. The `main_token` field is the `*=` token.
31093179 assign_mul,
3110 /// `lhs /= rhs`. main_token is op.
3180 /// `lhs /= rhs`. The `main_token` field is the `/=` token.
31113181 assign_div,
3112 /// `lhs %= rhs`. main_token is op.
3182 /// `lhs %= rhs`. The `main_token` field is the `%=` token.
31133183 assign_mod,
3114 /// `lhs += rhs`. main_token is op.
3184 /// `lhs += rhs`. The `main_token` field is the `+=` token.
31153185 assign_add,
3116 /// `lhs -= rhs`. main_token is op.
3186 /// `lhs -= rhs`. The `main_token` field is the `-=` token.
31173187 assign_sub,
3118 /// `lhs <<= rhs`. main_token is op.
3188 /// `lhs <<= rhs`. The `main_token` field is the `<<=` token.
31193189 assign_shl,
3120 /// `lhs <<|= rhs`. main_token is op.
3190 /// `lhs <<|= rhs`. The `main_token` field is the `<<|=` token.
31213191 assign_shl_sat,
3122 /// `lhs >>= rhs`. main_token is op.
3192 /// `lhs >>= rhs`. The `main_token` field is the `>>=` token.
31233193 assign_shr,
3124 /// `lhs &= rhs`. main_token is op.
3194 /// `lhs &= rhs`. The `main_token` field is the `&=` token.
31253195 assign_bit_and,
3126 /// `lhs ^= rhs`. main_token is op.
3196 /// `lhs ^= rhs`. The `main_token` field is the `^=` token.
31273197 assign_bit_xor,
3128 /// `lhs |= rhs`. main_token is op.
3198 /// `lhs |= rhs`. The `main_token` field is the `|=` token.
31293199 assign_bit_or,
3130 /// `lhs *%= rhs`. main_token is op.
3200 /// `lhs *%= rhs`. The `main_token` field is the `*%=` token.
31313201 assign_mul_wrap,
3132 /// `lhs +%= rhs`. main_token is op.
3202 /// `lhs +%= rhs`. The `main_token` field is the `+%=` token.
31333203 assign_add_wrap,
3134 /// `lhs -%= rhs`. main_token is op.
3204 /// `lhs -%= rhs`. The `main_token` field is the `-%=` token.
31353205 assign_sub_wrap,
3136 /// `lhs *|= rhs`. main_token is op.
3206 /// `lhs *|= rhs`. The `main_token` field is the `*%=` token.
31373207 assign_mul_sat,
3138 /// `lhs +|= rhs`. main_token is op.
3208 /// `lhs +|= rhs`. The `main_token` field is the `+|=` token.
31393209 assign_add_sat,
3140 /// `lhs -|= rhs`. main_token is op.
3210 /// `lhs -|= rhs`. The `main_token` field is the `-|=` token.
31413211 assign_sub_sat,
3142 /// `lhs = rhs`. main_token is op.
3212 /// `lhs = rhs`. The `main_token` field is the `=` token.
31433213 assign,
3144 /// `a, b, ... = rhs`. main_token is op. lhs is index into `extra_data`
3145 /// of an lhs elem count followed by an array of that many `Node.Index`,
3146 /// with each node having one of the following types:
3147 /// * `global_var_decl`
3148 /// * `local_var_decl`
3149 /// * `simple_var_decl`
3150 /// * `aligned_var_decl`
3151 /// * Any expression node
3152 /// The first 3 types correspond to a `var` or `const` lhs node (note
3153 /// that their `rhs` is always 0). An expression node corresponds to a
3154 /// standard assignment LHS (which must be evaluated as an lvalue).
3155 /// There may be a preceding `comptime` token, which does not create a
3156 /// corresponding `comptime` node so must be manually detected.
3214 /// `a, b, ... = rhs`.
3215 ///
3216 /// The `data` field is a `.extra_and_node`:
3217 /// 1. a `ExtraIndex`. Further explained below.
3218 /// 2. a `Node.Index` to the initialization expression.
3219 ///
3220 /// The `main_token` field is the `=` token.
3221 ///
3222 /// The `ExtraIndex` stores the following data:
3223 /// ```
3224 /// elem_count: u32,
3225 /// variables: [elem_count]Node.Index,
3226 /// ```
3227 ///
3228 /// Each node in `variables` has one of the following tags:
3229 /// - `global_var_decl`
3230 /// - `local_var_decl`
3231 /// - `simple_var_decl`
3232 /// - `aligned_var_decl`
3233 /// - Any expression node
3234 ///
3235 /// The first 4 tags correspond to a `var` or `const` lhs node (note
3236 /// that their initialization expression is always `.none`).
3237 /// An expression node corresponds to a standard assignment LHS (which
3238 /// must be evaluated as an lvalue). There may be a preceding
3239 /// `comptime` token, which does not create a corresponding `comptime`
3240 /// node so must be manually detected.
31573241 assign_destructure,
3158 /// `lhs || rhs`. main_token is the `||`.
3242 /// `lhs || rhs`. The `main_token` field is the `||` token.
31593243 merge_error_sets,
3160 /// `lhs * rhs`. main_token is the `*`.
3244 /// `lhs * rhs`. The `main_token` field is the `*` token.
31613245 mul,
3162 /// `lhs / rhs`. main_token is the `/`.
3246 /// `lhs / rhs`. The `main_token` field is the `/` token.
31633247 div,
3164 /// `lhs % rhs`. main_token is the `%`.
3248 /// `lhs % rhs`. The `main_token` field is the `%` token.
31653249 mod,
3166 /// `lhs ** rhs`. main_token is the `**`.
3250 /// `lhs ** rhs`. The `main_token` field is the `**` token.
31673251 array_mult,
3168 /// `lhs *% rhs`. main_token is the `*%`.
3252 /// `lhs *% rhs`. The `main_token` field is the `*%` token.
31693253 mul_wrap,
3170 /// `lhs *| rhs`. main_token is the `*|`.
3254 /// `lhs *| rhs`. The `main_token` field is the `*|` token.
31713255 mul_sat,
3172 /// `lhs + rhs`. main_token is the `+`.
3256 /// `lhs + rhs`. The `main_token` field is the `+` token.
31733257 add,
3174 /// `lhs - rhs`. main_token is the `-`.
3258 /// `lhs - rhs`. The `main_token` field is the `-` token.
31753259 sub,
3176 /// `lhs ++ rhs`. main_token is the `++`.
3260 /// `lhs ++ rhs`. The `main_token` field is the `++` token.
31773261 array_cat,
3178 /// `lhs +% rhs`. main_token is the `+%`.
3262 /// `lhs +% rhs`. The `main_token` field is the `+%` token.
31793263 add_wrap,
3180 /// `lhs -% rhs`. main_token is the `-%`.
3264 /// `lhs -% rhs`. The `main_token` field is the `-%` token.
31813265 sub_wrap,
3182 /// `lhs +| rhs`. main_token is the `+|`.
3266 /// `lhs +| rhs`. The `main_token` field is the `+|` token.
31833267 add_sat,
3184 /// `lhs -| rhs`. main_token is the `-|`.
3268 /// `lhs -| rhs`. The `main_token` field is the `-|` token.
31853269 sub_sat,
3186 /// `lhs << rhs`. main_token is the `<<`.
3270 /// `lhs << rhs`. The `main_token` field is the `<<` token.
31873271 shl,
3188 /// `lhs <<| rhs`. main_token is the `<<|`.
3272 /// `lhs <<| rhs`. The `main_token` field is the `<<|` token.
31893273 shl_sat,
3190 /// `lhs >> rhs`. main_token is the `>>`.
3274 /// `lhs >> rhs`. The `main_token` field is the `>>` token.
31913275 shr,
3192 /// `lhs & rhs`. main_token is the `&`.
3276 /// `lhs & rhs`. The `main_token` field is the `&` token.
31933277 bit_and,
3194 /// `lhs ^ rhs`. main_token is the `^`.
3278 /// `lhs ^ rhs`. The `main_token` field is the `^` token.
31953279 bit_xor,
3196 /// `lhs | rhs`. main_token is the `|`.
3280 /// `lhs | rhs`. The `main_token` field is the `|` token.
31973281 bit_or,
3198 /// `lhs orelse rhs`. main_token is the `orelse`.
3282 /// `lhs orelse rhs`. The `main_token` field is the `orelse` token.
31993283 @"orelse",
3200 /// `lhs and rhs`. main_token is the `and`.
3284 /// `lhs and rhs`. The `main_token` field is the `and` token.
32013285 bool_and,
3202 /// `lhs or rhs`. main_token is the `or`.
3286 /// `lhs or rhs`. The `main_token` field is the `or` token.
32033287 bool_or,
3204 /// `op lhs`. rhs unused. main_token is op.
3288 /// `!expr`. The `main_token` field is the `!` token.
32053289 bool_not,
3206 /// `op lhs`. rhs unused. main_token is op.
3290 /// `-expr`. The `main_token` field is the `-` token.
32073291 negation,
3208 /// `op lhs`. rhs unused. main_token is op.
3292 /// `~expr`. The `main_token` field is the `~` token.
32093293 bit_not,
3210 /// `op lhs`. rhs unused. main_token is op.
3294 /// `-%expr`. The `main_token` field is the `-%` token.
32113295 negation_wrap,
3212 /// `op lhs`. rhs unused. main_token is op.
3296 /// `&expr`. The `main_token` field is the `&` token.
32133297 address_of,
3214 /// `op lhs`. rhs unused. main_token is op.
3298 /// `try expr`. The `main_token` field is the `try` token.
32153299 @"try",
3216 /// `op lhs`. rhs unused. main_token is op.
3300 /// `await expr`. The `main_token` field is the `await` token.
32173301 @"await",
3218 /// `?lhs`. rhs unused. main_token is the `?`.
3302 /// `?expr`. The `main_token` field is the `?` token.
32193303 optional_type,
3220 /// `[lhs]rhs`.
3304 /// `[lhs]rhs`. The `main_token` field is the `[` token.
32213305 array_type,
3222 /// `[lhs:a]b`. `ArrayTypeSentinel[rhs]`.
3306 /// `[lhs:a]b`.
3307 ///
3308 /// The `data` field is a `.node_and_extra`:
3309 /// 1. a `Node.Index` to the length expression.
3310 /// 2. a `ExtraIndex` to `ArrayTypeSentinel`.
3311 ///
3312 /// The `main_token` field is the `[` token.
32233313 array_type_sentinel,
3224 /// `[*]align(lhs) rhs`. lhs can be omitted.
3225 /// `*align(lhs) rhs`. lhs can be omitted.
3314 /// `[*]align(lhs) rhs`,
3315 /// `*align(lhs) rhs`,
32263316 /// `[]rhs`.
3227 /// main_token is the asterisk if a single item pointer or the lbracket
3228 /// if a slice, many-item pointer, or C-pointer
3229 /// main_token might be a ** token, which is shared with a parent/child
3230 /// pointer type and may require special handling.
3317 ///
3318 /// The `data` field is a `.opt_node_and_node`:
3319 /// 1. a `Node.OptionalIndex` to the alignment expression, if any.
3320 /// 2. a `Node.Index` to the element type expression.
3321 ///
3322 /// The `main_token` is the asterisk if a single item pointer or the
3323 /// lbracket if a slice, many-item pointer, or C-pointer.
3324 /// The `main_token` might be a ** token, which is shared with a
3325 /// parent/child pointer type and may require special handling.
32313326 ptr_type_aligned,
3232 /// `[*:lhs]rhs`. lhs can be omitted.
3233 /// `*rhs`.
3327 /// `[*:lhs]rhs`,
3328 /// `*rhs`,
32343329 /// `[:lhs]rhs`.
3235 /// main_token is the asterisk if a single item pointer or the lbracket
3236 /// if a slice, many-item pointer, or C-pointer
3237 /// main_token might be a ** token, which is shared with a parent/child
3238 /// pointer type and may require special handling.
3330 ///
3331 /// The `data` field is a `.opt_node_and_node`:
3332 /// 1. a `Node.OptionalIndex` to the sentinel expression, if any.
3333 /// 2. a `Node.Index` to the element type expression.
3334 ///
3335 /// The `main_token` is the asterisk if a single item pointer or the
3336 /// lbracket if a slice, many-item pointer, or C-pointer.
3337 /// The `main_token` might be a ** token, which is shared with a
3338 /// parent/child pointer type and may require special handling.
32393339 ptr_type_sentinel,
3240 /// lhs is index into ptr_type. rhs is the element type expression.
3241 /// main_token is the asterisk if a single item pointer or the lbracket
3242 /// if a slice, many-item pointer, or C-pointer
3243 /// main_token might be a ** token, which is shared with a parent/child
3244 /// pointer type and may require special handling.
3340 /// The `data` field is a `.opt_node_and_node`:
3341 /// 1. a `ExtraIndex` to `PtrType`.
3342 /// 2. a `Node.Index` to the element type expression.
3343 ///
3344 /// The `main_token` is the asterisk if a single item pointer or the
3345 /// lbracket if a slice, many-item pointer, or C-pointer.
3346 /// The `main_token` might be a ** token, which is shared with a
3347 /// parent/child pointer type and may require special handling.
32453348 ptr_type,
3246 /// lhs is index into ptr_type_bit_range. rhs is the element type expression.
3247 /// main_token is the asterisk if a single item pointer or the lbracket
3248 /// if a slice, many-item pointer, or C-pointer
3249 /// main_token might be a ** token, which is shared with a parent/child
3250 /// pointer type and may require special handling.
3349 /// The `data` field is a `.opt_node_and_node`:
3350 /// 1. a `ExtraIndex` to `PtrTypeBitRange`.
3351 /// 2. a `Node.Index` to the element type expression.
3352 ///
3353 /// The `main_token` is the asterisk if a single item pointer or the
3354 /// lbracket if a slice, many-item pointer, or C-pointer.
3355 /// The `main_token` might be a ** token, which is shared with a
3356 /// parent/child pointer type and may require special handling.
32513357 ptr_type_bit_range,
32523358 /// `lhs[rhs..]`
3253 /// main_token is the lbracket.
3359 ///
3360 /// The `main_token` field is the `[` token.
32543361 slice_open,
3255 /// `lhs[b..c]`. rhs is index into Slice
3256 /// main_token is the lbracket.
3362 /// `sliced[start..end]`.
3363 ///
3364 /// The `data` field is a `.node_and_extra`:
3365 /// 1. a `Node.Index` to the sliced expression.
3366 /// 2. a `ExtraIndex` to `Slice`.
3367 ///
3368 /// The `main_token` field is the `[` token.
32573369 slice,
3258 /// `lhs[b..c :d]`. rhs is index into SliceSentinel. Slice end "c" can be omitted.
3259 /// main_token is the lbracket.
3370 /// `sliced[start..end :sentinel]`,
3371 /// `sliced[start.. :sentinel]`.
3372 ///
3373 /// The `data` field is a `.node_and_extra`:
3374 /// 1. a `Node.Index` to the sliced expression.
3375 /// 2. a `ExtraIndex` to `SliceSentinel`.
3376 ///
3377 /// The `main_token` field is the `[` token.
32603378 slice_sentinel,
3261 /// `lhs.*`. rhs is unused.
3379 /// `expr.*`.
3380 ///
3381 /// The `data` field is a `.node` to expr.
3382 ///
3383 /// The `main_token` field is the `*` token.
32623384 deref,
32633385 /// `lhs[rhs]`.
3386 ///
3387 /// The `main_token` field is the `[` token.
32643388 array_access,
3265 /// `lhs{rhs}`. rhs can be omitted.
3389 /// `lhs{rhs}`.
3390 ///
3391 /// The `main_token` field is the `{` token.
32663392 array_init_one,
3267 /// `lhs{rhs,}`. rhs can *not* be omitted
3393 /// Same as `array_init_one` except there is known to be a trailing
3394 /// comma before the final rbrace.
32683395 array_init_one_comma,
3269 /// `.{lhs, rhs}`. lhs and rhs can be omitted.
3396 /// `.{a}`,
3397 /// `.{a, b}`.
3398 ///
3399 /// The `data` field is a `.opt_node_and_opt_node`:
3400 /// 1. a `Node.OptionalIndex` to the first element. Never `.none`
3401 /// 2. a `Node.OptionalIndex` to the second element, if any.
3402 ///
3403 /// The `main_token` field is the `{` token.
32703404 array_init_dot_two,
3271 /// Same as `array_init_dot_two` except there is known to be a trailing comma
3272 /// before the final rbrace.
3405 /// Same as `array_init_dot_two` except there is known to be a trailing
3406 /// comma before the final rbrace.
32733407 array_init_dot_two_comma,
3274 /// `.{a, b}`. `sub_list[lhs..rhs]`.
3408 /// `.{a, b, c}`.
3409 ///
3410 /// The `data` field is a `.extra_range` that stores a `Node.Index` for
3411 /// each element.
3412 ///
3413 /// The `main_token` field is the `{` token.
32753414 array_init_dot,
3276 /// Same as `array_init_dot` except there is known to be a trailing comma
3277 /// before the final rbrace.
3415 /// Same as `array_init_dot` except there is known to be a trailing
3416 /// comma before the final rbrace.
32783417 array_init_dot_comma,
3279 /// `lhs{a, b}`. `sub_range_list[rhs]`. lhs can be omitted which means `.{a, b}`.
3418 /// `a{b, c}`.
3419 ///
3420 /// The `data` field is a `.node_and_extra`:
3421 /// 1. a `Node.Index` to the type expression.
3422 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3423 /// each element.
3424 ///
3425 /// The `main_token` field is the `{` token.
32803426 array_init,
32813427 /// Same as `array_init` except there is known to be a trailing comma
32823428 /// before the final rbrace.
32833429 array_init_comma,
3284 /// `lhs{.a = rhs}`. rhs can be omitted making it empty.
3285 /// main_token is the lbrace.
3430 /// `a{.x = b}`, `a{}`.
3431 ///
3432 /// The `data` field is a `.node_and_opt_node`:
3433 /// 1. a `Node.Index` to the type expression.
3434 /// 2. a `Node.OptionalIndex` to the first field initialization, if any.
3435 ///
3436 /// The `main_token` field is the `{` token.
3437 ///
3438 /// The field name is determined by looking at the tokens preceding the
3439 /// field initialization.
32863440 struct_init_one,
3287 /// `lhs{.a = rhs,}`. rhs can *not* be omitted.
3288 /// main_token is the lbrace.
3441 /// Same as `struct_init_one` except there is known to be a trailing comma
3442 /// before the final rbrace.
32893443 struct_init_one_comma,
3290 /// `.{.a = lhs, .b = rhs}`. lhs and rhs can be omitted.
3291 /// main_token is the lbrace.
3292 /// No trailing comma before the rbrace.
3444 /// `.{.x = a, .y = b}`.
3445 ///
3446 /// The `data` field is a `.opt_node_and_opt_node`:
3447 /// 1. a `Node.OptionalIndex` to the first field initialization. Never `.none`
3448 /// 2. a `Node.OptionalIndex` to the second field initialization, if any.
3449 ///
3450 /// The `main_token` field is the '{' token.
3451 ///
3452 /// The field name is determined by looking at the tokens preceding the
3453 /// field initialization.
32933454 struct_init_dot_two,
3294 /// Same as `struct_init_dot_two` except there is known to be a trailing comma
3295 /// before the final rbrace.
3455 /// Same as `struct_init_dot_two` except there is known to be a trailing
3456 /// comma before the final rbrace.
32963457 struct_init_dot_two_comma,
3297 /// `.{.a = b, .c = d}`. `sub_list[lhs..rhs]`.
3298 /// main_token is the lbrace.
3458 /// `.{.x = a, .y = b, .z = c}`.
3459 ///
3460 /// The `data` field is a `.extra_range` that stores a `Node.Index` for
3461 /// each field initialization.
3462 ///
3463 /// The `main_token` field is the `{` token.
3464 ///
3465 /// The field name is determined by looking at the tokens preceding the
3466 /// field initialization.
32993467 struct_init_dot,
3300 /// Same as `struct_init_dot` except there is known to be a trailing comma
3301 /// before the final rbrace.
3468 /// Same as `struct_init_dot` except there is known to be a trailing
3469 /// comma before the final rbrace.
33023470 struct_init_dot_comma,
3303 /// `lhs{.a = b, .c = d}`. `sub_range_list[rhs]`.
3304 /// lhs can be omitted which means `.{.a = b, .c = d}`.
3305 /// main_token is the lbrace.
3471 /// `a{.x = b, .y = c}`.
3472 ///
3473 /// The `data` field is a `.node_and_extra`:
3474 /// 1. a `Node.Index` to the type expression.
3475 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3476 /// each field initialization.
3477 ///
3478 /// The `main_token` field is the `{` token.
3479 ///
3480 /// The field name is determined by looking at the tokens preceding the
3481 /// field initialization.
33063482 struct_init,
33073483 /// Same as `struct_init` except there is known to be a trailing comma
33083484 /// before the final rbrace.
33093485 struct_init_comma,
3310 /// `lhs(rhs)`. rhs can be omitted.
3311 /// main_token is the lparen.
3486 /// `a(b)`, `a()`.
3487 ///
3488 /// The `data` field is a `.node_and_opt_node`:
3489 /// 1. a `Node.Index` to the function expression.
3490 /// 2. a `Node.OptionalIndex` to the first argument, if any.
3491 ///
3492 /// The `main_token` field is the `(` token.
33123493 call_one,
3313 /// `lhs(rhs,)`. rhs can be omitted.
3314 /// main_token is the lparen.
3494 /// Same as `call_one` except there is known to be a trailing comma
3495 /// before the final rparen.
33153496 call_one_comma,
3316 /// `async lhs(rhs)`. rhs can be omitted.
3497 /// `async a(b)`, `async a()`.
3498 ///
3499 /// The `data` field is a `.node_and_opt_node`:
3500 /// 1. a `Node.Index` to the function expression.
3501 /// 2. a `Node.OptionalIndex` to the first argument, if any.
3502 ///
3503 /// The `main_token` field is the `(` token.
33173504 async_call_one,
3318 /// `async lhs(rhs,)`.
3505 /// Same as `async_call_one` except there is known to be a trailing
3506 /// comma before the final rparen.
33193507 async_call_one_comma,
3320 /// `lhs(a, b, c)`. `SubRange[rhs]`.
3321 /// main_token is the `(`.
3508 /// `a(b, c, d)`.
3509 ///
3510 /// The `data` field is a `.node_and_extra`:
3511 /// 1. a `Node.Index` to the function expression.
3512 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3513 /// each argument.
3514 ///
3515 /// The `main_token` field is the `(` token.
33223516 call,
3323 /// `lhs(a, b, c,)`. `SubRange[rhs]`.
3324 /// main_token is the `(`.
3517 /// Same as `call` except there is known to be a trailing comma before
3518 /// the final rparen.
33253519 call_comma,
3326 /// `async lhs(a, b, c)`. `SubRange[rhs]`.
3327 /// main_token is the `(`.
3520 /// `async a(b, c, d)`.
3521 ///
3522 /// The `data` field is a `.node_and_extra`:
3523 /// 1. a `Node.Index` to the function expression.
3524 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3525 /// each argument.
3526 ///
3527 /// The `main_token` field is the `(` token.
33283528 async_call,
3329 /// `async lhs(a, b, c,)`. `SubRange[rhs]`.
3330 /// main_token is the `(`.
3529 /// Same as `async_call` except there is known to be a trailing comma
3530 /// before the final rparen.
33313531 async_call_comma,
3332 /// `switch(lhs) {}`. `SubRange[rhs]`.
3333 /// `main_token` is the identifier of a preceding label, if any; otherwise `switch`.
3532 /// `switch(a) {}`.
3533 ///
3534 /// The `data` field is a `.node_and_extra`:
3535 /// 1. a `Node.Index` to the switch operand.
3536 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3537 /// each switch case.
3538 ///
3539 /// `The `main_token` field` is the identifier of a preceding label, if any; otherwise `switch`.
33343540 @"switch",
3335 /// Same as switch except there is known to be a trailing comma
3336 /// before the final rbrace
3541 /// Same as `switch` except there is known to be a trailing comma before
3542 /// the final rbrace.
33373543 switch_comma,
3338 /// `lhs => rhs`. If lhs is omitted it means `else`.
3339 /// main_token is the `=>`
3544 /// `a => b`,
3545 /// `else => b`.
3546 ///
3547 /// The `data` field is a `.opt_node_and_node`:
3548 /// 1. a `Node.OptionalIndex` where `.none` means `else`.
3549 /// 2. a `Node.Index` to the target expression.
3550 ///
3551 /// The `main_token` field is the `=>` token.
33403552 switch_case_one,
3341 /// Same ast `switch_case_one` but the case is inline
3553 /// Same as `switch_case_one` but the case is inline.
33423554 switch_case_inline_one,
3343 /// `a, b, c => rhs`. `SubRange[lhs]`.
3344 /// main_token is the `=>`
3555 /// `a, b, c => d`.
3556 ///
3557 /// The `data` field is a `.extra_and_node`:
3558 /// 1. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3559 /// each switch item.
3560 /// 2. a `Node.Index` to the target expression.
3561 ///
3562 /// The `main_token` field is the `=>` token.
33453563 switch_case,
3346 /// Same ast `switch_case` but the case is inline
3564 /// Same as `switch_case` but the case is inline.
33473565 switch_case_inline,
33483566 /// `lhs...rhs`.
3567 ///
3568 /// The `main_token` field is the `...` token.
33493569 switch_range,
3350 /// `while (lhs) rhs`.
3351 /// `while (lhs) |x| rhs`.
3570 /// `while (a) b`,
3571 /// `while (a) |x| b`.
33523572 while_simple,
3353 /// `while (lhs) : (a) b`. `WhileCont[rhs]`.
3354 /// `while (lhs) : (a) b`. `WhileCont[rhs]`.
3573 /// `while (a) : (b) c`,
3574 /// `while (a) |x| : (b) c`.
33553575 while_cont,
3356 /// `while (lhs) : (a) b else c`. `While[rhs]`.
3357 /// `while (lhs) |x| : (a) b else c`. `While[rhs]`.
3358 /// `while (lhs) |x| : (a) b else |y| c`. `While[rhs]`.
3359 /// The cont expression part `: (a)` may be omitted.
3576 /// `while (a) : (b) c else d`,
3577 /// `while (a) |x| : (b) c else d`,
3578 /// `while (a) |x| : (b) c else |y| d`.
3579 /// The continue expression part `: (b)` may be omitted.
33603580 @"while",
3361 /// `for (lhs) rhs`.
3581 /// `for (a) b`.
33623582 for_simple,
33633583 /// `for (lhs[0..inputs]) lhs[inputs + 1] else lhs[inputs + 2]`. `For[rhs]`.
33643584 @"for",
3365 /// `lhs..rhs`. rhs can be omitted.
3585 /// `lhs..rhs`, `lhs..`.
33663586 for_range,
3367 /// `if (lhs) rhs`.
3368 /// `if (lhs) |a| rhs`.
3587 /// `if (a) b`.
3588 /// `if (b) |x| b`.
33693589 if_simple,
3370 /// `if (lhs) a else b`. `If[rhs]`.
3371 /// `if (lhs) |x| a else b`. `If[rhs]`.
3372 /// `if (lhs) |x| a else |y| b`. `If[rhs]`.
3590 /// `if (a) b else c`.
3591 /// `if (a) |x| b else c`.
3592 /// `if (a) |x| b else |y| d`.
33733593 @"if",
3374 /// `suspend lhs`. lhs can be omitted. rhs is unused.
3594 /// `suspend expr`.
3595 ///
3596 /// The `data` field is a `.node` to expr.
3597 ///
3598 /// The `main_token` field is the `suspend` token.
33753599 @"suspend",
3376 /// `resume lhs`. rhs is unused.
3600 /// `resume expr`.
3601 ///
3602 /// The `data` field is a `.node` to expr.
3603 ///
3604 /// The `main_token` field is the `resume` token.
33773605 @"resume",
3378 /// `continue :lhs rhs`
3379 /// both lhs and rhs may be omitted.
3606 /// `continue :label expr`,
3607 /// `continue expr`,
3608 /// `continue :label`,
3609 /// `continue`.
3610 ///
3611 /// The `data` field is a `.opt_token_and_opt_node`:
3612 /// 1. a `OptionalTokenIndex` to the label identifier, if any.
3613 /// 2. a `Node.OptionalIndex` to the target expression, if any.
3614 ///
3615 /// The `main_token` field is the `continue` token.
33803616 @"continue",
3381 /// `break :lhs rhs`
3382 /// both lhs and rhs may be omitted.
3617 /// `break :label expr`,
3618 /// `break expr`,
3619 /// `break :label`,
3620 /// `break`.
3621 ///
3622 /// The `data` field is a `.opt_token_and_opt_node`:
3623 /// 1. a `OptionalTokenIndex` to the label identifier, if any.
3624 /// 2. a `Node.OptionalIndex` to the target expression, if any.
3625 ///
3626 /// The `main_token` field is the `break` token.
33833627 @"break",
3384 /// `return lhs`. lhs can be omitted. rhs is unused.
3628 /// `return expr`, `return`.
3629 ///
3630 /// The `data` field is a `.opt_node` to the return value, if any.
3631 ///
3632 /// The `main_token` field is the `return` token.
33853633 @"return",
3386 /// `fn (a: lhs) rhs`. lhs can be omitted.
3387 /// anytype and ... parameters are omitted from the AST tree.
3388 /// main_token is the `fn` keyword.
3389 /// extern function declarations use this tag.
3634 /// `fn (a: type_expr) return_type`.
3635 ///
3636 /// The `data` field is a `.opt_node_and_opt_node`:
3637 /// 1. a `Node.OptionalIndex` to the first parameter type expression, if any.
3638 /// 2. a `Node.OptionalIndex` to the return type expression. Can't be
3639 /// `.none` unless a parsing error occured.
3640 ///
3641 /// The `main_token` field is the `fn` token.
3642 ///
3643 /// `anytype` and `...` parameters are omitted from the AST tree.
3644 /// Extern function declarations use this tag.
33903645 fn_proto_simple,
3391 /// `fn (a: b, c: d) rhs`. `sub_range_list[lhs]`.
3392 /// anytype and ... parameters are omitted from the AST tree.
3393 /// main_token is the `fn` keyword.
3394 /// extern function declarations use this tag.
3646 /// `fn (a: b, c: d) return_type`.
3647 ///
3648 /// The `data` field is a `.extra_and_opt_node`:
3649 /// 1. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3650 /// each parameter type expression.
3651 /// 2. a `Node.OptionalIndex` to the return type expression. Can't be
3652 /// `.none` unless a parsing error occured.
3653 ///
3654 /// The `main_token` field is the `fn` token.
3655 ///
3656 /// `anytype` and `...` parameters are omitted from the AST tree.
3657 /// Extern function declarations use this tag.
33953658 fn_proto_multi,
3396 /// `fn (a: b) addrspace(e) linksection(f) callconv(g) rhs`. `FnProtoOne[lhs]`.
3659 /// `fn (a: b) addrspace(e) linksection(f) callconv(g) return_type`.
33973660 /// zero or one parameters.
3398 /// anytype and ... parameters are omitted from the AST tree.
3399 /// main_token is the `fn` keyword.
3400 /// extern function declarations use this tag.
3661 ///
3662 /// The `data` field is a `.extra_and_opt_node`:
3663 /// 1. a `Node.ExtraIndex` to `FnProtoOne`.
3664 /// 2. a `Node.OptionalIndex` to the return type expression. Can't be
3665 /// `.none` unless a parsing error occured.
3666 ///
3667 /// The `main_token` field is the `fn` token.
3668 ///
3669 /// `anytype` and `...` parameters are omitted from the AST tree.
3670 /// Extern function declarations use this tag.
34013671 fn_proto_one,
3402 /// `fn (a: b, c: d) addrspace(e) linksection(f) callconv(g) rhs`. `FnProto[lhs]`.
3403 /// anytype and ... parameters are omitted from the AST tree.
3404 /// main_token is the `fn` keyword.
3405 /// extern function declarations use this tag.
3672 /// `fn (a: b, c: d) addrspace(e) linksection(f) callconv(g) return_type`.
3673 ///
3674 /// The `data` field is a `.extra_and_opt_node`:
3675 /// 1. a `Node.ExtraIndex` to `FnProto`.
3676 /// 2. a `Node.OptionalIndex` to the return type expression. Can't be
3677 /// `.none` unless a parsing error occured.
3678 ///
3679 /// The `main_token` field is the `fn` token.
3680 ///
3681 /// `anytype` and `...` parameters are omitted from the AST tree.
3682 /// Extern function declarations use this tag.
34063683 fn_proto,
3407 /// lhs is the fn_proto.
3408 /// rhs is the function body block.
3409 /// Note that extern function declarations use the fn_proto tags rather
3410 /// than this one.
3684 /// Extern function declarations use the fn_proto tags rather than this one.
3685 ///
3686 /// The `data` field is a `.node_and_node`:
3687 /// 1. a `Node.Index` to `fn_proto_*`.
3688 /// 2. a `Node.Index` to function body block.
3689 ///
3690 /// The `main_token` field is the `fn` token.
34113691 fn_decl,
3412 /// `anyframe->rhs`. main_token is `anyframe`. `lhs` is arrow token index.
3692 /// `anyframe->return_type`.
3693 ///
3694 /// The `data` field is a `.token_and_node`:
3695 /// 1. a `TokenIndex` to the `->` token.
3696 /// 2. a `Node.Index` to the function frame return type expression.
3697 ///
3698 /// The `main_token` field is the `anyframe` token.
34133699 anyframe_type,
3414 /// Both lhs and rhs unused.
3700 /// The `data` field is unused.
34153701 anyframe_literal,
3416 /// Both lhs and rhs unused.
3702 /// The `data` field is unused.
34173703 char_literal,
3418 /// Both lhs and rhs unused.
3704 /// The `data` field is unused.
34193705 number_literal,
3420 /// Both lhs and rhs unused.
3706 /// The `data` field is unused.
34213707 unreachable_literal,
3422 /// Both lhs and rhs unused.
3423 /// Most identifiers will not have explicit AST nodes, however for expressions
3424 /// which could be one of many different kinds of AST nodes, there will be an
3425 /// identifier AST node for it.
3708 /// The `data` field is unused.
3709 ///
3710 /// Most identifiers will not have explicit AST nodes, however for
3711 /// expressions which could be one of many different kinds of AST nodes,
3712 /// there will be an identifier AST node for it.
34263713 identifier,
3427 /// lhs is the dot token index, rhs unused, main_token is the identifier.
3714 /// `.foo`.
3715 ///
3716 /// The `data` field is a `.token` to the `.`.
3717 ///
3718 /// The `main_token` field is the identifier.
34283719 enum_literal,
3429 /// main_token is the string literal token
3430 /// Both lhs and rhs unused.
3720 /// The `data` field is unused.
3721 ///
3722 /// The `main_token` field is the string literal token.
34313723 string_literal,
3432 /// main_token is the first token index (redundant with lhs)
3433 /// lhs is the first token index; rhs is the last token index.
3434 /// Could be a series of multiline_string_literal_line tokens, or a single
3435 /// string_literal token.
3724 /// The `data` field is a `.token_and_token`:
3725 /// 1. a `TokenIndex` to the first `.multiline_string_literal_line` token.
3726 /// 2. a `TokenIndex` to the last `.multiline_string_literal_line` token.
3727 ///
3728 /// The `main_token` field is the first token index (redundant with `data`).
34363729 multiline_string_literal,
3437 /// `(lhs)`. main_token is the `(`; rhs is the token index of the `)`.
3730 /// `(expr)`.
3731 ///
3732 /// The `data` field is a `.node_and_token`:
3733 /// 1. a `Node.Index` to the sub-expression
3734 /// 2. a `TokenIndex` to the `)` token.
3735 ///
3736 /// The `main_token` field is the `(` token.
34383737 grouped_expression,
3439 /// `@a(lhs, rhs)`. lhs and rhs may be omitted.
3440 /// main_token is the builtin token.
3738 /// `@a(b, c)`.
3739 ///
3740 /// The `data` field is a `.opt_node_and_opt_node`:
3741 /// 1. a `Node.OptionalIndex` to the first argument, if any.
3742 /// 2. a `Node.OptionalIndex` to the second argument, if any.
3743 ///
3744 /// The `main_token` field is the builtin token.
34413745 builtin_call_two,
3442 /// Same as builtin_call_two but there is known to be a trailing comma before the rparen.
3746 /// Same as `builtin_call_two` except there is known to be a trailing comma
3747 /// before the final rparen.
34433748 builtin_call_two_comma,
3444 /// `@a(b, c)`. `sub_list[lhs..rhs]`.
3445 /// main_token is the builtin token.
3749 /// `@a(b, c, d)`.
3750 ///
3751 /// The `data` field is a `.extra_range` that stores a `Node.Index` for
3752 /// each argument.
3753 ///
3754 /// The `main_token` field is the builtin token.
34463755 builtin_call,
3447 /// Same as builtin_call but there is known to be a trailing comma before the rparen.
3756 /// Same as `builtin_call` except there is known to be a trailing comma
3757 /// before the final rparen.
34483758 builtin_call_comma,
34493759 /// `error{a, b}`.
3450 /// rhs is the rbrace, lhs is unused.
3760 ///
3761 /// The `data` field is a `.token` to the '}'.
3762 ///
3763 /// The `main_token` field is the `error`.
34513764 error_set_decl,
3452 /// `struct {}`, `union {}`, `opaque {}`, `enum {}`. `extra_data[lhs..rhs]`.
3453 /// main_token is `struct`, `union`, `opaque`, `enum` keyword.
3765 /// `struct {}`, `union {}`, `opaque {}`, `enum {}`.
3766 ///
3767 /// The `data` field is a `.extra_range` that stores a `Node.Index` for
3768 /// each container member.
3769 ///
3770 /// The `main_token` field is the `struct`, `union`, `opaque` or `enum` token.
34543771 container_decl,
3455 /// Same as ContainerDecl but there is known to be a trailing comma
3456 /// or semicolon before the rbrace.
3772 /// Same as `container_decl` except there is known to be a trailing
3773 /// comma before the final rbrace.
34573774 container_decl_trailing,
34583775 /// `struct {lhs, rhs}`, `union {lhs, rhs}`, `opaque {lhs, rhs}`, `enum {lhs, rhs}`.
3459 /// lhs or rhs can be omitted.
3460 /// main_token is `struct`, `union`, `opaque`, `enum` keyword.
3776 ///
3777 /// The `data` field is a `.opt_node_and_opt_node`:
3778 /// 1. a `Node.OptionalIndex` to the first container member, if any.
3779 /// 2. a `Node.OptionalIndex` to the second container member, if any.
3780 ///
3781 /// The `main_token` field is the `struct`, `union`, `opaque` or `enum` token.
34613782 container_decl_two,
3462 /// Same as ContainerDeclTwo except there is known to be a trailing comma
3463 /// or semicolon before the rbrace.
3783 /// Same as `container_decl_two` except there is known to be a trailing
3784 /// comma before the final rbrace.
34643785 container_decl_two_trailing,
3465 /// `struct(lhs)` / `union(lhs)` / `enum(lhs)`. `SubRange[rhs]`.
3786 /// `struct(arg)`, `union(arg)`, `enum(arg)`.
3787 ///
3788 /// The `data` field is a `.node_and_extra`:
3789 /// 1. a `Node.Index` to arg.
3790 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3791 /// each container member.
3792 ///
3793 /// The `main_token` field is the `struct`, `union` or `enum` token.
34663794 container_decl_arg,
3467 /// Same as container_decl_arg but there is known to be a trailing
3468 /// comma or semicolon before the rbrace.
3795 /// Same as `container_decl_arg` except there is known to be a trailing
3796 /// comma before the final rbrace.
34693797 container_decl_arg_trailing,
3470 /// `union(enum) {}`. `sub_list[lhs..rhs]`.
3471 /// Note that tagged unions with explicitly provided enums are represented
3472 /// by `container_decl_arg`.
3798 /// `union(enum) {}`.
3799 ///
3800 /// The `data` field is a `.extra_range` that stores a `Node.Index` for
3801 /// each container member.
3802 ///
3803 /// The `main_token` field is the `union` token.
3804 ///
3805 /// A tagged union with explicitly provided enums will instead be
3806 /// represented by `container_decl_arg`.
34733807 tagged_union,
3474 /// Same as tagged_union but there is known to be a trailing comma
3475 /// or semicolon before the rbrace.
3808 /// Same as `tagged_union` except there is known to be a trailing comma
3809 /// before the final rbrace.
34763810 tagged_union_trailing,
3477 /// `union(enum) {lhs, rhs}`. lhs or rhs may be omitted.
3478 /// Note that tagged unions with explicitly provided enums are represented
3479 /// by `container_decl_arg`.
3811 /// `union(enum) {lhs, rhs}`.
3812 ///
3813 /// The `data` field is a `.opt_node_and_opt_node`:
3814 /// 1. a `Node.OptionalIndex` to the first container member, if any.
3815 /// 2. a `Node.OptionalIndex` to the second container member, if any.
3816 ///
3817 /// The `main_token` field is the `union` token.
3818 ///
3819 /// A tagged union with explicitly provided enums will instead be
3820 /// represented by `container_decl_arg`.
34803821 tagged_union_two,
3481 /// Same as tagged_union_two but there is known to be a trailing comma
3482 /// or semicolon before the rbrace.
3822 /// Same as `tagged_union_two` except there is known to be a trailing
3823 /// comma before the final rbrace.
34833824 tagged_union_two_trailing,
3484 /// `union(enum(lhs)) {}`. `SubRange[rhs]`.
3825 /// `union(enum(arg)) {}`.
3826 ///
3827 /// The `data` field is a `.node_and_extra`:
3828 /// 1. a `Node.Index` to arg.
3829 /// 2. a `ExtraIndex` to a `SubRange` that stores a `Node.Index` for
3830 /// each container member.
3831 ///
3832 /// The `main_token` field is the `union` token.
34853833 tagged_union_enum_tag,
3486 /// Same as tagged_union_enum_tag but there is known to be a trailing comma
3487 /// or semicolon before the rbrace.
3834 /// Same as `tagged_union_enum_tag` except there is known to be a
3835 /// trailing comma before the final rbrace.
34883836 tagged_union_enum_tag_trailing,
3489 /// `a: lhs = rhs,`. lhs and rhs can be omitted.
3490 /// main_token is the field name identifier.
3491 /// lastToken() does not include the possible trailing comma.
3837 /// `a: lhs = rhs,`,
3838 /// `a: lhs,`.
3839 ///
3840 /// The `data` field is a `.node_and_opt_node`:
3841 /// 1. a `Node.Index` to the field type expression.
3842 /// 2. a `Node.OptionalIndex` to the default value expression, if any.
3843 ///
3844 /// The `main_token` field is the field name identifier.
3845 ///
3846 /// `lastToken()` does not include the possible trailing comma.
34923847 container_field_init,
3493 /// `a: lhs align(rhs),`. rhs can be omitted.
3494 /// main_token is the field name identifier.
3495 /// lastToken() does not include the possible trailing comma.
3848 /// `a: lhs align(rhs),`.
3849 ///
3850 /// The `data` field is a `.node_and_node`:
3851 /// 1. a `Node.Index` to the field type expression.
3852 /// 2. a `Node.Index` to the alignment expression.
3853 ///
3854 /// The `main_token` field is the field name identifier.
3855 ///
3856 /// `lastToken()` does not include the possible trailing comma.
34963857 container_field_align,
3497 /// `a: lhs align(c) = d,`. `container_field_list[rhs]`.
3498 /// main_token is the field name identifier.
3499 /// lastToken() does not include the possible trailing comma.
3858 /// `a: lhs align(c) = d,`.
3859 ///
3860 /// The `data` field is a `.node_and_extra`:
3861 /// 1. a `Node.Index` to the field type expression.
3862 /// 2. a `ExtraIndex` to `ContainerField`.
3863 ///
3864 /// The `main_token` field is the field name identifier.
3865 ///
3866 /// `lastToken()` does not include the possible trailing comma.
35003867 container_field,
3501 /// `comptime lhs`. rhs unused.
3868 /// `comptime expr`.
3869 ///
3870 /// The `data` field is a `.node` to expr.
3871 ///
3872 /// The `main_token` field is the `comptime` token.
35023873 @"comptime",
3503 /// `nosuspend lhs`. rhs unused.
3874 /// `nosuspend expr`.
3875 ///
3876 /// The `data` field is a `.node` to expr.
3877 ///
3878 /// The `main_token` field is the `nosuspend` token.
35043879 @"nosuspend",
3505 /// `{lhs rhs}`. rhs or lhs can be omitted.
3506 /// main_token points at the lbrace.
3880 /// `{lhs rhs}`.
3881 ///
3882 /// The `data` field is a `.opt_node_and_opt_node`:
3883 /// 1. a `Node.OptionalIndex` to the first statement, if any.
3884 /// 2. a `Node.OptionalIndex` to the second statement, if any.
3885 ///
3886 /// The `main_token` field is the `{` token.
35073887 block_two,
3508 /// Same as block_two but there is known to be a semicolon before the rbrace.
3888 /// Same as `block_two_semicolon` except there is known to be a trailing
3889 /// comma before the final rbrace.
35093890 block_two_semicolon,
3510 /// `{}`. `sub_list[lhs..rhs]`.
3511 /// main_token points at the lbrace.
3891 /// `{a b}`.
3892 ///
3893 /// The `data` field is a `.extra_range` that stores a `Node.Index` for
3894 /// each statement.
3895 ///
3896 /// The `main_token` field is the `{` token.
35123897 block,
3513 /// Same as block but there is known to be a semicolon before the rbrace.
3898 /// Same as `block` except there is known to be a trailing comma before
3899 /// the final rbrace.
35143900 block_semicolon,
3515 /// `asm(lhs)`. rhs is the token index of the rparen.
3901 /// `asm(lhs)`.
3902 ///
3903 /// rhs is a `Token.Index` to the `)` token.
3904 /// The `main_token` field is the `asm` token.
35163905 asm_simple,
3517 /// `asm(lhs, a)`. `Asm[rhs]`.
3906 /// `asm(lhs, a)`.
3907 ///
3908 /// The `data` field is a `.node_and_extra`:
3909 /// 1. a `Node.Index` to lhs.
3910 /// 2. a `ExtraIndex` to `Asm`.
3911 ///
3912 /// The `main_token` field is the `asm` token.
35183913 @"asm",
3519 /// `[a] "b" (c)`. lhs is 0, rhs is token index of the rparen.
3520 /// `[a] "b" (-> lhs)`. rhs is token index of the rparen.
3521 /// main_token is `a`.
3914 /// `[a] "b" (c)`.
3915 /// `[a] "b" (-> lhs)`.
3916 ///
3917 /// The `data` field is a `.opt_node_and_token`:
3918 /// 1. a `Node.OptionalIndex` to lhs, if any.
3919 /// 2. a `TokenIndex` to the `)` token.
3920 ///
3921 /// The `main_token` field is `a`.
35223922 asm_output,
3523 /// `[a] "b" (lhs)`. rhs is token index of the rparen.
3524 /// main_token is `a`.
3923 /// `[a] "b" (lhs)`.
3924 ///
3925 /// The `data` field is a `.node_and_token`:
3926 /// 1. a `Node.Index` to lhs.
3927 /// 2. a `TokenIndex` to the `)` token.
3928 ///
3929 /// The `main_token` field is `a`.
35253930 asm_input,
3526 /// `error.a`. lhs is token index of `.`. rhs is token index of `a`.
3931 /// `error.a`.
3932 ///
3933 /// The `data` field is a `.opt_token_and_opt_token`:
3934 /// 1. a `OptionalTokenIndex` of `.`. Can't be `.none` unless a parsing error occured.
3935 /// 2. a `OptionalTokenIndex` of `a`. Can't be `.none` unless a parsing error occured.
3936 ///
3937 /// The `main_token` field is `error` token.
35273938 error_value,
3528 /// `lhs!rhs`. main_token is the `!`.
3939 /// `lhs!rhs`.
3940 ///
3941 /// The `main_token` field is the `!` token.
35293942 error_union,
35303943
35313944 pub fn isContainerField(tag: Tag) bool {