class Regexp::Scanner
def emit_options(text, ts, te)
def emit_options(text, ts, te) if text =~ /\(\?([mixdau]*)-?([mix]*)(:)?/ positive, negative, group_local = $1, $2, $3 if positive.include?('x') self.free_spacing = true end # If the x appears in both, treat it like ruby does, the second cancels # the first. if negative.include?('x') self.free_spacing = false end if group_local spacing_stack << {:free_spacing => free_spacing, :depth => group_depth} else # switch for parent group level spacing_stack.last[:free_spacing] = free_spacing end end emit(:group, :options, text, ts, te) end