Skip to content

Instantly share code, notes, and snippets.

@jaynetics
Created December 25, 2020 20:24
Show Gist options
  • Save jaynetics/b667cabdce5af71f8e60683eef41ddde to your computer and use it in GitHub Desktop.
Save jaynetics/b667cabdce5af71f8e60683eef41ddde to your computer and use it in GitHub Desktop.
regexp_parser scanner.rb example (compiled from scanner.rl)
# -*- warn-indent:false; -*-
# line 1 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
# line 700 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
# THIS IS A GENERATED FILE, DO NOT EDIT DIRECTLY
# This file was generated from lib/regexp_parser/scanner/scanner.rl
class Regexp::Scanner
# General scanner error (catch all)
class ScannerError < StandardError; end
# Base for all scanner validation errors
class ValidationError < StandardError
def initialize(reason)
super reason
end
end
# Unexpected end of pattern
class PrematureEndError < ScannerError
def initialize(where = '')
super "Premature end of pattern at #{where}"
end
end
# Invalid sequence format. Used for escape sequences, mainly.
class InvalidSequenceError < ValidationError
def initialize(what = 'sequence', where = '')
super "Invalid #{what} at #{where}"
end
end
# Invalid group. Used for named groups.
class InvalidGroupError < ValidationError
def initialize(what, reason)
super "Invalid #{what}, #{reason}."
end
end
# Invalid groupOption. Used for inline options.
class InvalidGroupOption < ValidationError
def initialize(option, text)
super "Invalid group option #{option} in #{text}"
end
end
# Invalid back reference. Used for name a number refs/calls.
class InvalidBackrefError < ValidationError
def initialize(what, reason)
super "Invalid back reference #{what}, #{reason}"
end
end
# The property name was not recognized by the scanner.
class UnknownUnicodePropertyError < ValidationError
def initialize(name)
super "Unknown unicode character property name #{name}"
end
end
# Scans the given regular expression text, or Regexp object and collects the
# emitted token into an array that gets returned at the end. If a block is
# given, it gets called for each emitted token.
#
# This method may raise errors if a syntax error is encountered.
# --------------------------------------------------------------------------
def self.scan(input_object, options: nil, &block)
new.scan(input_object, options: options, &block)
end
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 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
class << self
attr_accessor :_re_scanner_trans_keys
private :_re_scanner_trans_keys, :_re_scanner_trans_keys=
end
self._re_scanner_trans_keys = [
0, 0, -128, -65, -128, -65,
-128, -65, 41, 41, 39,
57, 39, 39, 33, 62,
62, 62, 39, 60, 39, 57,
39, 39, 48, 57, 39,
57, 39, 57, 48, 57,
45, 62, 62, 62, 48, 57,
48, 62, 43, 62, 48,
57, 48, 57, 48, 125,
44, 125, 123, 123, 9, 122,
9, 125, 9, 122, -128,
-65, -128, -65, 38, 38,
45, 122, 45, 122, 93, 93,
94, 120, 97, 120, 108,
115, 110, 112, 117, 117,
109, 109, 58, 58, 93, 93,
104, 104, 97, 97, 99,
99, 105, 105, 105, 105,
108, 108, 97, 97, 110, 110,
107, 107, 110, 110, 116,
116, 114, 114, 108, 108,
105, 105, 103, 103, 105, 105,
116, 116, 114, 114, 97,
97, 112, 112, 104, 104,
111, 111, 119, 119, 101, 101,
114, 114, 114, 117, 105,
105, 110, 110, 110, 110,
99, 99, 112, 112, 97, 97,
99, 99, 101, 101, 112,
112, 112, 112, 111, 111,
114, 114, 100, 100, 100, 100,
65, 122, 61, 61, 93,
93, 93, 93, -128, -65,
-128, -65, 45, 45, 92, 92,
92, 92, 45, 45, 92,
92, 92, 92, 48, 123,
48, 102, 48, 102, 48, 102,
48, 102, 9, 125, 9,
125, 9, 125, 9, 125,
9, 125, 9, 125, 48, 123,
39, 39, 41, 41, 41,
57, 62, 62, -128, 127,
-62, -12, 1, 127, 1, 127,
9, 32, 33, 126, 10,
10, 63, 63, 33, 126,
33, 126, 62, 62, 43, 63,
43, 63, 43, 63, 65,
122, 44, 57, 43, 63,
68, 119, 80, 112, -62, 125,
-128, -65, -128, -65, -128,
-65, 38, 38, 38, 93,
46, 61, 45, 45, 45, 120,
-62, 125, -128, -65, -128,
-65, -128, -65, 48, 55,
48, 55, 77, 77, 45, 45,
0, 0, 67, 99, 45,
45, 0, 0, 92, 92,
48, 102, 39, 60, 39, 57,
49, 57, 41, 57, 45,
62, 0
]
class << self
attr_accessor :_re_scanner_key_spans
private :_re_scanner_key_spans, :_re_scanner_key_spans=
end
self._re_scanner_key_spans = [
0, 64, 64, 64, 1, 19, 1, 30,
1, 22, 19, 1, 10, 19, 19, 10,
18, 1, 10, 15, 20, 10, 10, 78,
82, 1, 114, 117, 114, 64, 64, 1,
78, 78, 1, 27, 24, 8, 3, 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, 4, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 58, 1, 1, 1, 64,
64, 1, 1, 1, 1, 1, 1, 76,
55, 55, 55, 55, 117, 117, 117, 117,
117, 117, 76, 1, 1, 17, 1, 256,
51, 127, 127, 24, 94, 1, 1, 94,
94, 1, 21, 21, 21, 58, 14, 21,
52, 33, 188, 64, 64, 64, 1, 56,
16, 1, 76, 188, 64, 64, 64, 8,
8, 1, 1, 0, 33, 1, 0, 1,
55, 22, 19, 9, 17, 18
]
class << self
attr_accessor :_re_scanner_index_offsets
private :_re_scanner_index_offsets, :_re_scanner_index_offsets=
end
self._re_scanner_index_offsets = [
0, 0, 65, 130, 195, 197, 217, 219,
250, 252, 275, 295, 297, 308, 328, 348,
359, 378, 380, 391, 407, 428, 439, 450,
529, 612, 614, 729, 847, 962, 1027, 1092,
1094, 1173, 1252, 1254, 1282, 1307, 1316, 1320,
1322, 1324, 1326, 1328, 1330, 1332, 1334, 1336,
1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352,
1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368,
1370, 1372, 1374, 1376, 1378, 1383, 1385, 1387,
1389, 1391, 1393, 1395, 1397, 1399, 1401, 1403,
1405, 1407, 1409, 1411, 1470, 1472, 1474, 1476,
1541, 1606, 1608, 1610, 1612, 1614, 1616, 1618,
1695, 1751, 1807, 1863, 1919, 2037, 2155, 2273,
2391, 2509, 2627, 2704, 2706, 2708, 2726, 2728,
2985, 3037, 3165, 3293, 3318, 3413, 3415, 3417,
3512, 3607, 3609, 3631, 3653, 3675, 3734, 3749,
3771, 3824, 3858, 4047, 4112, 4177, 4242, 4244,
4301, 4318, 4320, 4397, 4586, 4651, 4716, 4781,
4790, 4799, 4801, 4803, 4804, 4838, 4840, 4841,
4843, 4899, 4922, 4942, 4952, 4970
]
class << self
attr_accessor :_re_scanner_indicies
private :_re_scanner_indicies, :_re_scanner_indicies=
end
self._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,
1, 1, 1, 1, 1, 1, 1, 1,
0, 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, 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, 3, 3, 3, 3, 3, 3,
3, 3, 0, 6, 5, 8, 7, 7,
7, 7, 7, 4, 7, 7, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,
7, 8, 7, 10, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 4,
9, 9, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 9, 9, 9, 10,
8, 9, 8, 9, 12, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11,
11, 13, 11, 15, 14, 14, 14, 14,
14, 16, 14, 14, 11, 17, 17, 17,
17, 17, 17, 17, 17, 17, 14, 15,
14, 18, 17, 17, 17, 17, 17, 17,
17, 17, 17, 11, 15, 11, 11, 11,
11, 11, 11, 11, 11, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 11,
15, 11, 11, 11, 19, 11, 19, 11,
11, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 11, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 11, 21,
20, 20, 11, 22, 22, 22, 22, 22,
22, 22, 22, 22, 20, 20, 20, 20,
15, 20, 15, 20, 23, 22, 22, 22,
22, 22, 22, 22, 22, 22, 11, 23,
23, 23, 23, 23, 23, 23, 23, 23,
23, 11, 11, 11, 11, 15, 11, 24,
11, 24, 11, 11, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 11, 11,
11, 11, 15, 11, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 11, 26,
26, 26, 26, 26, 26, 26, 26, 26,
26, 25, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 27,
25, 26, 25, 25, 25, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 27, 25, 29, 30, 31, 31,
31, 31, 31, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 31, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 31, 31, 30, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 30,
30, 30, 31, 30, 30, 30, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
30, 30, 30, 32, 31, 30, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
30, 31, 31, 31, 31, 31, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
31, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 31, 31, 30,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 30, 30, 30, 31, 30, 30,
30, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 30, 30, 30, 30, 31,
30, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 30, 30, 33, 30, 31,
31, 31, 31, 31, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 31, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 31, 31, 30, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
30, 30, 30, 31, 30, 30, 30, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 30, 30, 30, 30, 31, 30, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31,
31, 30, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 34, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 34, 38, 37, 41, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 40, 40, 40, 40,
40, 40, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 40, 41, 42, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 40, 40, 40, 40, 40,
40, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 41, 41, 41, 41, 41,
41, 41, 41, 40, 43, 40, 44, 40,
40, 45, 46, 47, 48, 40, 40, 49,
40, 40, 40, 40, 50, 40, 40, 40,
51, 40, 40, 52, 40, 53, 40, 54,
55, 40, 45, 46, 47, 48, 40, 40,
49, 40, 40, 40, 40, 50, 40, 40,
40, 51, 40, 40, 52, 40, 53, 40,
54, 55, 40, 56, 40, 40, 40, 40,
40, 40, 57, 40, 58, 40, 59, 40,
60, 40, 61, 40, 62, 40, 63, 40,
64, 40, 61, 40, 65, 40, 66, 40,
61, 40, 67, 40, 68, 40, 69, 40,
61, 40, 70, 40, 71, 40, 72, 40,
61, 40, 73, 40, 74, 40, 75, 40,
61, 40, 76, 40, 77, 40, 78, 40,
61, 40, 79, 40, 80, 40, 81, 40,
61, 40, 82, 40, 40, 83, 40, 84,
40, 75, 40, 85, 40, 75, 40, 86,
40, 87, 40, 88, 40, 61, 40, 89,
40, 80, 40, 90, 40, 91, 40, 61,
40, 48, 40, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 40, 40, 40,
40, 40, 40, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 40, 93, 40,
94, 40, 96, 95, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 97, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 97, 100, 30,
102, 101, 104, 101, 105, 30, 107, 106,
109, 106, 110, 110, 110, 110, 110, 110,
110, 110, 110, 110, 30, 30, 30, 30,
30, 30, 30, 110, 110, 110, 110, 110,
110, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 110, 110, 110, 110, 110,
110, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 111, 30, 112,
112, 112, 112, 112, 112, 112, 112, 112,
112, 30, 30, 30, 30, 30, 30, 30,
112, 112, 112, 112, 112, 112, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
112, 112, 112, 112, 112, 112, 30, 113,
113, 113, 113, 113, 113, 113, 113, 113,
113, 30, 30, 30, 30, 30, 30, 30,
113, 113, 113, 113, 113, 113, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
113, 113, 113, 113, 113, 113, 30, 114,
114, 114, 114, 114, 114, 114, 114, 114,
114, 30, 30, 30, 30, 30, 30, 30,
114, 114, 114, 114, 114, 114, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
114, 114, 114, 114, 114, 114, 30, 115,
115, 115, 115, 115, 115, 115, 115, 115,
115, 30, 30, 30, 30, 30, 30, 30,
115, 115, 115, 115, 115, 115, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
115, 115, 115, 115, 115, 115, 30, 111,
111, 111, 111, 111, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 111, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 116, 116,
116, 116, 116, 116, 116, 116, 116, 116,
30, 30, 30, 30, 30, 30, 30, 116,
116, 116, 116, 116, 116, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 116,
116, 116, 116, 116, 116, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 114, 30, 111, 111, 111,
111, 111, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 111, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 117, 117, 117, 117,
117, 117, 117, 117, 117, 117, 30, 30,
30, 30, 30, 30, 30, 117, 117, 117,
117, 117, 117, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 117, 117, 117,
117, 117, 117, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 114, 30, 111, 111, 111, 111, 111,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 111, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 30, 30, 30, 30,
30, 30, 30, 118, 118, 118, 118, 118,
118, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 118, 118, 118, 118, 118,
118, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 114,
30, 111, 111, 111, 111, 111, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
111, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 30, 30, 30, 30, 30, 30,
30, 119, 119, 119, 119, 119, 119, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 119, 119, 119, 119, 119, 119, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 114, 30, 111,
111, 111, 111, 111, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 111, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 120, 120,
120, 120, 120, 120, 120, 120, 120, 120,
30, 30, 30, 30, 30, 30, 30, 120,
120, 120, 120, 120, 120, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 120,
120, 120, 120, 120, 120, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 114, 30, 111, 111, 111,
111, 111, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 111, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 114, 30, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 121, 121, 121,
121, 121, 121, 121, 122, 122, 122, 122,
122, 122, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 122, 122, 122, 122,
122, 122, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 30, 121,
125, 124, 126, 123, 126, 123, 123, 123,
123, 123, 123, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 123, 125, 128,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 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,
3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3,
129, 129, 129, 129, 129, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 130, 130, 130, 130, 130, 130, 130,
130, 131, 131, 131, 131, 131, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130,
132, 133, 133, 134, 135, 133, 133, 133,
136, 137, 138, 139, 133, 133, 140, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 141,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 142, 143, 144, 145, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 146, 147, 144, 133, 130,
133, 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, 3,
3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 129,
129, 129, 129, 129, 148, 130, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 130, 148, 130, 130, 130,
130, 130, 130, 130, 130, 131, 131, 131,
131, 131, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 132, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 130, 149, 132, 132, 132,
132, 132, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 149, 149, 149, 149,
149, 149, 149, 149, 132, 149, 133, 133,
148, 148, 133, 133, 133, 148, 148, 148,
148, 133, 133, 148, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 148, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
148, 148, 148, 148, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133,
148, 148, 148, 133, 148, 151, 134, 153,
152, 156, 155, 5, 155, 155, 155, 157,
158, 154, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 8, 155, 159, 156, 8, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 8, 155,
154, 155, 154, 155, 155, 155, 154, 154,
154, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 160, 155, 154, 154, 154, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 155, 155, 155,
155, 155, 155, 155, 155, 154, 155, 8,
9, 163, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 163, 162, 165,
164, 164, 164, 164, 164, 164, 164, 164,
164, 164, 164, 164, 164, 164, 164, 164,
164, 164, 164, 165, 164, 167, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166,
166, 167, 166, 169, 169, 168, 168, 168,
168, 169, 168, 168, 168, 170, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 169, 168, 168, 168,
168, 168, 168, 168, 169, 168, 168, 168,
168, 171, 168, 168, 168, 171, 168, 168,
168, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 169, 168, 173, 172,
172, 172, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 172, 175, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174,
174, 175, 174, 176, 30, 30, 30, 176,
30, 30, 30, 30, 30, 30, 30, 30,
30, 176, 176, 30, 30, 30, 176, 176,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 176, 30, 30, 30, 176,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 176, 30, 30, 30, 176, 30,
177, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30,
177, 30, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178,
179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179,
180, 180, 180, 180, 180, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 181, 35, 182, 35,
181, 181, 181, 181, 35, 183, 181, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 181,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 184, 185, 186, 187, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 181, 181, 181, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 188,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36,
188, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189,
189, 188, 190, 188, 192, 191, 191, 191,
191, 191, 191, 191, 191, 191, 191, 191,
191, 191, 191, 191, 191, 191, 191, 191,
191, 191, 191, 191, 191, 191, 191, 191,
191, 191, 191, 191, 191, 191, 191, 191,
191, 191, 191, 191, 191, 191, 191, 191,
191, 191, 191, 191, 191, 191, 191, 191,
191, 191, 191, 96, 191, 195, 194, 194,
194, 194, 194, 194, 194, 194, 194, 194,
194, 196, 194, 194, 197, 194, 199, 198,
201, 200, 200, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 200, 202, 202,
200, 200, 200, 202, 200, 200, 200, 200,
202, 200, 200, 202, 200, 200, 202, 200,
200, 200, 202, 200, 200, 200, 202, 202,
202, 203, 200, 200, 200, 202, 202, 202,
200, 200, 200, 202, 200, 200, 200, 200,
200, 200, 200, 202, 200, 200, 202, 200,
202, 200, 202, 202, 200, 204, 204, 204,
204, 204, 204, 204, 204, 204, 204, 204,
204, 204, 204, 204, 204, 204, 204, 204,
204, 204, 204, 204, 204, 204, 204, 204,
204, 204, 204, 205, 205, 205, 205, 205,
205, 205, 205, 205, 205, 205, 205, 205,
205, 205, 205, 206, 206, 206, 206, 206,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 207,
98, 98, 98, 207, 207, 207, 207, 98,
98, 207, 98, 208, 209, 209, 209, 209,
209, 209, 209, 210, 210, 98, 98, 98,
98, 98, 207, 98, 30, 30, 211, 212,
98, 98, 30, 212, 98, 98, 30, 98,
213, 98, 98, 214, 98, 212, 212, 98,
98, 98, 212, 212, 98, 30, 207, 207,
207, 207, 98, 98, 215, 215, 100, 212,
215, 215, 98, 212, 98, 98, 98, 98,
98, 215, 98, 214, 98, 215, 212, 215,
216, 215, 212, 217, 98, 30, 207, 207,
207, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 98, 98, 98, 98, 98, 98,
98, 98, 218, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 218, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 219, 219, 219, 219,
219, 219, 219, 219, 218, 221, 221, 221,
221, 221, 221, 221, 221, 220, 223, 223,
223, 223, 223, 223, 223, 223, 222, 225,
101, 227, 226, 101, 229, 106, 106, 106,
106, 106, 106, 106, 106, 106, 106, 106,
106, 106, 106, 106, 106, 106, 106, 106,
106, 106, 106, 106, 106, 106, 106, 106,
106, 106, 106, 106, 230, 106, 232, 231,
106, 109, 106, 234, 234, 234, 234, 234,
234, 234, 234, 234, 234, 233, 233, 233,
233, 233, 233, 233, 234, 234, 234, 234,
234, 234, 233, 233, 233, 233, 233, 233,
233, 233, 233, 233, 233, 233, 233, 233,
233, 233, 233, 233, 233, 233, 233, 233,
233, 233, 233, 233, 234, 234, 234, 234,
234, 234, 233, 236, 235, 235, 235, 235,
235, 237, 235, 235, 235, 238, 238, 238,
238, 238, 238, 238, 238, 238, 235, 235,
239, 235, 125, 124, 124, 124, 124, 124,
240, 124, 124, 240, 240, 240, 240, 240,
240, 240, 240, 240, 240, 124, 127, 127,
127, 127, 127, 127, 127, 127, 127, 240,
126, 240, 240, 240, 240, 240, 240, 127,
127, 127, 127, 127, 127, 127, 127, 127,
127, 240, 240, 128, 128, 240, 240, 240,
240, 240, 240, 240, 240, 240, 240, 128,
128, 128, 128, 125, 128, 0
]
class << self
attr_accessor :_re_scanner_trans_targs
private :_re_scanner_trans_targs, :_re_scanner_trans_targs=
end
self._re_scanner_trans_targs = [
111, 112, 1, 2, 111, 4, 111, 6,
111, 8, 121, 111, 10, 16, 11, 111,
12, 14, 13, 15, 17, 18, 20, 19,
21, 111, 23, 127, 24, 26, 0, 27,
28, 129, 130, 130, 29, 130, 130, 130,
130, 33, 34, 130, 36, 37, 48, 52,
56, 60, 64, 68, 73, 77, 79, 82,
38, 45, 39, 43, 40, 41, 42, 130,
44, 46, 47, 49, 50, 51, 53, 54,
55, 57, 58, 59, 61, 62, 63, 65,
66, 67, 69, 71, 70, 72, 74, 75,
76, 78, 80, 81, 84, 85, 130, 130,
130, 139, 139, 87, 90, 139, 145, 139,
147, 93, 139, 148, 139, 150, 96, 99,
97, 98, 139, 100, 101, 102, 103, 104,
105, 139, 152, 153, 107, 108, 153, 109,
110, 3, 113, 114, 115, 116, 117, 111,
118, 111, 122, 123, 111, 124, 111, 125,
111, 111, 126, 111, 111, 111, 111, 111,
111, 119, 111, 120, 111, 5, 111, 7,
111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 9, 111, 22, 111, 111,
128, 25, 131, 132, 133, 130, 134, 135,
136, 137, 130, 130, 130, 30, 130, 130,
31, 130, 130, 32, 35, 83, 130, 86,
138, 138, 138, 138, 140, 141, 142, 139,
143, 143, 139, 89, 139, 92, 139, 139,
95, 106, 139, 88, 139, 144, 139, 139,
139, 146, 139, 91, 139, 149, 151, 139,
94, 139, 139, 153, 154, 155, 156, 157,
153
]
class << self
attr_accessor :_re_scanner_trans_actions
private :_re_scanner_trans_actions, :_re_scanner_trans_actions=
end
self._re_scanner_trans_actions = [
1, 2, 0, 0, 3, 4, 5, 0,
6, 0, 7, 8, 0, 0, 0, 9,
0, 0, 0, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0, 0, 0,
0, 12, 13, 14, 0, 15, 16, 17,
18, 0, 0, 19, 0, 0, 0, 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, 0, 0, 0, 0, 21, 22,
23, 24, 25, 0, 0, 27, 0, 28,
0, 0, 29, 0, 30, 0, 0, 0,
0, 0, 31, 0, 0, 0, 0, 0,
0, 32, 0, 33, 0, 0, 34, 0,
0, 0, 0, 0, 0, 0, 0, 37,
38, 39, 0, 0, 40, 0, 41, 42,
43, 44, 42, 45, 46, 47, 48, 49,
50, 51, 52, 0, 53, 0, 54, 0,
55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 0, 66, 0, 67, 68,
70, 0, 0, 42, 42, 71, 0, 42,
72, 42, 73, 74, 75, 0, 76, 77,
0, 78, 79, 0, 0, 0, 80, 0,
81, 82, 83, 84, 0, 42, 42, 85,
86, 87, 88, 0, 89, 0, 90, 91,
0, 0, 92, 0, 93, 0, 94, 95,
96, 42, 97, 0, 98, 42, 0, 99,
0, 100, 101, 102, 42, 42, 42, 42,
103
]
class << self
attr_accessor :_re_scanner_to_state_actions
private :_re_scanner_to_state_actions, :_re_scanner_to_state_actions=
end
self._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, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 35,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
69, 69, 69, 0, 0, 0, 0, 0,
0, 0, 69, 69, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 69, 0, 0, 0, 0
]
class << self
attr_accessor :_re_scanner_from_state_actions
private :_re_scanner_from_state_actions, :_re_scanner_from_state_actions=
end
self._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, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 36,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
36, 36, 36, 0, 0, 0, 0, 0,
0, 0, 36, 36, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 36, 0, 0, 0, 0
]
class << self
attr_accessor :_re_scanner_eof_actions
private :_re_scanner_eof_actions, :_re_scanner_eof_actions=
end
self._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, 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,
0, 0, 0, 0, 0, 0, 0, 0,
0, 26, 26, 0, 26, 26, 0, 26,
26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 26, 0, 0, 0, 0, 0,
0, 0, 0, 26, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0
]
class << self
attr_accessor :_re_scanner_eof_trans
private :_re_scanner_eof_trans, :_re_scanner_eof_trans=
end
self._re_scanner_eof_trans = [
0, 1, 1, 1, 5, 5, 5, 5,
1, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 26, 26,
26, 0, 0, 0, 0, 35, 35, 38,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 96, 98,
98, 0, 0, 104, 0, 0, 109, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 124, 124, 124, 124, 0,
149, 149, 150, 150, 149, 151, 153, 155,
155, 162, 163, 165, 167, 169, 173, 175,
0, 0, 0, 189, 189, 189, 189, 192,
194, 199, 0, 0, 219, 219, 219, 221,
223, 225, 225, 225, 229, 229, 229, 229,
234, 0, 241, 241, 241, 241
]
class << self
attr_accessor :re_scanner_start
end
self.re_scanner_start = 111;
class << self
attr_accessor :re_scanner_first_final
end
self.re_scanner_first_final = 111;
class << self
attr_accessor :re_scanner_error
end
self.re_scanner_error = 0;
class << self
attr_accessor :re_scanner_en_char_type
end
self.re_scanner_en_char_type = 128;
class << self
attr_accessor :re_scanner_en_unicode_property
end
self.re_scanner_en_unicode_property = 129;
class << self
attr_accessor :re_scanner_en_character_set
end
self.re_scanner_en_character_set = 130;
class << self
attr_accessor :re_scanner_en_set_escape_sequence
end
self.re_scanner_en_set_escape_sequence = 138;
class << self
attr_accessor :re_scanner_en_escape_sequence
end
self.re_scanner_en_escape_sequence = 139;
class << self
attr_accessor :re_scanner_en_conditional_expression
end
self.re_scanner_en_conditional_expression = 153;
class << self
attr_accessor :re_scanner_en_main
end
self.re_scanner_en_main = 111;
# line 788 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
# line 1076 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
begin
p ||= 0
pe ||= data.length
cs = re_scanner_start
top = 0
ts = nil
te = nil
act = 0
end
# line 789 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
# line 1089 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
begin
testEof = false
_slen, _trans, _keys, _inds, _acts, _nacts = nil
_goto_level = 0
_resume = 10
_eof_trans = 15
_again = 20
_test_eof = 30
_out = 40
while true
if _goto_level <= 0
if p == pe
_goto_level = _test_eof
next
end
if cs == 0
_goto_level = _out
next
end
end
if _goto_level <= _resume
case _re_scanner_from_state_actions[cs]
when 36 then
# line 1 "NONE"
begin
ts = p
end
# line 1117 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
end
_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
end
if _goto_level <= _eof_trans
cs = _re_scanner_trans_targs[_trans]
if _re_scanner_trans_actions[_trans] != 0
case _re_scanner_trans_actions[_trans]
when 38 then
# line 154 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.group_depth = group_depth + 1 end
when 4 then
# line 155 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.group_depth = group_depth - 1 end
when 42 then
# line 1 "NONE"
begin
te = p+1
end
when 70 then
# line 12 "~/code/regexp_parser/lib/regexp_parser/scanner/char_type.rl"
begin
te = p+1
begin
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
end
end
end
when 12 then
# line 16 "~/code/regexp_parser/lib/regexp_parser/scanner/property.rl"
begin
te = p+1
begin
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
end
end
end
when 16 then
# line 184 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin # special case, emits two tokens
emit(:literal, :literal, '-')
emit(:set, :intersection, '&&')
end
end
when 74 then
# line 189 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
text = copy(data, ts, te)
if tokens.last[1] == :open
emit(:set, :negate, text)
else
emit(:literal, :literal, text)
end
end
end
when 76 then
# line 214 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:set, :intersection, copy(data, ts, te))
end
end
when 71 then
# line 248 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:literal, :literal, copy(data, ts, te))
end
end
when 14 then
# line 252 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
text = copy(data, ts, te)
emit(:literal, :literal, text)
end
end
when 77 then
# line 198 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
text = copy(data, ts, te)
# Ranges cant start with an intersection, negation, or range operator.
# The dash is treated as a literal in these cases.
# If a range starts or ends with a SUBSET, things get weird. The dash is
# discarded, and so is the other end of the range, unless it is also a
# subset. E.g. /[[a]-z]/ matches only a, /[[a]-[z]]/ matches only a and z.
if tokens.last[0] == :set && tokens.last[1] != :close
emit(:literal, :literal, text)
else
emit(:set, :range, text)
end
end
end
when 80 then
# line 218 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
begin
stack[top] = cs
top+= 1
cs = 138
_goto_level = _again
next
end
end
end
when 79 then
# line 222 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit(:set, :open, copy(data, ts, te))
begin
stack[top] = cs
top+= 1
cs = 130
_goto_level = _again
next
end
end
end
when 75 then
# line 252 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
text = copy(data, ts, te)
emit(:literal, :literal, text)
end
end
when 15 then
# line 198 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
text = copy(data, ts, te)
# Ranges cant start with an intersection, negation, or range operator.
# The dash is treated as a literal in these cases.
# If a range starts or ends with a SUBSET, things get weird. The dash is
# discarded, and so is the other end of the range, unless it is also a
# subset. E.g. /[[a]-z]/ matches only a, /[[a]-[z]]/ matches only a and z.
if tokens.last[0] == :set && tokens.last[1] != :close
emit(:literal, :literal, text)
else
emit(:set, :range, text)
end
end
end
when 22 then
# line 218 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
begin
stack[top] = cs
top+= 1
cs = 138
_goto_level = _again
next
end
end
end
when 18 then
# line 222 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
emit(:set, :open, copy(data, ts, te))
begin
stack[top] = cs
top+= 1
cs = 130
_goto_level = _again
next
end
end
end
when 13 then
# line 252 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
text = copy(data, ts, te)
emit(:literal, :literal, text)
end
end
when 82 then
# line 261 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
if tokens.last[1] == :open
emit(:escape, :literal, copy(data, ts-1, te))
else
emit(:escape, :set_range, copy(data, ts-1, te))
end
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 84 then
# line 270 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
if tokens.last[1] == :open
emit(:escape, :set_negate, copy(data, ts-1, te))
else
emit(:escape, :literal, copy(data, ts-1, te))
end
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 83 then
# line 279 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
p = p - 1;
cs = 130;
begin
stack[top] = cs
top+= 1
cs = 139
_goto_level = _again
next
end
end
end
when 81 then
# line 285 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:escape, :literal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 88 then
# line 295 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
text = copy(data, ts-1, te)
emit(:backref, :number, text)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 95 then
# line 301 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:escape, :octal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 85 then
# line 306 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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
end
end
end
when 91 then
# line 327 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
# \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
end
end
end
when 31 then
# line 343 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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
end
end
end
when 101 then
# line 353 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:escape, :hex, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 27 then
# line 362 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit_meta_control_sequence(data, ts, te, :control)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 29 then
# line 367 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit_meta_control_sequence(data, ts, te, :meta_sequence)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 89 then
# line 372 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
p = p - 1;
cs = ((in_set? ? 130 : 111));
begin
stack[top] = cs
top+= 1
cs = 128
_goto_level = _again
next
end
end
end
when 90 then
# line 378 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
p = p - 1;
cs = ((in_set? ? 130 : 111));
begin
stack[top] = cs
top+= 1
cs = 129
_goto_level = _again
next
end
end
end
when 25 then
# line 384 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:escape, :literal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 94 then
# line 301 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit(:escape, :octal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 100 then
# line 353 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit(:escape, :hex, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 97 then
# line 362 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit_meta_control_sequence(data, ts, te, :control)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 99 then
# line 367 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit_meta_control_sequence(data, ts, te, :meta_sequence)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 92 then
# line 384 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit(:escape, :literal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 24 then
# line 384 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
emit(:escape, :literal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 93 then
# line 1 "NONE"
begin
case act
when 20 then
begin 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
end
end
when 21 then
begin begin p = ((te))-1; end
emit(:escape, :octal, copy(data, ts-1, te))
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
end
when 34 then
# line 394 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
text = copy(data, ts, te-1)
emit(:conditional, :condition, text)
emit(:conditional, :condition_close, ')')
end
end
when 102 then
# line 400 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
p = p - 1;
begin
stack[top] = cs
top+= 1
cs = 111
_goto_level = _again
next
end
end
end
when 103 then
# line 400 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
p = p - 1;
begin
stack[top] = cs
top+= 1
cs = 111
_goto_level = _again
next
end
end
end
when 33 then
# line 400 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
p = p - 1;
begin
stack[top] = cs
top+= 1
cs = 111
_goto_level = _again
next
end
end
end
when 40 then
# line 413 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:meta, :dot, copy(data, ts, te))
end
end
when 45 then
# line 417 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
if conditional_stack.last == group_depth
emit(:conditional, :separator, copy(data, ts, te))
else
emit(:meta, :alternation, copy(data, ts, te))
end
end
end
when 44 then
# line 427 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:anchor, :bol, copy(data, ts, te))
end
end
when 37 then
# line 431 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:anchor, :eol, copy(data, ts, te))
end
end
when 65 then
# line 435 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:keep, :mark, copy(data, ts, te))
end
end
when 64 then
# line 439 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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
when 43 then
# line 450 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
append_literal(data, ts, te)
end
end
when 54 then
# line 465 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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 = 153
_goto_level = _again
next
end
end
end
when 55 then
# line 496 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = 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
when 53 then
# line 510 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = 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
when 6 then
# line 527 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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 /^\(\?<[^>]+>/
emit(:group, :named_ab, text)
when /^\(\?'[^']+'/
emit(:group, :named_sq, text)
end
end
end
when 9 then
# line 568 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
case text = copy(data, ts, te)
when /^\\([gk])(<>|'')/ # angle brackets
validation_error(:backref, 'ref/call', 'ref ID is empty')
# TODO: finer quirks of choosing recursive or non-recursive refs/calls.
# e.g.: `a-1` is a valid group id: 'aa'[/(?<a-1>a)\g<a-1>/] # => 'aa'
when /^\\([gk])<[^\p{digit}+\->][^>+\-]*>/ # angle-brackets
if $1 == 'k'
emit(:backref, :name_ref_ab, text)
else
emit(:backref, :name_call_ab, text)
end
when /^\\([gk])'[^\p{digit}+\-'][^'+\-]*'/ # 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<[^\p{digit}+\->][^>]*[+\-]\d+>/ # angle-brackets
emit(:backref, :name_recursion_ref_ab, text)
when /^\\k'[^\p{digit}+\-'][^']*[+\-]\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
when 62 then
# line 635 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = 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
when 58 then
# line 643 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = 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
when 60 then
# line 651 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = 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
when 68 then
# line 659 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:quantifier, :interval, copy(data, ts, te))
end
end
when 49 then
# line 674 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = 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
when 52 then
# line 496 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
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
when 56 then
# line 510 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
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
when 50 then
# line 545 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
text = copy(data, ts, te)
emit(:group, :capture, text)
end
end
when 61 then
# line 635 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
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
when 57 then
# line 643 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
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
when 59 then
# line 651 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
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
when 67 then
# line 659 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit(:quantifier, :interval, copy(data, ts, te))
end
end
when 66 then
# line 664 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
append_literal(data, ts, te)
end
end
when 63 then
# line 670 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
begin
stack[top] = cs
top+= 1
cs = 139
_goto_level = _again
next
end
end
end
when 48 then
# line 674 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
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
when 47 then
# line 684 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
if free_spacing
emit(:free_space, :whitespace, copy(data, ts, te))
else
append_literal(data, ts, te)
end
end
end
when 46 then
# line 695 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
append_literal(data, ts, te)
end
end
when 3 then
# line 496 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
text = copy(data, ts, te)
if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/
raise InvalidGroupOption.new($1 || "-#{$2}", text)
end
emit_options(text)
end
end
when 10 then
# line 664 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
append_literal(data, ts, te)
end
end
when 8 then
# line 670 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
begin
stack[top] = cs
top+= 1
cs = 139
_goto_level = _again
next
end
end
end
when 1 then
# line 1 "NONE"
begin
case act
when 0 then
begin begin
cs = 0
_goto_level = _again
next
end
end
when 44 then
begin begin p = ((te))-1; end
text = copy(data, ts, te)
if text[2..-1] =~ /([^\-mixdau:]|^$)|-.*([dau])/
raise InvalidGroupOption.new($1 || "-#{$2}", text)
end
emit_options(text)
end
when 45 then
begin 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
when 58 then
begin begin p = ((te))-1; end
append_literal(data, ts, te)
end
end
end
when 78 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 222 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit(:set, :open, copy(data, ts, te))
begin
stack[top] = cs
top+= 1
cs = 130
_goto_level = _again
next
end
end
end
when 17 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 222 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
emit(:set, :open, copy(data, ts, te))
begin
stack[top] = cs
top+= 1
cs = 130
_goto_level = _again
next
end
end
end
when 96 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 362 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit_meta_control_sequence(data, ts, te, :control)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 98 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 367 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p
p = p - 1; begin
emit_meta_control_sequence(data, ts, te, :meta_sequence)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 28 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 362 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
emit_meta_control_sequence(data, ts, te, :control)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 30 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 367 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
begin p = ((te))-1; end
begin
emit_meta_control_sequence(data, ts, te, :meta_sequence)
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 32 then
# line 148 "~/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 358 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
end
end
when 5 then
# line 155 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.group_depth = group_depth - 1 end
# line 481 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:group, :comment, copy(data, ts, te))
end
end
when 39 then
# line 155 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.group_depth = group_depth - 1 end
# line 550 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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
when 41 then
# line 156 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth + 1 end
# line 456 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:set, :open, copy(data, ts, te))
begin
stack[top] = cs
top+= 1
cs = 130
_goto_level = _again
next
end
end
end
when 73 then
# line 157 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth - 1 end
# line 163 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:set, :close, copy(data, ts, te))
if in_set?
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
else
begin
cs = 111
_goto_level = _again
next
end
end
end
end
when 23 then
# line 157 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth - 1 end
# line 172 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin # special case, emits two tokens
dash = copy(data, ts, te-1)
dash_type = dash == '\\-' ? :escape : :literal
emit(dash_type, :literal, dash)
emit(:set, :close, copy(data, te-1, te))
if in_set?
begin
top -= 1
cs = stack[top]
_goto_level = _again
next
end
else
begin
cs = 111
_goto_level = _again
next
end
end
end
end
when 20 then
# line 157 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth - 1 end
# line 227 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
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
when 19 then
# line 157 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth - 1 end
# line 240 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:set, :collation, copy(data, ts, te))
end
end
when 21 then
# line 157 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth - 1 end
# line 244 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
te = p+1
begin
emit(:set, :equivalent, copy(data, ts, te))
end
end
when 72 then
# line 1 "NONE"
begin
te = p+1
end
# line 156 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.set_depth = set_depth + 1 end
when 87 then
# line 1 "NONE"
begin
te = p+1
end
# line 295 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
act = 20; end
when 86 then
# line 1 "NONE"
begin
te = p+1
end
# line 301 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
act = 21; end
when 7 then
# line 1 "NONE"
begin
te = p+1
end
# line 510 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
act = 45; end
when 2 then
# line 1 "NONE"
begin
te = p+1
end
# line 695 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
act = 58; end
when 51 then
# line 1 "NONE"
begin
te = p+1
end
# line 155 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.group_depth = group_depth - 1 end
# line 154 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
self.group_depth = group_depth + 1 end
# line 496 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
act = 44; end
# line 2636 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
end
end
end
if _goto_level <= _again
case _re_scanner_to_state_actions[cs]
when 69 then
# line 1 "NONE"
begin
ts = nil; end
when 35 then
# line 1 "NONE"
begin
ts = nil; end
# line 1 "NONE"
begin
act = 0
end
# line 2654 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
end
if cs == 0
_goto_level = _out
next
end
p += 1
if p != pe
_goto_level = _resume
next
end
end
if _goto_level <= _test_eof
if p == eof
if _re_scanner_eof_trans[cs] > 0
_trans = _re_scanner_eof_trans[cs] - 1;
_goto_level = _eof_trans
next;
end
case _re_scanner_eof_actions[cs]
when 11 then
# line 8 "~/code/regexp_parser/lib/regexp_parser/scanner/property.rl"
begin
raise PrematureEndError.new('unicode property')
end
when 26 then
# line 142 "~/code/regexp_parser/lib/regexp_parser/scanner/scanner.rl"
begin
text = copy(data, ts ? ts-1 : 0, -1)
raise PrematureEndError.new( text )
end
# line 2688 "~/code/regexp_parser/lib/regexp_parser/scanner.rb"
end
end
end
if _goto_level <= _out
break
end
end
end
# line 790 "~/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
# lazy-load property maps when first needed
require 'yaml'
PROP_MAPS_DIR = File.expand_path('../scanner/properties', __FILE__)
def self.short_prop_map
@short_prop_map ||= YAML.load_file("#{PROP_MAPS_DIR}/short.yml")
end
def self.long_prop_map
@long_prop_map ||= YAML.load_file("#{PROP_MAPS_DIR}/long.yml")
end
# 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
# 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
private
attr_accessor :tokens, :literal, :block, :free_spacing, :spacing_stack,
:group_depth, :set_depth, :conditional_stack, :char_pos
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?
group_depth > 0
end
def in_set?
set_depth > 0
end
# Copy from ts to te from data as text
def copy(data, ts, te)
data[ts...te].pack('c*').force_encoding('utf-8')
end
# Appends one or more characters to the literal buffer, to be emitted later
# by a call to emit_literal.
def append_literal(data, ts, te)
self.literal = literal || []
literal << copy(data, ts, te)
end
# Emits the literal run collected by calls to the append_literal method.
def emit_literal
text = literal.join
self.literal = nil
emit(:literal, :literal, text)
end
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 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
# Centralizes and unifies the handling of validation related
# errors.
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
end # module Regexp::Scanner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment