Class: CDLInitializer

Inherits:
Object show all
Defined in:
lib/tecsgen/core/syntaxobj.rb

Overview

CDL の初期化子を扱うためのクラス

CDL の初期化子そのものではない

Class Method Summary collapse

Class Method Details

.clone_for_compoiste_array(array, ct_name, cell_name, locale) ⇒ Object

初期化子(配列)のクローン

要素は clone_for_composite を持つものだけ



1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
# File 'lib/tecsgen/core/syntaxobj.rb', line 1223

def self.clone_for_compoiste_array(array, ct_name, cell_name, locale)
  # "compoiste.identifier" の場合 (CDL としては誤り)
  if array[0] == :COMPOSITE
    return array.clone
  end

  new_array = array.map{|m|
    clone_for_composite(m, ct_name, cell_name, locale)
  }
  return new_array
end

.clone_for_composite(rhs, ct_name, cell_name, locale) ⇒ Object

初期化子のクローン

初期化子は Expression, C_EXP, Array のいずれか



1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
# File 'lib/tecsgen/core/syntaxobj.rb', line 1207

def self.clone_for_composite(rhs, ct_name, cell_name, locale)
  if rhs.instance_of? C_EXP
    # C_EXP の clone を作るとともに置換
    rhs = rhs.clone_for_composite(ct_name, cell_name, locale)
  elsif rhs.instance_of? Expression
    rhs = rhs.clone_for_composite
  elsif rhs.instance_of? Array
    rhs = clone_for_compoiste_array(rhs, ct_name, cell_name, locale)
  else
    raise "unknown rhs for join"
  end
  return rhs
end