Added dict to core lib.
This commit is contained in:
parent
39a92bd1ab
commit
7c02fe0564
11
core.nom
11
core.nom
@ -279,4 +279,15 @@ macro block "test %code yields %expected":
|
|||||||
error!
|
error!
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
rule "dict %items":
|
||||||
|
let "dict" = []
|
||||||
|
for "pair" in %items:
|
||||||
|
lua block "vars.dict[vars.pair[1]] = vars.pair[2]"
|
||||||
|
return %dict
|
||||||
|
|
||||||
|
rule "%dict -> %key":
|
||||||
|
lua expr "vars.dict[vars.key]"
|
||||||
|
|
||||||
|
rule "%dict -> %key = %value":
|
||||||
|
lua block "vars.dict[vars.key] = vars.value"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user