107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/nydp/cond.rb', line 107
def self.build cond, when_true, when_false
tsig = sig(when_true)
fsig = sig(when_false)
cond_sig = "#{tsig}_#{fsig}"
if (cond == when_true) && (fsig == "LIT")
OR_LEX_LIT.new cond, nil, when_false.expression
elsif (cond == when_true) && (fsig == "LEX")
OR_LEX_LEX.new cond, nil, when_false
elsif (cond == when_true)
OR_LEX_XXX.new cond, nil, when_false
else
case cond_sig
when "LIT_LIT"
Nydp::Cond_LEX_LIT_LIT.new(cond, when_true.expression, when_false.expression)
when "LEX_LIT"
Nydp::Cond_LEX_LEX_LIT.new(cond, when_true, when_false.expression)
when "CND_LIT"
Nydp::Cond_LEX_CND_LIT.new(cond, when_true, when_false.expression)
when "NVB_LEX"
Nydp::Cond_LEX_NVB_LEX.new(cond, when_true, when_false)
when "NVB_LIT"
Nydp::Cond_LEX_NVB_LIT.new(cond, when_true, when_false.expression)
else
new(cond, when_true, when_false)
end
end
end
|