class Regexp::Scanner

def self.long_prop_map

def self.long_prop_map
  @long_prop_map ||= parse_prop_map('long')
end

def self.parse_prop_map(name)

def self.parse_prop_map(name)
  File.read("#{__dir__}/scanner/properties/#{name}.csv").scan(/(.+),(.+)/).to_h
end

def self.posix_classes

def self.posix_classes
  %w[alnum alpha ascii blank cntrl digit graph
     lower print punct space upper word xdigit]
end

def self.scan(input_object, options: nil, collect_tokens: true, &block)

--------------------------------------------------------------------------
This method may raise errors if a syntax error is encountered.

given, it gets called for each emitted token.
emitted token into an array that gets returned at the end. If a block is
Scans the given regular expression text, or Regexp object and collects the
def self.scan(input_object, options: nil, collect_tokens: true, &block)
  new.scan(input_object, options: options, collect_tokens: collect_tokens, &block)
end

def self.short_prop_map

lazy-load property maps when first needed
def self.short_prop_map
  @short_prop_map ||= parse_prop_map('short')
end

def append_literal(data, ts, te)

by a call to emit_literal.
Appends one or more characters to the literal buffer, to be emitted later
def append_literal(data, ts, te)
  (self.literal_run ||= []) << copy(data, ts, te)
end

def copy(data, ts, te)

Copy from ts to te from data as text
def copy(data, ts, te)
  data[ts...te].pack('c*').force_encoding('utf-8')
end

def emit(type, token, text)

Emits an array with the details of the scanned pattern
def emit(type, token, text)
  #puts "EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}"
  emit_literal if literal_run
  # Ragel runs with byte-based indices (ts, te). These are of little value to
  # end-users, so we keep track of char-based indices and emit those instead.
  ts_char_pos = char_pos
  te_char_pos = char_pos + text.length
  tok = [type, token, text, ts_char_pos, te_char_pos]
  self.prev_token = tok
  self.char_pos = te_char_pos
  if block
    block.call type, token, text, ts_char_pos, te_char_pos
    # TODO: in v3.0.0,remove `collect_tokens:` kwarg and only collect if no block given
    tokens << tok if collect_tokens
  elsif collect_tokens
    tokens << tok
  end
end

def emit_literal

Emits the literal run collected by calls to the append_literal method.
def emit_literal
  text = literal_run.join
  self.literal_run = nil
  emit(:literal, :literal, text)
end

def emit_meta_control_sequence(data, ts, te, token)

def emit_meta_control_sequence(data, ts, te, token)
  if data.last < 0x00 || data.last > 0x7F
    raise ValidationError.for(:sequence, 'escape', token.to_s)
  end
  emit(:escape, token, copy(data, ts-1,te))
end

def emit_options(text)

def emit_options(text)
  token = nil
  # Ruby allows things like '(?-xxxx)' or '(?xx-xx--xx-:abc)'.
  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 && negative.include?('x')
    self.free_spacing = false
  end
  if group_local
    spacing_stack << {:free_spacing => free_spacing, :depth => group_depth}
    token = :options
  else
    # switch for parent group level
    spacing_stack.last[:free_spacing] = free_spacing
    token = :options_switch
  end
  emit(:group, token, text)
end

def free_spacing?(input_object, options)

def free_spacing?(input_object, options)
  if options && !input_object.is_a?(String)
    raise ArgumentError, 'options cannot be supplied unless scanning a String'
  end
  options = input_object.options if input_object.is_a?(::Regexp)
  return false unless options
  options & Regexp::EXTENDED != 0
end

def in_group?

def in_group?
  group_depth > 0
end

def in_set?

def in_set?
  set_depth > 0
end

def scan(input_object, options: nil, collect_tokens: true, &block)

def scan(input_object, options: nil, collect_tokens: true, &block)
  self.collect_tokens = collect_tokens
  self.literal_run = nil
  stack = []
  input = input_object.is_a?(Regexp) ? input_object.source : input_object
  self.free_spacing = free_spacing?(input_object, options)
  self.spacing_stack = [{:free_spacing => free_spacing, :depth => 0}]
  data  = input.unpack("c*")
  eof   = data.length
  self.tokens = []
  self.block  = block
  self.set_depth = 0
  self.group_depth = 0
  self.conditional_stack = []
  self.char_pos = 0
