Commit d9db292
authored
fix(parser): track bracket/brace depth in array subscript reader (#603)
## Summary
- Fix the parser's array subscript reader to track `[]` bracket depth
and `${}` brace depth
- Without this, `${arr[$RANDOM % ${#arr[@]}]}` had subscripts truncated
at the `]` inside `${#arr[@]}`
- Added parser unit tests for nested subscript parsing and assignment
parsing
Depends on #602 (lexer fix).
## Test plan
- [x] Parser unit test: `test_nested_expansion_in_array_subscript`
verifies correct AST
- [x] Parser unit test: `test_assignment_nested_subscript_parses`
verifies no fuel exhaustion
- [x] Full test suite passes (0 new failures)
Closes #6001 parent 5c2729c commit d9db292
1 file changed
+66
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2388 | 2388 | | |
2389 | 2389 | | |
2390 | 2390 | | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
2391 | 2396 | | |
2392 | | - | |
| 2397 | + | |
2393 | 2398 | | |
2394 | 2399 | | |
2395 | 2400 | | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
2396 | 2421 | | |
2397 | 2422 | | |
2398 | 2423 | | |
| |||
3045 | 3070 | | |
3046 | 3071 | | |
3047 | 3072 | | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
3048 | 3113 | | |
0 commit comments