From fc71b0331b6122c774585c3ab93e6e55978ecaf2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 15 Jun 2018 03:30:20 -0700 Subject: Fixed some nomsu codegen bugs --- nomsu.moon | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'nomsu.moon') diff --git a/nomsu.moon b/nomsu.moon index 94e6aa2..459ad7c 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -865,10 +865,18 @@ class NomsuCompiler for i, bit in ipairs tree if i > 1 nomsu\append "." - bit_nomsu = @tree_to_nomsu(bit, true) + local bit_nomsu + if bit.type == "Text" and #bit == 1 and type(bit[1]) == 'string' + if (NOMSU_DEFS.ident_char^1)\match(bit[1]) + bit_nomsu = bit[1] + unless bit_nomsu then bit_nomsu = @tree_to_nomsu(bit, true) return nil unless bit_nomsu - if bit.type == "Action" or bit.type == "Block" - bit_nomsu\parenthesize! + switch bit.type + when "Action", "Block", "IndexChain" + bit_nomsu\parenthesize! + when "Number" + if i < #tree + bit_nomsu\parenthesize! nomsu\append bit_nomsu return nomsu -- cgit v1.2.3