ass << self
ttr_accessor :_re_scanner_trans_keys
rivate :_re_scanner_trans_keys, :_re_scanner_trans_keys=
d
lf._re_scanner_trans_keys = [
0,-128,-65,-128,-65,
28,-65,41,41,39,
,39,39,33,62,
,62,39,60,39,57,
,39,48,57,39,
,48,57,39,57,
,62,62,62,48,57,
,62,48,57,48,
,39,60,39,57,
,39,48,57,39,57,
,57,39,57,33,
,62,62,48,57,
,62,48,57,48,62,
,57,48,125,44,
5,123,123,9,122,
125,9,122,-128,-65,
28,-65,38,38,58,
,58,93,-128,-65,
28,-65,45,45,92,92,
,92,45,45,92,
,92,92,48,123,
,102,48,102,48,102,
,102,9,125,9,
5,9,125,9,125,
125,9,125,48,123,
,39,41,41,41,
,62,62,-128,127,
2,-12,1,127,1,127,
32,33,126,10,
,63,63,33,126,
,126,62,62,43,63,
,63,43,63,65,
2,44,57,68,119,
,112,-62,125,-128,-65,
28,-65,-128,-65,38,
,38,93,58,58,
,120,48,55,48,55,
2,125,-128,-65,-128,
5,-128,-65,48,55,
,55,48,57,77,77,
,45,0,0,67,
,45,45,0,0,
,92,48,102,39,60,
,57,48,57,41,
,33,62,0
ass << self
ttr_accessor :_re_scanner_key_spans
rivate :_re_scanner_key_spans, :_re_scanner_key_spans=
d
lf._re_scanner_key_spans = [
64,64,64,1,19,1,30,
22,19,1,10,19,10,19,
,1,10,20,10,15,22,19,
10,19,10,19,30,1,10,
,10,15,10,78,82,1,114,
7,114,64,64,1,36,36,64,
,1,1,1,1,1,1,76,
,55,55,55,117,117,117,117,
7,117,76,1,1,17,1,256,
,127,127,24,94,1,1,94,
,1,21,21,21,58,14,52,
,188,64,64,64,1,56,1,
,8,8,188,64,64,64,8,
10,1,1,0,33,1,0,
55,22,19,10,17,30
ass << self
ttr_accessor :_re_scanner_index_offsets
rivate :_re_scanner_index_offsets, :_re_scanner_index_offsets=
d
lf._re_scanner_index_offsets = [
0,65,130,195,197,217,219,
0,252,275,295,297,308,328,339,
9,390,392,403,424,435,451,474,
4,496,507,527,538,558,589,591,
2,623,634,650,661,740,823,825,
0,1058,1173,1238,1303,1305,1342,1379,
44,1509,1511,1513,1515,1517,1519,1521,
98,1654,1710,1766,1822,1940,2058,2176,
94,2412,2530,2607,2609,2611,2629,2631,
88,2940,3068,3196,3221,3316,3318,3320,
15,3510,3512,3534,3556,3578,3637,3652,
05,3739,3928,3993,4058,4123,4125,4182,
84,4258,4267,4276,4465,4530,4595,4660,
69,4678,4689,4691,4693,4694,4728,4730,
31,4733,4789,4812,4832,4843,4861
ass << self
ttr_accessor :_re_scanner_indicies
rivate :_re_scanner_indicies, :_re_scanner_indicies=
d
lf._re_scanner_indicies = [
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
1,1,1,1,1,1,1,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
0,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,3,
3,0,6,5,8,7,7,
7,7,4,7,7,4,4,
4,4,4,4,4,4,4,
8,7,10,9,9,9,9,
9,9,9,9,9,9,4,
9,4,4,4,4,4,4,
4,4,4,9,9,9,11,
9,8,9,13,12,12,12,
,12,12,12,12,12,12,12,
,12,12,12,12,12,12,12,
,14,12,16,15,15,15,15,
,17,15,15,18,18,18,18,
,18,18,18,18,18,15,16,
,18,18,18,18,18,18,18,
,18,18,12,16,12,12,12,
,12,19,12,12,18,18,18,
,18,18,18,18,18,18,12,
,20,20,20,20,20,20,20,
,20,12,16,12,12,12,12,
,12,12,12,20,20,20,20,
,20,20,20,20,20,12,12,
,21,21,21,21,21,21,21,
,21,21,22,21,21,23,23,
,23,23,23,23,23,23,23,
,21,21,21,16,21,16,21,
,23,23,23,23,23,23,23,
,23,12,24,12,24,12,12,
,23,23,23,23,23,23,23,
,23,12,12,12,12,16,12,
,25,25,25,25,25,25,25,
,25,12,25,25,25,25,25,
,25,25,25,25,12,12,12,
,16,12,26,12,12,12,12,
,12,12,12,12,12,12,12,
,12,12,12,12,12,12,12,
,12,29,28,28,28,28,28,
,28,28,31,31,31,31,31,
,31,31,31,31,28,29,28,
,31,31,31,31,31,31,31,
,31,12,29,12,12,12,32,
,32,12,12,31,31,31,31,
,31,31,31,31,31,12,33,
,33,33,33,33,33,33,33,
,12,29,12,12,12,12,12,
,12,12,33,33,33,33,33,
,33,33,33,33,12,12,34,
,34,34,34,34,34,34,34,
,34,35,34,34,36,36,36,
,36,36,36,36,36,36,34,
,34,34,29,34,29,34,36,
,36,36,36,36,36,36,36,
,12,37,12,37,12,12,36,
,36,36,36,36,36,36,36,
,12,12,12,12,29,12,38,
,38,38,38,38,38,38,38,
,12,38,38,38,38,38,38,
,38,38,38,12,12,12,12,
,12,40,40,40,40,40,40,
,40,40,40,39,40,40,40,
,40,40,40,40,40,40,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,41,39,40,39,39,39,
,42,42,42,42,42,42,42,
,42,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,39,39,39,
,39,39,39,39,41,39,43,
,45,45,45,45,45,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,45,45,44,
,45,45,45,45,45,45,45,
,45,44,44,44,45,44,44,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,44,44,44,46,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,44,45,45,45,45,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,45,44,44,44,44,
,44,44,44,44,44,44,44,
,45,44,45,45,45,45,45,
,45,45,45,45,44,44,44,
,44,44,44,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,44,44,
,44,45,44,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,44,44,
,44,45,45,45,45,45,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,45,44,44,44,44,44,44,
,44,44,44,44,44,45,45,
,45,45,45,45,45,45,45,
,45,45,44,44,44,45,44,
,44,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,44,44,44,44,
,44,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,45,45,45,45,
,45,45,45,44,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,48,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,48,52,
,55,54,54,54,54,54,54,
,54,54,54,54,54,54,54,
,54,54,54,54,54,54,54,
,54,54,54,54,54,54,54,
,54,56,54,56,54,55,54,
,54,54,54,54,54,54,54,
,54,54,54,54,54,54,54,
,54,54,54,54,54,54,54,
,54,54,54,54,54,54,56,
,57,54,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,58,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,58,61,44,63,
,65,62,66,44,68,67,70,
,71,71,71,71,71,71,71,
,71,71,44,44,44,44,44,
,44,71,71,71,71,71,71,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,71,71,71,71,71,71,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,72,44,73,73,
,73,73,73,73,73,73,73,
,44,44,44,44,44,44,73,
,73,73,73,73,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,73,
,73,73,73,73,44,74,74,
,74,74,74,74,74,74,74,
,44,44,44,44,44,44,74,
,74,74,74,74,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,74,
,74,74,74,74,44,75,75,
,75,75,75,75,75,75,75,
,44,44,44,44,44,44,75,
,75,75,75,75,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,75,
,75,75,75,75,44,76,76,
,76,76,76,76,76,76,76,
,44,44,44,44,44,44,76,
,76,76,76,76,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,76,
,76,76,76,76,44,72,72,
,72,72,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,72,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,77,77,77,
,77,77,77,77,77,77,44,
,44,44,44,44,44,77,77,
,77,77,77,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,77,77,
,77,77,77,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,75,44,72,72,72,72,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,72,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,78,78,78,78,78,
,78,78,78,78,44,44,44,
,44,44,44,78,78,78,78,
,78,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,78,78,78,78,
,78,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,72,72,72,72,72,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,72,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,79,79,79,79,79,79,79,
,79,79,44,44,44,44,44,
,44,79,79,79,79,79,79,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,79,79,79,79,79,79,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,75,44,
,72,72,72,72,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,72,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,80,
,80,80,80,80,80,80,80,
,44,44,44,44,44,44,44,
,80,80,80,80,80,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,80,80,80,80,80,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,75,44,72,72,
,72,72,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,72,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,81,81,81,
,81,81,81,81,81,81,44,
,44,44,44,44,44,81,81,
,81,81,81,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,81,81,
,81,81,81,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,75,44,72,72,72,72,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,72,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,83,83,83,83,83,83,
,83,83,83,82,82,82,82,
,82,82,83,83,83,83,83,
,82,82,82,82,82,82,82,
,82,82,82,82,82,82,82,
,82,82,82,82,82,82,82,
,82,82,83,83,83,83,83,
,82,82,82,82,82,82,82,
,82,82,82,82,82,82,82,
,82,82,82,82,44,82,86,
,87,84,87,84,84,84,84,
,84,88,88,88,88,88,88,
,88,88,88,84,86,89,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,3,
3,3,3,3,3,3,3,
3,3,3,3,3,3,90,
,90,90,90,44,44,44,44,
,44,44,44,44,44,44,44,
,91,91,91,91,91,91,91,
,92,92,92,92,91,91,91,
,91,91,91,91,91,91,91,
,91,91,91,91,91,91,93,
,94,95,96,94,94,94,97,
,99,100,94,94,101,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,102,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,103,104,105,106,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,107,108,105,94,91,94,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,2,2,
2,2,2,2,2,3,3,
3,3,3,3,3,3,3,
3,3,3,3,3,90,90,
,90,90,109,91,91,91,91,
,91,91,91,91,91,91,91,
,91,91,91,91,91,91,91,
,91,91,91,91,91,91,91,
,91,91,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,109,109,109,109,109,109,
9,109,91,109,91,91,91,91,
,91,91,91,92,92,92,92,
,91,91,91,91,91,91,91,
,91,91,91,91,91,91,91,
,91,91,93,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,91,110,93,93,93,93,
,110,110,110,110,110,110,110,
0,110,110,110,110,110,110,110,
0,110,110,93,110,94,94,109,
9,94,94,94,109,109,109,109,
,94,109,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,109,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,109,
9,109,109,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,94,
,94,94,94,94,94,94,109,
9,109,94,109,112,95,114,113,
,116,5,116,116,116,117,118,
5,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,8,116,119,10,8,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,8,116,115,
6,115,116,116,116,115,115,115,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
0,116,115,115,115,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,116,116,116,116,
6,116,116,116,115,116,8,9,
3,122,122,122,122,122,122,122,
2,122,122,122,122,122,122,122,
2,122,122,122,123,122,125,124,
4,124,124,124,124,124,124,124,
4,124,124,124,124,124,124,124,
4,124,125,124,127,126,126,126,
6,126,126,126,126,126,126,126,
6,126,126,126,126,126,126,126,
7,126,129,129,128,128,128,128,
9,128,128,128,130,128,128,128,
8,128,128,128,128,128,128,128,
8,128,128,129,128,128,128,128,
8,128,128,129,128,128,128,128,
1,128,128,128,132,128,128,128,
8,128,128,128,128,128,128,128,
8,128,128,129,128,134,133,133,
3,42,42,42,42,42,42,42,
,42,42,133,135,44,44,44,
5,44,44,44,44,44,44,44,
,44,135,135,44,44,44,135,
5,44,44,44,44,44,44,44,
,44,44,44,135,44,44,44,
5,44,44,44,44,44,44,44,
,44,44,135,44,44,44,135,
,136,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,44,44,44,44,44,44,44,
,136,44,137,137,137,137,137,
7,137,137,137,137,137,137,137,
7,137,137,137,137,137,137,137,
7,137,137,137,137,137,137,137,
7,138,138,138,138,138,138,138,
8,138,138,138,138,138,138,138,
8,139,139,139,139,139,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,140,49,141,
,140,140,140,140,49,142,140,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
0,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,143,144,145,146,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,140,140,140,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
,49,49,49,49,49,49,49,
7,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,50,50,50,50,50,50,50,
,147,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,148,148,148,148,148,148,
8,148,147,149,147,151,150,150,
0,150,150,150,150,150,150,150,
0,150,150,150,150,150,150,150,
0,150,150,150,150,150,150,150,
0,150,150,150,150,150,150,150,
0,150,150,150,150,150,150,150,
0,150,150,150,150,150,150,150,
0,150,150,150,152,150,54,154,
6,156,156,156,156,156,156,156,
5,155,155,155,155,155,155,155,
5,155,155,157,157,155,155,155,
7,155,155,155,155,157,155,155,
7,155,155,157,155,155,155,157,
5,155,155,157,157,157,155,155,
5,157,157,157,157,157,157,155,
7,155,155,155,155,155,157,155,
7,155,157,157,157,157,157,157,
7,155,159,159,159,159,159,159,
9,159,158,160,160,160,160,160,
0,160,160,158,161,161,161,161,
1,161,161,161,161,161,161,161,
1,161,161,161,161,161,161,161,
1,161,161,161,161,161,161,161,
1,161,162,162,162,162,162,162,
2,162,162,162,162,162,162,162,
2,162,163,163,163,163,163,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,164,59,
,59,164,164,164,164,59,59,
4,59,165,166,166,166,166,166,
6,166,167,167,59,59,59,59,
,164,59,44,44,168,169,59,
,44,169,59,59,44,59,170,
,59,171,59,169,169,59,59,
,169,169,59,44,164,164,164,
4,59,59,172,172,61,169,172,
2,59,169,59,59,59,59,59,
2,59,171,59,172,169,172,173,
2,169,174,59,44,164,164,164,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,59,59,59,59,59,59,59,
,175,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,60,60,60,60,60,60,
,60,175,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,176,176,176,176,176,
6,176,176,175,178,178,178,178,
8,178,178,178,177,180,180,180,
0,180,180,180,180,179,182,182,
2,182,182,182,182,182,182,182,
1,184,62,186,185,62,188,67,
,67,67,67,67,67,67,67,
,67,67,67,67,67,67,67,
,67,67,67,67,67,67,67,
,67,67,67,67,67,189,67,
1,190,67,70,67,193,193,193,
3,193,193,193,193,193,193,192,
2,192,192,192,192,192,193,193,
3,193,193,193,192,192,192,192,
2,192,192,192,192,192,192,192,
2,192,192,192,192,192,192,192,
2,192,192,192,192,192,193,193,
3,193,193,193,192,195,194,194,
4,194,194,196,194,194,197,197,
7,197,197,197,197,197,197,197,
4,194,198,194,86,85,85,85,
,85,199,85,85,199,199,199,
9,199,199,199,199,199,199,85,
,88,88,88,88,88,88,88,
,88,199,87,199,199,199,199,
9,199,88,88,88,88,88,88,
,88,88,88,199,199,89,89,
,89,89,89,89,89,89,89,
,199,89,89,199,199,199,199,
9,199,199,199,199,199,89,89,
,89,86,89,0
ass << self
ttr_accessor :_re_scanner_trans_targs
rivate :_re_scanner_trans_targs, :_re_scanner_trans_targs=
d
lf._re_scanner_trans_targs = [
,72,1,2,71,4,71,6,
,8,71,81,71,10,16,11,
,12,13,14,15,17,18,19,
,21,23,29,24,71,25,26,
,28,30,31,32,33,34,71,
,71,37,39,0,40,41,88,
,89,42,89,89,89,45,46,
,89,99,99,47,50,99,106,
,108,53,99,109,99,111,56,
,57,58,99,60,61,62,63,
,65,99,113,114,67,68,114,
,70,3,73,74,75,76,77,
,78,71,82,83,71,84,71,
,71,71,86,71,71,71,71,
,71,79,71,80,5,71,7,
,71,71,71,71,71,71,71,
,71,71,9,22,71,35,87,
,90,91,92,89,93,94,95,
,89,89,89,43,89,89,44,
,89,89,96,97,96,96,98,
,100,101,102,99,103,103,105,
,99,52,99,99,55,66,99,
,99,104,99,99,99,99,99,
7,99,51,99,110,112,99,54,
,99,114,115,116,117,118,114
ass << self
ttr_accessor :_re_scanner_trans_actions
rivate :_re_scanner_trans_actions, :_re_scanner_trans_actions=
d
lf._re_scanner_trans_actions = [
2,0,0,3,0,4,0,
0,6,7,8,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,10,0,0,
0,0,0,0,0,0,11,
12,0,0,0,0,0,14,
,16,0,17,18,19,0,0,
,21,22,23,0,0,25,0,
,0,0,27,0,28,0,0,
0,0,29,0,0,0,0,
0,30,0,31,0,0,32,
0,0,0,0,0,0,0,
,36,37,0,0,38,0,39,
,41,42,40,43,44,45,46,
,48,49,50,0,0,51,0,
,53,54,55,56,57,58,59,
,61,62,0,0,63,0,65,
0,40,40,66,0,40,67,
,69,70,71,0,72,73,0,
,75,76,77,0,78,79,0,
,0,40,40,81,82,83,0,
84,0,85,86,0,0,87,
88,0,89,90,91,92,93,
,94,0,95,40,0,96,0,
,98,99,40,40,40,40,100
ass << self
ttr_accessor :_re_scanner_to_state_actions
rivate :_re_scanner_to_state_actions, :_re_scanner_to_state_actions=
d
lf._re_scanner_to_state_actions = [
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,33,
0,0,0,0,0,0,0,
0,0,0,0,0,0,64,
,64,0,0,0,0,0,0,
,0,0,64,0,0,0,0,
0,0,0,0,0,0,0,
0,64,0,0,0,0
ass << self
ttr_accessor :_re_scanner_from_state_actions
rivate :_re_scanner_from_state_actions, :_re_scanner_from_state_actions=
d
lf._re_scanner_from_state_actions = [
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,34,
0,0,0,0,0,0,0,
0,0,0,0,0,0,34,
,34,0,0,0,0,0,0,
,0,0,34,0,0,0,0,
0,0,0,0,0,0,0,
0,34,0,0,0,0
ass << self
ttr_accessor :_re_scanner_eof_actions
rivate :_re_scanner_eof_actions, :_re_scanner_eof_actions=
d
lf._re_scanner_eof_actions = [
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,13,13,
,13,0,0,0,0,0,0,
24,24,0,24,24,0,24,
,24,24,24,24,24,24,24,
,24,24,0,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0,0,
24,0,0,0,0,0,0,
0,0,24,0,0,0,0,
0,0,0,0,0,0,0,
0,0,0,0,0,0
ass << self
ttr_accessor :_re_scanner_eof_trans
rivate :_re_scanner_eof_trans, :_re_scanner_eof_trans=
d
lf._re_scanner_eof_trans = [
1,1,1,5,5,5,5,
13,13,13,13,13,13,13,
,13,13,13,13,13,13,13,
,13,13,13,13,13,13,13,
,13,13,40,40,40,0,0,
0,49,49,52,54,54,59,
,0,0,65,0,0,70,0,
0,0,0,0,0,0,0,
0,0,85,85,85,85,0,
0,110,111,111,110,112,114,116,
6,122,123,125,127,129,134,0,
0,148,148,148,148,151,154,
159,159,0,176,176,176,178,
0,182,184,184,184,188,188,188,
8,193,0,200,200,200,200
ass << self
ttr_accessor :re_scanner_start
d
lf.re_scanner_start = 71;
ass << self
ttr_accessor :re_scanner_first_final
d
lf.re_scanner_first_final = 71;
ass << self
ttr_accessor :re_scanner_error
d
lf.re_scanner_error = 0;
ass << self
ttr_accessor :re_scanner_en_char_type
d
lf.re_scanner_en_char_type = 87;
ass << self
ttr_accessor :re_scanner_en_unicode_property
d
lf.re_scanner_en_unicode_property = 88;
ass << self
ttr_accessor :re_scanner_en_character_set
d
lf.re_scanner_en_character_set = 89;
ass << self
ttr_accessor :re_scanner_en_set_escape_sequence
d
lf.re_scanner_en_set_escape_sequence = 96;
ass << self
ttr_accessor :re_scanner_en_escape_sequence
d
lf.re_scanner_en_escape_sequence = 99;
ass << self
ttr_accessor :re_scanner_en_conditional_expression
d
lf.re_scanner_en_conditional_expression = 114;
ass << self
ttr_accessor :re_scanner_en_main
d
lf.re_scanner_en_main = 71;
gin
 ||= 0
e ||= data.length
s = re_scanner_start
op = 0
s = nil
e = nil
ct = 0
d
gin
estEof = false
slen, _trans, _keys, _inds, _acts, _nacts = nil
goto_level = 0
resume = 10
eof_trans = 15
again = 20
test_eof = 30
out = 40
hile true
f _goto_level <= 0
f p == pe
_goto_level = _test_eof
next
nd
f cs == 0
_goto_level = _out
next
nd
nd
f _goto_level <= _resume
ase _re_scanner_from_state_actions[cs]
hen 34 then
begin
 = p
end
nd
keys = cs << 1
inds = _re_scanner_index_offsets[cs]
slen = _re_scanner_key_spans[cs]
wide = data[p].ord
trans = if (   _slen > 0 &&
	_re_scanner_trans_keys[_keys] <= _wide &&
	_wide <= _re_scanner_trans_keys[_keys + 1]
    ) then
	_re_scanner_indicies[ _inds + _wide - _re_scanner_trans_keys[_keys] ]
 else
	_re_scanner_indicies[ _inds + _slen ]
 end
nd
f _goto_level <= _eof_trans
s = _re_scanner_trans_targs[_trans]
f _re_scanner_trans_actions[_trans] != 0
ase _re_scanner_trans_actions[_trans]
hen 36 then
begin
elf.group_depth = group_depth + 1 		end
hen 40 then
begin
 = p+1
end
hen 65 then
begin
 = p+1
egin
    case text = copy(data, ts-1,te)
    when '\d'; emit(:type, :digit,      text)
    when '\D'; emit(:type, :nondigit,   text)
    when '\h'; emit(:type, :hex,        text)
    when '\H'; emit(:type, :nonhex,     text)
    when '\s'; emit(:type, :space,      text)
    when '\S'; emit(:type, :nonspace,   text)
    when '\w'; emit(:type, :word,       text)
    when '\W'; emit(:type, :nonword,    text)
    when '\R'; emit(:type, :linebreak,  text)
    when '\X'; emit(:type, :xgrapheme,  text)
    end
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 14 then
begin
 = p+1
egin
    text = copy(data, ts-1,te)
    type = (text[1] == 'P') ^ (text[3] == '^') ? :nonproperty : :property
    name = text[3..-2].gsub(/[\^\s_\-]/, '').downcase
    token = self.class.short_prop_map[name] || self.class.long_prop_map[name]
    raise ValidationError.for(:property, name) unless token
    self.emit(type, token.to_sym, text)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 18 then
begin
 = p+1
egin  # special case, emits two tokens
    emit(:literal, :literal, '-')
    emit(:set, :intersection, '&&')
   end
end
hen 70 then
begin
 = p+1
egin
    if prev_token[1] == :open
      emit(:set, :negate, '^')
    else
      emit(:literal, :literal, '^')
    end
   end
end
hen 72 then
begin
 = p+1
egin
    emit(:set, :intersection, '&&')
   end
end
hen 68 then
begin
 = p+1
egin
    	begin
stack[top] = cs
top+= 1
cs = 96
_goto_level = _again
next
nd
   end
end
hen 66 then
begin
 = p+1
egin
    emit(:literal, :literal, copy(data, ts, te))
   end
end
hen 16 then
begin
 = p+1
egin
    text = copy(data, ts, te)
    emit(:literal, :literal, text)
   end
end
hen 73 then
begin
 = p
= p - 1; begin
    # ranges cant start with the opening bracket, a subset, or
    # intersection/negation/range operators
    if prev_token[0] == :set
      emit(:literal, :literal, '-')
    else
      emit(:set, :range, '-')
    end
   end
end
hen 76 then
begin
 = p
= p - 1; begin
    emit(:set, :open, '[')
    	begin
stack[top] = cs
top+= 1
cs = 89
_goto_level = _again
next
nd
   end
end
hen 71 then
begin
 = p
= p - 1; begin
    text = copy(data, ts, te)
    emit(:literal, :literal, text)
   end
end
hen 17 then
begin
egin p = ((te))-1; end
egin
    # ranges cant start with the opening bracket, a subset, or
    # intersection/negation/range operators
    if prev_token[0] == :set
      emit(:literal, :literal, '-')
    else
      emit(:set, :range, '-')
    end
   end
end
hen 20 then
begin
egin p = ((te))-1; end
egin
    emit(:set, :open, '[')
    	begin
stack[top] = cs
top+= 1
cs = 89
_goto_level = _again
next
nd
   end
end
hen 15 then
begin
egin p = ((te))-1; end
egin
    text = copy(data, ts, te)
    emit(:literal, :literal, text)
   end
end
hen 80 then
begin
 = p+1
egin
    emit(:escape, :octal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 78 then
begin
 = p+1
egin
    p = p - 1;
    cs = 89;
    	begin
stack[top] = cs
top+= 1
cs = 99
_goto_level = _again
next
nd
   end
end
hen 77 then
begin
 = p+1
egin
    emit(:escape, :literal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 79 then
begin
 = p
= p - 1; begin
    emit(:escape, :octal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 90 then
begin
 = p+1
egin
    emit(:escape, :octal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 92 then
begin
 = p+1
egin  # special case, emits two tokens
    text = copy(data, ts-1,te)
    emit(:escape, :literal, text[0,2])
    emit(:literal, :literal, text[2])
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 81 then
begin
 = p+1
egin
    case text = copy(data, ts-1,te)
    when '\.';  emit(:escape, :dot,               text)
    when '\|';  emit(:escape, :alternation,       text)
    when '\^';  emit(:escape, :bol,               text)
    when '\$';  emit(:escape, :eol,               text)
    when '\?';  emit(:escape, :zero_or_one,       text)
    when '\*';  emit(:escape, :zero_or_more,      text)
    when '\+';  emit(:escape, :one_or_more,       text)
    when '\(';  emit(:escape, :group_open,        text)
    when '\)';  emit(:escape, :group_close,       text)
    when '\{';  emit(:escape, :interval_open,     text)
    when '\}';  emit(:escape, :interval_close,    text)
    when '\[';  emit(:escape, :set_open,          text)
    when '\]';  emit(:escape, :set_close,         text)
    when "\\\\";
      emit(:escape, :backslash, text)
    end
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 86 then
begin
 = p+1
egin
    # \b is emitted as backspace only when inside a character set, otherwise
    # it is a word boundary anchor. A syntax might "normalize" it if needed.
    case text = copy(data, ts-1,te)
    when '\a'; emit(:escape, :bell,           text)
    when '\b'; emit(:escape, :backspace,      text)
    when '\e'; emit(:escape, :escape,         text)
    when '\f'; emit(:escape, :form_feed,      text)
    when '\n'; emit(:escape, :newline,        text)
    when '\r'; emit(:escape, :carriage,       text)
    when '\t'; emit(:escape, :tab,            text)
    when '\v'; emit(:escape, :vertical_tab,   text)
    end
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 29 then
begin
 = p+1
egin
    text = copy(data, ts-1,te)
    if text[2] == '{'
      emit(:escape, :codepoint_list, text)
    else
      emit(:escape, :codepoint,      text)
    end
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 98 then
begin
 = p+1
egin
    emit(:escape, :hex, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 25 then
begin
 = p+1
egin
    emit_meta_control_sequence(data, ts, te, :control)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 27 then
begin
 = p+1
egin
    emit_meta_control_sequence(data, ts, te, :meta_sequence)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 84 then
begin
 = p+1
egin
    p = p - 1;
    cs = ((in_set? ? 89 : 71));
    	begin
stack[top] = cs
top+= 1
cs = 87
_goto_level = _again
next
nd
   end
end
hen 85 then
begin
 = p+1
egin
    p = p - 1;
    cs = ((in_set? ? 89 : 71));
    	begin
stack[top] = cs
top+= 1
cs = 88
_goto_level = _again
next
nd
   end
end
hen 23 then
begin
 = p+1
egin
    emit(:escape, :literal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 91 then
begin
 = p
= p - 1; begin
    text = copy(data, ts-1,te)
    emit(:backref, :number, text)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 89 then
begin
 = p
= p - 1; begin
    emit(:escape, :octal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 97 then
begin
 = p
= p - 1; begin
    emit(:escape, :hex, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 94 then
begin
 = p
= p - 1; begin
    emit_meta_control_sequence(data, ts, te, :control)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 96 then
begin
 = p
= p - 1; begin
    emit_meta_control_sequence(data, ts, te, :meta_sequence)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 87 then
begin
 = p
= p - 1; begin
    emit(:escape, :literal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 22 then
begin
egin p = ((te))-1; end
egin
    emit(:escape, :literal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 88 then
begin
ase act
hen 17 then
egin begin p = ((te))-1; end
    text = copy(data, ts-1,te)
    emit(:backref, :number, text)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
  end
hen 18 then
egin begin p = ((te))-1; end
    emit(:escape, :octal, copy(data, ts-1,te))
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
  end
d
	end
hen 32 then
begin
 = p+1
egin
    text = copy(data, ts, te-1)
    text =~ /[^0]/ or raise ValidationError.for(:backref, 'condition', 'invalid ref ID')
    emit(:conditional, :condition, text)
    emit(:conditional, :condition_close, ')')
   end
end
hen 99 then
begin
 = p+1
egin
    p = p - 1;
    	begin
stack[top] = cs
top+= 1
cs = 71
_goto_level = _again
next
nd
   end
end
hen 100 then
begin
 = p
= p - 1; begin
    p = p - 1;
    	begin
stack[top] = cs
top+= 1
cs = 71
_goto_level = _again
next
nd
   end
end
hen 31 then
begin
egin p = ((te))-1; end
egin
    p = p - 1;
    	begin
stack[top] = cs
top+= 1
cs = 71
_goto_level = _again
next
nd
   end
end
hen 38 then
begin
 = p+1
egin
    emit(:meta, :dot, copy(data, ts, te))
   end
end
hen 43 then
begin
 = p+1
egin
    if conditional_stack.last == group_depth
      emit(:conditional, :separator, copy(data, ts, te))
    else
      emit(:meta, :alternation, copy(data, ts, te))
    end
   end
end
hen 42 then
begin
 = p+1
egin
    emit(:anchor, :bol, copy(data, ts, te))
   end
end
hen 35 then
begin
 = p+1
egin
    emit(:anchor, :eol, copy(data, ts, te))
   end
end
hen 62 then
begin
 = p+1
egin
    emit(:keep, :mark, copy(data, ts, te))
   end
end
hen 61 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when '\A';  emit(:anchor, :bos,                text)
    when '\z';  emit(:anchor, :eos,                text)
    when '\Z';  emit(:anchor, :eos_ob_eol,         text)
    when '\b';  emit(:anchor, :word_boundary,      text)
    when '\B';  emit(:anchor, :nonword_boundary,   text)
    when '\G';  emit(:anchor, :match_start,        text)
    end
   end
end
hen 41 then
begin
 = p+1
egin
    append_literal(data, ts, te)
   end
end
hen 51 then
begin
 = p+1
egin
    text = copy(data, ts, te)
    conditional_stack << group_depth
    emit(:conditional, :open, text[0..-2])
    emit(:conditional, :condition_open, '(')
    	begin
stack[top] = cs
top+= 1
cs = 114
_goto_level = _again
next
nd
   end
end
hen 52 then
begin
 = p+1
egin
    text = copy(data, ts, te)
    if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/
      raise ValidationError.for(:group_option, $1 || "-#{$2}", text)
    end
    emit_options(text)
   end
end
hen 6 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when '(?=';  emit(:assertion, :lookahead,    text)
    when '(?!';  emit(:assertion, :nlookahead,   text)
    when '(?<='; emit(:assertion, :lookbehind,   text)
    when '(?<!'; emit(:assertion, :nlookbehind,  text)
    end
   end
end
hen 5 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when '(?:';  emit(:group, :passive,      text)
    when '(?>';  emit(:group, :atomic,       text)
    when '(?~';  emit(:group, :absence,      text)
    when /^\(\?(?:<>|'')/
      raise ValidationError.for(:group, 'named group', 'name is empty')
    when /^\(\?<[^>]+>/
      emit(:group, :named_ab,  text)
    when /^\(\?'[^']+'/
      emit(:group, :named_sq,  text)
    end
   end
end
hen 10 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when /^\\k(.)[^0-9\-][^+\-]*['>]$/
      emit(:backref, $1 == '<' ? :name_ref_ab : :name_ref_sq, text)
    when /^\\k(.)0*[1-9]\d*['>]$/
      emit(:backref, $1 == '<' ? :number_ref_ab : :number_ref_sq, text)
    when /^\\k(.)-0*[1-9]\d*['>]$/
      emit(:backref, $1 == '<' ? :number_rel_ref_ab : :number_rel_ref_sq, text)
    when /^\\k(.)[^0-9\-].*[+\-]\d+['>]$/
      emit(:backref, $1 == '<' ? :name_recursion_ref_ab : :name_recursion_ref_sq, text)
    when /^\\k(.)-?0*[1-9]\d*[+\-]\d+['>]$/
      emit(:backref, $1 == '<' ? :number_recursion_ref_ab : :number_recursion_ref_sq, text)
    else
      raise ValidationError.for(:backref, 'backreference', 'invalid ref ID')
    end
   end
end
hen 9 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when /^\\g(.)[^0-9+\-].*['>]$/
      emit(:backref, $1 == '<' ? :name_call_ab : :name_call_sq, text)
    when /^\\g(.)(?:0|0*[1-9]\d*)['>]$/
      emit(:backref, $1 == '<' ? :number_call_ab : :number_call_sq, text)
    when /^\\g(.)[+-]0*[1-9]\d*/
      emit(:backref, $1 == '<' ? :number_rel_call_ab : :number_rel_call_sq, text)
    else
      raise ValidationError.for(:backref, 'subexpression call', 'invalid ref ID')
    end
   end
end
hen 59 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when '?' ;  emit(:quantifier, :zero_or_one,            text)
    when '??';  emit(:quantifier, :zero_or_one_reluctant,  text)
    when '?+';  emit(:quantifier, :zero_or_one_possessive, text)
    end
   end
end
hen 55 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when '*' ;  emit(:quantifier, :zero_or_more,            text)
    when '*?';  emit(:quantifier, :zero_or_more_reluctant,  text)
    when '*+';  emit(:quantifier, :zero_or_more_possessive, text)
    end
   end
end
hen 57 then
begin
 = p+1
egin
    case text = copy(data, ts, te)
    when '+' ;  emit(:quantifier, :one_or_more,            text)
    when '+?';  emit(:quantifier, :one_or_more_reluctant,  text)
    when '++';  emit(:quantifier, :one_or_more_possessive, text)
    end
   end
end
hen 12 then
begin
 = p+1
egin
    emit(:quantifier, :interval, copy(data, ts, te))
   end
end
hen 47 then
begin
 = p+1
egin
    if free_spacing
      emit(:free_space, :comment, copy(data, ts, te))
    else
      # consume only the pound sign (#) and backtrack to do regular scanning
      append_literal(data, ts, ts + 1)
       begin p = (( ts + 1))-1; end
    end
   end
end
hen 50 then
begin
 = p
= p - 1; begin
    text = copy(data, ts, te)
    if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/
      raise ValidationError.for(:group_option, $1 || "-#{$2}", text)
    end
    emit_options(text)
   end
end
hen 53 then
begin
 = p
= p - 1; begin
    case text = copy(data, ts, te)
    when '(?=';  emit(:assertion, :lookahead,    text)
    when '(?!';  emit(:assertion, :nlookahead,   text)
    when '(?<='; emit(:assertion, :lookbehind,   text)
    when '(?<!'; emit(:assertion, :nlookbehind,  text)
    end
   end
end
hen 48 then
begin
 = p
= p - 1; begin
    text = copy(data, ts, te)
    emit(:group, :capture, text)
   end
end
hen 58 then
begin
 = p
= p - 1; begin
    case text = copy(data, ts, te)
    when '?' ;  emit(:quantifier, :zero_or_one,            text)
    when '??';  emit(:quantifier, :zero_or_one_reluctant,  text)
    when '?+';  emit(:quantifier, :zero_or_one_possessive, text)
    end
   end
end
hen 54 then
begin
 = p
= p - 1; begin
    case text = copy(data, ts, te)
    when '*' ;  emit(:quantifier, :zero_or_more,            text)
    when '*?';  emit(:quantifier, :zero_or_more_reluctant,  text)
    when '*+';  emit(:quantifier, :zero_or_more_possessive, text)
    end
   end
end
hen 56 then
begin
 = p
= p - 1; begin
    case text = copy(data, ts, te)
    when '+' ;  emit(:quantifier, :one_or_more,            text)
    when '+?';  emit(:quantifier, :one_or_more_reluctant,  text)
    when '++';  emit(:quantifier, :one_or_more_possessive, text)
    end
   end
end
hen 63 then
begin
 = p
= p - 1; begin
    append_literal(data, ts, te)
   end
end
hen 60 then
begin
 = p
= p - 1; begin
    	begin
stack[top] = cs
top+= 1
cs = 99
_goto_level = _again
next
nd
   end
end
hen 46 then
begin
 = p
= p - 1; begin
    if free_spacing
      emit(:free_space, :comment, copy(data, ts, te))
    else
      # consume only the pound sign (#) and backtrack to do regular scanning
      append_literal(data, ts, ts + 1)
       begin p = (( ts + 1))-1; end
    end
   end
end
hen 45 then
begin
 = p
= p - 1; begin
    if free_spacing
      emit(:free_space, :whitespace, copy(data, ts, te))
    else
      append_literal(data, ts, te)
    end
   end
end
hen 44 then
begin
 = p
= p - 1; begin
    append_literal(data, ts, te)
   end
end
hen 3 then
begin
egin p = ((te))-1; end
egin
    text = copy(data, ts, te)
    if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/
      raise ValidationError.for(:group_option, $1 || "-#{$2}", text)
    end
    emit_options(text)
   end
end
hen 11 then
begin
egin p = ((te))-1; end
egin
    append_literal(data, ts, te)
   end
end
hen 8 then
begin
egin p = ((te))-1; end
egin
    	begin
stack[top] = cs
top+= 1
cs = 99
_goto_level = _again
next
nd
   end
end
hen 1 then
begin
ase act
hen 0 then
egin	begin
cs = 0
_goto_level = _again
next
nd
d
hen 42 then
egin begin p = ((te))-1; end
    text = copy(data, ts, te)
    if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/
      raise ValidationError.for(:group_option, $1 || "-#{$2}", text)
    end
    emit_options(text)
  end
hen 43 then
egin begin p = ((te))-1; end
    case text = copy(data, ts, te)
    when '(?=';  emit(:assertion, :lookahead,    text)
    when '(?!';  emit(:assertion, :nlookahead,   text)
    when '(?<='; emit(:assertion, :lookbehind,   text)
    when '(?<!'; emit(:assertion, :nlookbehind,  text)
    end
  end
hen 57 then
egin begin p = ((te))-1; end
    append_literal(data, ts, te)
  end
d
	end
hen 75 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
begin
 = p
= p - 1; begin
    emit(:set, :open, '[')
    	begin
stack[top] = cs
top+= 1
cs = 89
_goto_level = _again
next
nd
   end
end
hen 19 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
begin
egin p = ((te))-1; end
egin
    emit(:set, :open, '[')
    	begin
stack[top] = cs
top+= 1
cs = 89
_goto_level = _again
next
nd
   end
end
hen 93 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
begin
 = p
= p - 1; begin
    emit_meta_control_sequence(data, ts, te, :control)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 95 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
begin
 = p
= p - 1; begin
    emit_meta_control_sequence(data, ts, te, :meta_sequence)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 26 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
begin
egin p = ((te))-1; end
egin
    emit_meta_control_sequence(data, ts, te, :control)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 28 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
begin
egin p = ((te))-1; end
egin
    emit_meta_control_sequence(data, ts, te, :meta_sequence)
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 30 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise ValidationError.for(:sequence, 'sequence', text)
		end
begin
 = p+1
egin
    	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
   end
end
hen 4 then
begin
elf.group_depth = group_depth - 1 		end
begin
 = p+1
egin
    emit(:group, :comment, copy(data, ts, te))
   end
end
hen 37 then
begin
elf.group_depth = group_depth - 1 		end
begin
 = p+1
egin
    if conditional_stack.last == group_depth + 1
      conditional_stack.pop
      emit(:conditional, :close, ')')
    elsif group_depth >= 0
      if spacing_stack.length > 1 &&
         spacing_stack.last[:depth] == group_depth + 1
        spacing_stack.pop
        self.free_spacing = spacing_stack.last[:free_spacing]
      end
      emit(:group, :close, ')')
    else
      raise ValidationError.for(:group, 'group', 'unmatched close parenthesis')
    end
   end
end
hen 39 then
begin
elf.set_depth   = set_depth   + 1 		end
begin
 = p+1
egin
    emit(:set, :open, copy(data, ts, te))
    	begin
stack[top] = cs
top+= 1
cs = 89
_goto_level = _again
next
nd
   end
end
hen 69 then
begin
elf.set_depth   = set_depth   - 1 		end
begin
 = p+1
egin
    emit(:set, :close, copy(data, ts, te))
    if in_set?
      	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
    else
      	begin
cs = 71
_goto_level = _again
next
nd
    end
   end
end
hen 74 then
begin
elf.set_depth   = set_depth   - 1 		end
begin
 = p+1
egin  # special case, emits two tokens
    emit(:literal, :literal, '-')
    emit(:set, :close, ']')
    if in_set?
      	begin
top -= 1
cs = stack[top]
_goto_level = _again
next
nd
    else
      	begin
cs = 71
_goto_level = _again
next
nd
    end
   end
end
hen 21 then
begin
elf.set_depth   = set_depth   - 1 		end
begin
 = p+1
egin
    text = copy(data, ts, te)
    type = :posixclass
    class_name = text[2..-3]
    if class_name[0] == '^'
      class_name = class_name[1..-1]
      type = :nonposixclass
    end
    unless self.class.posix_classes.include?(class_name)
      raise ValidationError.for(:posix_class, text)
    end
    emit(type, class_name.to_sym, text)
   end
end
hen 67 then
begin
 = p+1
end
begin
elf.set_depth   = set_depth   + 1 		end
hen 83 then
begin
 = p+1
end
begin
t = 17;		end
hen 82 then
begin
 = p+1
end
begin
t = 18;		end
hen 49 then
begin
 = p+1
end
begin
t = 42;		end
hen 7 then
begin
 = p+1
end
begin
t = 43;		end
hen 2 then
begin
 = p+1
end
begin
t = 57;		end
nd
nd
nd
f _goto_level <= _again
ase _re_scanner_to_state_actions[cs]
hen 64 then
begin
 = nil;		end
hen 33 then
begin
 = nil;		end
begin
t = 0
end
nd
f cs == 0
_goto_level = _out
next
nd
 += 1
f p != pe
_goto_level = _resume
next
nd
nd
f _goto_level <= _test_eof
f p == eof
f _re_scanner_eof_trans[cs] > 0
_trans = _re_scanner_eof_trans[cs] - 1;
_goto_level = _eof_trans
next;
nd
 case _re_scanner_eof_actions[cs]
hen 13 then
begin
  raise PrematureEndError.new('unicode property')
		end
hen 24 then
begin
  text = copy(data, ts ? ts-1 : 0,-1)
  raise PrematureEndError.new(text)
		end
 end
nd
nd
f _goto_level <= _out
break
nd
d
nd
  # to avoid "warning: assigned but unused variable - testEof"
  testEof = testEof
  if cs == re_scanner_error
    text = copy(data, ts ? ts-1 : 0,-1)
    raise ScannerError.new("Scan error at '#{text}'")
  end
  raise PrematureEndError.new("(missing group closing paranthesis) "+
        "[#{group_depth}]") if in_group?
  raise PrematureEndError.new("(missing set closing bracket) "+
        "[#{set_depth}]") if in_set?
  # when the entire expression is a literal run
  emit_literal if literal_run
  tokens
end