class Unparser::Writer::Binary
Constants
- KEYWORD_SYMBOLS
- KEYWORD_TOKENS
- MAP
- NEED_KEYWORD
- OPERATOR_SYMBOLS
- OPERATOR_TOKENS
Public Instance Methods
dispatch()
click to toggle source
# File lib/unparser/writer/binary.rb, line 54 def dispatch left_emitter.write_to_buffer write(' ', MAP.fetch(effective_symbol), ' ') visit(right) end
emit_operator()
click to toggle source
# File lib/unparser/writer/binary.rb, line 46 def emit_operator emit_with(OPERATOR_TOKENS) end
symbol_name()
click to toggle source
# File lib/unparser/writer/binary.rb, line 50 def symbol_name true end
Private Instance Methods
effective_symbol()
click to toggle source
# File lib/unparser/writer/binary.rb, line 62 def effective_symbol if NEED_KEYWORD.include?(right.type) || NEED_KEYWORD.include?(left.type) return keyword_symbol end unless left_emitter.symbol_name return operator_symbol end keyword_symbol end
emit_with(map)
click to toggle source
# File lib/unparser/writer/binary.rb, line 74 def emit_with(map) visit(left) write(' ', map.fetch(node.type), ' ') visit(right) end
keyword_symbol()
click to toggle source
# File lib/unparser/writer/binary.rb, line 80 def keyword_symbol KEYWORD_SYMBOLS.fetch(node.type) end
left_emitter()
click to toggle source
# File lib/unparser/writer/binary.rb, line 88 def left_emitter emitter(left) end
operator_symbol()
click to toggle source
# File lib/unparser/writer/binary.rb, line 84 def operator_symbol OPERATOR_SYMBOLS.fetch(node.type) end
right_emitter()
click to toggle source
# File lib/unparser/writer/binary.rb, line 93 def right_emitter emitter(right) end