mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
Shell: Add support for enumerating lists in for loops
With some odd syntax to boot: ```sh $ for index i x in $whatever {} ```
This commit is contained in:
parent
a45b2ea6fb
commit
13b65b632a
8 changed files with 133 additions and 23 deletions
|
@ -207,7 +207,7 @@ control_structure[c] :: for_expr
|
|||
continuation_control :: 'break'
|
||||
| 'continue'
|
||||
|
||||
for_expr :: 'for' ws+ (identifier ' '+ 'in' ws*)? expression ws+ '{' [c] toplevel '}'
|
||||
for_expr :: 'for' ws+ (('index' ' '+ identifier ' '+)? identifier ' '+ 'in' ws*)? expression ws+ '{' [c] toplevel '}'
|
||||
|
||||
loop_expr :: 'loop' ws* '{' [c] toplevel '}'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue