diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-25 17:43:48 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-25 17:44:24 -0700 |
| commit | 4e821308af654706b8bda5f3d00dce7a933d9942 (patch) | |
| tree | 674f4eea13cd7475a14344132ec6f12937ac9a96 /nomsu_tree.moon | |
| parent | 5d59d510cd6fdc8553250e5ec10f19a285e8878c (diff) | |
Overhauling parsing of Blocks (can no longer contain only one statement)
Diffstat (limited to 'nomsu_tree.moon')
| -rw-r--r-- | nomsu_tree.moon | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nomsu_tree.moon b/nomsu_tree.moon index 43ebcd2..2cf0777 100644 --- a/nomsu_tree.moon +++ b/nomsu_tree.moon @@ -74,8 +74,6 @@ Tree "Nomsu", Tree "Block", as_lua: (nomsu)=> - if #@value == 1 - return @value[1]\as_lua(nomsu) lua = Lua(@source) for i,line in ipairs @value line_lua = line\as_lua(nomsu) @@ -86,9 +84,15 @@ Tree "Block", return lua as_nomsu: (inline=false)=> - if #@value == 1 - return @value[1]\as_nomsu(inline) - return nil if inline + if inline + nomsu = Nomsu(@source) + for i,line in ipairs @value + if i > 1 + nomsu\append "; " + line_nomsu = line\as_nomsu(true) + return nil unless line_nomsu + nomsu\append line_nomsu + return nomsu nomsu = Nomsu(@source) for i, line in ipairs @value line = assert(line\as_nomsu!, "Could not convert line to nomsu") |
