Added numeric-for list comprehension
This commit is contained in:
parent
f0446a27c9
commit
27c8024888
@ -75,6 +75,29 @@ immediately
|
||||
end)()
|
||||
parse [%expression for all %iterable] as: %expression for % in %iterable
|
||||
|
||||
compile [..]
|
||||
%expression for %index from %start to %stop via %step
|
||||
%expression for %index from %start to %stop by %step
|
||||
..to
|
||||
assume ((%index's "type") is "Var") or barf ".."
|
||||
List comprehension has the wrong type for the loop variable. Expected Var, but got: \(%index's "type")
|
||||
return {..}
|
||||
expr:".."
|
||||
(function()
|
||||
local comprehension = {};
|
||||
for \(%index as lua expr)=\(%start as lua expr),\(%stop as lua expr),\(%step as lua expr) do
|
||||
comprehension[\(%index as lua expr)] = \(%expression as lua expr);
|
||||
end
|
||||
return comprehension;
|
||||
end)()
|
||||
parse [%expression for all ] as: %expression for % in %iterable
|
||||
parse [%expression for %var from %start to %stop] as: %expression for %var from %start to %stop via 1
|
||||
parse [..]
|
||||
%expression for all %start to %stop by %step
|
||||
%expression for all %start to %stop via %step
|
||||
..as: %expression for % from %start to %stop via %step
|
||||
parse [%expression for all %start to %stop] as: %expression for all %start to %stop via 1
|
||||
|
||||
compile [%expression for %key = %value in %iterable] to
|
||||
assume ((%key's "type") is "Var") or barf ".."
|
||||
List comprehension has the wrong type for the key loop variable. Expected Var, but got: \(%key's "type")
|
||||
|
Loading…
Reference in New Issue
Block a user