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.



230
231
232
233
# File 'lib/code_generator.rb', line 230

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

Instance Method Details

#convert_wildcard(str) ⇒ Object



235
236
237
# File 'lib/code_generator.rb', line 235

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

#genObject



239
240
241
242
# File 'lib/code_generator.rb', line 239

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