diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-13 14:30:32 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-13 14:30:39 -0700 |
| commit | 01a4f36398bfe66a7286a83fdd797c8b20541681 (patch) | |
| tree | b2ef8fc3ff0459295d6165832f62f06d0dca3055 /code_obj.lua | |
| parent | 84c0058e69a18d5aec0ca4641725e87eddf4362f (diff) | |
Minor changes.
Diffstat (limited to 'code_obj.lua')
| -rw-r--r-- | code_obj.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/code_obj.lua b/code_obj.lua index 84af36a..edbd446 100644 --- a/code_obj.lua +++ b/code_obj.lua @@ -3,6 +3,8 @@ do local _obj_0 = table insert, remove, concat = _obj_0.insert, _obj_0.remove, _obj_0.concat end +local repr +repr = require('utils').repr local LuaCode, NomsuCode, Source do local _class_0 @@ -77,6 +79,7 @@ local Code do local _class_0 local _base_0 = { + is_code = true, append = function(self, ...) local n = select("#", ...) local bits, indents = self.bits, self.indents @@ -86,14 +89,15 @@ do repeat local b = select(i, ...) assert(b, "code bit is nil") - if Source:is_instance(b) then - require('ldt').breakpoint() - end + assert(not Source:is_instance(b), "code bit is a Source") if b == '' then _continue_0 = true break end bits[#bits + 1] = b + if type(b) ~= 'string' and not (type(b) == 'table' and b.is_code) then + b = repr(b) + end if type(b) == 'string' then local trailing_text, spaces = match(b, "\n(([ ]*)[^\n]*)$") if trailing_text then @@ -415,6 +419,11 @@ do lua.is_value = true return lua end + self.Comment = function(...) + local lua = LuaCode(...) + lua.is_comment = true + return lua + end if _parent_0.__inherited then _parent_0.__inherited(_parent_0, _class_0) end |
