Class: C_EXP

Inherits:
Node show all
Defined in:
lib/tecsgen/core/expression.rb

Instance Method Summary collapse

Methods inherited from Node

#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #locale_str, #set_locale

Constructor Details

#initialize(c_exp_string, b_renew = false) ⇒ C_EXP

c_exp_string::String b_renew::Bool : true なら C_EXP の clone 作成(エスケープ処理等をしない)



977
978
979
980
981
982
983
984
985
986
# File 'lib/tecsgen/core/expression.rb', line 977

def initialize(c_exp_string, b_renew = false)
  if b_renew
    @c_exp_string = c_exp_string
  else
    # 前後の " を取り除く
    # str = c_exp_string.to_s.sub( /^\"(.*)\"$/, "\\1" )
    str = CDLString.remove_dquote c_exp_string.to_s
    @c_exp_string = CDLString.escape str
  end
end

Instance Method Details

#clone_for_composite(ct_name, cell_name, locale) ⇒ Object

composite 用に C_EXP を clone する

ct_name
cell_name

composite の attribute に現れる C_EXP を文字列置換して生成しなおす. この文字列置換は、意味解釈段階で行う. 他の C_EXP の文字列置換は、コード生成段階で行う.



994
995
996
997
998
999
1000
1001
1002
# File 'lib/tecsgen/core/expression.rb', line 994

def clone_for_composite(ct_name, cell_name, locale)
  dbgPrint "C_EXP: #{ct_name} #{cell_name} #{@c_exp_string}\n"

  @locale = locale
  str = @c_exp_string.gsub(/(^|[^\$])\$ct\$/, "\\1#{ct_name}")
  str = str.          gsub(/(^|[^\$])\$cell\$/, "\\1#{cell_name}")
  str = str.          gsub(/(^|[^\$])\$id\$/, "\\1#{ct_name}_#{cell_name}")
  return C_EXP.new(str, true)
end

#eval_const(name_list, name_list2 = nil) ⇒ Object

C_EXP を評価する

C_EXP の引き数文字列を返す 本来 C_EXP は eval_const する対象ではないが、便宜上 eval_const で対応



1011
1012
1013
# File 'lib/tecsgen/core/expression.rb', line 1011

def eval_const(name_list, name_list2 = nil)
  return self
end

#eval_const2(name_list, name_list2 = nil, nest = nil) ⇒ Object



1015
1016
1017
# File 'lib/tecsgen/core/expression.rb', line 1015

def eval_const2(name_list, name_list2 = nil, nest = nil)
  return self
end

#get_c_exp_stringObject



1004
1005
1006
# File 'lib/tecsgen/core/expression.rb', line 1004

def get_c_exp_string
  @c_exp_string
end

#show_tree(indent) ⇒ Object



1027
1028
1029
1030
# File 'lib/tecsgen/core/expression.rb', line 1027

def show_tree(indent)
  indent.times { print "  " }
  puts "C_EXP: #{@c_exp_string}"
end

#to_CDL_strObject



1023
1024
1025
# File 'lib/tecsgen/core/expression.rb', line 1023

def to_CDL_str
  return "C_EXP( \"#{self}\" )"
end

#to_sObject



1019
1020
1021
# File 'lib/tecsgen/core/expression.rb', line 1019

def to_s
  @c_exp_string
end