Class: Crokus::CommaStmt

Inherits:
Stmt
  • Object
show all
Defined in:
lib/crokus/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ast

#accept, #str

Constructor Details

#initialize(lhs, rhs) ⇒ CommaStmt

Returns a new instance of CommaStmt.



211
212
213
# File 'lib/crokus/ast.rb', line 211

def initialize lhs,rhs
  @lhs,@rhs=lhs,rhs
end

Instance Attribute Details

#lhsObject

Returns the value of attribute lhs.



210
211
212
# File 'lib/crokus/ast.rb', line 210

def lhs
  @lhs
end

#rhsObject

Returns the value of attribute rhs.



210
211
212
# File 'lib/crokus/ast.rb', line 210

def rhs
  @rhs
end

Instance Method Details

#to_listObject



215
216
217
218
219
220
# File 'lib/crokus/ast.rb', line 215

def to_list
  list=[]
  list << to_list_rec(@lhs)
  list << to_list_rec(@rhs)
  list.flatten
end

#to_list_rec(e) ⇒ Object



222
223
224
225
226
227
228
229
230
# File 'lib/crokus/ast.rb', line 222

def to_list_rec e
  ret=[]
  if e.is_a? CommaStmt
    ret << e.to_list
  else
    ret << e
  end
  ret
end