Class: Seaquel::AST::Unary

Inherits:
Expression show all
Defined in:
lib/seaquel/ast/unary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#as, #asc, binop, #desc, joinop, #lisp_inspect, unaryop

Constructor Details

#initialize(op, exp) ⇒ Unary

Returns a new instance of Unary.



7
8
9
10
# File 'lib/seaquel/ast/unary.rb', line 7

def initialize op, exp
  @exp = exp
  @op = op
end

Instance Attribute Details

#expObject (readonly)

Returns the value of attribute exp.



4
5
6
# File 'lib/seaquel/ast/unary.rb', line 4

def exp
  @exp
end

#opObject (readonly)

Returns the value of attribute op.



5
6
7
# File 'lib/seaquel/ast/unary.rb', line 5

def op
  @op
end

Instance Method Details

#inspectObject



16
17
18
# File 'lib/seaquel/ast/unary.rb', line 16

def inspect
  "(#{op.inspect} #{exp.inspect})"
end

#visit(visitor) ⇒ Object



12
13
14
# File 'lib/seaquel/ast/unary.rb', line 12

def visit visitor
  visitor.visit_unary op, exp
end