Class: MatchExpr

Inherits:
Object
  • Object
show all
Defined in:
lib/code_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(e1, e2) ⇒ MatchExpr

Returns a new instance of MatchExpr.



218
219
220
221
# File 'lib/code_generator.rb', line 218

def initialize e1, e2
  @e1 = e1
  @e2 = e2
end

Instance Method Details

#convert_wildcard(str) ⇒ Object



223
224
225
# File 'lib/code_generator.rb', line 223

def convert_wildcard str
  str.gsub(/%/, '.*')
end

#genObject



227
228
229
230
# File 'lib/code_generator.rb', line 227

def gen
  #raise "RHS: #{@e2.class} #{@e2.gen.class}"
  "#{@e1.gen} =~ /#{convert_wildcard @e2.gen}/"
end