class Regexp::Scanner
def self.long_prop_map
def self.long_prop_map @long_prop_map ||= YAML.load_file("#{PROP_MAPS_DIR}/long.yml") end
def self.scan(input_object, options: nil, &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, &block) new.scan(input_object, options: options, &block) end
def self.short_prop_map
def self.short_prop_map @short_prop_map ||= YAML.load_file("#{PROP_MAPS_DIR}/short.yml") end
def append_literal(data, ts, te)
Appends one or more characters to the literal buffer, to be emitted later
def append_literal(data, ts, te) self.literal = literal || [] literal << copy(data, ts, te) end
def copy(data, ts, te)
def copy(data, ts, te) data[ts...te].pack('c*').force_encoding('utf-8') end
def emit(type, token, text)
def emit(type, token, text) #puts "EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}" emit_literal if literal # 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 if block block.call type, token, text, ts_char_pos, te_char_pos end tokens << [type, token, text, ts_char_pos, te_char_pos] self.char_pos = te_char_pos end
def emit_literal
def emit_literal text = literal.join self.literal = 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 validation_error(: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, &block)
def scan(input_object, options: nil, &block) self.literal = 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*") if input.is_a?(String) eof = data.length self.tokens = [] self.block = block_given? ? block : nil self.set_depth = 0 self.group_depth = 0 self.conditional_stack = [] self.char_pos = 0 line 94 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" 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, 128, -65, -128, -65, -128, 65, -128, -65, 41, 41, 9, 122, 33, 122, 48, 122, 9, 60, 39, 122, 48, 7, 39, 57, 48, 57, 9, 57, 39, 122, 43, 122, 8, 57, 48, 62, 48, 7, 43, 62, 43, 122, 8, 57, 48, 125, 44, 125, 23, 123, 9, 122, 9, 25, 9, 122, -128, -65, 128, -65, 38, 38, 45, 122, 5, 122, 93, 93, 94, 20, 97, 120, 108, 115, 10, 112, 117, 117, 109, 109, 8, 58, 93, 93, 104, 04, 97, 97, 99, 99, 05, 105, 105, 105, 108, 108, 7, 97, 110, 110, 107, 07, 110, 110, 116, 116, 14, 114, 108, 108, 105, 105, 03, 103, 105, 105, 116, 16, 114, 114, 97, 97, 12, 112, 104, 104, 111, 111, 19, 119, 101, 101, 114, 14, 114, 117, 105, 105, 10, 110, 110, 110, 99, 99, 12, 112, 97, 97, 99, 9, 101, 101, 112, 112, 12, 112, 111, 111, 114, 114, 00, 100, 100, 100, 65, 22, 61, 61, 93, 93, 128, -65, -128, -65, 45, 45, 2, 92, 92, 92, 45, 5, 92, 92, 92, 92, 8, 123, 48, 102, 48, 102, 8, 102, 48, 102, 9, 25, 9, 125, 9, 125, , 125, 9, 125, 9, 125, 8, 123, 41, 41, 39, 22, 41, 57, 48, 122, 128, 127, -62, -33, -32, -17, 16, -12, 1, 127, 1, 27, 9, 32, 33, 126, 0, 10, 63, 63, 33, 126, 3, 126, 43, 63, 43, 3, 43, 63, 65, 122, 4, 57, 43, 63, 68, 119, 0, 112, -62, 125, -128, 65, -128, -65, -128, -65, 8, 38, 38, 93, 46, 61, 8, 122, -62, 125, -128, 65, -128, -65, -128, -65, 8, 55, 48, 55, 77, 77, 5, 45, 0, 0, 67, 9, 45, 45, 0, 0, 2, 92, 48, 102, 39, 60, 9, 122, 49, 57, 41, 7, 48, 122, 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, 64, 64, 64, 1, 4, 90, 75, 22, 84, 10, 19, 10, 9, 84, 80, 10, 15, 10, 20, 80, 0, 78, 82, 1, 114, 117, 114, 64, 4, 1, 78, 78, 1, 27, 24, 8, , 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, 4, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 58, 1, 1, 4, 64, 1, 1, 1, 1, 1, 1, 6, 55, 55, 55, 55, 117, 117, 117, 17, 117, 117, 76, 1, 84, 17, 75, 56, 30, 16, 5, 127, 127, 24, 94, , 1, 94, 94, 21, 21, 21, 58, 4, 21, 52, 33, 188, 64, 64, 64, , 56, 16, 75, 188, 64, 64, 64, , 8, 1, 1, 0, 33, 1, 0, , 55, 22, 84, 9, 17, 75 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, 260, 325, 390, 92, 477, 568, 644, 667, 752, 763, 783, 94, 814, 899, 980, 991, 1007, 1018, 1039, 120, 1131, 1210, 1293, 1295, 1410, 1528, 1643, 708, 1773, 1775, 1854, 1933, 1935, 1963, 1988, 997, 2001, 2003, 2005, 2007, 2009, 2011, 2013, 015, 2017, 2019, 2021, 2023, 2025, 2027, 2029, 031, 2033, 2035, 2037, 2039, 2041, 2043, 2045, 047, 2049, 2051, 2053, 2055, 2057, 2059, 2064, 066, 2068, 2070, 2072, 2074, 2076, 2078, 2080, 082, 2084, 2086, 2088, 2090, 2092, 2151, 2153, 155, 2220, 2285, 2287, 2289, 2291, 2293, 2295, 297, 2374, 2430, 2486, 2542, 2598, 2716, 2834, 952, 3070, 3188, 3306, 3383, 3385, 3470, 3488, 564, 3821, 3852, 3869, 3875, 4003, 4131, 4156, 251, 4253, 4255, 4350, 4445, 4467, 4489, 4511, 570, 4585, 4607, 4660, 4694, 4883, 4948, 5013, 078, 5080, 5137, 5154, 5230, 5419, 5484, 5549, 614, 5623, 5632, 5634, 5636, 5637, 5671, 5673, 674, 5676, 5732, 5755, 5840, 5850, 5868 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, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 4, 4, 4, 4, 4, , 4, 4, 0, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 5, 5, 5, 5, , 5, 5, 5, 0, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 6, 6, 6, , 6, 6, 6, 6, 0, 9, 8, 0, 7, 7, 7, 7, 7, 7, 7, , 11, 11, 11, 11, 11, 11, 11, 1, 11, 11, 7, 7, 7, 7, 7, , 7, 11, 11, 11, 11, 11, 11, 1, 11, 11, 11, 11, 11, 11, 11, 1, 11, 11, 11, 11, 11, 11, 11, 1, 11, 11, 11, 7, 7, 7, 7, 1, 7, 11, 11, 11, 11, 11, 11, 1, 11, 11, 11, 11, 11, 11, 11, 1, 11, 11, 11, 11, 11, 11, 11, 1, 11, 11, 11, 7, 12, 7, 7, , 7, 7, 7, 7, 7, 7, 7, , 7, 7, 7, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 7, 7, , 12, 10, 7, 7, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 7, , 7, 7, 13, 7, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 7, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 7, 7, 7, 7, 10, 7, , 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 7, 7, 7, 7, 13, , 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 13, 13, 13, 13, 13, 3, 13, 13, 7, 15, 14, 14, 14, 4, 14, 14, 14, 14, 14, 14, 14, 4, 14, 14, 14, 14, 14, 14, 14, 4, 16, 14, 17, 14, 14, 14, 18, 4, 19, 14, 14, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 14, 14, 4, 14, 14, 14, 14, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 14, 4, 14, 14, 20, 14, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 14, 1, 21, 21, 21, 21, 21, 21, 21, 1, 21, 14, 17, 14, 14, 14, 14, 4, 14, 14, 14, 21, 21, 21, 21, 1, 21, 21, 21, 21, 21, 14, 21, 2, 22, 22, 22, 22, 22, 22, 22, 2, 14, 17, 14, 14, 14, 18, 14, 8, 14, 14, 22, 22, 22, 22, 22, 2, 22, 22, 22, 22, 14, 17, 14, 4, 14, 18, 14, 18, 14, 14, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 14, 14, 14, 14, 14, 14, 14, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 14, 14, 14, 14, 20, 14, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 0, 20, 14, 23, 14, 24, 14, 14, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 14, 14, 14, 14, 17, 14, 4, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 14, 14, 14, 14, 25, 4, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 14, 26, 26, 26, 26, 6, 26, 26, 26, 26, 26, 14, 26, 6, 26, 26, 26, 26, 26, 26, 26, 6, 14, 14, 14, 14, 17, 14, 26, 7, 27, 27, 27, 27, 27, 27, 27, 7, 14, 23, 14, 23, 14, 14, 27, 7, 27, 27, 27, 27, 27, 27, 27, 7, 14, 14, 14, 14, 17, 14, 23, 4, 23, 14, 14, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 14, 14, 4, 14, 17, 14, 14, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 14, 4, 14, 14, 25, 14, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 14, 9, 29, 29, 29, 29, 29, 29, 29, 9, 29, 28, 29, 29, 29, 29, 29, 9, 29, 29, 29, 29, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 0, 28, 29, 28, 28, 28, 31, 31, 1, 31, 31, 31, 31, 31, 31, 31, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 28, 28, 28, 28, 28, 8, 28, 28, 30, 28, 32, 33, 34, 4, 34, 34, 34, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 34, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 34, 34, 33, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 3, 33, 33, 34, 33, 33, 33, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 33, 33, 33, 35, 34, 33, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 33, 34, 34, 34, 34, 34, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 34, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 34, 34, 3, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 33, 33, 33, 34, 33, 3, 33, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 33, 33, 33, 33, 4, 33, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 33, 33, 36, 33, 4, 34, 34, 34, 34, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 34, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 34, 34, 33, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 33, 33, 33, 34, 33, 33, 33, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 33, 33, 33, 33, 34, 33, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 34, 34, 34, 34, 34, 34, 4, 34, 33, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 37, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 37, 41, 40, 44, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 43, 43, 43, 3, 43, 43, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 43, 44, 45, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 43, 43, 43, 43, 3, 43, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 44, 44, 44, 44, 4, 44, 44, 44, 43, 46, 43, 47, 3, 43, 48, 49, 50, 51, 43, 43, 2, 43, 43, 43, 43, 53, 43, 43, 3, 54, 43, 43, 55, 43, 56, 43, 7, 58, 43, 48, 49, 50, 51, 43, 3, 52, 43, 43, 43, 43, 53, 43, 3, 43, 54, 43, 43, 55, 43, 56, 3, 57, 58, 43, 59, 43, 43, 43, 3, 43, 43, 60, 43, 61, 43, 62, 3, 63, 43, 64, 43, 65, 43, 66, 3, 67, 43, 64, 43, 68, 43, 69, 3, 64, 43, 70, 43, 71, 43, 72, 3, 64, 43, 73, 43, 74, 43, 75, 3, 64, 43, 76, 43, 77, 43, 78, 3, 64, 43, 79, 43, 80, 43, 81, 3, 64, 43, 82, 43, 83, 43, 84, 3, 64, 43, 85, 43, 43, 86, 43, 7, 43, 78, 43, 88, 43, 78, 43, 9, 43, 90, 43, 91, 43, 64, 43, 2, 43, 83, 43, 93, 43, 94, 43, 4, 43, 51, 43, 95, 95, 95, 95, 5, 95, 95, 95, 95, 95, 95, 95, 5, 95, 95, 95, 95, 95, 95, 95, 5, 95, 95, 95, 95, 95, 43, 43, 3, 43, 43, 43, 95, 95, 95, 95, 5, 95, 95, 95, 95, 95, 95, 95, 5, 95, 95, 95, 95, 95, 95, 95, 5, 95, 95, 95, 95, 95, 43, 96, 3, 97, 43, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 98, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 98, 101, 33, 103, 02, 105, 102, 106, 33, 108, 107, 110, 07, 111, 111, 111, 111, 111, 111, 111, 11, 111, 111, 33, 33, 33, 33, 33, 3, 33, 111, 111, 111, 111, 111, 111, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 111, 111, 111, 111, 111, 111, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 112, 33, 113, 113, 13, 113, 113, 113, 113, 113, 113, 113, 3, 33, 33, 33, 33, 33, 33, 113, 13, 113, 113, 113, 113, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 113, 13, 113, 113, 113, 113, 33, 114, 114, 14, 114, 114, 114, 114, 114, 114, 114, 3, 33, 33, 33, 33, 33, 33, 114, 14, 114, 114, 114, 114, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 114, 14, 114, 114, 114, 114, 33, 115, 115, 15, 115, 115, 115, 115, 115, 115, 115, 3, 33, 33, 33, 33, 33, 33, 115, 15, 115, 115, 115, 115, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 115, 15, 115, 115, 115, 115, 33, 116, 116, 16, 116, 116, 116, 116, 116, 116, 116, 3, 33, 33, 33, 33, 33, 33, 116, 16, 116, 116, 116, 116, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 116, 16, 116, 116, 116, 116, 33, 112, 112, 12, 112, 112, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 112, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 117, 117, 117, 17, 117, 117, 117, 117, 117, 117, 33, 3, 33, 33, 33, 33, 33, 117, 117, 17, 117, 117, 117, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 117, 117, 17, 117, 117, 117, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 115, 33, 112, 112, 112, 112, 12, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 112, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 118, 118, 118, 118, 118, 18, 118, 118, 118, 118, 33, 33, 33, 3, 33, 33, 33, 118, 118, 118, 118, 18, 118, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 118, 118, 118, 118, 18, 118, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 15, 33, 112, 112, 112, 112, 112, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 112, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 119, 119, 119, 119, 119, 119, 119, 19, 119, 119, 33, 33, 33, 33, 33, 3, 33, 119, 119, 119, 119, 119, 119, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 119, 119, 119, 119, 119, 119, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 115, 33, 12, 112, 112, 112, 112, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 112, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 120, 20, 120, 120, 120, 120, 120, 120, 120, 20, 33, 33, 33, 33, 33, 33, 33, 20, 120, 120, 120, 120, 120, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 20, 120, 120, 120, 120, 120, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 115, 33, 112, 112, 12, 112, 112, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 112, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 121, 121, 121, 21, 121, 121, 121, 121, 121, 121, 33, 3, 33, 33, 33, 33, 33, 121, 121, 21, 121, 121, 121, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 121, 121, 21, 121, 121, 121, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 115, 33, 112, 112, 112, 112, 12, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 112, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 15, 33, 123, 123, 123, 123, 123, 123, 23, 123, 123, 123, 122, 122, 122, 122, 22, 122, 122, 123, 123, 123, 123, 123, 23, 122, 122, 122, 122, 122, 122, 122, 22, 122, 122, 122, 122, 122, 122, 122, 22, 122, 122, 122, 122, 122, 122, 122, 22, 122, 122, 123, 123, 123, 123, 123, 23, 122, 122, 122, 122, 122, 122, 122, 22, 122, 122, 122, 122, 122, 122, 122, 22, 122, 122, 122, 122, 33, 122, 125, 24, 126, 124, 124, 124, 124, 124, 124, 24, 124, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 124, 124, 124, 124, 24, 124, 124, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 124, 124, 124, 24, 127, 124, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 124, 125, 124, 24, 124, 124, 124, 124, 128, 128, 128, 28, 128, 128, 128, 128, 128, 128, 124, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 124, 124, 124, 124, 126, 124, 24, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 124, 124, 124, 124, 129, 24, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 124, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 130, 130, 30, 130, 130, 130, 130, 130, 130, 130, 30, 130, 130, 130, 130, 130, 130, 130, 30, 130, 130, 130, 130, 130, 130, 130, 30, 130, 130, 130, 131, 131, 131, 131, 31, 131, 131, 131, 131, 131, 131, 131, 31, 131, 131, 131, 132, 132, 132, 132, 32, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 133, 133, 133, 33, 133, 133, 133, 133, 134, 134, 134, 34, 134, 133, 133, 133, 133, 133, 133, 33, 133, 133, 133, 133, 133, 133, 133, 33, 133, 133, 133, 135, 136, 136, 137, 38, 136, 136, 136, 139, 140, 141, 142, 36, 136, 143, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 144, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 145, 46, 147, 148, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 149, 50, 147, 136, 133, 136, 130, 130, 130, 30, 130, 130, 130, 130, 130, 130, 130, 30, 130, 130, 130, 130, 130, 130, 130, 30, 130, 130, 130, 130, 130, 130, 130, 30, 130, 130, 151, 131, 131, 131, 131, 31, 131, 131, 131, 131, 131, 131, 131, 31, 131, 131, 131, 151, 132, 132, 132, 32, 132, 151, 133, 133, 133, 133, 133, 33, 133, 133, 133, 133, 133, 133, 133, 33, 133, 133, 133, 133, 133, 133, 133, 33, 133, 133, 133, 133, 133, 133, 133, 33, 133, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 151, 151, 151, 151, 151, 151, 151, 51, 133, 151, 133, 133, 133, 133, 133, 33, 133, 133, 134, 134, 134, 134, 134, 33, 133, 133, 133, 133, 133, 133, 133, 33, 133, 133, 133, 133, 133, 133, 133, 33, 133, 135, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 133, 152, 135, 135, 135, 135, 135, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 152, 152, 152, 152, 152, 152, 52, 152, 135, 152, 136, 136, 151, 151, 36, 136, 136, 151, 151, 151, 151, 136, 36, 151, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 151, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 151, 151, 51, 151, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 136, 136, 36, 136, 136, 136, 136, 136, 151, 151, 51, 136, 151, 154, 137, 156, 155, 12, 58, 8, 158, 158, 158, 11, 159, 157, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 0, 158, 160, 12, 10, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 10, 158, 157, 158, 57, 158, 158, 158, 157, 157, 157, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 161, 58, 157, 157, 157, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 158, 158, 158, 158, 158, 58, 158, 158, 157, 158, 163, 162, 162, 62, 162, 162, 162, 162, 162, 162, 162, 62, 162, 162, 162, 162, 162, 162, 162, 62, 163, 162, 165, 164, 164, 164, 164, 64, 164, 164, 164, 164, 164, 164, 164, 64, 164, 164, 164, 164, 164, 164, 165, 64, 167, 166, 166, 166, 166, 166, 166, 66, 166, 166, 166, 166, 166, 166, 166, 66, 166, 166, 166, 166, 167, 166, 169, 69, 168, 168, 168, 168, 169, 168, 168, 68, 170, 168, 168, 168, 168, 168, 168, 68, 168, 168, 168, 168, 168, 168, 168, 69, 168, 168, 168, 168, 168, 168, 168, 69, 168, 168, 168, 168, 171, 168, 168, 68, 171, 168, 168, 168, 168, 168, 168, 68, 168, 168, 168, 168, 168, 168, 168, 69, 168, 173, 172, 172, 172, 31, 31, 1, 31, 31, 31, 31, 31, 31, 31, 72, 175, 174, 174, 174, 174, 174, 174, 74, 174, 174, 174, 174, 174, 174, 174, 74, 174, 174, 174, 174, 175, 174, 176, 3, 33, 33, 176, 33, 33, 33, 33, 3, 33, 33, 33, 33, 176, 176, 33, 3, 33, 176, 176, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 176, 3, 33, 33, 176, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 176, 33, 3, 33, 176, 33, 177, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 33, 33, 33, 33, 3, 33, 33, 33, 177, 33, 178, 178, 78, 178, 178, 178, 178, 178, 178, 178, 78, 178, 178, 178, 178, 178, 178, 178, 78, 178, 178, 178, 178, 178, 178, 178, 78, 178, 178, 178, 179, 179, 179, 179, 79, 179, 179, 179, 179, 179, 179, 179, 79, 179, 179, 179, 180, 180, 180, 180, 80, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 81, 38, 182, 38, 181, 181, 181, 181, 8, 183, 181, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 181, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 184, 85, 186, 187, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 181, 81, 181, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 38, 38, 38, 38, 38, 8, 38, 38, 188, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 39, 39, 39, 39, 9, 39, 39, 39, 188, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 189, 189, 189, 89, 189, 189, 189, 189, 188, 190, 188, 92, 191, 191, 191, 191, 191, 191, 191, 91, 191, 191, 191, 191, 191, 191, 191, 91, 191, 191, 191, 191, 191, 191, 191, 91, 191, 191, 191, 191, 191, 191, 191, 91, 191, 191, 191, 191, 191, 191, 191, 91, 191, 191, 191, 191, 191, 191, 191, 91, 191, 191, 191, 191, 191, 191, 193, 91, 196, 195, 195, 195, 195, 195, 195, 95, 195, 195, 195, 195, 197, 195, 195, 98, 195, 200, 200, 200, 200, 200, 200, 00, 200, 200, 200, 199, 199, 199, 199, 99, 199, 199, 200, 200, 200, 199, 199, 99, 200, 199, 199, 199, 200, 199, 200, 99, 199, 199, 199, 200, 199, 199, 199, 99, 199, 200, 199, 200, 199, 199, 199, 99, 199, 199, 199, 199, 200, 199, 199, 99, 200, 199, 199, 199, 200, 199, 199, 99, 199, 199, 199, 199, 199, 199, 199, 99, 199, 199, 199, 200, 199, 201, 201, 01, 201, 201, 201, 201, 201, 201, 201, 01, 201, 201, 201, 201, 201, 201, 201, 01, 201, 201, 201, 201, 201, 201, 201, 01, 201, 201, 201, 202, 202, 202, 202, 02, 202, 202, 202, 202, 202, 202, 202, 02, 202, 202, 202, 203, 203, 203, 203, 03, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 04, 99, 99, 99, 204, 204, 204, 204, 9, 99, 204, 99, 205, 206, 206, 206, 06, 206, 206, 206, 207, 207, 99, 99, 9, 99, 99, 204, 99, 33, 33, 208, 09, 99, 99, 33, 209, 99, 99, 33, 9, 210, 99, 99, 211, 99, 209, 209, 9, 99, 99, 209, 209, 99, 33, 204, 04, 204, 204, 99, 99, 212, 212, 101, 09, 212, 212, 99, 209, 99, 99, 99, 9, 99, 212, 99, 211, 99, 212, 209, 12, 213, 212, 209, 214, 99, 33, 204, 04, 204, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 99, 99, 99, 99, 99, 9, 99, 99, 215, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 100, 100, 100, 100, 00, 100, 100, 100, 215, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 216, 216, 216, 16, 216, 216, 216, 216, 215, 218, 218, 18, 218, 218, 218, 218, 218, 217, 220, 20, 220, 220, 220, 220, 220, 220, 219, 22, 102, 224, 223, 102, 226, 107, 107, 07, 107, 107, 107, 107, 107, 107, 107, 07, 107, 107, 107, 107, 107, 107, 107, 07, 107, 107, 107, 107, 107, 107, 107, 07, 107, 107, 107, 107, 227, 107, 229, 28, 107, 110, 107, 232, 232, 232, 232, 32, 232, 232, 232, 232, 232, 231, 231, 31, 231, 231, 231, 231, 232, 232, 232, 32, 232, 232, 231, 231, 231, 231, 231, 31, 231, 231, 231, 231, 231, 231, 231, 31, 231, 231, 231, 231, 231, 231, 231, 31, 231, 231, 231, 231, 232, 232, 232, 32, 232, 232, 231, 234, 233, 233, 233, 33, 233, 235, 233, 233, 233, 236, 236, 36, 236, 236, 236, 236, 236, 236, 233, 33, 237, 233, 126, 238, 238, 238, 238, 38, 238, 238, 238, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 238, 238, 38, 238, 238, 238, 238, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 238, 38, 238, 238, 127, 238, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 127, 27, 127, 127, 127, 127, 127, 127, 238, 28, 128, 128, 128, 128, 128, 128, 128, 28, 238, 125, 238, 238, 238, 238, 238, 38, 128, 128, 128, 128, 128, 128, 128, 28, 128, 128, 238, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 238, 238, 38, 238, 126, 238, 238, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 238, 38, 238, 238, 129, 238, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 129, 29, 129, 129, 129, 129, 129, 129, 238, ass << self ttr_accessor :_re_scanner_trans_targs rivate :_re_scanner_trans_targs, :_re_scanner_trans_targs= d lf._re_scanner_trans_targs = [ 12, 113, 3, 114, 5, 6, 115, 112, , 112, 112, 8, 112, 10, 112, 12, 8, 112, 13, 15, 17, 14, 16, 19, 1, 23, 20, 22, 112, 25, 129, 26, 8, 0, 29, 30, 131, 132, 132, 31, 32, 132, 132, 132, 35, 36, 132, 38, 9, 50, 54, 58, 62, 66, 70, 75, 9, 81, 84, 40, 47, 41, 45, 42, 3, 44, 132, 46, 48, 49, 51, 52, 3, 55, 56, 57, 59, 60, 61, 63, 4, 65, 67, 68, 69, 71, 73, 72, 4, 76, 77, 78, 80, 82, 83, 86, 7, 132, 140, 140, 88, 91, 140, 146, 40, 148, 94, 140, 149, 140, 151, 97, 00, 98, 99, 140, 101, 102, 103, 104, 05, 106, 140, 153, 154, 154, 108, 109, 10, 111, 1, 2, 4, 116, 117, 118, 19, 120, 112, 121, 112, 124, 125, 112, 26, 112, 127, 112, 112, 128, 112, 112, 12, 112, 112, 112, 122, 112, 123, 112, , 112, 112, 112, 112, 112, 112, 112, 12, 112, 112, 11, 112, 24, 112, 112, 30, 27, 133, 134, 135, 132, 136, 137, 38, 132, 132, 132, 132, 32, 132, 132, 3, 132, 132, 132, 34, 37, 85, 139, 39, 141, 142, 143, 140, 144, 144, 140, 0, 140, 93, 140, 140, 96, 107, 140, 9, 140, 145, 140, 140, 140, 147, 140, 2, 140, 150, 152, 140, 95, 140, 140, 40, 154, 155, 156, 157, 158, 154 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, 2, 0, 0, 2, 3, , 5, 6, 0, 7, 0, 8, 0, , 9, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 10, 0, 0, 0, , 0, 0, 0, 12, 13, 14, 0, 5, 16, 17, 18, 0, 0, 19, 0, , 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, , 0, 20, 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, , 21, 22, 23, 0, 0, 25, 0, 6, 0, 0, 27, 0, 28, 0, 0, , 0, 0, 29, 0, 0, 0, 0, , 0, 30, 0, 31, 32, 0, 0, , 0, 0, 0, 0, 0, 0, 0, , 0, 35, 36, 37, 0, 0, 38, , 39, 40, 41, 42, 40, 43, 44, 5, 46, 47, 48, 49, 50, 0, 51, , 52, 53, 54, 55, 56, 57, 58, 9, 60, 61, 0, 62, 0, 63, 64, 6, 0, 0, 40, 40, 67, 0, 40, 8, 69, 70, 71, 72, 0, 73, 74, , 75, 76, 77, 0, 0, 0, 78, 9, 0, 40, 40, 80, 81, 82, 83, , 84, 0, 85, 86, 0, 0, 87, , 88, 0, 89, 90, 91, 40, 92, , 93, 40, 0, 94, 0, 95, 96, 7, 98, 40, 40, 40, 40, 99 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, 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, 3, 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, , 0, 65, 65, 65, 0, 0, 0, , 0, 0, 65, 65, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, , 0, 65, 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, 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, 4, 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 0, 0, 0, 0, , 0, 34, 34, 34, 0, 0, 0, , 0, 0, 34, 34, 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, 11, 11, 11, 11, 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, 24, 24, 0, 24, 24, 0, 4, 24, 24, 24, 24, 24, 24, 24, 4, 24, 24, 24, 0, 0, 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, 24, 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, 1, 1, 1, 8, , 8, 8, 15, 15, 15, 15, 15, 5, 15, 15, 15, 15, 15, 15, 15, 9, 29, 29, 0, 0, 0, 0, 38, 8, 41, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, 9, 99, 0, 0, 105, 0, 0, 110, , 0, 0, 0, 0, 0, 0, 0, , 0, 0, 0, 125, 125, 125, 125, , 152, 152, 152, 152, 153, 153, 152, 54, 156, 158, 158, 163, 165, 167, 169, 73, 175, 0, 0, 0, 189, 189, 189, 89, 192, 195, 0, 0, 216, 216, 216, 18, 220, 222, 222, 222, 226, 226, 226, 26, 231, 0, 239, 239, 239, 239 ass << self ttr_accessor :re_scanner_start d lf.re_scanner_start = 112; ass << self ttr_accessor :re_scanner_first_final d lf.re_scanner_first_final = 112; 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 = 130; ass << self ttr_accessor :re_scanner_en_unicode_property d lf.re_scanner_en_unicode_property = 131; ass << self ttr_accessor :re_scanner_en_character_set d lf.re_scanner_en_character_set = 132; ass << self ttr_accessor :re_scanner_en_set_escape_sequence d lf.re_scanner_en_set_escape_sequence = 139; ass << self ttr_accessor :re_scanner_en_escape_sequence d lf.re_scanner_en_escape_sequence = 140; ass << self ttr_accessor :re_scanner_en_conditional_expression d lf.re_scanner_en_conditional_expression = 154; ass << self ttr_accessor :re_scanner_en_main d lf.re_scanner_en_main = 112; line 768 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" line 1194 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" gin ||= 0 e ||= data.length s = re_scanner_start op = 0 s = nil e = nil ct = 0 d line 769 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" line 1207 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" 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 line 1 "NONE" begin = p end line 1235 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" 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 line 149 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.group_depth = group_depth + 1 end hen 4 then line 150 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.group_depth = group_depth - 1 end hen 40 then line 1 "NONE" begin = p+1 end hen 66 then line 12 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/char_type.rl" 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 12 then line 16 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/property.rl" begin = p+1 egin text = copy(data, ts-1, te) type = (text[1] == 'P') ^ (text[3] == '^') ? :nonproperty : :property name = data[ts+2..te-2].pack('c*').gsub(/[\^\s_\-]/, '').downcase token = self.class.short_prop_map[name] || self.class.long_prop_map[name] raise UnknownUnicodePropertyError.new(name) unless token self.emit(type, token.to_sym, text) begin top -= 1 cs = stack[top] _goto_level = _again next nd end end hen 16 then line 177 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin # special case, emits two tokens emit(:literal, :literal, '-') emit(:set, :intersection, '&&') end end hen 71 then line 182 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts, te) if tokens.last[1] == :open emit(:set, :negate, text) else emit(:literal, :literal, text) end end end hen 73 then line 203 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:set, :intersection, copy(data, ts, te)) end end hen 69 then line 207 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin begin stack[top] = cs top+= 1 cs = 139 _goto_level = _again next nd end end hen 67 then line 237 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:literal, :literal, copy(data, ts, te)) end end hen 14 then line 245 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts, te) emit(:literal, :literal, text) end end hen 74 then line 191 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin text = copy(data, ts, te) # ranges cant start with a subset or intersection/negation/range operator if tokens.last[0] == :set emit(:literal, :literal, text) else emit(:set, :range, text) end end end hen 77 then line 211 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin emit(:set, :open, copy(data, ts, te)) begin stack[top] = cs top+= 1 cs = 132 _goto_level = _again next nd end end hen 72 then line 245 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin text = copy(data, ts, te) emit(:literal, :literal, text) end end hen 15 then line 191 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin text = copy(data, ts, te) # ranges cant start with a subset or intersection/negation/range operator if tokens.last[0] == :set emit(:literal, :literal, text) else emit(:set, :range, text) end end end hen 18 then line 211 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin emit(:set, :open, copy(data, ts, te)) begin stack[top] = cs top+= 1 cs = 132 _goto_level = _again next nd end end hen 13 then line 245 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin text = copy(data, ts, te) emit(:literal, :literal, text) end end hen 79 then line 254 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 78 then line 259 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin p = p - 1; cs = 132; begin stack[top] = cs top+= 1 cs = 140 _goto_level = _again next nd end end hen 83 then line 270 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts-1, te) emit(:backref, :number, text) begin top -= 1 cs = stack[top] _goto_level = _again next nd end end hen 90 then line 276 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 80 then line 281 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 302 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 318 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts-1, te) if text[2].chr == '{' 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 97 then line 328 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 337 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 342 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 347 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin p = p - 1; cs = ((in_set? ? 132 : 112)); begin stack[top] = cs top+= 1 cs = 130 _goto_level = _again next nd end end hen 85 then line 353 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin p = p - 1; cs = ((in_set? ? 132 : 112)); begin stack[top] = cs top+= 1 cs = 131 _goto_level = _again next nd end end hen 23 then line 362 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 89 then line 276 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 96 then line 328 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 92 then line 337 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 94 then line 342 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 362 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 362 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 1 "NONE" begin ase act hen 18 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 19 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 line 372 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts, te-1) emit(:conditional, :condition, text) emit(:conditional, :condition_close, ')') end end hen 98 then line 378 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin p = p - 1; begin stack[top] = cs top+= 1 cs = 112 _goto_level = _again next nd end end hen 99 then line 378 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin p = p - 1; begin stack[top] = cs top+= 1 cs = 112 _goto_level = _again next nd end end hen 31 then line 378 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin p = p - 1; begin stack[top] = cs top+= 1 cs = 112 _goto_level = _again next nd end end hen 38 then line 391 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:meta, :dot, copy(data, ts, te)) end end hen 43 then line 395 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 405 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:anchor, :bol, copy(data, ts, te)) end end hen 35 then line 409 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:anchor, :eol, copy(data, ts, te)) end end hen 61 then line 413 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:keep, :mark, copy(data, ts, te)) end end hen 60 then line 417 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 428 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin append_literal(data, ts, te) end end hen 51 then line 443 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 = 154 _goto_level = _again next nd end end hen 52 then line 474 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts, te) if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/ raise InvalidGroupOption.new($1 || "-#{$2}", text) end emit_options(text) end end hen 7 then line 488 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 6 then line 505 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 /^\(\?(?:<>|'')/ validation_error(:group, 'named group', 'name is empty') when /^\(\?<\w*>/ emit(:group, :named_ab, text) when /^\(\?'\w*'/ emit(:group, :named_sq, text) end end end hen 9 then line 546 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin case text = copy(data, ts, te) when /^\\([gk])(<>|'')/ # angle brackets validation_error(:backref, 'ref/call', 'ref ID is empty') when /^\\([gk])<[^\d+-]\w*>/ # angle-brackets if $1 == 'k' emit(:backref, :name_ref_ab, text) else emit(:backref, :name_call_ab, text) end when /^\\([gk])'[^\d+-]\w*'/ #single quotes if $1 == 'k' emit(:backref, :name_ref_sq, text) else emit(:backref, :name_call_sq, text) end when /^\\([gk])<\d+>/ # angle-brackets if $1 == 'k' emit(:backref, :number_ref_ab, text) else emit(:backref, :number_call_ab, text) end when /^\\([gk])'\d+'/ # single quotes if $1 == 'k' emit(:backref, :number_ref_sq, text) else emit(:backref, :number_call_sq, text) end when /^\\(?:g<\+|g<-|(k)<-)\d+>/ # angle-brackets if $1 == 'k' emit(:backref, :number_rel_ref_ab, text) else emit(:backref, :number_rel_call_ab, text) end when /^\\(?:g'\+|g'-|(k)'-)\d+'/ # single quotes if $1 == 'k' emit(:backref, :number_rel_ref_sq, text) else emit(:backref, :number_rel_call_sq, text) end when /^\\k<[^\d+\-]\w*[+\-]\d+>/ # angle-brackets emit(:backref, :name_recursion_ref_ab, text) when /^\\k'[^\d+\-]\w*[+\-]\d+'/ # single-quotes emit(:backref, :name_recursion_ref_sq, text) when /^\\([gk])<[+\-]?\d+[+\-]\d+>/ # angle-brackets emit(:backref, :number_recursion_ref_ab, text) when /^\\([gk])'[+\-]?\d+[+\-]\d+'/ # single-quotes emit(:backref, :number_recursion_ref_sq, text) end end end hen 58 then line 611 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 54 then line 619 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 56 then line 627 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 64 then line 635 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:quantifier, :interval, copy(data, ts, te)) end end hen 47 then line 650 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 474 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin text = copy(data, ts, te) if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/ raise InvalidGroupOption.new($1 || "-#{$2}", text) end emit_options(text) end end hen 48 then line 523 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin text = copy(data, ts, te) emit(:group, :capture, text) end end hen 57 then line 611 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 53 then line 619 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 55 then line 627 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 635 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin emit(:quantifier, :interval, copy(data, ts, te)) end end hen 62 then line 640 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin append_literal(data, ts, te) end end hen 59 then line 646 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin begin stack[top] = cs top+= 1 cs = 140 _goto_level = _again next nd end end hen 46 then line 650 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 660 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 675 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin append_literal(data, ts, te) end end hen 3 then line 474 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin text = copy(data, ts, te) if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/ raise InvalidGroupOption.new($1 || "-#{$2}", text) end emit_options(text) end end hen 10 then line 640 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin append_literal(data, ts, te) end end hen 8 then line 646 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin begin stack[top] = cs top+= 1 cs = 140 _goto_level = _again next nd end end hen 1 then line 1 "NONE" begin ase act hen 0 then egin begin cs = 0 _goto_level = _again next nd d hen 56 then egin begin p = ((te))-1; end append_literal(data, ts, te) end d end hen 76 then line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 211 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p = p - 1; begin emit(:set, :open, copy(data, ts, te)) begin stack[top] = cs top+= 1 cs = 132 _goto_level = _again next nd end end hen 17 then line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 211 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin egin p = ((te))-1; end egin emit(:set, :open, copy(data, ts, te)) begin stack[top] = cs top+= 1 cs = 132 _goto_level = _again next nd end end hen 95 then line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 328 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 91 then line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 337 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 93 then line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 342 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 337 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 342 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 line 143 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) validation_error(:sequence, 'sequence', text) end line 333 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin begin top -= 1 cs = stack[top] _goto_level = _again next nd end end hen 5 then line 150 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.group_depth = group_depth - 1 end line 459 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:group, :comment, copy(data, ts, te)) end end hen 37 then line 150 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.group_depth = group_depth - 1 end line 528 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin if conditional_stack.last == group_depth + 1 conditional_stack.pop emit(:conditional, :close, copy(data, ts, te)) else 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, copy(data, ts, te)) end end end hen 39 then line 151 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth + 1 end line 434 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:set, :open, copy(data, ts, te)) begin stack[top] = cs top+= 1 cs = 132 _goto_level = _again next nd end end hen 70 then line 152 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth - 1 end line 158 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" 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 = 112 _goto_level = _again next nd end end end hen 75 then line 152 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth - 1 end line 167 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin # special case, emits two tokens emit(:literal, :literal, copy(data, ts, te-1)) emit(:set, :close, copy(data, ts+1, te)) if in_set? begin top -= 1 cs = stack[top] _goto_level = _again next nd else begin cs = 112 _goto_level = _again next nd end end end hen 20 then line 152 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth - 1 end line 216 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin text = copy(data, ts, te) type = :posixclass class_name = text[2..-3] if class_name[0].chr == '^' class_name = class_name[1..-1] type = :nonposixclass end emit(type, class_name.to_sym, text) end end hen 19 then line 152 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth - 1 end line 229 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:set, :collation, copy(data, ts, te)) end end hen 21 then line 152 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth - 1 end line 233 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin = p+1 egin emit(:set, :equivalent, copy(data, ts, te)) end end hen 68 then line 1 "NONE" begin = p+1 end line 151 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.set_depth = set_depth + 1 end hen 82 then line 1 "NONE" begin = p+1 end line 270 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin t = 18; end hen 81 then line 1 "NONE" begin = p+1 end line 276 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin t = 19; end hen 2 then line 1 "NONE" begin = p+1 end line 675 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin t = 56; end hen 49 then line 1 "NONE" begin = p+1 end line 150 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.group_depth = group_depth - 1 end line 149 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin elf.group_depth = group_depth + 1 end line 2667 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" nd nd nd f _goto_level <= _again ase _re_scanner_to_state_actions[cs] hen 65 then line 1 "NONE" begin = nil; end hen 33 then line 1 "NONE" begin = nil; end line 1 "NONE" begin t = 0 end line 2685 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" 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 11 then line 8 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/property.rl" begin raise PrematureEndError.new('unicode property') end hen 24 then line 137 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" begin text = copy(data, ts ? ts-1 : 0, -1) raise PrematureEndError.new( text ) end line 2719 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner.rb" end nd nd f _goto_level <= _out break nd d nd line 770 "/Users/jannoschmuller/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl" # 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 tokens end
def validation_error(type, what, reason)
Centralizes and unifies the handling of validation related
def validation_error(type, what, reason) case type when :group error = InvalidGroupError.new(what, reason) when :backref error = InvalidBackrefError.new(what, reason) when :sequence error = InvalidSequenceError.new(what, reason) end raise error # unless @@config.validation_ignore end