class RedParse::Nodes::UnOpNode

Attributes

ident[R]

Public Class Methods

new(op,val) click to toggle source
Calls superclass method RedParse::Nodes::ExprNode::new
# File lib/redparse/babynodes.rb, line 115
def initialize(op,val)
  @ident=op.ident
  super(op,val)
end

Public Instance Methods

parsetree() click to toggle source
# File lib/redparse/babynodes.rb, line 126
def parsetree
  case @data[0].ident
  when /^[*&]/: "huh"
  when "!": [:not, @data[1].parsetree]
  when "defined?": [:defined, @data[1].parsetree]
  else
    [:call, @data[1].parsetree, @data[0].ident.to_sym]
  end
end
to_lisp() click to toggle source
# File lib/redparse/babynodes.rb, line 122
def to_lisp
  "(#{@data[0]} #{@data[1].to_lisp})"
end