| ... | ... | @@ -3052,480 +3052,893 @@ pub const Node = struct { |
| 3052 | 3052 | } |
| 3053 | 3053 | } |
| 3054 | 3054 | |
| 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()` |
| 3057 | 3057 | 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. |
| 3059 | 3063 | 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. |
| 3061 | 3069 | @"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. |
| 3064 | 3079 | 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. |
| 3068 | 3088 | 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. |
| 3072 | 3100 | 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`. |
| 3074 | 3103 | /// 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. |
| 3076 | 3113 | 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`. |
| 3078 | 3116 | /// 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. |
| 3080 | 3126 | 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. |
| 3083 | 3135 | @"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`. |
| 3086 | 3141 | @"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. |
| 3091 | 3149 | @"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. |
| 3093 | 3157 | 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. |
| 3095 | 3165 | unwrap_optional, |
| 3096 | | /// `lhs == rhs`. main_token is op. |
| 3166 | /// `lhs == rhs`. The `main_token` field is the `==` token. |
| 3097 | 3167 | equal_equal, |
| 3098 | | /// `lhs != rhs`. main_token is op. |
| 3168 | /// `lhs != rhs`. The `main_token` field is the `!=` token. |
| 3099 | 3169 | bang_equal, |
| 3100 | | /// `lhs < rhs`. main_token is op. |
| 3170 | /// `lhs < rhs`. The `main_token` field is the `<` token. |
| 3101 | 3171 | less_than, |
| 3102 | | /// `lhs > rhs`. main_token is op. |
| 3172 | /// `lhs > rhs`. The `main_token` field is the `>` token. |
| 3103 | 3173 | greater_than, |
| 3104 | | /// `lhs <= rhs`. main_token is op. |
| 3174 | /// `lhs <= rhs`. The `main_token` field is the `<=` token. |
| 3105 | 3175 | less_or_equal, |
| 3106 | | /// `lhs >= rhs`. main_token is op. |
| 3176 | /// `lhs >= rhs`. The `main_token` field is the `>=` token. |
| 3107 | 3177 | greater_or_equal, |
| 3108 | | /// `lhs *= rhs`. main_token is op. |
| 3178 | /// `lhs *= rhs`. The `main_token` field is the `*=` token. |
| 3109 | 3179 | assign_mul, |
| 3110 | | /// `lhs /= rhs`. main_token is op. |
| 3180 | /// `lhs /= rhs`. The `main_token` field is the `/=` token. |
| 3111 | 3181 | assign_div, |
| 3112 | | /// `lhs %= rhs`. main_token is op. |
| 3182 | /// `lhs %= rhs`. The `main_token` field is the `%=` token. |
| 3113 | 3183 | assign_mod, |
| 3114 | | /// `lhs += rhs`. main_token is op. |
| 3184 | /// `lhs += rhs`. The `main_token` field is the `+=` token. |
| 3115 | 3185 | assign_add, |
| 3116 | | /// `lhs -= rhs`. main_token is op. |
| 3186 | /// `lhs -= rhs`. The `main_token` field is the `-=` token. |
| 3117 | 3187 | assign_sub, |
| 3118 | | /// `lhs <<= rhs`. main_token is op. |
| 3188 | /// `lhs <<= rhs`. The `main_token` field is the `<<=` token. |
| 3119 | 3189 | assign_shl, |
| 3120 | | /// `lhs <<|= rhs`. main_token is op. |
| 3190 | /// `lhs <<|= rhs`. The `main_token` field is the `<<|=` token. |
| 3121 | 3191 | assign_shl_sat, |
| 3122 | | /// `lhs >>= rhs`. main_token is op. |
| 3192 | /// `lhs >>= rhs`. The `main_token` field is the `>>=` token. |
| 3123 | 3193 | assign_shr, |
| 3124 | | /// `lhs &= rhs`. main_token is op. |
| 3194 | /// `lhs &= rhs`. The `main_token` field is the `&=` token. |
| 3125 | 3195 | assign_bit_and, |
| 3126 | | /// `lhs ^= rhs`. main_token is op. |
| 3196 | /// `lhs ^= rhs`. The `main_token` field is the `^=` token. |
| 3127 | 3197 | assign_bit_xor, |
| 3128 | | /// `lhs |= rhs`. main_token is op. |
| 3198 | /// `lhs |= rhs`. The `main_token` field is the `|=` token. |
| 3129 | 3199 | assign_bit_or, |
| 3130 | | /// `lhs *%= rhs`. main_token is op. |
| 3200 | /// `lhs *%= rhs`. The `main_token` field is the `*%=` token. |
| 3131 | 3201 | assign_mul_wrap, |
| 3132 | | /// `lhs +%= rhs`. main_token is op. |
| 3202 | /// `lhs +%= rhs`. The `main_token` field is the `+%=` token. |
| 3133 | 3203 | assign_add_wrap, |
| 3134 | | /// `lhs -%= rhs`. main_token is op. |
| 3204 | /// `lhs -%= rhs`. The `main_token` field is the `-%=` token. |
| 3135 | 3205 | assign_sub_wrap, |
| 3136 | | /// `lhs *|= rhs`. main_token is op. |
| 3206 | /// `lhs *|= rhs`. The `main_token` field is the `*%=` token. |
| 3137 | 3207 | assign_mul_sat, |
| 3138 | | /// `lhs +|= rhs`. main_token is op. |
| 3208 | /// `lhs +|= rhs`. The `main_token` field is the `+|=` token. |
| 3139 | 3209 | assign_add_sat, |
| 3140 | | /// `lhs -|= rhs`. main_token is op. |
| 3210 | /// `lhs -|= rhs`. The `main_token` field is the `-|=` token. |
| 3141 | 3211 | assign_sub_sat, |
| 3142 | | /// `lhs = rhs`. main_token is op. |
| 3212 | /// `lhs = rhs`. The `main_token` field is the `=` token. |
| 3143 | 3213 | 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. |
| 3157 | 3241 | assign_destructure, |
| 3158 | | /// `lhs || rhs`. main_token is the `||`. |
| 3242 | /// `lhs || rhs`. The `main_token` field is the `||` token. |
| 3159 | 3243 | merge_error_sets, |
| 3160 | | /// `lhs * rhs`. main_token is the `*`. |
| 3244 | /// `lhs * rhs`. The `main_token` field is the `*` token. |
| 3161 | 3245 | mul, |
| 3162 | | /// `lhs / rhs`. main_token is the `/`. |
| 3246 | /// `lhs / rhs`. The `main_token` field is the `/` token. |
| 3163 | 3247 | div, |
| 3164 | | /// `lhs % rhs`. main_token is the `%`. |
| 3248 | /// `lhs % rhs`. The `main_token` field is the `%` token. |
| 3165 | 3249 | mod, |
| 3166 | | /// `lhs ** rhs`. main_token is the `**`. |
| 3250 | /// `lhs ** rhs`. The `main_token` field is the `**` token. |
| 3167 | 3251 | array_mult, |
| 3168 | | /// `lhs *% rhs`. main_token is the `*%`. |
| 3252 | /// `lhs *% rhs`. The `main_token` field is the `*%` token. |
| 3169 | 3253 | mul_wrap, |
| 3170 | | /// `lhs *| rhs`. main_token is the `*|`. |
| 3254 | /// `lhs *| rhs`. The `main_token` field is the `*|` token. |
| 3171 | 3255 | mul_sat, |
| 3172 | | /// `lhs + rhs`. main_token is the `+`. |
| 3256 | /// `lhs + rhs`. The `main_token` field is the `+` token. |
| 3173 | 3257 | add, |
| 3174 | | /// `lhs - rhs`. main_token is the `-`. |
| 3258 | /// `lhs - rhs`. The `main_token` field is the `-` token. |
| 3175 | 3259 | sub, |
| 3176 | | /// `lhs ++ rhs`. main_token is the `++`. |
| 3260 | /// `lhs ++ rhs`. The `main_token` field is the `++` token. |
| 3177 | 3261 | array_cat, |
| 3178 | | /// `lhs +% rhs`. main_token is the `+%`. |
| 3262 | /// `lhs +% rhs`. The `main_token` field is the `+%` token. |
| 3179 | 3263 | add_wrap, |
| 3180 | | /// `lhs -% rhs`. main_token is the `-%`. |
| 3264 | /// `lhs -% rhs`. The `main_token` field is the `-%` token. |
| 3181 | 3265 | sub_wrap, |
| 3182 | | /// `lhs +| rhs`. main_token is the `+|`. |
| 3266 | /// `lhs +| rhs`. The `main_token` field is the `+|` token. |
| 3183 | 3267 | add_sat, |
| 3184 | | /// `lhs -| rhs`. main_token is the `-|`. |
| 3268 | /// `lhs -| rhs`. The `main_token` field is the `-|` token. |
| 3185 | 3269 | sub_sat, |
| 3186 | | /// `lhs << rhs`. main_token is the `<<`. |
| 3270 | /// `lhs << rhs`. The `main_token` field is the `<<` token. |
| 3187 | 3271 | shl, |
| 3188 | | /// `lhs <<| rhs`. main_token is the `<<|`. |
| 3272 | /// `lhs <<| rhs`. The `main_token` field is the `<<|` token. |
| 3189 | 3273 | shl_sat, |
| 3190 | | /// `lhs >> rhs`. main_token is the `>>`. |
| 3274 | /// `lhs >> rhs`. The `main_token` field is the `>>` token. |
| 3191 | 3275 | shr, |
| 3192 | | /// `lhs & rhs`. main_token is the `&`. |
| 3276 | /// `lhs & rhs`. The `main_token` field is the `&` token. |
| 3193 | 3277 | bit_and, |
| 3194 | | /// `lhs ^ rhs`. main_token is the `^`. |
| 3278 | /// `lhs ^ rhs`. The `main_token` field is the `^` token. |
| 3195 | 3279 | bit_xor, |
| 3196 | | /// `lhs | rhs`. main_token is the `|`. |
| 3280 | /// `lhs | rhs`. The `main_token` field is the `|` token. |
| 3197 | 3281 | bit_or, |
| 3198 | | /// `lhs orelse rhs`. main_token is the `orelse`. |
| 3282 | /// `lhs orelse rhs`. The `main_token` field is the `orelse` token. |
| 3199 | 3283 | @"orelse", |
| 3200 | | /// `lhs and rhs`. main_token is the `and`. |
| 3284 | /// `lhs and rhs`. The `main_token` field is the `and` token. |
| 3201 | 3285 | bool_and, |
| 3202 | | /// `lhs or rhs`. main_token is the `or`. |
| 3286 | /// `lhs or rhs`. The `main_token` field is the `or` token. |
| 3203 | 3287 | bool_or, |
| 3204 | | /// `op lhs`. rhs unused. main_token is op. |
| 3288 | /// `!expr`. The `main_token` field is the `!` token. |
| 3205 | 3289 | bool_not, |
| 3206 | | /// `op lhs`. rhs unused. main_token is op. |
| 3290 | /// `-expr`. The `main_token` field is the `-` token. |
| 3207 | 3291 | negation, |
| 3208 | | /// `op lhs`. rhs unused. main_token is op. |
| 3292 | /// `~expr`. The `main_token` field is the `~` token. |
| 3209 | 3293 | bit_not, |
| 3210 | | /// `op lhs`. rhs unused. main_token is op. |
| 3294 | /// `-%expr`. The `main_token` field is the `-%` token. |
| 3211 | 3295 | negation_wrap, |
| 3212 | | /// `op lhs`. rhs unused. main_token is op. |
| 3296 | /// `&expr`. The `main_token` field is the `&` token. |
| 3213 | 3297 | address_of, |
| 3214 | | /// `op lhs`. rhs unused. main_token is op. |
| 3298 | /// `try expr`. The `main_token` field is the `try` token. |
| 3215 | 3299 | @"try", |
| 3216 | | /// `op lhs`. rhs unused. main_token is op. |
| 3300 | /// `await expr`. The `main_token` field is the `await` token. |
| 3217 | 3301 | @"await", |
| 3218 | | /// `?lhs`. rhs unused. main_token is the `?`. |
| 3302 | /// `?expr`. The `main_token` field is the `?` token. |
| 3219 | 3303 | optional_type, |
| 3220 | | /// `[lhs]rhs`. |
| 3304 | /// `[lhs]rhs`. The `main_token` field is the `[` token. |
| 3221 | 3305 | 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. |
| 3223 | 3313 | 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`, |
| 3226 | 3316 | /// `[]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. |
| 3231 | 3326 | ptr_type_aligned, |
| 3232 | | /// `[*:lhs]rhs`. lhs can be omitted. |
| 3233 | | /// `*rhs`. |
| 3327 | /// `[*:lhs]rhs`, |
| 3328 | /// `*rhs`, |
| 3234 | 3329 | /// `[: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. |
| 3239 | 3339 | 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. |
| 3245 | 3348 | 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. |
| 3251 | 3357 | ptr_type_bit_range, |
| 3252 | 3358 | /// `lhs[rhs..]` |
| 3253 | | /// main_token is the lbracket. |
| 3359 | /// |
| 3360 | /// The `main_token` field is the `[` token. |
| 3254 | 3361 | 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. |
| 3257 | 3369 | 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. |
| 3260 | 3378 | 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. |
| 3262 | 3384 | deref, |
| 3263 | 3385 | /// `lhs[rhs]`. |
| 3386 | /// |
| 3387 | /// The `main_token` field is the `[` token. |
| 3264 | 3388 | array_access, |
| 3265 | | /// `lhs{rhs}`. rhs can be omitted. |
| 3389 | /// `lhs{rhs}`. |
| 3390 | /// |
| 3391 | /// The `main_token` field is the `{` token. |
| 3266 | 3392 | 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. |
| 3268 | 3395 | 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. |
| 3270 | 3404 | 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. |
| 3273 | 3407 | 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. |
| 3275 | 3414 | 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. |
| 3278 | 3417 | 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. |
| 3280 | 3426 | array_init, |
| 3281 | 3427 | /// Same as `array_init` except there is known to be a trailing comma |
| 3282 | 3428 | /// before the final rbrace. |
| 3283 | 3429 | 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. |
| 3286 | 3440 | 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. |
| 3289 | 3443 | 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. |
| 3293 | 3454 | 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. |
| 3296 | 3457 | 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. |
| 3299 | 3467 | 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. |
| 3302 | 3470 | 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. |
| 3306 | 3482 | struct_init, |
| 3307 | 3483 | /// Same as `struct_init` except there is known to be a trailing comma |
| 3308 | 3484 | /// before the final rbrace. |
| 3309 | 3485 | 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. |
| 3312 | 3493 | 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. |
| 3315 | 3496 | 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. |
| 3317 | 3504 | 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. |
| 3319 | 3507 | 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. |
| 3322 | 3516 | 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. |
| 3325 | 3519 | 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. |
| 3328 | 3528 | 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. |
| 3331 | 3531 | 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`. |
| 3334 | 3540 | @"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. |
| 3337 | 3543 | 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. |
| 3340 | 3552 | 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. |
| 3342 | 3554 | 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. |
| 3345 | 3563 | switch_case, |
| 3346 | | /// Same ast `switch_case` but the case is inline |
| 3564 | /// Same as `switch_case` but the case is inline. |
| 3347 | 3565 | switch_case_inline, |
| 3348 | 3566 | /// `lhs...rhs`. |
| 3567 | /// |
| 3568 | /// The `main_token` field is the `...` token. |
| 3349 | 3569 | switch_range, |
| 3350 | | /// `while (lhs) rhs`. |
| 3351 | | /// `while (lhs) |x| rhs`. |
| 3570 | /// `while (a) b`, |
| 3571 | /// `while (a) |x| b`. |
| 3352 | 3572 | 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`. |
| 3355 | 3575 | 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. |
| 3360 | 3580 | @"while", |
| 3361 | | /// `for (lhs) rhs`. |
| 3581 | /// `for (a) b`. |
| 3362 | 3582 | for_simple, |
| 3363 | 3583 | /// `for (lhs[0..inputs]) lhs[inputs + 1] else lhs[inputs + 2]`. `For[rhs]`. |
| 3364 | 3584 | @"for", |
| 3365 | | /// `lhs..rhs`. rhs can be omitted. |
| 3585 | /// `lhs..rhs`, `lhs..`. |
| 3366 | 3586 | for_range, |
| 3367 | | /// `if (lhs) rhs`. |
| 3368 | | /// `if (lhs) |a| rhs`. |
| 3587 | /// `if (a) b`. |
| 3588 | /// `if (b) |x| b`. |
| 3369 | 3589 | 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`. |
| 3373 | 3593 | @"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. |
| 3375 | 3599 | @"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. |
| 3377 | 3605 | @"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. |
| 3380 | 3616 | @"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. |
| 3383 | 3627 | @"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. |
| 3385 | 3633 | @"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. |
| 3390 | 3645 | 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. |
| 3395 | 3658 | 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`. |
| 3397 | 3660 | /// 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. |
| 3401 | 3671 | 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. |
| 3406 | 3683 | 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. |
| 3411 | 3691 | 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. |
| 3413 | 3699 | anyframe_type, |
| 3414 | | /// Both lhs and rhs unused. |
| 3700 | /// The `data` field is unused. |
| 3415 | 3701 | anyframe_literal, |
| 3416 | | /// Both lhs and rhs unused. |
| 3702 | /// The `data` field is unused. |
| 3417 | 3703 | char_literal, |
| 3418 | | /// Both lhs and rhs unused. |
| 3704 | /// The `data` field is unused. |
| 3419 | 3705 | number_literal, |
| 3420 | | /// Both lhs and rhs unused. |
| 3706 | /// The `data` field is unused. |
| 3421 | 3707 | 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. |
| 3426 | 3713 | 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. |
| 3428 | 3719 | 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. |
| 3431 | 3723 | 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`). |
| 3436 | 3729 | 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. |
| 3438 | 3737 | 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. |
| 3441 | 3745 | 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. |
| 3443 | 3748 | 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. |
| 3446 | 3755 | 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. |
| 3448 | 3758 | builtin_call_comma, |
| 3449 | 3759 | /// `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`. |
| 3451 | 3764 | 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. |
| 3454 | 3771 | 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. |
| 3457 | 3774 | container_decl_trailing, |
| 3458 | 3775 | /// `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. |
| 3461 | 3782 | 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. |
| 3464 | 3785 | 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. |
| 3466 | 3794 | 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. |
| 3469 | 3797 | 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`. |
| 3473 | 3807 | 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. |
| 3476 | 3810 | 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`. |
| 3480 | 3821 | 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. |
| 3483 | 3824 | 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. |
| 3485 | 3833 | 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. |
| 3488 | 3836 | 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. |
| 3492 | 3847 | 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. |
| 3496 | 3857 | 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. |
| 3500 | 3867 | 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. |
| 3502 | 3873 | @"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. |
| 3504 | 3879 | @"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. |
| 3507 | 3887 | 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. |
| 3509 | 3890 | 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. |
| 3512 | 3897 | 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. |
| 3514 | 3900 | 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. |
| 3516 | 3905 | 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. |
| 3518 | 3913 | @"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`. |
| 3522 | 3922 | 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`. |
| 3525 | 3930 | 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. |
| 3527 | 3938 | error_value, |
| 3528 | | /// `lhs!rhs`. main_token is the `!`. |
| 3939 | /// `lhs!rhs`. |
| 3940 | /// |
| 3941 | /// The `main_token` field is the `!` token. |
| 3529 | 3942 | error_union, |
| 3530 | 3943 | |
| 3531 | 3944 | pub fn isContainerField(tag: Tag) bool { |