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.



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

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

Instance Attribute Details

#lhsObject

Returns the value of attribute lhs.



214
215
216
# File 'lib/crokus/ast.rb', line 214

def lhs
  @lhs
end

#rhsObject

Returns the value of attribute rhs.



214
215
216
# File 'lib/crokus/ast.rb', line 214

def rhs
  @rhs
end

Instance Method Details

#to_listObject



219
220
221
222
223
224
# File 'lib/crokus/ast.rb', line 219

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

#to_list_rec(e) ⇒ Object



226
227
228
229
230
231
232
233
234
# File 'lib/crokus/ast.rb', line 226

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