diff --git a/lib/metaprogramming.nom b/lib/metaprogramming.nom index 29a4ebd..95deb0c 100644 --- a/lib/metaprogramming.nom +++ b/lib/metaprogramming.nom @@ -72,6 +72,10 @@ rule [%tree as value] =: =lua "nomsu:tree_to_value(\(%tree), vars)" compile [repr %obj] to: "nomsu:repr(\(%obj as lua))" +compile [indented %obj] to: + "nomsu:indent(\(%obj as lua))" +compile [dedented %obj] to: + "nomsu:dedent(\(%obj as lua))" compile [type %obj, type of %obj] to: "type(\(%obj as lua))" diff --git a/nomsu.lua b/nomsu.lua index 12a9f5d..6ea1d79 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -353,8 +353,9 @@ do scope = nil end if after == nil then - after = 0 + after = nil end + after = after or (self.core_defs or 0) scope = scope or self.defs local defs_by_num = { } for stub, def in pairs(scope) do diff --git a/nomsu.moon b/nomsu.moon index ce6f554..af66123 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -277,7 +277,8 @@ class NomsuCompiler if not ok then @error(ret1) return ret1, ret2 - serialize_defs: (scope=nil, after=0)=> + serialize_defs: (scope=nil, after=nil)=> + after or= @core_defs or 0 scope or= @defs defs_by_num = {} for stub, def in pairs(scope)