@@ -587,11 +587,14 @@ def value
587
587
588
588
class InterpolatedRegularExpressionNode < Node
589
589
# Returns a numeric value that represents the flags that were used to create
590
- # the regular expression. This mirrors the Regexp#options method in Ruby.
591
- # Note that this is effectively masking only the three common flags that are
592
- # used in Ruby, and does not include the full set of flags like encoding.
590
+ # the regular expression.
593
591
def options
594
- flags & 0b111
592
+ o = flags & 0b111
593
+ o |= Regexp ::FIXEDENCODING if flags & 8 != 0 # 'e'
594
+ o |= Regexp ::FIXEDENCODING if flags & 32 != 0 # 's'
595
+ o |= Regexp ::FIXEDENCODING if flags & 64 != 0 # 'u'
596
+ o |= Regexp ::NOENCODING if flags & 16 != 0 # 'n'
597
+ o
595
598
end
596
599
end
597
600
@@ -604,11 +607,14 @@ def value
604
607
605
608
class RegularExpressionNode < Node
606
609
# Returns a numeric value that represents the flags that were used to create
607
- # the regular expression. This mirrors the Regexp#options method in Ruby.
608
- # Note that this is effectively masking only the three common flags that are
609
- # used in Ruby, and does not include the full set of flags like encoding.
610
+ # the regular expression.
610
611
def options
611
- flags & 0b111
612
+ o = flags & 0b111
613
+ o |= Regexp ::FIXEDENCODING if flags & 8 != 0 # 'e'
614
+ o |= Regexp ::FIXEDENCODING if flags & 32 != 0 # 's'
615
+ o |= Regexp ::FIXEDENCODING if flags & 64 != 0 # 'u'
616
+ o |= Regexp ::NOENCODING if flags & 16 != 0 # 'n'
617
+ o
612
618
end
613
619
end
614
620
end
0 commit comments