diff options
Diffstat (limited to 'lib/operators.nom')
| -rw-r--r-- | lib/operators.nom | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/operators.nom b/lib/operators.nom index 7102a65..9f93a39 100644 --- a/lib/operators.nom +++ b/lib/operators.nom @@ -47,6 +47,14 @@ compile [%str |%start|] to: "\(%str as lua):sub(\(%start as lua), \(%start as lu compile [%str |%start - %stop|] to: "\(%str as lua):sub(\(%start as lua), \(%stop as lua))" # Variable assignment operator, and += type versions +compile [local %vars] to code: + lua> ".." + local locals = \%vars.type == "List" and \%vars.value or {\%vars}; + local identifiers = {}; + for i,x in ipairs(locals) do + identifiers[i] = nomsu:tree_to_lua(x).expr; + end + return "local "..table.concat(identifiers, ", "); compile [set %var = %val] to code: lua> ".." if \%var.type == 'List' and \%val.type == 'List' then |
