382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
# File 'lib/equation_grammar.rb', line 382
def value(ctx:)
case operator.text_value
when 'in'
return rhs.value(ctx: ctx).include?(lhs.value(ctx: ctx))
when '<='
return lhs.value(ctx: ctx) <= rhs.value(ctx: ctx)
when '<'
return lhs.value(ctx: ctx) < rhs.value(ctx: ctx)
when '>='
return lhs.value(ctx: ctx) >= rhs.value(ctx: ctx)
when '>'
return lhs.value(ctx: ctx) > rhs.value(ctx: ctx)
when '=='
return lhs.value(ctx: ctx) == rhs.value(ctx: ctx)
when '!='
return lhs.value(ctx: ctx) != rhs.value(ctx: ctx)
when '=~'
expression = Regexp.new rhs.value(ctx: ctx)
return !(lhs.value(ctx: ctx) =~ expression).nil?
end
end
|