diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-24 21:16:51 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-24 21:17:15 -0700 |
| commit | 64294f5cd6ab67236625cf4d645debafc35d0055 (patch) | |
| tree | db469d2e94f4d8479d02e7a390941c122025b423 /nomsu_tree.lua | |
| parent | d9b795ee45d7a3c65bdd74da5ee042fac12cf5b8 (diff) | |
Removed the Word tree type and replaced it with raw strings, since
they're only used as part of Actions
Diffstat (limited to 'nomsu_tree.lua')
| -rw-r--r-- | nomsu_tree.lua | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/nomsu_tree.lua b/nomsu_tree.lua index 4bacdb5..e7a5fce 100644 --- a/nomsu_tree.lua +++ b/nomsu_tree.lua @@ -103,7 +103,6 @@ Tree("Dict", 'multi') Tree("DictEntry", 'multi') Tree("IndexChain", 'multi') Tree("Number", 'single') -Tree("Word", 'single') Tree("Comment", 'single') Tree("Var", 'single', { as_lua_id = function(self) @@ -121,31 +120,29 @@ Tree("Action", 'multi', { if include_names == nil then include_names = false end - local bits if include_names then - do + return concat((function() local _accum_0 = { } local _len_0 = 1 for _index_0 = 1, #self do - local t = self[_index_0] - _accum_0[_len_0] = (t.type == "Word" and t.value or "%" .. tostring(t.value)) + local a = self[_index_0] + _accum_0[_len_0] = type(a) == "string" and a or "%" .. tostring(a.value) _len_0 = _len_0 + 1 end - bits = _accum_0 - end + return _accum_0 + end)(), " ") else - do + return concat((function() local _accum_0 = { } local _len_0 = 1 for _index_0 = 1, #self do - local t = self[_index_0] - _accum_0[_len_0] = (t.type == "Word" and t.value or "%") + local a = self[_index_0] + _accum_0[_len_0] = type(a) == "string" and a or "%" _len_0 = _len_0 + 1 end - bits = _accum_0 - end + return _accum_0 + end)(), " ") end - return concat(bits, " ") end }) return Types |
