Sha256: 6e807b0dc9efd1d757f4f0e2f25cfe696dbefa960127d1a44f1b8a93766d512e
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
# infix visitor # # use this visitor in a processor to get infix visiting order # # visitor node deps # accept -> visit left -> # process # visit right -> module Dentaku module Visitor module Infix def visit(ast) ast.accept(self) end def process(_ast) raise NotImplementedError end def visit_function(node) node.args.each do |arg| visit(arg) end process(node) end def visit_identifier(node) process(node) end def visit_operation(node) visit(node.left) if node.left process(node) visit(node.right) if node.right end def visit_operand(node) process(node) end def visit_case(node) process(node) end def visit_switch(node) process(node) end def visit_case_conditional(node) process(node) end def visit_when(node) process(node) end def visit_then(node) process(node) end def visit_else(node) process(node) end def visit_negation(node) process(node) end def visit_access(node) process(node) end def visit_literal(node) process(node) end def visit_nil(node) process(node) end def visit_array(node) process(node) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dentaku-3.5.4 | lib/dentaku/visitor/infix.rb |
dentaku-3.5.3 | lib/dentaku/visitor/infix.rb |
dentaku-3.5.2 | lib/dentaku/visitor/infix.rb |