- if node==nil then self:acc'<<error>>'; return end
- if not node.tag then -- tagless block.
- self:list (node, self.nl)
- else
- local f = M[node.tag]
- if type (f) == "function" then -- Delegate to tag method.
- f (self, node, unpack (node))
- elseif type (f) == "string" then -- tag string.
- self:acc (f)
- else -- No appropriate method, fall back to splice dumping.
- -- This cannot happen in a plain Lua AST.
- self:acc " -{ "
- self:acc (pp.tostring (node, {metalua_tag=1, hide_hash=1}), 80)
- self:acc " }"
+ if node==nil then self:acc'<<error>>'
+ elseif not self.custom_printer or not self.custom_printer (self, node) then
+ if not node.tag then -- tagless (henceunindented) block.
+ self:list (node, self.nl)
+ else
+ local f = M[node.tag]
+ if type (f) == "function" then -- Delegate to tag method.
+ f (self, node, unpack (node))
+ elseif type (f) == "string" then -- tag string.
+ self:acc (f)
+ else -- No appropriate method, fall back to splice dumping.
+ -- This cannot happen in a plain Lua AST.
+ self:acc " -{ "
+ self:acc (pp.tostring (node, {metalua_tag=1, hide_hash=1}), 80)
+ self:acc " }"
+ end