rookout 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +12 -0
- data/bin/rookout +30 -0
- data/lib/rookout.rb +18 -0
- data/lib/rookout/augs/actions/action.rb +11 -0
- data/lib/rookout/augs/actions/action_run_processor.rb +29 -0
- data/lib/rookout/augs/aug.rb +121 -0
- data/lib/rookout/augs/aug_factory.rb +69 -0
- data/lib/rookout/augs/aug_rate_limiter.rb +96 -0
- data/lib/rookout/augs/augs_manager.rb +77 -0
- data/lib/rookout/augs/conditions/condition.rb +15 -0
- data/lib/rookout/augs/locations/location.rb +11 -0
- data/lib/rookout/augs/locations/location_file_line.rb +26 -0
- data/lib/rookout/com_ws/agent_com_ws.rb +221 -0
- data/lib/rookout/com_ws/backoff.rb +35 -0
- data/lib/rookout/com_ws/command_handler.rb +22 -0
- data/lib/rookout/com_ws/git.rb +53 -0
- data/lib/rookout/com_ws/information.rb +85 -0
- data/lib/rookout/com_ws/output.rb +135 -0
- data/lib/rookout/com_ws/token_bucket.rb +36 -0
- data/lib/rookout/config.rb +55 -0
- data/lib/rookout/exceptions.rb +140 -0
- data/lib/rookout/interface.rb +140 -0
- data/lib/rookout/logger.rb +158 -0
- data/lib/rookout/processor/namespace_serializer.rb +26 -0
- data/lib/rookout/processor/namespaces/container_namespace.rb +45 -0
- data/lib/rookout/processor/namespaces/frame_namespace.rb +65 -0
- data/lib/rookout/processor/namespaces/namespace.rb +28 -0
- data/lib/rookout/processor/namespaces/noop_namespace.rb +32 -0
- data/lib/rookout/processor/namespaces/ruby_object_namespace.rb +97 -0
- data/lib/rookout/processor/namespaces/ruby_object_serializer.rb +208 -0
- data/lib/rookout/processor/namespaces/ruby_utils_namespace.rb +65 -0
- data/lib/rookout/processor/namespaces/stack_namespace.rb +30 -0
- data/lib/rookout/processor/namespaces/traceback_namespace.rb +40 -0
- data/lib/rookout/processor/operations/operation.rb +11 -0
- data/lib/rookout/processor/operations/set_operation.rb +48 -0
- data/lib/rookout/processor/paths/arithmetic_path.rb +84 -0
- data/lib/rookout/processor/paths/canopy/actions.rb +184 -0
- data/lib/rookout/processor/paths/canopy/consts.rb +82 -0
- data/lib/rookout/processor/paths/canopy/maps.rb +2837 -0
- data/lib/rookout/processor/paths/canopy/markers.rb +186 -0
- data/lib/rookout/processor/paths/path.rb +15 -0
- data/lib/rookout/processor/processor.rb +34 -0
- data/lib/rookout/processor/processor_factory.rb +23 -0
- data/lib/rookout/processor/rook_error.rb +45 -0
- data/lib/rookout/protobuf/.gitignore +0 -0
- data/lib/rookout/protobuf/agent_info_pb.rb +68 -0
- data/lib/rookout/protobuf/controller_info_pb.rb +29 -0
- data/lib/rookout/protobuf/envelope_pb.rb +21 -0
- data/lib/rookout/protobuf/messages_pb.rb +189 -0
- data/lib/rookout/protobuf/variant_pb.rb +139 -0
- data/lib/rookout/rookout_singleton.rb +73 -0
- data/lib/rookout/services/position.rb +163 -0
- data/lib/rookout/services/tracer.rb +83 -0
- data/lib/rookout/trigger_services.rb +34 -0
- data/lib/rookout/user_warnings.rb +25 -0
- data/lib/rookout/version.rb +4 -0
- metadata +269 -0
@@ -0,0 +1,184 @@
|
|
1
|
+
module Rookout
|
2
|
+
module Processor
|
3
|
+
module Paths
|
4
|
+
module Canopy
|
5
|
+
require_relative "../../../exceptions"
|
6
|
+
|
7
|
+
require_relative "markers"
|
8
|
+
require_relative "consts"
|
9
|
+
|
10
|
+
class Actions
|
11
|
+
def initialize namespace
|
12
|
+
@namespace = namespace
|
13
|
+
@operations = []
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :operations
|
17
|
+
|
18
|
+
def make_lookup_operation input, start, finish, _elements
|
19
|
+
LookupOperation.new input[start + 1...finish - 1]
|
20
|
+
end
|
21
|
+
|
22
|
+
def make_function_operation _input, _start, _finish, elements
|
23
|
+
name = elements[0].text + elements[1].text
|
24
|
+
return elements[3] if elements[3].is_a? Exceptions::ToolException
|
25
|
+
|
26
|
+
args = elements[3].text
|
27
|
+
FunctionOperation.new name, args
|
28
|
+
end
|
29
|
+
|
30
|
+
def make_function_operation_access _input, _start, _finish, elements
|
31
|
+
# To build the function name, we will merge the unicode_set and all the unicode_set_with_numbers
|
32
|
+
# To build the args we will simply read the atom at index 4
|
33
|
+
# which can be result of another operation; thus checking for exception
|
34
|
+
# For further explanation, check ArithmeticPath.peg
|
35
|
+
|
36
|
+
return elements[4] if elements[4].is_a? ToolExceptionMarker
|
37
|
+
|
38
|
+
function_name = elements[1].text + elements[2].text
|
39
|
+
args = elements[4].text
|
40
|
+
FunctionOperation.new function_name, args
|
41
|
+
end
|
42
|
+
|
43
|
+
def make_attribute_operation input, start, finish, _elements
|
44
|
+
AttributeOperation.new input[start + 1...finish]
|
45
|
+
end
|
46
|
+
|
47
|
+
def make_attribute input, start, finish, _elements
|
48
|
+
AttributeOperation.new input[start...finish]
|
49
|
+
end
|
50
|
+
|
51
|
+
def make_and_execute_namespace_operation input, start, finish, elements
|
52
|
+
# Element 1 will not be null
|
53
|
+
# Element 2 is a list of another elements (can be empty)
|
54
|
+
# element1.(element2.element3.element4)
|
55
|
+
# For further explanation, check ArithmeticPath.peg
|
56
|
+
@operations = []
|
57
|
+
@operations.push elements[1]
|
58
|
+
|
59
|
+
elements[2].elements.each { |e| @operations.push e }
|
60
|
+
|
61
|
+
@operations.each do |op|
|
62
|
+
return op if op.is_a? ToolExceptionMarker
|
63
|
+
end
|
64
|
+
|
65
|
+
result = elements[1].read @namespace, false
|
66
|
+
elements[2].elements.each do |e|
|
67
|
+
result = e.read result, false
|
68
|
+
end
|
69
|
+
|
70
|
+
NamespaceResult.new result, input[start...finish]
|
71
|
+
rescue StandardError => e
|
72
|
+
ToolExceptionMarker.new e
|
73
|
+
end
|
74
|
+
|
75
|
+
def make_comp_exp_ex _input, _start, _finish, elements
|
76
|
+
# Element 2 is the actual expression
|
77
|
+
# For further explanation, check ArithmeticPath.peg
|
78
|
+
elements[2]
|
79
|
+
end
|
80
|
+
|
81
|
+
# rubocop:disable Metrics/AbcSize
|
82
|
+
def make_comp_exp _input, _start, _finish, elements
|
83
|
+
# We can assume the following: atom ( opt_ atom )*
|
84
|
+
# the first (which must be) will be simple atom
|
85
|
+
# the second and so forth will always be pair <Opt, Atom>
|
86
|
+
# Its important to remember that this execution will handle the inner brackets if exist
|
87
|
+
# In order to handle priority (which i could not figure out if available with canopy library):
|
88
|
+
# 1. lets make the tree flat
|
89
|
+
# 2. handle priority ourselves - (atom opt1 atom) will be handled before (atom opt2 atom)
|
90
|
+
# and will return TreeNode with result
|
91
|
+
# For further explanation, check ArithmeticPath.peg
|
92
|
+
|
93
|
+
# handle case the size is 1
|
94
|
+
return elements[0] if elements[1].elements.empty? || elements[0].is_a?(ToolExceptionMarker)
|
95
|
+
|
96
|
+
flat_elements = [elements[0]]
|
97
|
+
elements[1].elements.each do |it|
|
98
|
+
return it.elements[1] if it.elements[1].is_a? ToolExceptionMarker
|
99
|
+
|
100
|
+
flat_elements.push it.elements[0]
|
101
|
+
flat_elements.push it.elements[1]
|
102
|
+
end
|
103
|
+
|
104
|
+
until flat_elements.length == 1
|
105
|
+
restart_scan = false
|
106
|
+
|
107
|
+
ALL_LEVELS.each_with_index do |_, level|
|
108
|
+
flat_elements.each_with_index do |e, index|
|
109
|
+
if e.is_a?(Opt) && e.level == level
|
110
|
+
result = e.execute_operation flat_elements[index - 1], flat_elements[index + 1]
|
111
|
+
flat_elements = flat_elements[0...index - 1] + [result] + flat_elements[index + 2..-1]
|
112
|
+
restart_scan = true
|
113
|
+
break
|
114
|
+
end
|
115
|
+
|
116
|
+
break if restart_scan
|
117
|
+
end
|
118
|
+
|
119
|
+
break if restart_scan
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
flat_elements[0]
|
124
|
+
end
|
125
|
+
# rubocop:enable Metrics/AbcSize
|
126
|
+
|
127
|
+
def make_opt _input, _start, _finish, elements
|
128
|
+
Opt.new elements[1].text
|
129
|
+
end
|
130
|
+
|
131
|
+
def make_apostrophe_string _input, _start, _finish, elements
|
132
|
+
Text.new elements[2].text
|
133
|
+
end
|
134
|
+
|
135
|
+
def make_string _input, _start, _finish, elements
|
136
|
+
Text.new elements[2].text
|
137
|
+
end
|
138
|
+
|
139
|
+
def make_list input, start, finish, elements
|
140
|
+
list = []
|
141
|
+
items_to_scan = [elements[3]]
|
142
|
+
until items_to_scan.empty?
|
143
|
+
item = items_to_scan.pop
|
144
|
+
|
145
|
+
if item.is_a? Marker
|
146
|
+
list.push item
|
147
|
+
else
|
148
|
+
item.elements.each do |e|
|
149
|
+
items_to_scan.push e
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
List.new list, input[start...finish]
|
155
|
+
end
|
156
|
+
|
157
|
+
def make_float input, start, finish, _elements
|
158
|
+
FloatNumber.new input[start...finish].delete " "
|
159
|
+
end
|
160
|
+
|
161
|
+
def make_number input, start, finish, _elements
|
162
|
+
Number.new input[start...finish].delete " "
|
163
|
+
end
|
164
|
+
|
165
|
+
def make_char input, start, finish, _elements
|
166
|
+
Char.new input[start...finish].delete " "
|
167
|
+
end
|
168
|
+
|
169
|
+
def make_bool input, start, finish, _elements
|
170
|
+
Bool.new input[start...finish].delete " "
|
171
|
+
end
|
172
|
+
|
173
|
+
def make_null _input, _start, _finish, _elements
|
174
|
+
Nil.new
|
175
|
+
end
|
176
|
+
|
177
|
+
def make_undefined _input, _start, _finish, _elements
|
178
|
+
Nil.new
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Rookout
|
2
|
+
module Processor
|
3
|
+
module Paths
|
4
|
+
module Canopy
|
5
|
+
require "bigdecimal"
|
6
|
+
|
7
|
+
LEVEL1 = ["*", "/"].freeze
|
8
|
+
LEVEL2 = ["+", "-"].freeze
|
9
|
+
LEVEL3 = ["<=", ">=", "!=", "=", "==", ">", "<", "LT", "GT", "LE", "GE", "EQ", "NE", "lt", "gt", "le", "ge",
|
10
|
+
"eq", "ne"].freeze
|
11
|
+
LEVEL4 = ["in"].freeze
|
12
|
+
LEVEL5 = ["or", "OR", "||", "and", "AND", "&&"].freeze
|
13
|
+
|
14
|
+
ALL_LEVELS = [LEVEL1, LEVEL2, LEVEL3, LEVEL4, LEVEL5].freeze
|
15
|
+
|
16
|
+
PRIMITIVES = [Array, Hash, TrueClass, FalseClass, Symbol, Integer, Float, Complex, Rational, BigDecimal,
|
17
|
+
String].freeze
|
18
|
+
|
19
|
+
OPS_ALTERNATIVES = {
|
20
|
+
"NE" => "!=",
|
21
|
+
"=" => "==",
|
22
|
+
"EQ" => "==",
|
23
|
+
"LT" => "<",
|
24
|
+
"GT" => ">",
|
25
|
+
"GE" => ">=",
|
26
|
+
"LE" => "<=",
|
27
|
+
"AND" => "and",
|
28
|
+
"OR" => "or",
|
29
|
+
"&&" => "and",
|
30
|
+
"IN" => "in",
|
31
|
+
"||" => "or"
|
32
|
+
}.freeze
|
33
|
+
|
34
|
+
OPS_FUNCTIONS = {
|
35
|
+
"+" => ->(a, b) { a + b },
|
36
|
+
"-" => ->(a, b) { a - b },
|
37
|
+
"/" => ->(a, b) { a / b },
|
38
|
+
"*" => ->(a, b) { a * b },
|
39
|
+
"<" => ->(a, b) { a < b },
|
40
|
+
"<=" => ->(a, b) { a <= b },
|
41
|
+
">" => ->(a, b) { a > b },
|
42
|
+
">=" => ->(a, b) { a >= b },
|
43
|
+
"!=" => ->(a, b) { a != b },
|
44
|
+
"=" => ->(a, b) { a == b },
|
45
|
+
"==" => ->(a, b) { a == b },
|
46
|
+
"in" => lambda do |a, b|
|
47
|
+
# If both are strings, just call include
|
48
|
+
return b.include? a if b.is_a?(String) && a.is_a?(String)
|
49
|
+
|
50
|
+
# If it's a dict, scan the keys, compensating for additional abstraction
|
51
|
+
if b.is_a? Hash
|
52
|
+
b.each_key do |key|
|
53
|
+
if key.is_a? ObjectMarker
|
54
|
+
return true if key.obj == a
|
55
|
+
elsif key == a
|
56
|
+
return true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
return false
|
60
|
+
end
|
61
|
+
|
62
|
+
# If it's an array, scan the value, compensating for additional abstraction
|
63
|
+
if b.is_a? Array
|
64
|
+
b.each do |value|
|
65
|
+
if value.is_a? ObjectMarker
|
66
|
+
return true if value.obj == a
|
67
|
+
elsif value == a
|
68
|
+
return true
|
69
|
+
end
|
70
|
+
end
|
71
|
+
return false
|
72
|
+
end
|
73
|
+
|
74
|
+
false
|
75
|
+
end,
|
76
|
+
"and" => ->(a, b) { a && b },
|
77
|
+
"or" => ->(a, b) { a || b }
|
78
|
+
}.freeze
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,2837 @@
|
|
1
|
+
# This file was generated from ../rookout/canopy/ArithmeticPath.peg
|
2
|
+
# See http://canopy.jcoglan.com/ for documentation.
|
3
|
+
|
4
|
+
module Maps
|
5
|
+
class TreeNode
|
6
|
+
include Enumerable
|
7
|
+
attr_reader :text, :offset, :elements
|
8
|
+
|
9
|
+
def initialize(text, offset, elements)
|
10
|
+
@text = text
|
11
|
+
@offset = offset
|
12
|
+
@elements = elements
|
13
|
+
end
|
14
|
+
|
15
|
+
def each(&block)
|
16
|
+
@elements.each(&block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class TreeNode1 < TreeNode
|
21
|
+
attr_reader :atom
|
22
|
+
|
23
|
+
def initialize(text, offset, elements)
|
24
|
+
super
|
25
|
+
@atom = elements[0]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class TreeNode2 < TreeNode
|
30
|
+
attr_reader :opt_, :atom
|
31
|
+
|
32
|
+
def initialize(text, offset, elements)
|
33
|
+
super
|
34
|
+
@opt_ = elements[0]
|
35
|
+
@atom = elements[1]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class TreeNode3 < TreeNode
|
40
|
+
attr_reader :unicode_set
|
41
|
+
|
42
|
+
def initialize(text, offset, elements)
|
43
|
+
super
|
44
|
+
@unicode_set = elements[0]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class TreeNode4 < TreeNode
|
49
|
+
attr_reader :variable
|
50
|
+
|
51
|
+
def initialize(text, offset, elements)
|
52
|
+
super
|
53
|
+
@variable = elements[1]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class TreeNode5 < TreeNode
|
58
|
+
attr_reader :unicode_set
|
59
|
+
|
60
|
+
def initialize(text, offset, elements)
|
61
|
+
super
|
62
|
+
@unicode_set = elements[0]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class TreeNode6 < TreeNode
|
67
|
+
attr_reader :unicode_set
|
68
|
+
|
69
|
+
def initialize(text, offset, elements)
|
70
|
+
super
|
71
|
+
@unicode_set = elements[1]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class TreeNode7 < TreeNode
|
76
|
+
attr_reader :__
|
77
|
+
|
78
|
+
def initialize(text, offset, elements)
|
79
|
+
super
|
80
|
+
@__ = elements[3]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class TreeNode8 < TreeNode
|
85
|
+
attr_reader :__, :comp_expression
|
86
|
+
|
87
|
+
def initialize(text, offset, elements)
|
88
|
+
super
|
89
|
+
@__ = elements[4]
|
90
|
+
@comp_expression = elements[2]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
class TreeNode9 < TreeNode
|
95
|
+
attr_reader :__
|
96
|
+
|
97
|
+
def initialize(text, offset, elements)
|
98
|
+
super
|
99
|
+
@__ = elements[4]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class TreeNode10 < TreeNode
|
104
|
+
attr_reader :__
|
105
|
+
|
106
|
+
def initialize(text, offset, elements)
|
107
|
+
super
|
108
|
+
@__ = elements[4]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class TreeNode11 < TreeNode
|
113
|
+
attr_reader :__
|
114
|
+
|
115
|
+
def initialize(text, offset, elements)
|
116
|
+
super
|
117
|
+
@__ = elements[6]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class TreeNode12 < TreeNode
|
122
|
+
attr_reader :atom, :__
|
123
|
+
|
124
|
+
def initialize(text, offset, elements)
|
125
|
+
super
|
126
|
+
@atom = elements[0]
|
127
|
+
@__ = elements[1]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class TreeNode13 < TreeNode
|
132
|
+
attr_reader :__, :atom
|
133
|
+
|
134
|
+
def initialize(text, offset, elements)
|
135
|
+
super
|
136
|
+
@__ = elements[3]
|
137
|
+
@atom = elements[2]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
class TreeNode14 < TreeNode
|
142
|
+
attr_reader :__
|
143
|
+
|
144
|
+
def initialize(text, offset, elements)
|
145
|
+
super
|
146
|
+
@__ = elements[4]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
class TreeNode15 < TreeNode
|
151
|
+
attr_reader :__
|
152
|
+
|
153
|
+
def initialize(text, offset, elements)
|
154
|
+
super
|
155
|
+
@__ = elements[3]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
class TreeNode16 < TreeNode
|
160
|
+
attr_reader :__
|
161
|
+
|
162
|
+
def initialize(text, offset, elements)
|
163
|
+
super
|
164
|
+
@__ = elements[5]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
class TreeNode17 < TreeNode
|
169
|
+
attr_reader :__, :data
|
170
|
+
|
171
|
+
def initialize(text, offset, elements)
|
172
|
+
super
|
173
|
+
@__ = elements[2]
|
174
|
+
@data = elements[1]
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
class TreeNode18 < TreeNode
|
179
|
+
attr_reader :__, :data
|
180
|
+
|
181
|
+
def initialize(text, offset, elements)
|
182
|
+
super
|
183
|
+
@__ = elements[2]
|
184
|
+
@data = elements[1]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
class TreeNode19 < TreeNode
|
189
|
+
attr_reader :__, :data
|
190
|
+
|
191
|
+
def initialize(text, offset, elements)
|
192
|
+
super
|
193
|
+
@__ = elements[2]
|
194
|
+
@data = elements[1]
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
class TreeNode20 < TreeNode
|
199
|
+
attr_reader :__, :data
|
200
|
+
|
201
|
+
def initialize(text, offset, elements)
|
202
|
+
super
|
203
|
+
@__ = elements[2]
|
204
|
+
@data = elements[1]
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
ParseError = Class.new(StandardError)
|
209
|
+
|
210
|
+
FAILURE = Object.new
|
211
|
+
|
212
|
+
module Grammar
|
213
|
+
def _read_comp_expression
|
214
|
+
address0, index0 = FAILURE, @offset
|
215
|
+
cached = @cache[:comp_expression][index0]
|
216
|
+
if cached
|
217
|
+
@offset = cached[1]
|
218
|
+
return cached[0]
|
219
|
+
end
|
220
|
+
index1, elements0 = @offset, []
|
221
|
+
address1 = FAILURE
|
222
|
+
address1 = _read_atom
|
223
|
+
unless address1 == FAILURE
|
224
|
+
elements0 << address1
|
225
|
+
address2 = FAILURE
|
226
|
+
remaining0, index2, elements1, address3 = 0, @offset, [], true
|
227
|
+
until address3 == FAILURE
|
228
|
+
index3, elements2 = @offset, []
|
229
|
+
address4 = FAILURE
|
230
|
+
address4 = _read_opt_
|
231
|
+
unless address4 == FAILURE
|
232
|
+
elements2 << address4
|
233
|
+
address5 = FAILURE
|
234
|
+
address5 = _read_atom
|
235
|
+
unless address5 == FAILURE
|
236
|
+
elements2 << address5
|
237
|
+
else
|
238
|
+
elements2 = nil
|
239
|
+
@offset = index3
|
240
|
+
end
|
241
|
+
else
|
242
|
+
elements2 = nil
|
243
|
+
@offset = index3
|
244
|
+
end
|
245
|
+
if elements2.nil?
|
246
|
+
address3 = FAILURE
|
247
|
+
else
|
248
|
+
address3 = TreeNode2.new(@input[index3...@offset], index3, elements2)
|
249
|
+
@offset = @offset
|
250
|
+
end
|
251
|
+
unless address3 == FAILURE
|
252
|
+
elements1 << address3
|
253
|
+
remaining0 -= 1
|
254
|
+
end
|
255
|
+
end
|
256
|
+
if remaining0 <= 0
|
257
|
+
address2 = TreeNode.new(@input[index2...@offset], index2, elements1)
|
258
|
+
@offset = @offset
|
259
|
+
else
|
260
|
+
address2 = FAILURE
|
261
|
+
end
|
262
|
+
unless address2 == FAILURE
|
263
|
+
elements0 << address2
|
264
|
+
else
|
265
|
+
elements0 = nil
|
266
|
+
@offset = index1
|
267
|
+
end
|
268
|
+
else
|
269
|
+
elements0 = nil
|
270
|
+
@offset = index1
|
271
|
+
end
|
272
|
+
if elements0.nil?
|
273
|
+
address0 = FAILURE
|
274
|
+
else
|
275
|
+
address0 = @actions.make_comp_exp(@input, index1, @offset, elements0)
|
276
|
+
@offset = @offset
|
277
|
+
end
|
278
|
+
@cache[:comp_expression][index0] = [address0, @offset]
|
279
|
+
return address0
|
280
|
+
end
|
281
|
+
|
282
|
+
def _read_atom
|
283
|
+
address0, index0 = FAILURE, @offset
|
284
|
+
cached = @cache[:atom][index0]
|
285
|
+
if cached
|
286
|
+
@offset = cached[1]
|
287
|
+
return cached[0]
|
288
|
+
end
|
289
|
+
index1 = @offset
|
290
|
+
address0 = _read_float_
|
291
|
+
if address0 == FAILURE
|
292
|
+
@offset = index1
|
293
|
+
address0 = _read_number
|
294
|
+
if address0 == FAILURE
|
295
|
+
@offset = index1
|
296
|
+
address0 = _read_string
|
297
|
+
if address0 == FAILURE
|
298
|
+
@offset = index1
|
299
|
+
address0 = _read_apostrophe_string
|
300
|
+
if address0 == FAILURE
|
301
|
+
@offset = index1
|
302
|
+
address0 = _read_list
|
303
|
+
if address0 == FAILURE
|
304
|
+
@offset = index1
|
305
|
+
address0 = _read_chr
|
306
|
+
if address0 == FAILURE
|
307
|
+
@offset = index1
|
308
|
+
address0 = _read_boolean_
|
309
|
+
if address0 == FAILURE
|
310
|
+
@offset = index1
|
311
|
+
address0 = _read_null_
|
312
|
+
if address0 == FAILURE
|
313
|
+
@offset = index1
|
314
|
+
address0 = _read_undefined_
|
315
|
+
if address0 == FAILURE
|
316
|
+
@offset = index1
|
317
|
+
address0 = _read_comp_expression_ex
|
318
|
+
if address0 == FAILURE
|
319
|
+
@offset = index1
|
320
|
+
address0 = _read_namespace
|
321
|
+
if address0 == FAILURE
|
322
|
+
@offset = index1
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
@cache[:atom][index0] = [address0, @offset]
|
335
|
+
return address0
|
336
|
+
end
|
337
|
+
|
338
|
+
def _read_unicode_set
|
339
|
+
address0, index0 = FAILURE, @offset
|
340
|
+
cached = @cache[:unicode_set][index0]
|
341
|
+
if cached
|
342
|
+
@offset = cached[1]
|
343
|
+
return cached[0]
|
344
|
+
end
|
345
|
+
chunk0, max0 = nil, @offset + 1
|
346
|
+
if max0 <= @input_size
|
347
|
+
chunk0 = @input[@offset...max0]
|
348
|
+
end
|
349
|
+
if chunk0 =~ /\A[a-zA-Z_$@]/
|
350
|
+
address0 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
351
|
+
@offset = @offset + 1
|
352
|
+
else
|
353
|
+
address0 = FAILURE
|
354
|
+
if @offset > @failure
|
355
|
+
@failure = @offset
|
356
|
+
@expected = []
|
357
|
+
end
|
358
|
+
if @offset == @failure
|
359
|
+
@expected << "[a-zA-Z_$@]"
|
360
|
+
end
|
361
|
+
end
|
362
|
+
@cache[:unicode_set][index0] = [address0, @offset]
|
363
|
+
return address0
|
364
|
+
end
|
365
|
+
|
366
|
+
def _read_unicode_set_with_numbers
|
367
|
+
address0, index0 = FAILURE, @offset
|
368
|
+
cached = @cache[:unicode_set_with_numbers][index0]
|
369
|
+
if cached
|
370
|
+
@offset = cached[1]
|
371
|
+
return cached[0]
|
372
|
+
end
|
373
|
+
chunk0, max0 = nil, @offset + 1
|
374
|
+
if max0 <= @input_size
|
375
|
+
chunk0 = @input[@offset...max0]
|
376
|
+
end
|
377
|
+
if chunk0 =~ /\A[a-zA-Z0-9_$@]/
|
378
|
+
address0 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
379
|
+
@offset = @offset + 1
|
380
|
+
else
|
381
|
+
address0 = FAILURE
|
382
|
+
if @offset > @failure
|
383
|
+
@failure = @offset
|
384
|
+
@expected = []
|
385
|
+
end
|
386
|
+
if @offset == @failure
|
387
|
+
@expected << "[a-zA-Z0-9_$@]"
|
388
|
+
end
|
389
|
+
end
|
390
|
+
@cache[:unicode_set_with_numbers][index0] = [address0, @offset]
|
391
|
+
return address0
|
392
|
+
end
|
393
|
+
|
394
|
+
def _read_variable
|
395
|
+
address0, index0 = FAILURE, @offset
|
396
|
+
cached = @cache[:variable][index0]
|
397
|
+
if cached
|
398
|
+
@offset = cached[1]
|
399
|
+
return cached[0]
|
400
|
+
end
|
401
|
+
index1, elements0 = @offset, []
|
402
|
+
address1 = FAILURE
|
403
|
+
address1 = _read_unicode_set
|
404
|
+
unless address1 == FAILURE
|
405
|
+
elements0 << address1
|
406
|
+
address2 = FAILURE
|
407
|
+
remaining0, index2, elements1, address3 = 0, @offset, [], true
|
408
|
+
until address3 == FAILURE
|
409
|
+
address3 = _read_unicode_set_with_numbers
|
410
|
+
unless address3 == FAILURE
|
411
|
+
elements1 << address3
|
412
|
+
remaining0 -= 1
|
413
|
+
end
|
414
|
+
end
|
415
|
+
if remaining0 <= 0
|
416
|
+
address2 = TreeNode.new(@input[index2...@offset], index2, elements1)
|
417
|
+
@offset = @offset
|
418
|
+
else
|
419
|
+
address2 = FAILURE
|
420
|
+
end
|
421
|
+
unless address2 == FAILURE
|
422
|
+
elements0 << address2
|
423
|
+
else
|
424
|
+
elements0 = nil
|
425
|
+
@offset = index1
|
426
|
+
end
|
427
|
+
else
|
428
|
+
elements0 = nil
|
429
|
+
@offset = index1
|
430
|
+
end
|
431
|
+
if elements0.nil?
|
432
|
+
address0 = FAILURE
|
433
|
+
else
|
434
|
+
address0 = @actions.make_attribute(@input, index1, @offset, elements0)
|
435
|
+
@offset = @offset
|
436
|
+
end
|
437
|
+
@cache[:variable][index0] = [address0, @offset]
|
438
|
+
return address0
|
439
|
+
end
|
440
|
+
|
441
|
+
def _read_variable_access
|
442
|
+
address0, index0 = FAILURE, @offset
|
443
|
+
cached = @cache[:variable_access][index0]
|
444
|
+
if cached
|
445
|
+
@offset = cached[1]
|
446
|
+
return cached[0]
|
447
|
+
end
|
448
|
+
index1, elements0 = @offset, []
|
449
|
+
address1 = FAILURE
|
450
|
+
chunk0, max0 = nil, @offset + 1
|
451
|
+
if max0 <= @input_size
|
452
|
+
chunk0 = @input[@offset...max0]
|
453
|
+
end
|
454
|
+
if chunk0 == "."
|
455
|
+
address1 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
456
|
+
@offset = @offset + 1
|
457
|
+
else
|
458
|
+
address1 = FAILURE
|
459
|
+
if @offset > @failure
|
460
|
+
@failure = @offset
|
461
|
+
@expected = []
|
462
|
+
end
|
463
|
+
if @offset == @failure
|
464
|
+
@expected << "\".\""
|
465
|
+
end
|
466
|
+
end
|
467
|
+
unless address1 == FAILURE
|
468
|
+
elements0 << address1
|
469
|
+
address2 = FAILURE
|
470
|
+
address2 = _read_variable
|
471
|
+
unless address2 == FAILURE
|
472
|
+
elements0 << address2
|
473
|
+
else
|
474
|
+
elements0 = nil
|
475
|
+
@offset = index1
|
476
|
+
end
|
477
|
+
else
|
478
|
+
elements0 = nil
|
479
|
+
@offset = index1
|
480
|
+
end
|
481
|
+
if elements0.nil?
|
482
|
+
address0 = FAILURE
|
483
|
+
else
|
484
|
+
address0 = @actions.make_attribute_operation(@input, index1, @offset, elements0)
|
485
|
+
@offset = @offset
|
486
|
+
end
|
487
|
+
@cache[:variable_access][index0] = [address0, @offset]
|
488
|
+
return address0
|
489
|
+
end
|
490
|
+
|
491
|
+
def _read_map_access
|
492
|
+
address0, index0 = FAILURE, @offset
|
493
|
+
cached = @cache[:map_access][index0]
|
494
|
+
if cached
|
495
|
+
@offset = cached[1]
|
496
|
+
return cached[0]
|
497
|
+
end
|
498
|
+
index1, elements0 = @offset, []
|
499
|
+
address1 = FAILURE
|
500
|
+
chunk0, max0 = nil, @offset + 1
|
501
|
+
if max0 <= @input_size
|
502
|
+
chunk0 = @input[@offset...max0]
|
503
|
+
end
|
504
|
+
if chunk0 == "["
|
505
|
+
address1 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
506
|
+
@offset = @offset + 1
|
507
|
+
else
|
508
|
+
address1 = FAILURE
|
509
|
+
if @offset > @failure
|
510
|
+
@failure = @offset
|
511
|
+
@expected = []
|
512
|
+
end
|
513
|
+
if @offset == @failure
|
514
|
+
@expected << "\"[\""
|
515
|
+
end
|
516
|
+
end
|
517
|
+
unless address1 == FAILURE
|
518
|
+
elements0 << address1
|
519
|
+
address2 = FAILURE
|
520
|
+
index2 = @offset
|
521
|
+
address2 = _read_chr
|
522
|
+
if address2 == FAILURE
|
523
|
+
@offset = index2
|
524
|
+
address2 = _read_string
|
525
|
+
if address2 == FAILURE
|
526
|
+
@offset = index2
|
527
|
+
address2 = _read_apostrophe_string
|
528
|
+
if address2 == FAILURE
|
529
|
+
@offset = index2
|
530
|
+
address2 = _read_number
|
531
|
+
if address2 == FAILURE
|
532
|
+
@offset = index2
|
533
|
+
end
|
534
|
+
end
|
535
|
+
end
|
536
|
+
end
|
537
|
+
unless address2 == FAILURE
|
538
|
+
elements0 << address2
|
539
|
+
address3 = FAILURE
|
540
|
+
chunk1, max1 = nil, @offset + 1
|
541
|
+
if max1 <= @input_size
|
542
|
+
chunk1 = @input[@offset...max1]
|
543
|
+
end
|
544
|
+
if chunk1 == "]"
|
545
|
+
address3 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
546
|
+
@offset = @offset + 1
|
547
|
+
else
|
548
|
+
address3 = FAILURE
|
549
|
+
if @offset > @failure
|
550
|
+
@failure = @offset
|
551
|
+
@expected = []
|
552
|
+
end
|
553
|
+
if @offset == @failure
|
554
|
+
@expected << "\"]\""
|
555
|
+
end
|
556
|
+
end
|
557
|
+
unless address3 == FAILURE
|
558
|
+
elements0 << address3
|
559
|
+
else
|
560
|
+
elements0 = nil
|
561
|
+
@offset = index1
|
562
|
+
end
|
563
|
+
else
|
564
|
+
elements0 = nil
|
565
|
+
@offset = index1
|
566
|
+
end
|
567
|
+
else
|
568
|
+
elements0 = nil
|
569
|
+
@offset = index1
|
570
|
+
end
|
571
|
+
if elements0.nil?
|
572
|
+
address0 = FAILURE
|
573
|
+
else
|
574
|
+
address0 = @actions.make_lookup_operation(@input, index1, @offset, elements0)
|
575
|
+
@offset = @offset
|
576
|
+
end
|
577
|
+
@cache[:map_access][index0] = [address0, @offset]
|
578
|
+
return address0
|
579
|
+
end
|
580
|
+
|
581
|
+
def _read_func_call
|
582
|
+
address0, index0 = FAILURE, @offset
|
583
|
+
cached = @cache[:func_call][index0]
|
584
|
+
if cached
|
585
|
+
@offset = cached[1]
|
586
|
+
return cached[0]
|
587
|
+
end
|
588
|
+
index1, elements0 = @offset, []
|
589
|
+
address1 = FAILURE
|
590
|
+
address1 = _read_unicode_set
|
591
|
+
unless address1 == FAILURE
|
592
|
+
elements0 << address1
|
593
|
+
address2 = FAILURE
|
594
|
+
remaining0, index2, elements1, address3 = 0, @offset, [], true
|
595
|
+
until address3 == FAILURE
|
596
|
+
address3 = _read_unicode_set_with_numbers
|
597
|
+
unless address3 == FAILURE
|
598
|
+
elements1 << address3
|
599
|
+
remaining0 -= 1
|
600
|
+
end
|
601
|
+
end
|
602
|
+
if remaining0 <= 0
|
603
|
+
address2 = TreeNode.new(@input[index2...@offset], index2, elements1)
|
604
|
+
@offset = @offset
|
605
|
+
else
|
606
|
+
address2 = FAILURE
|
607
|
+
end
|
608
|
+
unless address2 == FAILURE
|
609
|
+
elements0 << address2
|
610
|
+
address4 = FAILURE
|
611
|
+
chunk0, max0 = nil, @offset + 1
|
612
|
+
if max0 <= @input_size
|
613
|
+
chunk0 = @input[@offset...max0]
|
614
|
+
end
|
615
|
+
if chunk0 == "("
|
616
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
617
|
+
@offset = @offset + 1
|
618
|
+
else
|
619
|
+
address4 = FAILURE
|
620
|
+
if @offset > @failure
|
621
|
+
@failure = @offset
|
622
|
+
@expected = []
|
623
|
+
end
|
624
|
+
if @offset == @failure
|
625
|
+
@expected << "\"(\""
|
626
|
+
end
|
627
|
+
end
|
628
|
+
unless address4 == FAILURE
|
629
|
+
elements0 << address4
|
630
|
+
address5 = FAILURE
|
631
|
+
index3 = @offset
|
632
|
+
address5 = _read_atom
|
633
|
+
if address5 == FAILURE
|
634
|
+
address5 = TreeNode.new(@input[index3...index3], index3, [])
|
635
|
+
@offset = index3
|
636
|
+
end
|
637
|
+
unless address5 == FAILURE
|
638
|
+
elements0 << address5
|
639
|
+
address6 = FAILURE
|
640
|
+
chunk1, max1 = nil, @offset + 1
|
641
|
+
if max1 <= @input_size
|
642
|
+
chunk1 = @input[@offset...max1]
|
643
|
+
end
|
644
|
+
if chunk1 == ")"
|
645
|
+
address6 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
646
|
+
@offset = @offset + 1
|
647
|
+
else
|
648
|
+
address6 = FAILURE
|
649
|
+
if @offset > @failure
|
650
|
+
@failure = @offset
|
651
|
+
@expected = []
|
652
|
+
end
|
653
|
+
if @offset == @failure
|
654
|
+
@expected << "\")\""
|
655
|
+
end
|
656
|
+
end
|
657
|
+
unless address6 == FAILURE
|
658
|
+
elements0 << address6
|
659
|
+
else
|
660
|
+
elements0 = nil
|
661
|
+
@offset = index1
|
662
|
+
end
|
663
|
+
else
|
664
|
+
elements0 = nil
|
665
|
+
@offset = index1
|
666
|
+
end
|
667
|
+
else
|
668
|
+
elements0 = nil
|
669
|
+
@offset = index1
|
670
|
+
end
|
671
|
+
else
|
672
|
+
elements0 = nil
|
673
|
+
@offset = index1
|
674
|
+
end
|
675
|
+
else
|
676
|
+
elements0 = nil
|
677
|
+
@offset = index1
|
678
|
+
end
|
679
|
+
if elements0.nil?
|
680
|
+
address0 = FAILURE
|
681
|
+
else
|
682
|
+
address0 = @actions.make_function_operation(@input, index1, @offset, elements0)
|
683
|
+
@offset = @offset
|
684
|
+
end
|
685
|
+
@cache[:func_call][index0] = [address0, @offset]
|
686
|
+
return address0
|
687
|
+
end
|
688
|
+
|
689
|
+
def _read_func_call_access
|
690
|
+
address0, index0 = FAILURE, @offset
|
691
|
+
cached = @cache[:func_call_access][index0]
|
692
|
+
if cached
|
693
|
+
@offset = cached[1]
|
694
|
+
return cached[0]
|
695
|
+
end
|
696
|
+
index1, elements0 = @offset, []
|
697
|
+
address1 = FAILURE
|
698
|
+
chunk0, max0 = nil, @offset + 1
|
699
|
+
if max0 <= @input_size
|
700
|
+
chunk0 = @input[@offset...max0]
|
701
|
+
end
|
702
|
+
if chunk0 == "."
|
703
|
+
address1 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
704
|
+
@offset = @offset + 1
|
705
|
+
else
|
706
|
+
address1 = FAILURE
|
707
|
+
if @offset > @failure
|
708
|
+
@failure = @offset
|
709
|
+
@expected = []
|
710
|
+
end
|
711
|
+
if @offset == @failure
|
712
|
+
@expected << "\".\""
|
713
|
+
end
|
714
|
+
end
|
715
|
+
unless address1 == FAILURE
|
716
|
+
elements0 << address1
|
717
|
+
address2 = FAILURE
|
718
|
+
address2 = _read_unicode_set
|
719
|
+
unless address2 == FAILURE
|
720
|
+
elements0 << address2
|
721
|
+
address3 = FAILURE
|
722
|
+
remaining0, index2, elements1, address4 = 0, @offset, [], true
|
723
|
+
until address4 == FAILURE
|
724
|
+
address4 = _read_unicode_set_with_numbers
|
725
|
+
unless address4 == FAILURE
|
726
|
+
elements1 << address4
|
727
|
+
remaining0 -= 1
|
728
|
+
end
|
729
|
+
end
|
730
|
+
if remaining0 <= 0
|
731
|
+
address3 = TreeNode.new(@input[index2...@offset], index2, elements1)
|
732
|
+
@offset = @offset
|
733
|
+
else
|
734
|
+
address3 = FAILURE
|
735
|
+
end
|
736
|
+
unless address3 == FAILURE
|
737
|
+
elements0 << address3
|
738
|
+
address5 = FAILURE
|
739
|
+
chunk1, max1 = nil, @offset + 1
|
740
|
+
if max1 <= @input_size
|
741
|
+
chunk1 = @input[@offset...max1]
|
742
|
+
end
|
743
|
+
if chunk1 == "("
|
744
|
+
address5 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
745
|
+
@offset = @offset + 1
|
746
|
+
else
|
747
|
+
address5 = FAILURE
|
748
|
+
if @offset > @failure
|
749
|
+
@failure = @offset
|
750
|
+
@expected = []
|
751
|
+
end
|
752
|
+
if @offset == @failure
|
753
|
+
@expected << "\"(\""
|
754
|
+
end
|
755
|
+
end
|
756
|
+
unless address5 == FAILURE
|
757
|
+
elements0 << address5
|
758
|
+
address6 = FAILURE
|
759
|
+
index3 = @offset
|
760
|
+
address6 = _read_atom
|
761
|
+
if address6 == FAILURE
|
762
|
+
address6 = TreeNode.new(@input[index3...index3], index3, [])
|
763
|
+
@offset = index3
|
764
|
+
end
|
765
|
+
unless address6 == FAILURE
|
766
|
+
elements0 << address6
|
767
|
+
address7 = FAILURE
|
768
|
+
chunk2, max2 = nil, @offset + 1
|
769
|
+
if max2 <= @input_size
|
770
|
+
chunk2 = @input[@offset...max2]
|
771
|
+
end
|
772
|
+
if chunk2 == ")"
|
773
|
+
address7 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
774
|
+
@offset = @offset + 1
|
775
|
+
else
|
776
|
+
address7 = FAILURE
|
777
|
+
if @offset > @failure
|
778
|
+
@failure = @offset
|
779
|
+
@expected = []
|
780
|
+
end
|
781
|
+
if @offset == @failure
|
782
|
+
@expected << "\")\""
|
783
|
+
end
|
784
|
+
end
|
785
|
+
unless address7 == FAILURE
|
786
|
+
elements0 << address7
|
787
|
+
else
|
788
|
+
elements0 = nil
|
789
|
+
@offset = index1
|
790
|
+
end
|
791
|
+
else
|
792
|
+
elements0 = nil
|
793
|
+
@offset = index1
|
794
|
+
end
|
795
|
+
else
|
796
|
+
elements0 = nil
|
797
|
+
@offset = index1
|
798
|
+
end
|
799
|
+
else
|
800
|
+
elements0 = nil
|
801
|
+
@offset = index1
|
802
|
+
end
|
803
|
+
else
|
804
|
+
elements0 = nil
|
805
|
+
@offset = index1
|
806
|
+
end
|
807
|
+
else
|
808
|
+
elements0 = nil
|
809
|
+
@offset = index1
|
810
|
+
end
|
811
|
+
if elements0.nil?
|
812
|
+
address0 = FAILURE
|
813
|
+
else
|
814
|
+
address0 = @actions.make_function_operation_access(@input, index1, @offset, elements0)
|
815
|
+
@offset = @offset
|
816
|
+
end
|
817
|
+
@cache[:func_call_access][index0] = [address0, @offset]
|
818
|
+
return address0
|
819
|
+
end
|
820
|
+
|
821
|
+
def _read_namespace
|
822
|
+
address0, index0 = FAILURE, @offset
|
823
|
+
cached = @cache[:namespace][index0]
|
824
|
+
if cached
|
825
|
+
@offset = cached[1]
|
826
|
+
return cached[0]
|
827
|
+
end
|
828
|
+
index1, elements0 = @offset, []
|
829
|
+
address1 = FAILURE
|
830
|
+
address1 = _read___
|
831
|
+
unless address1 == FAILURE
|
832
|
+
elements0 << address1
|
833
|
+
address2 = FAILURE
|
834
|
+
index2 = @offset
|
835
|
+
address2 = _read_func_call
|
836
|
+
if address2 == FAILURE
|
837
|
+
@offset = index2
|
838
|
+
address2 = _read_variable
|
839
|
+
if address2 == FAILURE
|
840
|
+
@offset = index2
|
841
|
+
end
|
842
|
+
end
|
843
|
+
unless address2 == FAILURE
|
844
|
+
elements0 << address2
|
845
|
+
address3 = FAILURE
|
846
|
+
remaining0, index3, elements1, address4 = 0, @offset, [], true
|
847
|
+
until address4 == FAILURE
|
848
|
+
index4 = @offset
|
849
|
+
address4 = _read_func_call_access
|
850
|
+
if address4 == FAILURE
|
851
|
+
@offset = index4
|
852
|
+
address4 = _read_map_access
|
853
|
+
if address4 == FAILURE
|
854
|
+
@offset = index4
|
855
|
+
address4 = _read_variable_access
|
856
|
+
if address4 == FAILURE
|
857
|
+
@offset = index4
|
858
|
+
end
|
859
|
+
end
|
860
|
+
end
|
861
|
+
unless address4 == FAILURE
|
862
|
+
elements1 << address4
|
863
|
+
remaining0 -= 1
|
864
|
+
end
|
865
|
+
end
|
866
|
+
if remaining0 <= 0
|
867
|
+
address3 = TreeNode.new(@input[index3...@offset], index3, elements1)
|
868
|
+
@offset = @offset
|
869
|
+
else
|
870
|
+
address3 = FAILURE
|
871
|
+
end
|
872
|
+
unless address3 == FAILURE
|
873
|
+
elements0 << address3
|
874
|
+
address5 = FAILURE
|
875
|
+
address5 = _read___
|
876
|
+
unless address5 == FAILURE
|
877
|
+
elements0 << address5
|
878
|
+
else
|
879
|
+
elements0 = nil
|
880
|
+
@offset = index1
|
881
|
+
end
|
882
|
+
else
|
883
|
+
elements0 = nil
|
884
|
+
@offset = index1
|
885
|
+
end
|
886
|
+
else
|
887
|
+
elements0 = nil
|
888
|
+
@offset = index1
|
889
|
+
end
|
890
|
+
else
|
891
|
+
elements0 = nil
|
892
|
+
@offset = index1
|
893
|
+
end
|
894
|
+
if elements0.nil?
|
895
|
+
address0 = FAILURE
|
896
|
+
else
|
897
|
+
address0 = @actions.make_and_execute_namespace_operation(@input, index1, @offset, elements0)
|
898
|
+
@offset = @offset
|
899
|
+
end
|
900
|
+
@cache[:namespace][index0] = [address0, @offset]
|
901
|
+
return address0
|
902
|
+
end
|
903
|
+
|
904
|
+
def _read_comp_expression_ex
|
905
|
+
address0, index0 = FAILURE, @offset
|
906
|
+
cached = @cache[:comp_expression_ex][index0]
|
907
|
+
if cached
|
908
|
+
@offset = cached[1]
|
909
|
+
return cached[0]
|
910
|
+
end
|
911
|
+
index1, elements0 = @offset, []
|
912
|
+
address1 = FAILURE
|
913
|
+
address1 = _read___
|
914
|
+
unless address1 == FAILURE
|
915
|
+
elements0 << address1
|
916
|
+
address2 = FAILURE
|
917
|
+
chunk0, max0 = nil, @offset + 1
|
918
|
+
if max0 <= @input_size
|
919
|
+
chunk0 = @input[@offset...max0]
|
920
|
+
end
|
921
|
+
if chunk0 == "("
|
922
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
923
|
+
@offset = @offset + 1
|
924
|
+
else
|
925
|
+
address2 = FAILURE
|
926
|
+
if @offset > @failure
|
927
|
+
@failure = @offset
|
928
|
+
@expected = []
|
929
|
+
end
|
930
|
+
if @offset == @failure
|
931
|
+
@expected << "\"(\""
|
932
|
+
end
|
933
|
+
end
|
934
|
+
unless address2 == FAILURE
|
935
|
+
elements0 << address2
|
936
|
+
address3 = FAILURE
|
937
|
+
address3 = _read_comp_expression
|
938
|
+
unless address3 == FAILURE
|
939
|
+
elements0 << address3
|
940
|
+
address4 = FAILURE
|
941
|
+
chunk1, max1 = nil, @offset + 1
|
942
|
+
if max1 <= @input_size
|
943
|
+
chunk1 = @input[@offset...max1]
|
944
|
+
end
|
945
|
+
if chunk1 == ")"
|
946
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
947
|
+
@offset = @offset + 1
|
948
|
+
else
|
949
|
+
address4 = FAILURE
|
950
|
+
if @offset > @failure
|
951
|
+
@failure = @offset
|
952
|
+
@expected = []
|
953
|
+
end
|
954
|
+
if @offset == @failure
|
955
|
+
@expected << "\")\""
|
956
|
+
end
|
957
|
+
end
|
958
|
+
unless address4 == FAILURE
|
959
|
+
elements0 << address4
|
960
|
+
address5 = FAILURE
|
961
|
+
address5 = _read___
|
962
|
+
unless address5 == FAILURE
|
963
|
+
elements0 << address5
|
964
|
+
else
|
965
|
+
elements0 = nil
|
966
|
+
@offset = index1
|
967
|
+
end
|
968
|
+
else
|
969
|
+
elements0 = nil
|
970
|
+
@offset = index1
|
971
|
+
end
|
972
|
+
else
|
973
|
+
elements0 = nil
|
974
|
+
@offset = index1
|
975
|
+
end
|
976
|
+
else
|
977
|
+
elements0 = nil
|
978
|
+
@offset = index1
|
979
|
+
end
|
980
|
+
else
|
981
|
+
elements0 = nil
|
982
|
+
@offset = index1
|
983
|
+
end
|
984
|
+
if elements0.nil?
|
985
|
+
address0 = FAILURE
|
986
|
+
else
|
987
|
+
address0 = @actions.make_comp_exp_ex(@input, index1, @offset, elements0)
|
988
|
+
@offset = @offset
|
989
|
+
end
|
990
|
+
@cache[:comp_expression_ex][index0] = [address0, @offset]
|
991
|
+
return address0
|
992
|
+
end
|
993
|
+
|
994
|
+
def _read_string
|
995
|
+
address0, index0 = FAILURE, @offset
|
996
|
+
cached = @cache[:string][index0]
|
997
|
+
if cached
|
998
|
+
@offset = cached[1]
|
999
|
+
return cached[0]
|
1000
|
+
end
|
1001
|
+
index1, elements0 = @offset, []
|
1002
|
+
address1 = FAILURE
|
1003
|
+
address1 = _read___
|
1004
|
+
unless address1 == FAILURE
|
1005
|
+
elements0 << address1
|
1006
|
+
address2 = FAILURE
|
1007
|
+
chunk0, max0 = nil, @offset + 1
|
1008
|
+
if max0 <= @input_size
|
1009
|
+
chunk0 = @input[@offset...max0]
|
1010
|
+
end
|
1011
|
+
if chunk0 =~ /\A[\"]/
|
1012
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1013
|
+
@offset = @offset + 1
|
1014
|
+
else
|
1015
|
+
address2 = FAILURE
|
1016
|
+
if @offset > @failure
|
1017
|
+
@failure = @offset
|
1018
|
+
@expected = []
|
1019
|
+
end
|
1020
|
+
if @offset == @failure
|
1021
|
+
@expected << "[\\\"]"
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
unless address2 == FAILURE
|
1025
|
+
elements0 << address2
|
1026
|
+
address3 = FAILURE
|
1027
|
+
remaining0, index2, elements1, address4 = 0, @offset, [], true
|
1028
|
+
until address4 == FAILURE
|
1029
|
+
chunk1, max1 = nil, @offset + 1
|
1030
|
+
if max1 <= @input_size
|
1031
|
+
chunk1 = @input[@offset...max1]
|
1032
|
+
end
|
1033
|
+
if chunk1 =~ /\A[ !#-~]/
|
1034
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1035
|
+
@offset = @offset + 1
|
1036
|
+
else
|
1037
|
+
address4 = FAILURE
|
1038
|
+
if @offset > @failure
|
1039
|
+
@failure = @offset
|
1040
|
+
@expected = []
|
1041
|
+
end
|
1042
|
+
if @offset == @failure
|
1043
|
+
@expected << "[ !#-~]"
|
1044
|
+
end
|
1045
|
+
end
|
1046
|
+
unless address4 == FAILURE
|
1047
|
+
elements1 << address4
|
1048
|
+
remaining0 -= 1
|
1049
|
+
end
|
1050
|
+
end
|
1051
|
+
if remaining0 <= 0
|
1052
|
+
address3 = TreeNode.new(@input[index2...@offset], index2, elements1)
|
1053
|
+
@offset = @offset
|
1054
|
+
else
|
1055
|
+
address3 = FAILURE
|
1056
|
+
end
|
1057
|
+
unless address3 == FAILURE
|
1058
|
+
elements0 << address3
|
1059
|
+
address5 = FAILURE
|
1060
|
+
chunk2, max2 = nil, @offset + 1
|
1061
|
+
if max2 <= @input_size
|
1062
|
+
chunk2 = @input[@offset...max2]
|
1063
|
+
end
|
1064
|
+
if chunk2 =~ /\A[\"]/
|
1065
|
+
address5 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1066
|
+
@offset = @offset + 1
|
1067
|
+
else
|
1068
|
+
address5 = FAILURE
|
1069
|
+
if @offset > @failure
|
1070
|
+
@failure = @offset
|
1071
|
+
@expected = []
|
1072
|
+
end
|
1073
|
+
if @offset == @failure
|
1074
|
+
@expected << "[\\\"]"
|
1075
|
+
end
|
1076
|
+
end
|
1077
|
+
unless address5 == FAILURE
|
1078
|
+
elements0 << address5
|
1079
|
+
address6 = FAILURE
|
1080
|
+
address6 = _read___
|
1081
|
+
unless address6 == FAILURE
|
1082
|
+
elements0 << address6
|
1083
|
+
else
|
1084
|
+
elements0 = nil
|
1085
|
+
@offset = index1
|
1086
|
+
end
|
1087
|
+
else
|
1088
|
+
elements0 = nil
|
1089
|
+
@offset = index1
|
1090
|
+
end
|
1091
|
+
else
|
1092
|
+
elements0 = nil
|
1093
|
+
@offset = index1
|
1094
|
+
end
|
1095
|
+
else
|
1096
|
+
elements0 = nil
|
1097
|
+
@offset = index1
|
1098
|
+
end
|
1099
|
+
else
|
1100
|
+
elements0 = nil
|
1101
|
+
@offset = index1
|
1102
|
+
end
|
1103
|
+
if elements0.nil?
|
1104
|
+
address0 = FAILURE
|
1105
|
+
else
|
1106
|
+
address0 = @actions.make_string(@input, index1, @offset, elements0)
|
1107
|
+
@offset = @offset
|
1108
|
+
end
|
1109
|
+
@cache[:string][index0] = [address0, @offset]
|
1110
|
+
return address0
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
def _read_apostrophe_string
|
1114
|
+
address0, index0 = FAILURE, @offset
|
1115
|
+
cached = @cache[:apostrophe_string][index0]
|
1116
|
+
if cached
|
1117
|
+
@offset = cached[1]
|
1118
|
+
return cached[0]
|
1119
|
+
end
|
1120
|
+
index1, elements0 = @offset, []
|
1121
|
+
address1 = FAILURE
|
1122
|
+
address1 = _read___
|
1123
|
+
unless address1 == FAILURE
|
1124
|
+
elements0 << address1
|
1125
|
+
address2 = FAILURE
|
1126
|
+
chunk0, max0 = nil, @offset + 1
|
1127
|
+
if max0 <= @input_size
|
1128
|
+
chunk0 = @input[@offset...max0]
|
1129
|
+
end
|
1130
|
+
if chunk0 == "'"
|
1131
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1132
|
+
@offset = @offset + 1
|
1133
|
+
else
|
1134
|
+
address2 = FAILURE
|
1135
|
+
if @offset > @failure
|
1136
|
+
@failure = @offset
|
1137
|
+
@expected = []
|
1138
|
+
end
|
1139
|
+
if @offset == @failure
|
1140
|
+
@expected << "\"'\""
|
1141
|
+
end
|
1142
|
+
end
|
1143
|
+
unless address2 == FAILURE
|
1144
|
+
elements0 << address2
|
1145
|
+
address3 = FAILURE
|
1146
|
+
remaining0, index2, elements1, address4 = 0, @offset, [], true
|
1147
|
+
until address4 == FAILURE
|
1148
|
+
chunk1, max1 = nil, @offset + 1
|
1149
|
+
if max1 <= @input_size
|
1150
|
+
chunk1 = @input[@offset...max1]
|
1151
|
+
end
|
1152
|
+
if chunk1 =~ /\A[^']/
|
1153
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1154
|
+
@offset = @offset + 1
|
1155
|
+
else
|
1156
|
+
address4 = FAILURE
|
1157
|
+
if @offset > @failure
|
1158
|
+
@failure = @offset
|
1159
|
+
@expected = []
|
1160
|
+
end
|
1161
|
+
if @offset == @failure
|
1162
|
+
@expected << "[^']"
|
1163
|
+
end
|
1164
|
+
end
|
1165
|
+
unless address4 == FAILURE
|
1166
|
+
elements1 << address4
|
1167
|
+
remaining0 -= 1
|
1168
|
+
end
|
1169
|
+
end
|
1170
|
+
if remaining0 <= 0
|
1171
|
+
address3 = TreeNode.new(@input[index2...@offset], index2, elements1)
|
1172
|
+
@offset = @offset
|
1173
|
+
else
|
1174
|
+
address3 = FAILURE
|
1175
|
+
end
|
1176
|
+
unless address3 == FAILURE
|
1177
|
+
elements0 << address3
|
1178
|
+
address5 = FAILURE
|
1179
|
+
chunk2, max2 = nil, @offset + 1
|
1180
|
+
if max2 <= @input_size
|
1181
|
+
chunk2 = @input[@offset...max2]
|
1182
|
+
end
|
1183
|
+
if chunk2 == "'"
|
1184
|
+
address5 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1185
|
+
@offset = @offset + 1
|
1186
|
+
else
|
1187
|
+
address5 = FAILURE
|
1188
|
+
if @offset > @failure
|
1189
|
+
@failure = @offset
|
1190
|
+
@expected = []
|
1191
|
+
end
|
1192
|
+
if @offset == @failure
|
1193
|
+
@expected << "\"'\""
|
1194
|
+
end
|
1195
|
+
end
|
1196
|
+
unless address5 == FAILURE
|
1197
|
+
elements0 << address5
|
1198
|
+
address6 = FAILURE
|
1199
|
+
address6 = _read___
|
1200
|
+
unless address6 == FAILURE
|
1201
|
+
elements0 << address6
|
1202
|
+
else
|
1203
|
+
elements0 = nil
|
1204
|
+
@offset = index1
|
1205
|
+
end
|
1206
|
+
else
|
1207
|
+
elements0 = nil
|
1208
|
+
@offset = index1
|
1209
|
+
end
|
1210
|
+
else
|
1211
|
+
elements0 = nil
|
1212
|
+
@offset = index1
|
1213
|
+
end
|
1214
|
+
else
|
1215
|
+
elements0 = nil
|
1216
|
+
@offset = index1
|
1217
|
+
end
|
1218
|
+
else
|
1219
|
+
elements0 = nil
|
1220
|
+
@offset = index1
|
1221
|
+
end
|
1222
|
+
if elements0.nil?
|
1223
|
+
address0 = FAILURE
|
1224
|
+
else
|
1225
|
+
address0 = @actions.make_apostrophe_string(@input, index1, @offset, elements0)
|
1226
|
+
@offset = @offset
|
1227
|
+
end
|
1228
|
+
@cache[:apostrophe_string][index0] = [address0, @offset]
|
1229
|
+
return address0
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
def _read_list
|
1233
|
+
address0, index0 = FAILURE, @offset
|
1234
|
+
cached = @cache[:list][index0]
|
1235
|
+
if cached
|
1236
|
+
@offset = cached[1]
|
1237
|
+
return cached[0]
|
1238
|
+
end
|
1239
|
+
index1, elements0 = @offset, []
|
1240
|
+
address1 = FAILURE
|
1241
|
+
address1 = _read___
|
1242
|
+
unless address1 == FAILURE
|
1243
|
+
elements0 << address1
|
1244
|
+
address2 = FAILURE
|
1245
|
+
chunk0, max0 = nil, @offset + 1
|
1246
|
+
if max0 <= @input_size
|
1247
|
+
chunk0 = @input[@offset...max0]
|
1248
|
+
end
|
1249
|
+
if chunk0 == "["
|
1250
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1251
|
+
@offset = @offset + 1
|
1252
|
+
else
|
1253
|
+
address2 = FAILURE
|
1254
|
+
if @offset > @failure
|
1255
|
+
@failure = @offset
|
1256
|
+
@expected = []
|
1257
|
+
end
|
1258
|
+
if @offset == @failure
|
1259
|
+
@expected << "\"[\""
|
1260
|
+
end
|
1261
|
+
end
|
1262
|
+
unless address2 == FAILURE
|
1263
|
+
elements0 << address2
|
1264
|
+
address3 = FAILURE
|
1265
|
+
address3 = _read___
|
1266
|
+
unless address3 == FAILURE
|
1267
|
+
elements0 << address3
|
1268
|
+
address4 = FAILURE
|
1269
|
+
index2 = @offset
|
1270
|
+
index3, elements1 = @offset, []
|
1271
|
+
address5 = FAILURE
|
1272
|
+
address5 = _read_atom
|
1273
|
+
unless address5 == FAILURE
|
1274
|
+
elements1 << address5
|
1275
|
+
address6 = FAILURE
|
1276
|
+
address6 = _read___
|
1277
|
+
unless address6 == FAILURE
|
1278
|
+
elements1 << address6
|
1279
|
+
address7 = FAILURE
|
1280
|
+
remaining0, index4, elements2, address8 = 0, @offset, [], true
|
1281
|
+
until address8 == FAILURE
|
1282
|
+
index5, elements3 = @offset, []
|
1283
|
+
address9 = FAILURE
|
1284
|
+
chunk1, max1 = nil, @offset + 1
|
1285
|
+
if max1 <= @input_size
|
1286
|
+
chunk1 = @input[@offset...max1]
|
1287
|
+
end
|
1288
|
+
if chunk1 == ","
|
1289
|
+
address9 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1290
|
+
@offset = @offset + 1
|
1291
|
+
else
|
1292
|
+
address9 = FAILURE
|
1293
|
+
if @offset > @failure
|
1294
|
+
@failure = @offset
|
1295
|
+
@expected = []
|
1296
|
+
end
|
1297
|
+
if @offset == @failure
|
1298
|
+
@expected << "\",\""
|
1299
|
+
end
|
1300
|
+
end
|
1301
|
+
unless address9 == FAILURE
|
1302
|
+
elements3 << address9
|
1303
|
+
address10 = FAILURE
|
1304
|
+
address10 = _read___
|
1305
|
+
unless address10 == FAILURE
|
1306
|
+
elements3 << address10
|
1307
|
+
address11 = FAILURE
|
1308
|
+
address11 = _read_atom
|
1309
|
+
unless address11 == FAILURE
|
1310
|
+
elements3 << address11
|
1311
|
+
address12 = FAILURE
|
1312
|
+
address12 = _read___
|
1313
|
+
unless address12 == FAILURE
|
1314
|
+
elements3 << address12
|
1315
|
+
else
|
1316
|
+
elements3 = nil
|
1317
|
+
@offset = index5
|
1318
|
+
end
|
1319
|
+
else
|
1320
|
+
elements3 = nil
|
1321
|
+
@offset = index5
|
1322
|
+
end
|
1323
|
+
else
|
1324
|
+
elements3 = nil
|
1325
|
+
@offset = index5
|
1326
|
+
end
|
1327
|
+
else
|
1328
|
+
elements3 = nil
|
1329
|
+
@offset = index5
|
1330
|
+
end
|
1331
|
+
if elements3.nil?
|
1332
|
+
address8 = FAILURE
|
1333
|
+
else
|
1334
|
+
address8 = TreeNode13.new(@input[index5...@offset], index5, elements3)
|
1335
|
+
@offset = @offset
|
1336
|
+
end
|
1337
|
+
unless address8 == FAILURE
|
1338
|
+
elements2 << address8
|
1339
|
+
remaining0 -= 1
|
1340
|
+
end
|
1341
|
+
end
|
1342
|
+
if remaining0 <= 0
|
1343
|
+
address7 = TreeNode.new(@input[index4...@offset], index4, elements2)
|
1344
|
+
@offset = @offset
|
1345
|
+
else
|
1346
|
+
address7 = FAILURE
|
1347
|
+
end
|
1348
|
+
unless address7 == FAILURE
|
1349
|
+
elements1 << address7
|
1350
|
+
else
|
1351
|
+
elements1 = nil
|
1352
|
+
@offset = index3
|
1353
|
+
end
|
1354
|
+
else
|
1355
|
+
elements1 = nil
|
1356
|
+
@offset = index3
|
1357
|
+
end
|
1358
|
+
else
|
1359
|
+
elements1 = nil
|
1360
|
+
@offset = index3
|
1361
|
+
end
|
1362
|
+
if elements1.nil?
|
1363
|
+
address4 = FAILURE
|
1364
|
+
else
|
1365
|
+
address4 = TreeNode12.new(@input[index3...@offset], index3, elements1)
|
1366
|
+
@offset = @offset
|
1367
|
+
end
|
1368
|
+
if address4 == FAILURE
|
1369
|
+
address4 = TreeNode.new(@input[index2...index2], index2, [])
|
1370
|
+
@offset = index2
|
1371
|
+
end
|
1372
|
+
unless address4 == FAILURE
|
1373
|
+
elements0 << address4
|
1374
|
+
address13 = FAILURE
|
1375
|
+
address13 = _read___
|
1376
|
+
unless address13 == FAILURE
|
1377
|
+
elements0 << address13
|
1378
|
+
address14 = FAILURE
|
1379
|
+
chunk2, max2 = nil, @offset + 1
|
1380
|
+
if max2 <= @input_size
|
1381
|
+
chunk2 = @input[@offset...max2]
|
1382
|
+
end
|
1383
|
+
if chunk2 == "]"
|
1384
|
+
address14 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1385
|
+
@offset = @offset + 1
|
1386
|
+
else
|
1387
|
+
address14 = FAILURE
|
1388
|
+
if @offset > @failure
|
1389
|
+
@failure = @offset
|
1390
|
+
@expected = []
|
1391
|
+
end
|
1392
|
+
if @offset == @failure
|
1393
|
+
@expected << "\"]\""
|
1394
|
+
end
|
1395
|
+
end
|
1396
|
+
unless address14 == FAILURE
|
1397
|
+
elements0 << address14
|
1398
|
+
address15 = FAILURE
|
1399
|
+
address15 = _read___
|
1400
|
+
unless address15 == FAILURE
|
1401
|
+
elements0 << address15
|
1402
|
+
else
|
1403
|
+
elements0 = nil
|
1404
|
+
@offset = index1
|
1405
|
+
end
|
1406
|
+
else
|
1407
|
+
elements0 = nil
|
1408
|
+
@offset = index1
|
1409
|
+
end
|
1410
|
+
else
|
1411
|
+
elements0 = nil
|
1412
|
+
@offset = index1
|
1413
|
+
end
|
1414
|
+
else
|
1415
|
+
elements0 = nil
|
1416
|
+
@offset = index1
|
1417
|
+
end
|
1418
|
+
else
|
1419
|
+
elements0 = nil
|
1420
|
+
@offset = index1
|
1421
|
+
end
|
1422
|
+
else
|
1423
|
+
elements0 = nil
|
1424
|
+
@offset = index1
|
1425
|
+
end
|
1426
|
+
else
|
1427
|
+
elements0 = nil
|
1428
|
+
@offset = index1
|
1429
|
+
end
|
1430
|
+
if elements0.nil?
|
1431
|
+
address0 = FAILURE
|
1432
|
+
else
|
1433
|
+
address0 = @actions.make_list(@input, index1, @offset, elements0)
|
1434
|
+
@offset = @offset
|
1435
|
+
end
|
1436
|
+
@cache[:list][index0] = [address0, @offset]
|
1437
|
+
return address0
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
def _read_chr
|
1441
|
+
address0, index0 = FAILURE, @offset
|
1442
|
+
cached = @cache[:chr][index0]
|
1443
|
+
if cached
|
1444
|
+
@offset = cached[1]
|
1445
|
+
return cached[0]
|
1446
|
+
end
|
1447
|
+
index1, elements0 = @offset, []
|
1448
|
+
address1 = FAILURE
|
1449
|
+
address1 = _read___
|
1450
|
+
unless address1 == FAILURE
|
1451
|
+
elements0 << address1
|
1452
|
+
address2 = FAILURE
|
1453
|
+
chunk0, max0 = nil, @offset + 1
|
1454
|
+
if max0 <= @input_size
|
1455
|
+
chunk0 = @input[@offset...max0]
|
1456
|
+
end
|
1457
|
+
if chunk0 =~ /\A[']/
|
1458
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1459
|
+
@offset = @offset + 1
|
1460
|
+
else
|
1461
|
+
address2 = FAILURE
|
1462
|
+
if @offset > @failure
|
1463
|
+
@failure = @offset
|
1464
|
+
@expected = []
|
1465
|
+
end
|
1466
|
+
if @offset == @failure
|
1467
|
+
@expected << "[']"
|
1468
|
+
end
|
1469
|
+
end
|
1470
|
+
unless address2 == FAILURE
|
1471
|
+
elements0 << address2
|
1472
|
+
address3 = FAILURE
|
1473
|
+
chunk1, max1 = nil, @offset + 1
|
1474
|
+
if max1 <= @input_size
|
1475
|
+
chunk1 = @input[@offset...max1]
|
1476
|
+
end
|
1477
|
+
if chunk1 =~ /\A[ !#-~]/
|
1478
|
+
address3 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1479
|
+
@offset = @offset + 1
|
1480
|
+
else
|
1481
|
+
address3 = FAILURE
|
1482
|
+
if @offset > @failure
|
1483
|
+
@failure = @offset
|
1484
|
+
@expected = []
|
1485
|
+
end
|
1486
|
+
if @offset == @failure
|
1487
|
+
@expected << "[ !#-~]"
|
1488
|
+
end
|
1489
|
+
end
|
1490
|
+
unless address3 == FAILURE
|
1491
|
+
elements0 << address3
|
1492
|
+
address4 = FAILURE
|
1493
|
+
chunk2, max2 = nil, @offset + 1
|
1494
|
+
if max2 <= @input_size
|
1495
|
+
chunk2 = @input[@offset...max2]
|
1496
|
+
end
|
1497
|
+
if chunk2 =~ /\A[']/
|
1498
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1499
|
+
@offset = @offset + 1
|
1500
|
+
else
|
1501
|
+
address4 = FAILURE
|
1502
|
+
if @offset > @failure
|
1503
|
+
@failure = @offset
|
1504
|
+
@expected = []
|
1505
|
+
end
|
1506
|
+
if @offset == @failure
|
1507
|
+
@expected << "[']"
|
1508
|
+
end
|
1509
|
+
end
|
1510
|
+
unless address4 == FAILURE
|
1511
|
+
elements0 << address4
|
1512
|
+
address5 = FAILURE
|
1513
|
+
address5 = _read___
|
1514
|
+
unless address5 == FAILURE
|
1515
|
+
elements0 << address5
|
1516
|
+
else
|
1517
|
+
elements0 = nil
|
1518
|
+
@offset = index1
|
1519
|
+
end
|
1520
|
+
else
|
1521
|
+
elements0 = nil
|
1522
|
+
@offset = index1
|
1523
|
+
end
|
1524
|
+
else
|
1525
|
+
elements0 = nil
|
1526
|
+
@offset = index1
|
1527
|
+
end
|
1528
|
+
else
|
1529
|
+
elements0 = nil
|
1530
|
+
@offset = index1
|
1531
|
+
end
|
1532
|
+
else
|
1533
|
+
elements0 = nil
|
1534
|
+
@offset = index1
|
1535
|
+
end
|
1536
|
+
if elements0.nil?
|
1537
|
+
address0 = FAILURE
|
1538
|
+
else
|
1539
|
+
address0 = @actions.make_char(@input, index1, @offset, elements0)
|
1540
|
+
@offset = @offset
|
1541
|
+
end
|
1542
|
+
@cache[:chr][index0] = [address0, @offset]
|
1543
|
+
return address0
|
1544
|
+
end
|
1545
|
+
|
1546
|
+
def _read_number
|
1547
|
+
address0, index0 = FAILURE, @offset
|
1548
|
+
cached = @cache[:number][index0]
|
1549
|
+
if cached
|
1550
|
+
@offset = cached[1]
|
1551
|
+
return cached[0]
|
1552
|
+
end
|
1553
|
+
index1, elements0 = @offset, []
|
1554
|
+
address1 = FAILURE
|
1555
|
+
address1 = _read___
|
1556
|
+
unless address1 == FAILURE
|
1557
|
+
elements0 << address1
|
1558
|
+
address2 = FAILURE
|
1559
|
+
index2 = @offset
|
1560
|
+
chunk0, max0 = nil, @offset + 1
|
1561
|
+
if max0 <= @input_size
|
1562
|
+
chunk0 = @input[@offset...max0]
|
1563
|
+
end
|
1564
|
+
if chunk0 == "-"
|
1565
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1566
|
+
@offset = @offset + 1
|
1567
|
+
else
|
1568
|
+
address2 = FAILURE
|
1569
|
+
if @offset > @failure
|
1570
|
+
@failure = @offset
|
1571
|
+
@expected = []
|
1572
|
+
end
|
1573
|
+
if @offset == @failure
|
1574
|
+
@expected << "\"-\""
|
1575
|
+
end
|
1576
|
+
end
|
1577
|
+
if address2 == FAILURE
|
1578
|
+
address2 = TreeNode.new(@input[index2...index2], index2, [])
|
1579
|
+
@offset = index2
|
1580
|
+
end
|
1581
|
+
unless address2 == FAILURE
|
1582
|
+
elements0 << address2
|
1583
|
+
address3 = FAILURE
|
1584
|
+
remaining0, index3, elements1, address4 = 1, @offset, [], true
|
1585
|
+
until address4 == FAILURE
|
1586
|
+
chunk1, max1 = nil, @offset + 1
|
1587
|
+
if max1 <= @input_size
|
1588
|
+
chunk1 = @input[@offset...max1]
|
1589
|
+
end
|
1590
|
+
if chunk1 =~ /\A[0-9]/
|
1591
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1592
|
+
@offset = @offset + 1
|
1593
|
+
else
|
1594
|
+
address4 = FAILURE
|
1595
|
+
if @offset > @failure
|
1596
|
+
@failure = @offset
|
1597
|
+
@expected = []
|
1598
|
+
end
|
1599
|
+
if @offset == @failure
|
1600
|
+
@expected << "[0-9]"
|
1601
|
+
end
|
1602
|
+
end
|
1603
|
+
unless address4 == FAILURE
|
1604
|
+
elements1 << address4
|
1605
|
+
remaining0 -= 1
|
1606
|
+
end
|
1607
|
+
end
|
1608
|
+
if remaining0 <= 0
|
1609
|
+
address3 = TreeNode.new(@input[index3...@offset], index3, elements1)
|
1610
|
+
@offset = @offset
|
1611
|
+
else
|
1612
|
+
address3 = FAILURE
|
1613
|
+
end
|
1614
|
+
unless address3 == FAILURE
|
1615
|
+
elements0 << address3
|
1616
|
+
address5 = FAILURE
|
1617
|
+
address5 = _read___
|
1618
|
+
unless address5 == FAILURE
|
1619
|
+
elements0 << address5
|
1620
|
+
else
|
1621
|
+
elements0 = nil
|
1622
|
+
@offset = index1
|
1623
|
+
end
|
1624
|
+
else
|
1625
|
+
elements0 = nil
|
1626
|
+
@offset = index1
|
1627
|
+
end
|
1628
|
+
else
|
1629
|
+
elements0 = nil
|
1630
|
+
@offset = index1
|
1631
|
+
end
|
1632
|
+
else
|
1633
|
+
elements0 = nil
|
1634
|
+
@offset = index1
|
1635
|
+
end
|
1636
|
+
if elements0.nil?
|
1637
|
+
address0 = FAILURE
|
1638
|
+
else
|
1639
|
+
address0 = @actions.make_number(@input, index1, @offset, elements0)
|
1640
|
+
@offset = @offset
|
1641
|
+
end
|
1642
|
+
@cache[:number][index0] = [address0, @offset]
|
1643
|
+
return address0
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
def _read_float_
|
1647
|
+
address0, index0 = FAILURE, @offset
|
1648
|
+
cached = @cache[:float_][index0]
|
1649
|
+
if cached
|
1650
|
+
@offset = cached[1]
|
1651
|
+
return cached[0]
|
1652
|
+
end
|
1653
|
+
index1, elements0 = @offset, []
|
1654
|
+
address1 = FAILURE
|
1655
|
+
address1 = _read___
|
1656
|
+
unless address1 == FAILURE
|
1657
|
+
elements0 << address1
|
1658
|
+
address2 = FAILURE
|
1659
|
+
index2 = @offset
|
1660
|
+
chunk0, max0 = nil, @offset + 1
|
1661
|
+
if max0 <= @input_size
|
1662
|
+
chunk0 = @input[@offset...max0]
|
1663
|
+
end
|
1664
|
+
if chunk0 == "-"
|
1665
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1666
|
+
@offset = @offset + 1
|
1667
|
+
else
|
1668
|
+
address2 = FAILURE
|
1669
|
+
if @offset > @failure
|
1670
|
+
@failure = @offset
|
1671
|
+
@expected = []
|
1672
|
+
end
|
1673
|
+
if @offset == @failure
|
1674
|
+
@expected << "\"-\""
|
1675
|
+
end
|
1676
|
+
end
|
1677
|
+
if address2 == FAILURE
|
1678
|
+
address2 = TreeNode.new(@input[index2...index2], index2, [])
|
1679
|
+
@offset = index2
|
1680
|
+
end
|
1681
|
+
unless address2 == FAILURE
|
1682
|
+
elements0 << address2
|
1683
|
+
address3 = FAILURE
|
1684
|
+
remaining0, index3, elements1, address4 = 1, @offset, [], true
|
1685
|
+
until address4 == FAILURE
|
1686
|
+
chunk1, max1 = nil, @offset + 1
|
1687
|
+
if max1 <= @input_size
|
1688
|
+
chunk1 = @input[@offset...max1]
|
1689
|
+
end
|
1690
|
+
if chunk1 =~ /\A[0-9]/
|
1691
|
+
address4 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1692
|
+
@offset = @offset + 1
|
1693
|
+
else
|
1694
|
+
address4 = FAILURE
|
1695
|
+
if @offset > @failure
|
1696
|
+
@failure = @offset
|
1697
|
+
@expected = []
|
1698
|
+
end
|
1699
|
+
if @offset == @failure
|
1700
|
+
@expected << "[0-9]"
|
1701
|
+
end
|
1702
|
+
end
|
1703
|
+
unless address4 == FAILURE
|
1704
|
+
elements1 << address4
|
1705
|
+
remaining0 -= 1
|
1706
|
+
end
|
1707
|
+
end
|
1708
|
+
if remaining0 <= 0
|
1709
|
+
address3 = TreeNode.new(@input[index3...@offset], index3, elements1)
|
1710
|
+
@offset = @offset
|
1711
|
+
else
|
1712
|
+
address3 = FAILURE
|
1713
|
+
end
|
1714
|
+
unless address3 == FAILURE
|
1715
|
+
elements0 << address3
|
1716
|
+
address5 = FAILURE
|
1717
|
+
chunk2, max2 = nil, @offset + 1
|
1718
|
+
if max2 <= @input_size
|
1719
|
+
chunk2 = @input[@offset...max2]
|
1720
|
+
end
|
1721
|
+
if chunk2 == "."
|
1722
|
+
address5 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1723
|
+
@offset = @offset + 1
|
1724
|
+
else
|
1725
|
+
address5 = FAILURE
|
1726
|
+
if @offset > @failure
|
1727
|
+
@failure = @offset
|
1728
|
+
@expected = []
|
1729
|
+
end
|
1730
|
+
if @offset == @failure
|
1731
|
+
@expected << "\".\""
|
1732
|
+
end
|
1733
|
+
end
|
1734
|
+
unless address5 == FAILURE
|
1735
|
+
elements0 << address5
|
1736
|
+
address6 = FAILURE
|
1737
|
+
remaining1, index4, elements2, address7 = 1, @offset, [], true
|
1738
|
+
until address7 == FAILURE
|
1739
|
+
chunk3, max3 = nil, @offset + 1
|
1740
|
+
if max3 <= @input_size
|
1741
|
+
chunk3 = @input[@offset...max3]
|
1742
|
+
end
|
1743
|
+
if chunk3 =~ /\A[0-9]/
|
1744
|
+
address7 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
1745
|
+
@offset = @offset + 1
|
1746
|
+
else
|
1747
|
+
address7 = FAILURE
|
1748
|
+
if @offset > @failure
|
1749
|
+
@failure = @offset
|
1750
|
+
@expected = []
|
1751
|
+
end
|
1752
|
+
if @offset == @failure
|
1753
|
+
@expected << "[0-9]"
|
1754
|
+
end
|
1755
|
+
end
|
1756
|
+
unless address7 == FAILURE
|
1757
|
+
elements2 << address7
|
1758
|
+
remaining1 -= 1
|
1759
|
+
end
|
1760
|
+
end
|
1761
|
+
if remaining1 <= 0
|
1762
|
+
address6 = TreeNode.new(@input[index4...@offset], index4, elements2)
|
1763
|
+
@offset = @offset
|
1764
|
+
else
|
1765
|
+
address6 = FAILURE
|
1766
|
+
end
|
1767
|
+
unless address6 == FAILURE
|
1768
|
+
elements0 << address6
|
1769
|
+
address8 = FAILURE
|
1770
|
+
address8 = _read___
|
1771
|
+
unless address8 == FAILURE
|
1772
|
+
elements0 << address8
|
1773
|
+
else
|
1774
|
+
elements0 = nil
|
1775
|
+
@offset = index1
|
1776
|
+
end
|
1777
|
+
else
|
1778
|
+
elements0 = nil
|
1779
|
+
@offset = index1
|
1780
|
+
end
|
1781
|
+
else
|
1782
|
+
elements0 = nil
|
1783
|
+
@offset = index1
|
1784
|
+
end
|
1785
|
+
else
|
1786
|
+
elements0 = nil
|
1787
|
+
@offset = index1
|
1788
|
+
end
|
1789
|
+
else
|
1790
|
+
elements0 = nil
|
1791
|
+
@offset = index1
|
1792
|
+
end
|
1793
|
+
else
|
1794
|
+
elements0 = nil
|
1795
|
+
@offset = index1
|
1796
|
+
end
|
1797
|
+
if elements0.nil?
|
1798
|
+
address0 = FAILURE
|
1799
|
+
else
|
1800
|
+
address0 = @actions.make_float(@input, index1, @offset, elements0)
|
1801
|
+
@offset = @offset
|
1802
|
+
end
|
1803
|
+
@cache[:float_][index0] = [address0, @offset]
|
1804
|
+
return address0
|
1805
|
+
end
|
1806
|
+
|
1807
|
+
def _read_boolean_
|
1808
|
+
address0, index0 = FAILURE, @offset
|
1809
|
+
cached = @cache[:boolean_][index0]
|
1810
|
+
if cached
|
1811
|
+
@offset = cached[1]
|
1812
|
+
return cached[0]
|
1813
|
+
end
|
1814
|
+
index1, elements0 = @offset, []
|
1815
|
+
address1 = FAILURE
|
1816
|
+
address1 = _read___
|
1817
|
+
unless address1 == FAILURE
|
1818
|
+
elements0 << address1
|
1819
|
+
address2 = FAILURE
|
1820
|
+
index2 = @offset
|
1821
|
+
chunk0, max0 = nil, @offset + 4
|
1822
|
+
if max0 <= @input_size
|
1823
|
+
chunk0 = @input[@offset...max0]
|
1824
|
+
end
|
1825
|
+
if chunk0 == "True"
|
1826
|
+
address2 = TreeNode.new(@input[@offset...@offset + 4], @offset, [])
|
1827
|
+
@offset = @offset + 4
|
1828
|
+
else
|
1829
|
+
address2 = FAILURE
|
1830
|
+
if @offset > @failure
|
1831
|
+
@failure = @offset
|
1832
|
+
@expected = []
|
1833
|
+
end
|
1834
|
+
if @offset == @failure
|
1835
|
+
@expected << "\"True\""
|
1836
|
+
end
|
1837
|
+
end
|
1838
|
+
if address2 == FAILURE
|
1839
|
+
@offset = index2
|
1840
|
+
chunk1, max1 = nil, @offset + 4
|
1841
|
+
if max1 <= @input_size
|
1842
|
+
chunk1 = @input[@offset...max1]
|
1843
|
+
end
|
1844
|
+
if chunk1 == "true"
|
1845
|
+
address2 = TreeNode.new(@input[@offset...@offset + 4], @offset, [])
|
1846
|
+
@offset = @offset + 4
|
1847
|
+
else
|
1848
|
+
address2 = FAILURE
|
1849
|
+
if @offset > @failure
|
1850
|
+
@failure = @offset
|
1851
|
+
@expected = []
|
1852
|
+
end
|
1853
|
+
if @offset == @failure
|
1854
|
+
@expected << "\"true\""
|
1855
|
+
end
|
1856
|
+
end
|
1857
|
+
if address2 == FAILURE
|
1858
|
+
@offset = index2
|
1859
|
+
chunk2, max2 = nil, @offset + 5
|
1860
|
+
if max2 <= @input_size
|
1861
|
+
chunk2 = @input[@offset...max2]
|
1862
|
+
end
|
1863
|
+
if chunk2 == "False"
|
1864
|
+
address2 = TreeNode.new(@input[@offset...@offset + 5], @offset, [])
|
1865
|
+
@offset = @offset + 5
|
1866
|
+
else
|
1867
|
+
address2 = FAILURE
|
1868
|
+
if @offset > @failure
|
1869
|
+
@failure = @offset
|
1870
|
+
@expected = []
|
1871
|
+
end
|
1872
|
+
if @offset == @failure
|
1873
|
+
@expected << "\"False\""
|
1874
|
+
end
|
1875
|
+
end
|
1876
|
+
if address2 == FAILURE
|
1877
|
+
@offset = index2
|
1878
|
+
chunk3, max3 = nil, @offset + 5
|
1879
|
+
if max3 <= @input_size
|
1880
|
+
chunk3 = @input[@offset...max3]
|
1881
|
+
end
|
1882
|
+
if chunk3 == "false"
|
1883
|
+
address2 = TreeNode.new(@input[@offset...@offset + 5], @offset, [])
|
1884
|
+
@offset = @offset + 5
|
1885
|
+
else
|
1886
|
+
address2 = FAILURE
|
1887
|
+
if @offset > @failure
|
1888
|
+
@failure = @offset
|
1889
|
+
@expected = []
|
1890
|
+
end
|
1891
|
+
if @offset == @failure
|
1892
|
+
@expected << "\"false\""
|
1893
|
+
end
|
1894
|
+
end
|
1895
|
+
if address2 == FAILURE
|
1896
|
+
@offset = index2
|
1897
|
+
end
|
1898
|
+
end
|
1899
|
+
end
|
1900
|
+
end
|
1901
|
+
unless address2 == FAILURE
|
1902
|
+
elements0 << address2
|
1903
|
+
address3 = FAILURE
|
1904
|
+
address3 = _read___
|
1905
|
+
unless address3 == FAILURE
|
1906
|
+
elements0 << address3
|
1907
|
+
else
|
1908
|
+
elements0 = nil
|
1909
|
+
@offset = index1
|
1910
|
+
end
|
1911
|
+
else
|
1912
|
+
elements0 = nil
|
1913
|
+
@offset = index1
|
1914
|
+
end
|
1915
|
+
else
|
1916
|
+
elements0 = nil
|
1917
|
+
@offset = index1
|
1918
|
+
end
|
1919
|
+
if elements0.nil?
|
1920
|
+
address0 = FAILURE
|
1921
|
+
else
|
1922
|
+
address0 = @actions.make_bool(@input, index1, @offset, elements0)
|
1923
|
+
@offset = @offset
|
1924
|
+
end
|
1925
|
+
@cache[:boolean_][index0] = [address0, @offset]
|
1926
|
+
return address0
|
1927
|
+
end
|
1928
|
+
|
1929
|
+
def _read_null_
|
1930
|
+
address0, index0 = FAILURE, @offset
|
1931
|
+
cached = @cache[:null_][index0]
|
1932
|
+
if cached
|
1933
|
+
@offset = cached[1]
|
1934
|
+
return cached[0]
|
1935
|
+
end
|
1936
|
+
index1, elements0 = @offset, []
|
1937
|
+
address1 = FAILURE
|
1938
|
+
address1 = _read___
|
1939
|
+
unless address1 == FAILURE
|
1940
|
+
elements0 << address1
|
1941
|
+
address2 = FAILURE
|
1942
|
+
index2 = @offset
|
1943
|
+
chunk0, max0 = nil, @offset + 4
|
1944
|
+
if max0 <= @input_size
|
1945
|
+
chunk0 = @input[@offset...max0]
|
1946
|
+
end
|
1947
|
+
if chunk0 == "None"
|
1948
|
+
address2 = TreeNode.new(@input[@offset...@offset + 4], @offset, [])
|
1949
|
+
@offset = @offset + 4
|
1950
|
+
else
|
1951
|
+
address2 = FAILURE
|
1952
|
+
if @offset > @failure
|
1953
|
+
@failure = @offset
|
1954
|
+
@expected = []
|
1955
|
+
end
|
1956
|
+
if @offset == @failure
|
1957
|
+
@expected << "\"None\""
|
1958
|
+
end
|
1959
|
+
end
|
1960
|
+
if address2 == FAILURE
|
1961
|
+
@offset = index2
|
1962
|
+
chunk1, max1 = nil, @offset + 3
|
1963
|
+
if max1 <= @input_size
|
1964
|
+
chunk1 = @input[@offset...max1]
|
1965
|
+
end
|
1966
|
+
if chunk1 == "nil"
|
1967
|
+
address2 = TreeNode.new(@input[@offset...@offset + 3], @offset, [])
|
1968
|
+
@offset = @offset + 3
|
1969
|
+
else
|
1970
|
+
address2 = FAILURE
|
1971
|
+
if @offset > @failure
|
1972
|
+
@failure = @offset
|
1973
|
+
@expected = []
|
1974
|
+
end
|
1975
|
+
if @offset == @failure
|
1976
|
+
@expected << "\"nil\""
|
1977
|
+
end
|
1978
|
+
end
|
1979
|
+
if address2 == FAILURE
|
1980
|
+
@offset = index2
|
1981
|
+
chunk2, max2 = nil, @offset + 4
|
1982
|
+
if max2 <= @input_size
|
1983
|
+
chunk2 = @input[@offset...max2]
|
1984
|
+
end
|
1985
|
+
if chunk2 == "null"
|
1986
|
+
address2 = TreeNode.new(@input[@offset...@offset + 4], @offset, [])
|
1987
|
+
@offset = @offset + 4
|
1988
|
+
else
|
1989
|
+
address2 = FAILURE
|
1990
|
+
if @offset > @failure
|
1991
|
+
@failure = @offset
|
1992
|
+
@expected = []
|
1993
|
+
end
|
1994
|
+
if @offset == @failure
|
1995
|
+
@expected << "\"null\""
|
1996
|
+
end
|
1997
|
+
end
|
1998
|
+
if address2 == FAILURE
|
1999
|
+
@offset = index2
|
2000
|
+
end
|
2001
|
+
end
|
2002
|
+
end
|
2003
|
+
unless address2 == FAILURE
|
2004
|
+
elements0 << address2
|
2005
|
+
address3 = FAILURE
|
2006
|
+
address3 = _read___
|
2007
|
+
unless address3 == FAILURE
|
2008
|
+
elements0 << address3
|
2009
|
+
else
|
2010
|
+
elements0 = nil
|
2011
|
+
@offset = index1
|
2012
|
+
end
|
2013
|
+
else
|
2014
|
+
elements0 = nil
|
2015
|
+
@offset = index1
|
2016
|
+
end
|
2017
|
+
else
|
2018
|
+
elements0 = nil
|
2019
|
+
@offset = index1
|
2020
|
+
end
|
2021
|
+
if elements0.nil?
|
2022
|
+
address0 = FAILURE
|
2023
|
+
else
|
2024
|
+
address0 = @actions.make_null(@input, index1, @offset, elements0)
|
2025
|
+
@offset = @offset
|
2026
|
+
end
|
2027
|
+
@cache[:null_][index0] = [address0, @offset]
|
2028
|
+
return address0
|
2029
|
+
end
|
2030
|
+
|
2031
|
+
def _read_undefined_
|
2032
|
+
address0, index0 = FAILURE, @offset
|
2033
|
+
cached = @cache[:undefined_][index0]
|
2034
|
+
if cached
|
2035
|
+
@offset = cached[1]
|
2036
|
+
return cached[0]
|
2037
|
+
end
|
2038
|
+
index1, elements0 = @offset, []
|
2039
|
+
address1 = FAILURE
|
2040
|
+
address1 = _read___
|
2041
|
+
unless address1 == FAILURE
|
2042
|
+
elements0 << address1
|
2043
|
+
address2 = FAILURE
|
2044
|
+
chunk0, max0 = nil, @offset + 9
|
2045
|
+
if max0 <= @input_size
|
2046
|
+
chunk0 = @input[@offset...max0]
|
2047
|
+
end
|
2048
|
+
if chunk0 == "undefined"
|
2049
|
+
address2 = TreeNode.new(@input[@offset...@offset + 9], @offset, [])
|
2050
|
+
@offset = @offset + 9
|
2051
|
+
else
|
2052
|
+
address2 = FAILURE
|
2053
|
+
if @offset > @failure
|
2054
|
+
@failure = @offset
|
2055
|
+
@expected = []
|
2056
|
+
end
|
2057
|
+
if @offset == @failure
|
2058
|
+
@expected << "\"undefined\""
|
2059
|
+
end
|
2060
|
+
end
|
2061
|
+
unless address2 == FAILURE
|
2062
|
+
elements0 << address2
|
2063
|
+
address3 = FAILURE
|
2064
|
+
address3 = _read___
|
2065
|
+
unless address3 == FAILURE
|
2066
|
+
elements0 << address3
|
2067
|
+
else
|
2068
|
+
elements0 = nil
|
2069
|
+
@offset = index1
|
2070
|
+
end
|
2071
|
+
else
|
2072
|
+
elements0 = nil
|
2073
|
+
@offset = index1
|
2074
|
+
end
|
2075
|
+
else
|
2076
|
+
elements0 = nil
|
2077
|
+
@offset = index1
|
2078
|
+
end
|
2079
|
+
if elements0.nil?
|
2080
|
+
address0 = FAILURE
|
2081
|
+
else
|
2082
|
+
address0 = @actions.make_undefined(@input, index1, @offset, elements0)
|
2083
|
+
@offset = @offset
|
2084
|
+
end
|
2085
|
+
@cache[:undefined_][index0] = [address0, @offset]
|
2086
|
+
return address0
|
2087
|
+
end
|
2088
|
+
|
2089
|
+
def _read_opt_
|
2090
|
+
address0, index0 = FAILURE, @offset
|
2091
|
+
cached = @cache[:opt_][index0]
|
2092
|
+
if cached
|
2093
|
+
@offset = cached[1]
|
2094
|
+
return cached[0]
|
2095
|
+
end
|
2096
|
+
index1, elements0 = @offset, []
|
2097
|
+
address1 = FAILURE
|
2098
|
+
address1 = _read___
|
2099
|
+
unless address1 == FAILURE
|
2100
|
+
elements0 << address1
|
2101
|
+
address2 = FAILURE
|
2102
|
+
index2 = @offset
|
2103
|
+
chunk0, max0 = nil, @offset + 1
|
2104
|
+
if max0 <= @input_size
|
2105
|
+
chunk0 = @input[@offset...max0]
|
2106
|
+
end
|
2107
|
+
if chunk0 == "+"
|
2108
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2109
|
+
@offset = @offset + 1
|
2110
|
+
else
|
2111
|
+
address2 = FAILURE
|
2112
|
+
if @offset > @failure
|
2113
|
+
@failure = @offset
|
2114
|
+
@expected = []
|
2115
|
+
end
|
2116
|
+
if @offset == @failure
|
2117
|
+
@expected << "\"+\""
|
2118
|
+
end
|
2119
|
+
end
|
2120
|
+
if address2 == FAILURE
|
2121
|
+
@offset = index2
|
2122
|
+
chunk1, max1 = nil, @offset + 1
|
2123
|
+
if max1 <= @input_size
|
2124
|
+
chunk1 = @input[@offset...max1]
|
2125
|
+
end
|
2126
|
+
if chunk1 == "-"
|
2127
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2128
|
+
@offset = @offset + 1
|
2129
|
+
else
|
2130
|
+
address2 = FAILURE
|
2131
|
+
if @offset > @failure
|
2132
|
+
@failure = @offset
|
2133
|
+
@expected = []
|
2134
|
+
end
|
2135
|
+
if @offset == @failure
|
2136
|
+
@expected << "\"-\""
|
2137
|
+
end
|
2138
|
+
end
|
2139
|
+
if address2 == FAILURE
|
2140
|
+
@offset = index2
|
2141
|
+
chunk2, max2 = nil, @offset + 1
|
2142
|
+
if max2 <= @input_size
|
2143
|
+
chunk2 = @input[@offset...max2]
|
2144
|
+
end
|
2145
|
+
if chunk2 == "*"
|
2146
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2147
|
+
@offset = @offset + 1
|
2148
|
+
else
|
2149
|
+
address2 = FAILURE
|
2150
|
+
if @offset > @failure
|
2151
|
+
@failure = @offset
|
2152
|
+
@expected = []
|
2153
|
+
end
|
2154
|
+
if @offset == @failure
|
2155
|
+
@expected << "\"*\""
|
2156
|
+
end
|
2157
|
+
end
|
2158
|
+
if address2 == FAILURE
|
2159
|
+
@offset = index2
|
2160
|
+
chunk3, max3 = nil, @offset + 1
|
2161
|
+
if max3 <= @input_size
|
2162
|
+
chunk3 = @input[@offset...max3]
|
2163
|
+
end
|
2164
|
+
if chunk3 == "/"
|
2165
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2166
|
+
@offset = @offset + 1
|
2167
|
+
else
|
2168
|
+
address2 = FAILURE
|
2169
|
+
if @offset > @failure
|
2170
|
+
@failure = @offset
|
2171
|
+
@expected = []
|
2172
|
+
end
|
2173
|
+
if @offset == @failure
|
2174
|
+
@expected << "\"/\""
|
2175
|
+
end
|
2176
|
+
end
|
2177
|
+
if address2 == FAILURE
|
2178
|
+
@offset = index2
|
2179
|
+
chunk4, max4 = nil, @offset + 2
|
2180
|
+
if max4 <= @input_size
|
2181
|
+
chunk4 = @input[@offset...max4]
|
2182
|
+
end
|
2183
|
+
if chunk4 == "<="
|
2184
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2185
|
+
@offset = @offset + 2
|
2186
|
+
else
|
2187
|
+
address2 = FAILURE
|
2188
|
+
if @offset > @failure
|
2189
|
+
@failure = @offset
|
2190
|
+
@expected = []
|
2191
|
+
end
|
2192
|
+
if @offset == @failure
|
2193
|
+
@expected << "\"<=\""
|
2194
|
+
end
|
2195
|
+
end
|
2196
|
+
if address2 == FAILURE
|
2197
|
+
@offset = index2
|
2198
|
+
chunk5, max5 = nil, @offset + 2
|
2199
|
+
if max5 <= @input_size
|
2200
|
+
chunk5 = @input[@offset...max5]
|
2201
|
+
end
|
2202
|
+
if chunk5 == ">="
|
2203
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2204
|
+
@offset = @offset + 2
|
2205
|
+
else
|
2206
|
+
address2 = FAILURE
|
2207
|
+
if @offset > @failure
|
2208
|
+
@failure = @offset
|
2209
|
+
@expected = []
|
2210
|
+
end
|
2211
|
+
if @offset == @failure
|
2212
|
+
@expected << "\">=\""
|
2213
|
+
end
|
2214
|
+
end
|
2215
|
+
if address2 == FAILURE
|
2216
|
+
@offset = index2
|
2217
|
+
chunk6, max6 = nil, @offset + 2
|
2218
|
+
if max6 <= @input_size
|
2219
|
+
chunk6 = @input[@offset...max6]
|
2220
|
+
end
|
2221
|
+
if chunk6 == "!="
|
2222
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2223
|
+
@offset = @offset + 2
|
2224
|
+
else
|
2225
|
+
address2 = FAILURE
|
2226
|
+
if @offset > @failure
|
2227
|
+
@failure = @offset
|
2228
|
+
@expected = []
|
2229
|
+
end
|
2230
|
+
if @offset == @failure
|
2231
|
+
@expected << "\"!=\""
|
2232
|
+
end
|
2233
|
+
end
|
2234
|
+
if address2 == FAILURE
|
2235
|
+
@offset = index2
|
2236
|
+
chunk7, max7 = nil, @offset + 2
|
2237
|
+
if max7 <= @input_size
|
2238
|
+
chunk7 = @input[@offset...max7]
|
2239
|
+
end
|
2240
|
+
if chunk7 == "=="
|
2241
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2242
|
+
@offset = @offset + 2
|
2243
|
+
else
|
2244
|
+
address2 = FAILURE
|
2245
|
+
if @offset > @failure
|
2246
|
+
@failure = @offset
|
2247
|
+
@expected = []
|
2248
|
+
end
|
2249
|
+
if @offset == @failure
|
2250
|
+
@expected << "\"==\""
|
2251
|
+
end
|
2252
|
+
end
|
2253
|
+
if address2 == FAILURE
|
2254
|
+
@offset = index2
|
2255
|
+
chunk8, max8 = nil, @offset + 1
|
2256
|
+
if max8 <= @input_size
|
2257
|
+
chunk8 = @input[@offset...max8]
|
2258
|
+
end
|
2259
|
+
if chunk8 == "="
|
2260
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2261
|
+
@offset = @offset + 1
|
2262
|
+
else
|
2263
|
+
address2 = FAILURE
|
2264
|
+
if @offset > @failure
|
2265
|
+
@failure = @offset
|
2266
|
+
@expected = []
|
2267
|
+
end
|
2268
|
+
if @offset == @failure
|
2269
|
+
@expected << "\"=\""
|
2270
|
+
end
|
2271
|
+
end
|
2272
|
+
if address2 == FAILURE
|
2273
|
+
@offset = index2
|
2274
|
+
chunk9, max9 = nil, @offset + 1
|
2275
|
+
if max9 <= @input_size
|
2276
|
+
chunk9 = @input[@offset...max9]
|
2277
|
+
end
|
2278
|
+
if chunk9 == ">"
|
2279
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2280
|
+
@offset = @offset + 1
|
2281
|
+
else
|
2282
|
+
address2 = FAILURE
|
2283
|
+
if @offset > @failure
|
2284
|
+
@failure = @offset
|
2285
|
+
@expected = []
|
2286
|
+
end
|
2287
|
+
if @offset == @failure
|
2288
|
+
@expected << "\">\""
|
2289
|
+
end
|
2290
|
+
end
|
2291
|
+
if address2 == FAILURE
|
2292
|
+
@offset = index2
|
2293
|
+
chunk10, max10 = nil, @offset + 1
|
2294
|
+
if max10 <= @input_size
|
2295
|
+
chunk10 = @input[@offset...max10]
|
2296
|
+
end
|
2297
|
+
if chunk10 == "<"
|
2298
|
+
address2 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2299
|
+
@offset = @offset + 1
|
2300
|
+
else
|
2301
|
+
address2 = FAILURE
|
2302
|
+
if @offset > @failure
|
2303
|
+
@failure = @offset
|
2304
|
+
@expected = []
|
2305
|
+
end
|
2306
|
+
if @offset == @failure
|
2307
|
+
@expected << "\"<\""
|
2308
|
+
end
|
2309
|
+
end
|
2310
|
+
if address2 == FAILURE
|
2311
|
+
@offset = index2
|
2312
|
+
chunk11, max11 = nil, @offset + 2
|
2313
|
+
if max11 <= @input_size
|
2314
|
+
chunk11 = @input[@offset...max11]
|
2315
|
+
end
|
2316
|
+
if chunk11 == "LT"
|
2317
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2318
|
+
@offset = @offset + 2
|
2319
|
+
else
|
2320
|
+
address2 = FAILURE
|
2321
|
+
if @offset > @failure
|
2322
|
+
@failure = @offset
|
2323
|
+
@expected = []
|
2324
|
+
end
|
2325
|
+
if @offset == @failure
|
2326
|
+
@expected << "\"LT\""
|
2327
|
+
end
|
2328
|
+
end
|
2329
|
+
if address2 == FAILURE
|
2330
|
+
@offset = index2
|
2331
|
+
chunk12, max12 = nil, @offset + 2
|
2332
|
+
if max12 <= @input_size
|
2333
|
+
chunk12 = @input[@offset...max12]
|
2334
|
+
end
|
2335
|
+
if chunk12 == "GT"
|
2336
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2337
|
+
@offset = @offset + 2
|
2338
|
+
else
|
2339
|
+
address2 = FAILURE
|
2340
|
+
if @offset > @failure
|
2341
|
+
@failure = @offset
|
2342
|
+
@expected = []
|
2343
|
+
end
|
2344
|
+
if @offset == @failure
|
2345
|
+
@expected << "\"GT\""
|
2346
|
+
end
|
2347
|
+
end
|
2348
|
+
if address2 == FAILURE
|
2349
|
+
@offset = index2
|
2350
|
+
chunk13, max13 = nil, @offset + 2
|
2351
|
+
if max13 <= @input_size
|
2352
|
+
chunk13 = @input[@offset...max13]
|
2353
|
+
end
|
2354
|
+
if chunk13 == "LE"
|
2355
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2356
|
+
@offset = @offset + 2
|
2357
|
+
else
|
2358
|
+
address2 = FAILURE
|
2359
|
+
if @offset > @failure
|
2360
|
+
@failure = @offset
|
2361
|
+
@expected = []
|
2362
|
+
end
|
2363
|
+
if @offset == @failure
|
2364
|
+
@expected << "\"LE\""
|
2365
|
+
end
|
2366
|
+
end
|
2367
|
+
if address2 == FAILURE
|
2368
|
+
@offset = index2
|
2369
|
+
chunk14, max14 = nil, @offset + 2
|
2370
|
+
if max14 <= @input_size
|
2371
|
+
chunk14 = @input[@offset...max14]
|
2372
|
+
end
|
2373
|
+
if chunk14 == "GE"
|
2374
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2375
|
+
@offset = @offset + 2
|
2376
|
+
else
|
2377
|
+
address2 = FAILURE
|
2378
|
+
if @offset > @failure
|
2379
|
+
@failure = @offset
|
2380
|
+
@expected = []
|
2381
|
+
end
|
2382
|
+
if @offset == @failure
|
2383
|
+
@expected << "\"GE\""
|
2384
|
+
end
|
2385
|
+
end
|
2386
|
+
if address2 == FAILURE
|
2387
|
+
@offset = index2
|
2388
|
+
chunk15, max15 = nil, @offset + 2
|
2389
|
+
if max15 <= @input_size
|
2390
|
+
chunk15 = @input[@offset...max15]
|
2391
|
+
end
|
2392
|
+
if chunk15 == "EQ"
|
2393
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2394
|
+
@offset = @offset + 2
|
2395
|
+
else
|
2396
|
+
address2 = FAILURE
|
2397
|
+
if @offset > @failure
|
2398
|
+
@failure = @offset
|
2399
|
+
@expected = []
|
2400
|
+
end
|
2401
|
+
if @offset == @failure
|
2402
|
+
@expected << "\"EQ\""
|
2403
|
+
end
|
2404
|
+
end
|
2405
|
+
if address2 == FAILURE
|
2406
|
+
@offset = index2
|
2407
|
+
chunk16, max16 = nil, @offset + 2
|
2408
|
+
if max16 <= @input_size
|
2409
|
+
chunk16 = @input[@offset...max16]
|
2410
|
+
end
|
2411
|
+
if chunk16 == "NE"
|
2412
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2413
|
+
@offset = @offset + 2
|
2414
|
+
else
|
2415
|
+
address2 = FAILURE
|
2416
|
+
if @offset > @failure
|
2417
|
+
@failure = @offset
|
2418
|
+
@expected = []
|
2419
|
+
end
|
2420
|
+
if @offset == @failure
|
2421
|
+
@expected << "\"NE\""
|
2422
|
+
end
|
2423
|
+
end
|
2424
|
+
if address2 == FAILURE
|
2425
|
+
@offset = index2
|
2426
|
+
chunk17, max17 = nil, @offset + 2
|
2427
|
+
if max17 <= @input_size
|
2428
|
+
chunk17 = @input[@offset...max17]
|
2429
|
+
end
|
2430
|
+
if chunk17 == "lt"
|
2431
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2432
|
+
@offset = @offset + 2
|
2433
|
+
else
|
2434
|
+
address2 = FAILURE
|
2435
|
+
if @offset > @failure
|
2436
|
+
@failure = @offset
|
2437
|
+
@expected = []
|
2438
|
+
end
|
2439
|
+
if @offset == @failure
|
2440
|
+
@expected << "\"lt\""
|
2441
|
+
end
|
2442
|
+
end
|
2443
|
+
if address2 == FAILURE
|
2444
|
+
@offset = index2
|
2445
|
+
chunk18, max18 = nil, @offset + 2
|
2446
|
+
if max18 <= @input_size
|
2447
|
+
chunk18 = @input[@offset...max18]
|
2448
|
+
end
|
2449
|
+
if chunk18 == "gt"
|
2450
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2451
|
+
@offset = @offset + 2
|
2452
|
+
else
|
2453
|
+
address2 = FAILURE
|
2454
|
+
if @offset > @failure
|
2455
|
+
@failure = @offset
|
2456
|
+
@expected = []
|
2457
|
+
end
|
2458
|
+
if @offset == @failure
|
2459
|
+
@expected << "\"gt\""
|
2460
|
+
end
|
2461
|
+
end
|
2462
|
+
if address2 == FAILURE
|
2463
|
+
@offset = index2
|
2464
|
+
chunk19, max19 = nil, @offset + 2
|
2465
|
+
if max19 <= @input_size
|
2466
|
+
chunk19 = @input[@offset...max19]
|
2467
|
+
end
|
2468
|
+
if chunk19 == "le"
|
2469
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2470
|
+
@offset = @offset + 2
|
2471
|
+
else
|
2472
|
+
address2 = FAILURE
|
2473
|
+
if @offset > @failure
|
2474
|
+
@failure = @offset
|
2475
|
+
@expected = []
|
2476
|
+
end
|
2477
|
+
if @offset == @failure
|
2478
|
+
@expected << "\"le\""
|
2479
|
+
end
|
2480
|
+
end
|
2481
|
+
if address2 == FAILURE
|
2482
|
+
@offset = index2
|
2483
|
+
chunk20, max20 = nil, @offset + 2
|
2484
|
+
if max20 <= @input_size
|
2485
|
+
chunk20 = @input[@offset...max20]
|
2486
|
+
end
|
2487
|
+
if chunk20 == "ge"
|
2488
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2489
|
+
@offset = @offset + 2
|
2490
|
+
else
|
2491
|
+
address2 = FAILURE
|
2492
|
+
if @offset > @failure
|
2493
|
+
@failure = @offset
|
2494
|
+
@expected = []
|
2495
|
+
end
|
2496
|
+
if @offset == @failure
|
2497
|
+
@expected << "\"ge\""
|
2498
|
+
end
|
2499
|
+
end
|
2500
|
+
if address2 == FAILURE
|
2501
|
+
@offset = index2
|
2502
|
+
chunk21, max21 = nil, @offset + 2
|
2503
|
+
if max21 <= @input_size
|
2504
|
+
chunk21 = @input[@offset...max21]
|
2505
|
+
end
|
2506
|
+
if chunk21 == "eq"
|
2507
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2508
|
+
@offset = @offset + 2
|
2509
|
+
else
|
2510
|
+
address2 = FAILURE
|
2511
|
+
if @offset > @failure
|
2512
|
+
@failure = @offset
|
2513
|
+
@expected = []
|
2514
|
+
end
|
2515
|
+
if @offset == @failure
|
2516
|
+
@expected << "\"eq\""
|
2517
|
+
end
|
2518
|
+
end
|
2519
|
+
if address2 == FAILURE
|
2520
|
+
@offset = index2
|
2521
|
+
chunk22, max22 = nil, @offset + 2
|
2522
|
+
if max22 <= @input_size
|
2523
|
+
chunk22 = @input[@offset...max22]
|
2524
|
+
end
|
2525
|
+
if chunk22 == "ne"
|
2526
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2527
|
+
@offset = @offset + 2
|
2528
|
+
else
|
2529
|
+
address2 = FAILURE
|
2530
|
+
if @offset > @failure
|
2531
|
+
@failure = @offset
|
2532
|
+
@expected = []
|
2533
|
+
end
|
2534
|
+
if @offset == @failure
|
2535
|
+
@expected << "\"ne\""
|
2536
|
+
end
|
2537
|
+
end
|
2538
|
+
if address2 == FAILURE
|
2539
|
+
@offset = index2
|
2540
|
+
chunk23, max23 = nil, @offset + 2
|
2541
|
+
if max23 <= @input_size
|
2542
|
+
chunk23 = @input[@offset...max23]
|
2543
|
+
end
|
2544
|
+
if chunk23 == "in"
|
2545
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2546
|
+
@offset = @offset + 2
|
2547
|
+
else
|
2548
|
+
address2 = FAILURE
|
2549
|
+
if @offset > @failure
|
2550
|
+
@failure = @offset
|
2551
|
+
@expected = []
|
2552
|
+
end
|
2553
|
+
if @offset == @failure
|
2554
|
+
@expected << "\"in\""
|
2555
|
+
end
|
2556
|
+
end
|
2557
|
+
if address2 == FAILURE
|
2558
|
+
@offset = index2
|
2559
|
+
chunk24, max24 = nil, @offset + 2
|
2560
|
+
if max24 <= @input_size
|
2561
|
+
chunk24 = @input[@offset...max24]
|
2562
|
+
end
|
2563
|
+
if chunk24 == "IN"
|
2564
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2565
|
+
@offset = @offset + 2
|
2566
|
+
else
|
2567
|
+
address2 = FAILURE
|
2568
|
+
if @offset > @failure
|
2569
|
+
@failure = @offset
|
2570
|
+
@expected = []
|
2571
|
+
end
|
2572
|
+
if @offset == @failure
|
2573
|
+
@expected << "\"IN\""
|
2574
|
+
end
|
2575
|
+
end
|
2576
|
+
if address2 == FAILURE
|
2577
|
+
@offset = index2
|
2578
|
+
chunk25, max25 = nil, @offset + 2
|
2579
|
+
if max25 <= @input_size
|
2580
|
+
chunk25 = @input[@offset...max25]
|
2581
|
+
end
|
2582
|
+
if chunk25 == "or"
|
2583
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2584
|
+
@offset = @offset + 2
|
2585
|
+
else
|
2586
|
+
address2 = FAILURE
|
2587
|
+
if @offset > @failure
|
2588
|
+
@failure = @offset
|
2589
|
+
@expected = []
|
2590
|
+
end
|
2591
|
+
if @offset == @failure
|
2592
|
+
@expected << "\"or\""
|
2593
|
+
end
|
2594
|
+
end
|
2595
|
+
if address2 == FAILURE
|
2596
|
+
@offset = index2
|
2597
|
+
chunk26, max26 = nil, @offset + 2
|
2598
|
+
if max26 <= @input_size
|
2599
|
+
chunk26 = @input[@offset...max26]
|
2600
|
+
end
|
2601
|
+
if chunk26 == "OR"
|
2602
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2603
|
+
@offset = @offset + 2
|
2604
|
+
else
|
2605
|
+
address2 = FAILURE
|
2606
|
+
if @offset > @failure
|
2607
|
+
@failure = @offset
|
2608
|
+
@expected = []
|
2609
|
+
end
|
2610
|
+
if @offset == @failure
|
2611
|
+
@expected << "\"OR\""
|
2612
|
+
end
|
2613
|
+
end
|
2614
|
+
if address2 == FAILURE
|
2615
|
+
@offset = index2
|
2616
|
+
chunk27, max27 = nil, @offset + 2
|
2617
|
+
if max27 <= @input_size
|
2618
|
+
chunk27 = @input[@offset...max27]
|
2619
|
+
end
|
2620
|
+
if chunk27 == "||"
|
2621
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2622
|
+
@offset = @offset + 2
|
2623
|
+
else
|
2624
|
+
address2 = FAILURE
|
2625
|
+
if @offset > @failure
|
2626
|
+
@failure = @offset
|
2627
|
+
@expected = []
|
2628
|
+
end
|
2629
|
+
if @offset == @failure
|
2630
|
+
@expected << "\"||\""
|
2631
|
+
end
|
2632
|
+
end
|
2633
|
+
if address2 == FAILURE
|
2634
|
+
@offset = index2
|
2635
|
+
chunk28, max28 = nil, @offset + 3
|
2636
|
+
if max28 <= @input_size
|
2637
|
+
chunk28 = @input[@offset...max28]
|
2638
|
+
end
|
2639
|
+
if chunk28 == "and"
|
2640
|
+
address2 = TreeNode.new(@input[@offset...@offset + 3], @offset, [])
|
2641
|
+
@offset = @offset + 3
|
2642
|
+
else
|
2643
|
+
address2 = FAILURE
|
2644
|
+
if @offset > @failure
|
2645
|
+
@failure = @offset
|
2646
|
+
@expected = []
|
2647
|
+
end
|
2648
|
+
if @offset == @failure
|
2649
|
+
@expected << "\"and\""
|
2650
|
+
end
|
2651
|
+
end
|
2652
|
+
if address2 == FAILURE
|
2653
|
+
@offset = index2
|
2654
|
+
chunk29, max29 = nil, @offset + 3
|
2655
|
+
if max29 <= @input_size
|
2656
|
+
chunk29 = @input[@offset...max29]
|
2657
|
+
end
|
2658
|
+
if chunk29 == "AND"
|
2659
|
+
address2 = TreeNode.new(@input[@offset...@offset + 3], @offset, [])
|
2660
|
+
@offset = @offset + 3
|
2661
|
+
else
|
2662
|
+
address2 = FAILURE
|
2663
|
+
if @offset > @failure
|
2664
|
+
@failure = @offset
|
2665
|
+
@expected = []
|
2666
|
+
end
|
2667
|
+
if @offset == @failure
|
2668
|
+
@expected << "\"AND\""
|
2669
|
+
end
|
2670
|
+
end
|
2671
|
+
if address2 == FAILURE
|
2672
|
+
@offset = index2
|
2673
|
+
chunk30, max30 = nil, @offset + 2
|
2674
|
+
if max30 <= @input_size
|
2675
|
+
chunk30 = @input[@offset...max30]
|
2676
|
+
end
|
2677
|
+
if chunk30 == "&&"
|
2678
|
+
address2 = TreeNode.new(@input[@offset...@offset + 2], @offset, [])
|
2679
|
+
@offset = @offset + 2
|
2680
|
+
else
|
2681
|
+
address2 = FAILURE
|
2682
|
+
if @offset > @failure
|
2683
|
+
@failure = @offset
|
2684
|
+
@expected = []
|
2685
|
+
end
|
2686
|
+
if @offset == @failure
|
2687
|
+
@expected << "\"&&\""
|
2688
|
+
end
|
2689
|
+
end
|
2690
|
+
if address2 == FAILURE
|
2691
|
+
@offset = index2
|
2692
|
+
end
|
2693
|
+
end
|
2694
|
+
end
|
2695
|
+
end
|
2696
|
+
end
|
2697
|
+
end
|
2698
|
+
end
|
2699
|
+
end
|
2700
|
+
end
|
2701
|
+
end
|
2702
|
+
end
|
2703
|
+
end
|
2704
|
+
end
|
2705
|
+
end
|
2706
|
+
end
|
2707
|
+
end
|
2708
|
+
end
|
2709
|
+
end
|
2710
|
+
end
|
2711
|
+
end
|
2712
|
+
end
|
2713
|
+
end
|
2714
|
+
end
|
2715
|
+
end
|
2716
|
+
end
|
2717
|
+
end
|
2718
|
+
end
|
2719
|
+
end
|
2720
|
+
end
|
2721
|
+
end
|
2722
|
+
end
|
2723
|
+
unless address2 == FAILURE
|
2724
|
+
elements0 << address2
|
2725
|
+
address3 = FAILURE
|
2726
|
+
address3 = _read___
|
2727
|
+
unless address3 == FAILURE
|
2728
|
+
elements0 << address3
|
2729
|
+
else
|
2730
|
+
elements0 = nil
|
2731
|
+
@offset = index1
|
2732
|
+
end
|
2733
|
+
else
|
2734
|
+
elements0 = nil
|
2735
|
+
@offset = index1
|
2736
|
+
end
|
2737
|
+
else
|
2738
|
+
elements0 = nil
|
2739
|
+
@offset = index1
|
2740
|
+
end
|
2741
|
+
if elements0.nil?
|
2742
|
+
address0 = FAILURE
|
2743
|
+
else
|
2744
|
+
address0 = @actions.make_opt(@input, index1, @offset, elements0)
|
2745
|
+
@offset = @offset
|
2746
|
+
end
|
2747
|
+
@cache[:opt_][index0] = [address0, @offset]
|
2748
|
+
return address0
|
2749
|
+
end
|
2750
|
+
|
2751
|
+
def _read___
|
2752
|
+
address0, index0 = FAILURE, @offset
|
2753
|
+
cached = @cache[:__][index0]
|
2754
|
+
if cached
|
2755
|
+
@offset = cached[1]
|
2756
|
+
return cached[0]
|
2757
|
+
end
|
2758
|
+
remaining0, index1, elements0, address1 = 0, @offset, [], true
|
2759
|
+
until address1 == FAILURE
|
2760
|
+
chunk0, max0 = nil, @offset + 1
|
2761
|
+
if max0 <= @input_size
|
2762
|
+
chunk0 = @input[@offset...max0]
|
2763
|
+
end
|
2764
|
+
if chunk0 =~ /\A[\s]/
|
2765
|
+
address1 = TreeNode.new(@input[@offset...@offset + 1], @offset, [])
|
2766
|
+
@offset = @offset + 1
|
2767
|
+
else
|
2768
|
+
address1 = FAILURE
|
2769
|
+
if @offset > @failure
|
2770
|
+
@failure = @offset
|
2771
|
+
@expected = []
|
2772
|
+
end
|
2773
|
+
if @offset == @failure
|
2774
|
+
@expected << "[\\s]"
|
2775
|
+
end
|
2776
|
+
end
|
2777
|
+
unless address1 == FAILURE
|
2778
|
+
elements0 << address1
|
2779
|
+
remaining0 -= 1
|
2780
|
+
end
|
2781
|
+
end
|
2782
|
+
if remaining0 <= 0
|
2783
|
+
address0 = TreeNode.new(@input[index1...@offset], index1, elements0)
|
2784
|
+
@offset = @offset
|
2785
|
+
else
|
2786
|
+
address0 = FAILURE
|
2787
|
+
end
|
2788
|
+
@cache[:__][index0] = [address0, @offset]
|
2789
|
+
return address0
|
2790
|
+
end
|
2791
|
+
end
|
2792
|
+
|
2793
|
+
class Parser
|
2794
|
+
include Grammar
|
2795
|
+
|
2796
|
+
def initialize(input, actions, types)
|
2797
|
+
@input = input
|
2798
|
+
@input_size = input.size
|
2799
|
+
@actions = actions
|
2800
|
+
@types = types
|
2801
|
+
@offset = 0
|
2802
|
+
@cache = Hash.new { |h,k| h[k] = {} }
|
2803
|
+
@failure = 0
|
2804
|
+
@expected = []
|
2805
|
+
end
|
2806
|
+
|
2807
|
+
def parse
|
2808
|
+
tree = _read_comp_expression
|
2809
|
+
if tree != FAILURE and @offset == @input_size
|
2810
|
+
return tree
|
2811
|
+
end
|
2812
|
+
if @expected.empty?
|
2813
|
+
@failure = @offset
|
2814
|
+
@expected << "<EOF>"
|
2815
|
+
end
|
2816
|
+
raise ParseError, Parser.format_error(@input, @failure, @expected)
|
2817
|
+
end
|
2818
|
+
|
2819
|
+
def self.format_error(input, offset, expected)
|
2820
|
+
lines, line_no, position = input.split(/\n/), 0, 0
|
2821
|
+
while position <= offset
|
2822
|
+
position += lines[line_no].size + 1
|
2823
|
+
line_no += 1
|
2824
|
+
end
|
2825
|
+
message, line = "Line #{line_no}: expected #{expected * ", "}\n", lines[line_no - 1]
|
2826
|
+
message += "#{line}\n"
|
2827
|
+
position -= line.size + 1
|
2828
|
+
message += " " * (offset - position)
|
2829
|
+
return message + "^"
|
2830
|
+
end
|
2831
|
+
end
|
2832
|
+
|
2833
|
+
def self.parse(input, options = {})
|
2834
|
+
parser = Parser.new(input, options[:actions], options[:types])
|
2835
|
+
parser.parse
|
2836
|
+
end
|
2837
|
+
end
|