Regex
object from a literal prefixed string
# Factorize the making of a `Regex` object from a literal prefixed string
protected fun make_re(v: AbstractCompilerVisitor, rs: RuntimeVariable): nullable RuntimeVariable do
var re = to_re
assert re != null
var res = v.compile_callsite(re, [rs])
if res == null then
print "Cannot call property `to_re` on {self}"
abort
end
for i in suffix.chars do
if i == 'i' then
var ign = ignore_case
assert ign != null
v.compile_callsite(ign, [res, v.bool_instance(true)])
continue
end
if i == 'm' then
var nl = newline
assert nl != null
v.compile_callsite(nl, [res, v.bool_instance(true)])
continue
end
if i == 'b' then
var ext = extended
assert ext != null
v.compile_callsite(ext, [res, v.bool_instance(false)])
continue
end
# Should not happen, this needs to be updated
# along with the addition of new suffixes
abort
end
return res
end
src/compiler/abstract_compiler.nit:4152,2--4185,4