Class: Rampi::UnaryExpr

Inherits:
Node
  • Object
show all
Defined in:
lib/rampi/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#!=, #%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #^, #|, #~

Constructor Details

#initialize(op, value) ⇒ UnaryExpr

Returns a new instance of UnaryExpr.



47
48
49
50
# File 'lib/rampi/node.rb', line 47

def initialize(op, value)
  @op = op
  @value = value
end

Instance Attribute Details

#opObject

Returns the value of attribute op.



45
46
47
# File 'lib/rampi/node.rb', line 45

def op
  @op
end

#valueObject

Returns the value of attribute value.



45
46
47
# File 'lib/rampi/node.rb', line 45

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



57
58
59
# File 'lib/rampi/node.rb', line 57

def accept(visitor)
  visitor.visit_unary_expr(self)
end

#to_sObject Also known as: inspect



52
53
54
# File 'lib/rampi/node.rb', line 52

def to_s
  "#{@op}#{@value}"
end