From 64294f5cd6ab67236625cf4d645debafc35d0055 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 24 May 2018 21:16:51 -0700 Subject: Removed the Word tree type and replaced it with raw strings, since they're only used as part of Actions --- nomsu_tree.lua | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'nomsu_tree.lua') 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 -- cgit v1.2.3