diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-14 21:59:25 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-14 21:59:43 -0700 |
| commit | 82cfd3e54b5910843c091a9fb6ef3ad6b64ba757 (patch) | |
| tree | aed04a3910646c82447b9b4b515169005b3010af /code_obj.moon | |
| parent | 282565a309aef632502a64fef0a67b0b7efcfaaa (diff) | |
More streamlining and cleanup. Especially for core/metaprogramming.nom
Diffstat (limited to 'code_obj.moon')
| -rw-r--r-- | code_obj.moon | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/code_obj.moon b/code_obj.moon index ec644a5..d3de65c 100644 --- a/code_obj.moon +++ b/code_obj.moon @@ -65,6 +65,22 @@ class Code elseif @current_indent != 0 indents[#bits] = @current_indent @__str = nil + + concat_append: (values, joiner)=> + bits, indents = @bits, @indents + match = string.match + for i=1,#values + b = values[i] + assert(b) + if i > 1 + bits[#bits+1] = joiner + bits[#bits+1] = b + if type(b) == 'string' + if spaces = match(b, "\n([ ]*)[^\n]*$") + @current_indent = #spaces + elseif @current_indent != 0 + indents[#bits] = @current_indent + @__str = nil prepend: (...)=> n = select("#",...) |
