racc 1.4.14 → 1.4.15-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Manifest.txt +50 -0
- data/ext/racc/com/headius/racc/Cparse.java +66 -23
- data/ext/racc/cparse.c +1 -1
- data/ext/racc/depend +1 -1
- data/lib/racc/cparse-jruby.jar +0 -0
- data/lib/racc/info.rb +2 -2
- data/test/assets/bibtex.y +141 -0
- data/test/assets/cadenza.y +170 -0
- data/test/assets/cast.y +926 -0
- data/test/assets/csspool.y +729 -0
- data/test/assets/edtf.y +583 -0
- data/test/assets/huia.y +318 -0
- data/test/assets/journey.y +47 -0
- data/test/assets/liquor.y +313 -0
- data/test/assets/machete.y +423 -0
- data/test/assets/macruby.y +2197 -0
- data/test/assets/mediacloth.y +599 -0
- data/test/assets/mof.y +649 -0
- data/test/assets/namae.y +302 -0
- data/test/assets/nasl.y +626 -0
- data/test/assets/nokogiri-css.y +255 -0
- data/test/assets/opal.y +1807 -0
- data/test/assets/php_serialization.y +98 -0
- data/test/assets/rdblockparser.y +576 -0
- data/test/assets/rdinlineparser.y +561 -0
- data/test/assets/riml.y +665 -0
- data/test/assets/ruby18.y +1943 -0
- data/test/assets/ruby19.y +2174 -0
- data/test/assets/ruby20.y +2350 -0
- data/test/assets/ruby21.y +2359 -0
- data/test/assets/ruby22.y +2381 -0
- data/test/assets/tp_plus.y +622 -0
- data/test/assets/twowaysql.y +278 -0
- data/test/helper.rb +50 -34
- data/test/regress/bibtex +474 -0
- data/test/regress/cadenza +796 -0
- data/test/regress/cast +3425 -0
- data/test/regress/csspool +2318 -0
- data/test/regress/edtf +1794 -0
- data/test/regress/huia +1392 -0
- data/test/regress/journey +222 -0
- data/test/regress/liquor +885 -0
- data/test/regress/machete +833 -0
- data/test/regress/mediacloth +1463 -0
- data/test/regress/mof +1368 -0
- data/test/regress/namae +634 -0
- data/test/regress/nasl +2058 -0
- data/test/regress/nokogiri-css +836 -0
- data/test/regress/opal +6429 -0
- data/test/regress/php_serialization +336 -0
- data/test/regress/rdblockparser +1061 -0
- data/test/regress/rdinlineparser +1243 -0
- data/test/regress/riml +3297 -0
- data/test/regress/ruby18 +6351 -0
- data/test/regress/ruby22 +7456 -0
- data/test/regress/tp_plus +1933 -0
- data/test/regress/twowaysql +556 -0
- data/test/test_racc_command.rb +177 -0
- metadata +88 -32
@@ -0,0 +1,336 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.14
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
require 'php_serialization/tokenizer'
|
10
|
+
|
11
|
+
module PhpSerialization
|
12
|
+
class Unserializer < Racc::Parser
|
13
|
+
|
14
|
+
module_eval(<<'...end php_serialization.y/module_eval...', 'php_serialization.y', 84)
|
15
|
+
def initialize(tokenizer_klass = Tokenizer)
|
16
|
+
@tokenizer_klass = tokenizer_klass
|
17
|
+
end
|
18
|
+
|
19
|
+
def run(string)
|
20
|
+
@tokenizer = @tokenizer_klass.new(string)
|
21
|
+
yyparse(@tokenizer, :each)
|
22
|
+
return @object
|
23
|
+
ensure
|
24
|
+
@tokenizer = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def next_token
|
28
|
+
@tokenizer.next_token
|
29
|
+
end
|
30
|
+
...end php_serialization.y/module_eval...
|
31
|
+
##### State transition tables begin ###
|
32
|
+
|
33
|
+
racc_action_table = [
|
34
|
+
9, 10, 18, 20, 11, 12, 13, 21, 14, 9,
|
35
|
+
10, 15, 22, 11, 12, 13, 23, 14, 24, 46,
|
36
|
+
15, 9, 10, 25, 26, 11, 12, 13, 27, 14,
|
37
|
+
9, 10, 15, 28, 11, 12, 13, 29, 14, 30,
|
38
|
+
51, 15, 31, 32, 33, 34, 35, 36, 37, 38,
|
39
|
+
39, 40, 41, 43, 49, 47, 16, 17, 19 ]
|
40
|
+
|
41
|
+
racc_action_check = [
|
42
|
+
0, 0, 3, 5, 0, 0, 0, 6, 0, 42,
|
43
|
+
42, 0, 10, 42, 42, 42, 11, 42, 12, 42,
|
44
|
+
42, 45, 45, 13, 14, 45, 45, 45, 15, 45,
|
45
|
+
50, 50, 45, 16, 50, 50, 50, 22, 50, 23,
|
46
|
+
50, 50, 24, 25, 26, 27, 32, 33, 34, 35,
|
47
|
+
36, 37, 39, 41, 47, 43, 1, 2, 4 ]
|
48
|
+
|
49
|
+
racc_action_pointer = [
|
50
|
+
-3, 56, 55, 0, 56, 1, 5, nil, nil, nil,
|
51
|
+
7, 11, 13, 18, 19, 23, 33, nil, nil, nil,
|
52
|
+
nil, nil, 31, 33, 36, 37, 38, 39, nil, nil,
|
53
|
+
nil, nil, 41, 42, 43, 39, 40, 39, nil, 47,
|
54
|
+
nil, 47, 6, 50, nil, 18, nil, 42, nil, nil,
|
55
|
+
27, nil ]
|
56
|
+
|
57
|
+
racc_action_default = [
|
58
|
+
-18, -18, -18, -18, -18, -18, -18, -6, -7, -8,
|
59
|
+
-18, -18, -18, -18, -18, -18, -18, -1, -2, -3,
|
60
|
+
-4, -5, -18, -18, -18, -18, -18, -18, 52, -9,
|
61
|
+
-10, -11, -18, -18, -18, -18, -18, -18, -12, -18,
|
62
|
+
-15, -18, -18, -18, -14, -18, -17, -18, -16, -15,
|
63
|
+
-18, -13 ]
|
64
|
+
|
65
|
+
racc_goto_table = [
|
66
|
+
1, 42, nil, nil, nil, nil, nil, nil, nil, nil,
|
67
|
+
50, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
68
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
69
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
70
|
+
nil, nil, nil, nil, nil, 48 ]
|
71
|
+
|
72
|
+
racc_goto_check = [
|
73
|
+
1, 9, nil, nil, nil, nil, nil, nil, nil, nil,
|
74
|
+
9, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
75
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
76
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
77
|
+
nil, nil, nil, nil, nil, 1 ]
|
78
|
+
|
79
|
+
racc_goto_pointer = [
|
80
|
+
nil, 0, nil, nil, nil, nil, nil, nil, nil, -39,
|
81
|
+
nil ]
|
82
|
+
|
83
|
+
racc_goto_default = [
|
84
|
+
nil, 45, 2, 3, 4, 5, 6, 7, 8, nil,
|
85
|
+
44 ]
|
86
|
+
|
87
|
+
racc_reduce_table = [
|
88
|
+
0, 0, :racc_error,
|
89
|
+
2, 16, :_reduce_1,
|
90
|
+
2, 16, :_reduce_2,
|
91
|
+
2, 16, :_reduce_3,
|
92
|
+
2, 16, :_reduce_4,
|
93
|
+
2, 16, :_reduce_5,
|
94
|
+
1, 16, :_reduce_6,
|
95
|
+
1, 16, :_reduce_7,
|
96
|
+
1, 17, :_reduce_8,
|
97
|
+
3, 18, :_reduce_9,
|
98
|
+
3, 19, :_reduce_10,
|
99
|
+
3, 20, :_reduce_11,
|
100
|
+
5, 21, :_reduce_12,
|
101
|
+
11, 23, :_reduce_13,
|
102
|
+
2, 24, :_reduce_14,
|
103
|
+
0, 24, :_reduce_15,
|
104
|
+
2, 25, :_reduce_16,
|
105
|
+
7, 22, :_reduce_17 ]
|
106
|
+
|
107
|
+
racc_reduce_n = 18
|
108
|
+
|
109
|
+
racc_shift_n = 52
|
110
|
+
|
111
|
+
racc_token_table = {
|
112
|
+
false => 0,
|
113
|
+
:error => 1,
|
114
|
+
";" => 2,
|
115
|
+
"N" => 3,
|
116
|
+
"b" => 4,
|
117
|
+
":" => 5,
|
118
|
+
:NUMBER => 6,
|
119
|
+
"i" => 7,
|
120
|
+
"d" => 8,
|
121
|
+
"s" => 9,
|
122
|
+
:STRING => 10,
|
123
|
+
"O" => 11,
|
124
|
+
"{" => 12,
|
125
|
+
"}" => 13,
|
126
|
+
"a" => 14 }
|
127
|
+
|
128
|
+
racc_nt_base = 15
|
129
|
+
|
130
|
+
racc_use_result_var = true
|
131
|
+
|
132
|
+
Racc_arg = [
|
133
|
+
racc_action_table,
|
134
|
+
racc_action_check,
|
135
|
+
racc_action_default,
|
136
|
+
racc_action_pointer,
|
137
|
+
racc_goto_table,
|
138
|
+
racc_goto_check,
|
139
|
+
racc_goto_default,
|
140
|
+
racc_goto_pointer,
|
141
|
+
racc_nt_base,
|
142
|
+
racc_reduce_table,
|
143
|
+
racc_token_table,
|
144
|
+
racc_shift_n,
|
145
|
+
racc_reduce_n,
|
146
|
+
racc_use_result_var ]
|
147
|
+
|
148
|
+
Racc_token_to_s_table = [
|
149
|
+
"$end",
|
150
|
+
"error",
|
151
|
+
"\";\"",
|
152
|
+
"\"N\"",
|
153
|
+
"\"b\"",
|
154
|
+
"\":\"",
|
155
|
+
"NUMBER",
|
156
|
+
"\"i\"",
|
157
|
+
"\"d\"",
|
158
|
+
"\"s\"",
|
159
|
+
"STRING",
|
160
|
+
"\"O\"",
|
161
|
+
"\"{\"",
|
162
|
+
"\"}\"",
|
163
|
+
"\"a\"",
|
164
|
+
"$start",
|
165
|
+
"data",
|
166
|
+
"null",
|
167
|
+
"bool",
|
168
|
+
"integer",
|
169
|
+
"double",
|
170
|
+
"string",
|
171
|
+
"assoc_array",
|
172
|
+
"object",
|
173
|
+
"attribute_list",
|
174
|
+
"attribute" ]
|
175
|
+
|
176
|
+
Racc_debug_parser = false
|
177
|
+
|
178
|
+
##### State transition tables end #####
|
179
|
+
|
180
|
+
# reduce 0 omitted
|
181
|
+
|
182
|
+
module_eval(<<'.,.,', 'php_serialization.y', 6)
|
183
|
+
def _reduce_1(val, _values, result)
|
184
|
+
@object = val[0]
|
185
|
+
result
|
186
|
+
end
|
187
|
+
.,.,
|
188
|
+
|
189
|
+
module_eval(<<'.,.,', 'php_serialization.y', 7)
|
190
|
+
def _reduce_2(val, _values, result)
|
191
|
+
@object = val[0]
|
192
|
+
result
|
193
|
+
end
|
194
|
+
.,.,
|
195
|
+
|
196
|
+
module_eval(<<'.,.,', 'php_serialization.y', 8)
|
197
|
+
def _reduce_3(val, _values, result)
|
198
|
+
@object = val[0]
|
199
|
+
result
|
200
|
+
end
|
201
|
+
.,.,
|
202
|
+
|
203
|
+
module_eval(<<'.,.,', 'php_serialization.y', 9)
|
204
|
+
def _reduce_4(val, _values, result)
|
205
|
+
@object = val[0]
|
206
|
+
result
|
207
|
+
end
|
208
|
+
.,.,
|
209
|
+
|
210
|
+
module_eval(<<'.,.,', 'php_serialization.y', 10)
|
211
|
+
def _reduce_5(val, _values, result)
|
212
|
+
@object = val[0]
|
213
|
+
result
|
214
|
+
end
|
215
|
+
.,.,
|
216
|
+
|
217
|
+
module_eval(<<'.,.,', 'php_serialization.y', 11)
|
218
|
+
def _reduce_6(val, _values, result)
|
219
|
+
@object = val[0]
|
220
|
+
result
|
221
|
+
end
|
222
|
+
.,.,
|
223
|
+
|
224
|
+
module_eval(<<'.,.,', 'php_serialization.y', 12)
|
225
|
+
def _reduce_7(val, _values, result)
|
226
|
+
@object = val[0]
|
227
|
+
result
|
228
|
+
end
|
229
|
+
.,.,
|
230
|
+
|
231
|
+
module_eval(<<'.,.,', 'php_serialization.y', 15)
|
232
|
+
def _reduce_8(val, _values, result)
|
233
|
+
result = nil
|
234
|
+
result
|
235
|
+
end
|
236
|
+
.,.,
|
237
|
+
|
238
|
+
module_eval(<<'.,.,', 'php_serialization.y', 18)
|
239
|
+
def _reduce_9(val, _values, result)
|
240
|
+
result = Integer(val[2]) > 0
|
241
|
+
result
|
242
|
+
end
|
243
|
+
.,.,
|
244
|
+
|
245
|
+
module_eval(<<'.,.,', 'php_serialization.y', 21)
|
246
|
+
def _reduce_10(val, _values, result)
|
247
|
+
result = Integer(val[2])
|
248
|
+
result
|
249
|
+
end
|
250
|
+
.,.,
|
251
|
+
|
252
|
+
module_eval(<<'.,.,', 'php_serialization.y', 24)
|
253
|
+
def _reduce_11(val, _values, result)
|
254
|
+
result = Float(val[2])
|
255
|
+
result
|
256
|
+
end
|
257
|
+
.,.,
|
258
|
+
|
259
|
+
module_eval(<<'.,.,', 'php_serialization.y', 27)
|
260
|
+
def _reduce_12(val, _values, result)
|
261
|
+
result = val[4]
|
262
|
+
result
|
263
|
+
end
|
264
|
+
.,.,
|
265
|
+
|
266
|
+
module_eval(<<'.,.,', 'php_serialization.y', 32)
|
267
|
+
def _reduce_13(val, _values, result)
|
268
|
+
if eval("defined?(#{val[4]})")
|
269
|
+
result = Object.const_get(val[4]).new
|
270
|
+
|
271
|
+
val[9].each do |(attr_name, value)|
|
272
|
+
# Protected and private attributes will have a \0..\0 prefix
|
273
|
+
attr_name = attr_name.gsub(/\A\\0[^\\]+\\0/, '')
|
274
|
+
result.instance_variable_set("@#{attr_name}", value)
|
275
|
+
end
|
276
|
+
else
|
277
|
+
klass_name = val[4].gsub(/^Struct::/, '')
|
278
|
+
attr_names, values = [], []
|
279
|
+
|
280
|
+
val[9].each do |(attr_name, value)|
|
281
|
+
# Protected and private attributes will have a \0..\0 prefix
|
282
|
+
attr_names << attr_name.gsub(/\A\\0[^\\]+\\0/, '')
|
283
|
+
values << value
|
284
|
+
end
|
285
|
+
|
286
|
+
result = Struct.new(klass_name, *attr_names).new(*values)
|
287
|
+
result.instance_variable_set("@_php_class", klass_name)
|
288
|
+
end
|
289
|
+
|
290
|
+
result
|
291
|
+
end
|
292
|
+
.,.,
|
293
|
+
|
294
|
+
module_eval(<<'.,.,', 'php_serialization.y', 56)
|
295
|
+
def _reduce_14(val, _values, result)
|
296
|
+
result = val[0] << val[1]
|
297
|
+
result
|
298
|
+
end
|
299
|
+
.,.,
|
300
|
+
|
301
|
+
module_eval(<<'.,.,', 'php_serialization.y', 57)
|
302
|
+
def _reduce_15(val, _values, result)
|
303
|
+
result = []
|
304
|
+
result
|
305
|
+
end
|
306
|
+
.,.,
|
307
|
+
|
308
|
+
module_eval(<<'.,.,', 'php_serialization.y', 60)
|
309
|
+
def _reduce_16(val, _values, result)
|
310
|
+
result = val
|
311
|
+
result
|
312
|
+
end
|
313
|
+
.,.,
|
314
|
+
|
315
|
+
module_eval(<<'.,.,', 'php_serialization.y', 65)
|
316
|
+
def _reduce_17(val, _values, result)
|
317
|
+
# Checks if the keys are a sequence of integers
|
318
|
+
idx = -1
|
319
|
+
arr = val[5].all? { |(k,v)| k == (idx += 1) }
|
320
|
+
|
321
|
+
if arr
|
322
|
+
result = val[5].map { |(k,v)| v }
|
323
|
+
else
|
324
|
+
result = Hash[val[5]]
|
325
|
+
end
|
326
|
+
|
327
|
+
result
|
328
|
+
end
|
329
|
+
.,.,
|
330
|
+
|
331
|
+
def _reduce_none(val, _values, result)
|
332
|
+
val[0]
|
333
|
+
end
|
334
|
+
|
335
|
+
end # class Unserializer
|
336
|
+
end # module PhpSerialization
|
@@ -0,0 +1,1061 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.14
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
require "rd/rdinlineparser.tab.rb"
|
10
|
+
require "rd/parser-util"
|
11
|
+
|
12
|
+
module RD
|
13
|
+
class RDParser < Racc::Parser
|
14
|
+
|
15
|
+
module_eval(<<'...end rdblockparser.y/module_eval...', 'rdblockparser.y', 289)
|
16
|
+
include ParserUtility
|
17
|
+
|
18
|
+
TMPFILE = ["rdtmp", $$, 0]
|
19
|
+
|
20
|
+
attr_reader :tree
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
@inline_parser = RDInlineParser.new(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse(src, tree)
|
27
|
+
@src = src
|
28
|
+
@src.push(false)
|
29
|
+
# RDtree
|
30
|
+
@tree = tree
|
31
|
+
|
32
|
+
# @i: index(line no.) of src
|
33
|
+
@i = 0
|
34
|
+
# stack for current indentation
|
35
|
+
@indent_stack = []
|
36
|
+
# how indented.
|
37
|
+
@current_indent = @indent_stack.join("")
|
38
|
+
# RDParser for tmp src
|
39
|
+
@subparser = nil
|
40
|
+
# which part is in now
|
41
|
+
@in_part = nil
|
42
|
+
@part_content = []
|
43
|
+
|
44
|
+
@in_verbatim = false
|
45
|
+
|
46
|
+
@yydebug = true
|
47
|
+
do_parse
|
48
|
+
end
|
49
|
+
|
50
|
+
def next_token
|
51
|
+
# preprocessing
|
52
|
+
# if it is not in RD part
|
53
|
+
# => method
|
54
|
+
while @in_part != "rd"
|
55
|
+
line = @src[@i]
|
56
|
+
@i += 1 # next line
|
57
|
+
|
58
|
+
case line
|
59
|
+
# src end
|
60
|
+
when false
|
61
|
+
return [false, false]
|
62
|
+
# RD part begin
|
63
|
+
when /^=begin\s*(?:\bRD\b.*)?\s*$/
|
64
|
+
if @in_part # if in non-RD part
|
65
|
+
@part_content.push(line)
|
66
|
+
else
|
67
|
+
@in_part = "rd"
|
68
|
+
return [:WHITELINE, "=begin\n"] # <= for textblockand
|
69
|
+
end
|
70
|
+
# non-RD part begin
|
71
|
+
when /^=begin\s+(\w+)/
|
72
|
+
part = $1
|
73
|
+
if @in_part # if in non-RD part
|
74
|
+
@part_content.push(line)
|
75
|
+
else
|
76
|
+
@in_part = part if @tree.filter[part] # if filter exists
|
77
|
+
# p "BEGIN_PART: #{@in_part}" # DEBUG
|
78
|
+
end
|
79
|
+
# non-RD part end
|
80
|
+
when /^=end/
|
81
|
+
if @in_part # if in non-RD part
|
82
|
+
# p "END_PART: #{@in_part}" # DEBUG
|
83
|
+
# make Part-in object
|
84
|
+
part = RD::Part.new(@part_content.join(""), @tree, "r")
|
85
|
+
@part_content.clear
|
86
|
+
# call filter, part_out is output(Part object)
|
87
|
+
part_out = @tree.filter[@in_part].call(part)
|
88
|
+
|
89
|
+
if @tree.filter[@in_part].mode == :rd # if output is RD formated
|
90
|
+
subtree = parse_subtree( (RUBY_VERSION >= '1.9.0' ? part_out.lines.to_a : part_out.to_a ) )
|
91
|
+
else # if output is target formated
|
92
|
+
basename = TMPFILE.join('.')
|
93
|
+
TMPFILE[-1] += 1
|
94
|
+
tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
|
95
|
+
tmpfile.print(part_out)
|
96
|
+
tmpfile.close
|
97
|
+
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
|
98
|
+
end
|
99
|
+
@in_part = nil
|
100
|
+
return [:SUBTREE, subtree]
|
101
|
+
end
|
102
|
+
else
|
103
|
+
if @in_part # if in non-RD part
|
104
|
+
@part_content.push(line)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
@current_indent = @indent_stack.join("")
|
110
|
+
line = @src[@i]
|
111
|
+
case line
|
112
|
+
when false
|
113
|
+
if_current_indent_equal("") do
|
114
|
+
[false, false]
|
115
|
+
end
|
116
|
+
when /^=end/
|
117
|
+
if_current_indent_equal("") do
|
118
|
+
@in_part = nil
|
119
|
+
[:WHITELINE, "=end"] # MUST CHANGE??
|
120
|
+
end
|
121
|
+
when /^\s*$/
|
122
|
+
@i += 1 # next line
|
123
|
+
return [:WHITELINE, ':WHITELINE']
|
124
|
+
when /^\#/ # comment line
|
125
|
+
@i += 1 # next line
|
126
|
+
self.next_token()
|
127
|
+
when /^(={1,4})(?!=)\s*(?=\S)/, /^(\+{1,2})(?!\+)\s*(?=\S)/
|
128
|
+
rest = $' # '
|
129
|
+
rest.strip!
|
130
|
+
mark = $1
|
131
|
+
if_current_indent_equal("") do
|
132
|
+
return [:HEADLINE, [Headline.mark_to_level(mark), rest]]
|
133
|
+
end
|
134
|
+
when /^<<<\s*(\S+)/
|
135
|
+
file = $1
|
136
|
+
if_current_indent_equal("") do
|
137
|
+
suffix = file[-3 .. -1]
|
138
|
+
if suffix == ".rd" or suffix == ".rb"
|
139
|
+
subtree = parse_subtree(get_included(file))
|
140
|
+
[:SUBTREE, subtree]
|
141
|
+
else
|
142
|
+
[:INCLUDE, file]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
when /^(\s*)\*(\s*)/
|
146
|
+
rest = $' # '
|
147
|
+
newIndent = $2
|
148
|
+
if_current_indent_equal($1) do
|
149
|
+
if @in_verbatim
|
150
|
+
[:STRINGLINE, line]
|
151
|
+
else
|
152
|
+
@indent_stack.push("\s" << newIndent)
|
153
|
+
[:ITEMLISTLINE, rest]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
when /^(\s*)(\(\d+\))(\s*)/
|
157
|
+
rest = $' # '
|
158
|
+
mark = $2
|
159
|
+
newIndent = $3
|
160
|
+
if_current_indent_equal($1) do
|
161
|
+
if @in_verbatim
|
162
|
+
[:STRINGLINE, line]
|
163
|
+
else
|
164
|
+
@indent_stack.push("\s" * mark.size << newIndent)
|
165
|
+
[:ENUMLISTLINE, rest]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
when /^(\s*):(\s*)/
|
169
|
+
rest = $' # '
|
170
|
+
newIndent = $2
|
171
|
+
if_current_indent_equal($1) do
|
172
|
+
if @in_verbatim
|
173
|
+
[:STRINGLINE, line]
|
174
|
+
else
|
175
|
+
@indent_stack.push("\s" << $2)
|
176
|
+
[:DESCLISTLINE, rest]
|
177
|
+
end
|
178
|
+
end
|
179
|
+
when /^(\s*)---(?!-|\s*$)/
|
180
|
+
indent = $1
|
181
|
+
rest = $'
|
182
|
+
/\s*/ === rest
|
183
|
+
term = $'
|
184
|
+
new_indent = $&
|
185
|
+
if_current_indent_equal(indent) do
|
186
|
+
if @in_verbatim
|
187
|
+
[:STRINGLINE, line]
|
188
|
+
else
|
189
|
+
@indent_stack.push("\s\s\s" + new_indent)
|
190
|
+
[:METHODLISTLINE, term]
|
191
|
+
end
|
192
|
+
end
|
193
|
+
when /^(\s*)/
|
194
|
+
if_current_indent_equal($1) do
|
195
|
+
[:STRINGLINE, line]
|
196
|
+
end
|
197
|
+
else
|
198
|
+
raise "[BUG] parsing error may occured."
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
=begin private
|
203
|
+
--- RDParser#if_current_indent_equal(indent)
|
204
|
+
if (({@current_indent == ((|indent|))})) then yield block, otherwise
|
205
|
+
process indentation.
|
206
|
+
=end
|
207
|
+
# always @current_indent = @indent_stack.join("")
|
208
|
+
def if_current_indent_equal(indent)
|
209
|
+
indent = indent.sub(/\t/, "\s" * 8)
|
210
|
+
if @current_indent == indent
|
211
|
+
@i += 1 # next line
|
212
|
+
yield
|
213
|
+
elsif indent.index(@current_indent) == 0
|
214
|
+
@indent_stack.push(indent[@current_indent.size .. -1])
|
215
|
+
[:INDENT, ":INDENT"]
|
216
|
+
else
|
217
|
+
@indent_stack.pop
|
218
|
+
[:DEDENT, ":DEDENT"]
|
219
|
+
end
|
220
|
+
end
|
221
|
+
private :if_current_indent_equal
|
222
|
+
|
223
|
+
def cut_off(src)
|
224
|
+
ret = []
|
225
|
+
whiteline_buf = []
|
226
|
+
line = src.shift
|
227
|
+
/^\s*/ =~ line
|
228
|
+
indent = Regexp.quote($&)
|
229
|
+
ret.push($') # '
|
230
|
+
while line = src.shift
|
231
|
+
if /^(\s*)$/ =~ line
|
232
|
+
whiteline_buf.push(line)
|
233
|
+
elsif /^#{indent}/ =~ line
|
234
|
+
unless whiteline_buf.empty?
|
235
|
+
ret.concat(whiteline_buf)
|
236
|
+
whiteline_buf.clear
|
237
|
+
end
|
238
|
+
ret.push($') # '
|
239
|
+
else
|
240
|
+
raise "[BUG]: probably Parser Error while cutting off.\n"
|
241
|
+
end
|
242
|
+
end
|
243
|
+
ret
|
244
|
+
end
|
245
|
+
private :cut_off
|
246
|
+
|
247
|
+
def set_term_to_element(parent, term)
|
248
|
+
# parent.set_term_under_document_struct(term, @tree.document_struct)
|
249
|
+
parent.set_term_without_document_struct(term)
|
250
|
+
end
|
251
|
+
private :set_term_to_element
|
252
|
+
|
253
|
+
def on_error( et, ev, _values )
|
254
|
+
line = @src[@i]
|
255
|
+
prv, cur, nxt = format_line_num(@i, @i+1, @i+2)
|
256
|
+
|
257
|
+
raise ParseError, <<Msg
|
258
|
+
|
259
|
+
RD syntax error: line #{@i+1}:
|
260
|
+
#{prv} |#{@src[@i-1].chomp}
|
261
|
+
#{cur}=>|#{@src[@i].chomp}
|
262
|
+
#{nxt} |#{@src[@i+1].chomp}
|
263
|
+
|
264
|
+
Msg
|
265
|
+
end
|
266
|
+
|
267
|
+
def line_index
|
268
|
+
@i
|
269
|
+
end
|
270
|
+
|
271
|
+
def parse_subtree(src)
|
272
|
+
@subparser = RD::RDParser.new() unless @subparser
|
273
|
+
|
274
|
+
@subparser.parse(src, @tree)
|
275
|
+
end
|
276
|
+
private :parse_subtree
|
277
|
+
|
278
|
+
def get_included(file)
|
279
|
+
included = ""
|
280
|
+
@tree.include_path.each do |dir|
|
281
|
+
file_name = dir + "/" + file
|
282
|
+
if test(?e, file_name)
|
283
|
+
included = IO.readlines(file_name)
|
284
|
+
break
|
285
|
+
end
|
286
|
+
end
|
287
|
+
included
|
288
|
+
end
|
289
|
+
private :get_included
|
290
|
+
|
291
|
+
def format_line_num(*args)
|
292
|
+
width = args.collect{|i| i.to_s.length }.max
|
293
|
+
args.collect{|i| sprintf("%#{width}d", i) }
|
294
|
+
end
|
295
|
+
private :format_line_num
|
296
|
+
|
297
|
+
...end rdblockparser.y/module_eval...
|
298
|
+
##### State transition tables begin ###
|
299
|
+
|
300
|
+
racc_action_table = [
|
301
|
+
34, 35, 30, 33, 40, 34, 35, 30, 33, 40,
|
302
|
+
65, 34, 35, 30, 33, 14, 73, 14, 54, 76,
|
303
|
+
15, 88, 34, 35, 30, 33, 14, 73, 77, 33,
|
304
|
+
54, 15, 34, 35, 30, 33, 14, 73, 81, 38,
|
305
|
+
38, 15, 34, 35, 30, 33, 14, 73, 40, 36,
|
306
|
+
83, 15, 34, 35, 30, 33, 54, 47, 30, 35,
|
307
|
+
34, 15, 34, 35, 30, 33, 14, 73, 38, 67,
|
308
|
+
59, 15, 34, 35, 30, 33, 14, 9, 10, 11,
|
309
|
+
12, 15, 34, 35, 30, 33, 14, 73, 14, nil,
|
310
|
+
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
311
|
+
nil, 15, 34, 35, 30, 33, nil, 47, nil, nil,
|
312
|
+
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
313
|
+
nil, 15, 34, 35, 30, 33, 14, 73, nil, nil,
|
314
|
+
nil, 15, 34, 35, 30, 33, 14, 9, 10, 11,
|
315
|
+
12, 15, 34, 35, 30, 33, 14, 73, 61, 63,
|
316
|
+
nil, 15, 14, 62, 60, 61, 63, 79, 61, 63,
|
317
|
+
62, 87, nil, 62, 34, 35, 30, 33 ]
|
318
|
+
|
319
|
+
racc_action_check = [
|
320
|
+
41, 41, 41, 41, 41, 15, 15, 15, 15, 15,
|
321
|
+
41, 86, 86, 86, 86, 86, 86, 34, 33, 49,
|
322
|
+
86, 86, 85, 85, 85, 85, 85, 85, 51, 31,
|
323
|
+
54, 85, 79, 79, 79, 79, 79, 79, 56, 57,
|
324
|
+
58, 79, 78, 78, 78, 78, 78, 78, 62, 1,
|
325
|
+
66, 78, 24, 24, 24, 24, 30, 24, 28, 25,
|
326
|
+
22, 24, 75, 75, 75, 75, 75, 75, 13, 44,
|
327
|
+
36, 75, 2, 2, 2, 2, 2, 2, 2, 2,
|
328
|
+
2, 2, 46, 46, 46, 46, 46, 46, 35, nil,
|
329
|
+
nil, 46, 45, 45, 45, 45, 45, 45, nil, nil,
|
330
|
+
nil, 45, 27, 27, 27, 27, nil, 27, nil, nil,
|
331
|
+
nil, 27, 74, 74, 74, 74, 74, 74, nil, nil,
|
332
|
+
nil, 74, 68, 68, 68, 68, 68, 68, nil, nil,
|
333
|
+
nil, 68, 0, 0, 0, 0, 0, 0, 0, 0,
|
334
|
+
0, 0, 47, 47, 47, 47, 47, 47, 39, 39,
|
335
|
+
nil, 47, 52, 39, 39, 82, 82, 52, 64, 64,
|
336
|
+
82, 82, nil, 64, 20, 20, 20, 20 ]
|
337
|
+
|
338
|
+
racc_action_pointer = [
|
339
|
+
129, 49, 69, nil, nil, nil, nil, nil, nil, nil,
|
340
|
+
nil, nil, nil, 61, nil, 2, nil, nil, nil, nil,
|
341
|
+
161, nil, 57, nil, 49, 55, nil, 99, 53, nil,
|
342
|
+
48, 23, nil, 10, 10, 81, 70, nil, nil, 141,
|
343
|
+
nil, -3, nil, nil, 56, 89, 79, 139, nil, 6,
|
344
|
+
nil, 15, 145, nil, 22, nil, 25, 32, 33, nil,
|
345
|
+
nil, nil, 41, nil, 151, nil, 37, nil, 119, nil,
|
346
|
+
nil, nil, nil, nil, 109, 59, nil, nil, 39, 29,
|
347
|
+
nil, nil, 148, nil, nil, 19, 8, nil, nil ]
|
348
|
+
|
349
|
+
racc_action_default = [
|
350
|
+
-2, -73, -1, -4, -5, -6, -7, -8, -9, -10,
|
351
|
+
-11, -12, -13, -14, -16, -73, -23, -24, -25, -26,
|
352
|
+
-27, -31, -32, -34, -72, -36, -38, -72, -40, -42,
|
353
|
+
-59, -44, -46, -59, -63, -65, -73, -3, -15, -73,
|
354
|
+
-22, -73, -30, -33, -73, -69, -70, -71, -37, -73,
|
355
|
+
-41, -73, -51, -58, -61, -45, -73, -62, -64, 89,
|
356
|
+
-17, -19, -73, -21, -18, -28, -73, -35, -66, -53,
|
357
|
+
-54, -55, -56, -57, -67, -68, -39, -43, -49, -73,
|
358
|
+
-60, -47, -73, -29, -52, -48, -73, -20, -50 ]
|
359
|
+
|
360
|
+
racc_goto_table = [
|
361
|
+
4, 39, 4, 68, 74, 75, 6, 5, 6, 5,
|
362
|
+
44, 42, 51, 49, 3, 56, 37, 57, 58, 80,
|
363
|
+
2, 66, 84, 41, 43, 48, 50, 64, 84, 84,
|
364
|
+
46, 45, 42, 46, 45, 55, 85, 86, 1, 84,
|
365
|
+
84, nil, nil, nil, nil, nil, nil, nil, 82, nil,
|
366
|
+
nil, nil, 78 ]
|
367
|
+
|
368
|
+
racc_goto_check = [
|
369
|
+
4, 10, 4, 31, 31, 31, 6, 5, 6, 5,
|
370
|
+
21, 12, 27, 21, 3, 27, 3, 9, 9, 33,
|
371
|
+
2, 11, 32, 17, 19, 23, 26, 10, 32, 32,
|
372
|
+
6, 5, 12, 6, 5, 29, 31, 31, 1, 32,
|
373
|
+
32, nil, nil, nil, nil, nil, nil, nil, 10, nil,
|
374
|
+
nil, nil, 4 ]
|
375
|
+
|
376
|
+
racc_goto_pointer = [
|
377
|
+
nil, 38, 20, 14, 0, 7, 6, nil, nil, -17,
|
378
|
+
-14, -20, -9, nil, nil, nil, nil, 8, nil, 2,
|
379
|
+
nil, -14, nil, 0, nil, nil, -2, -18, nil, 4,
|
380
|
+
nil, -42, -46, -35 ]
|
381
|
+
|
382
|
+
racc_goto_default = [
|
383
|
+
nil, nil, nil, nil, 70, 71, 72, 7, 8, 13,
|
384
|
+
nil, nil, 21, 16, 17, 18, 19, 20, 22, 23,
|
385
|
+
24, nil, 25, 26, 27, 28, 29, nil, 31, 32,
|
386
|
+
52, nil, 69, 53 ]
|
387
|
+
|
388
|
+
racc_reduce_table = [
|
389
|
+
0, 0, :racc_error,
|
390
|
+
1, 15, :_reduce_1,
|
391
|
+
0, 15, :_reduce_2,
|
392
|
+
2, 16, :_reduce_3,
|
393
|
+
1, 16, :_reduce_none,
|
394
|
+
1, 17, :_reduce_5,
|
395
|
+
1, 17, :_reduce_6,
|
396
|
+
1, 17, :_reduce_none,
|
397
|
+
1, 17, :_reduce_8,
|
398
|
+
1, 17, :_reduce_9,
|
399
|
+
1, 17, :_reduce_10,
|
400
|
+
1, 17, :_reduce_11,
|
401
|
+
1, 21, :_reduce_12,
|
402
|
+
1, 22, :_reduce_13,
|
403
|
+
1, 18, :_reduce_14,
|
404
|
+
2, 23, :_reduce_15,
|
405
|
+
1, 23, :_reduce_16,
|
406
|
+
3, 19, :_reduce_17,
|
407
|
+
1, 25, :_reduce_18,
|
408
|
+
2, 24, :_reduce_19,
|
409
|
+
4, 24, :_reduce_20,
|
410
|
+
2, 24, :_reduce_21,
|
411
|
+
1, 24, :_reduce_22,
|
412
|
+
1, 26, :_reduce_none,
|
413
|
+
1, 26, :_reduce_none,
|
414
|
+
1, 26, :_reduce_none,
|
415
|
+
1, 26, :_reduce_none,
|
416
|
+
1, 20, :_reduce_none,
|
417
|
+
3, 20, :_reduce_28,
|
418
|
+
4, 20, :_reduce_29,
|
419
|
+
2, 31, :_reduce_30,
|
420
|
+
1, 31, :_reduce_31,
|
421
|
+
1, 27, :_reduce_32,
|
422
|
+
2, 32, :_reduce_33,
|
423
|
+
1, 32, :_reduce_34,
|
424
|
+
3, 33, :_reduce_35,
|
425
|
+
1, 28, :_reduce_36,
|
426
|
+
2, 36, :_reduce_37,
|
427
|
+
1, 36, :_reduce_38,
|
428
|
+
3, 37, :_reduce_39,
|
429
|
+
1, 29, :_reduce_40,
|
430
|
+
2, 39, :_reduce_41,
|
431
|
+
1, 39, :_reduce_42,
|
432
|
+
3, 40, :_reduce_43,
|
433
|
+
1, 30, :_reduce_44,
|
434
|
+
2, 42, :_reduce_45,
|
435
|
+
1, 42, :_reduce_46,
|
436
|
+
3, 43, :_reduce_47,
|
437
|
+
3, 41, :_reduce_48,
|
438
|
+
2, 41, :_reduce_49,
|
439
|
+
4, 41, :_reduce_50,
|
440
|
+
1, 41, :_reduce_51,
|
441
|
+
2, 45, :_reduce_52,
|
442
|
+
1, 45, :_reduce_none,
|
443
|
+
1, 46, :_reduce_54,
|
444
|
+
1, 46, :_reduce_55,
|
445
|
+
1, 46, :_reduce_none,
|
446
|
+
1, 46, :_reduce_57,
|
447
|
+
1, 44, :_reduce_none,
|
448
|
+
0, 44, :_reduce_none,
|
449
|
+
2, 47, :_reduce_none,
|
450
|
+
1, 47, :_reduce_none,
|
451
|
+
2, 34, :_reduce_62,
|
452
|
+
1, 34, :_reduce_63,
|
453
|
+
2, 38, :_reduce_64,
|
454
|
+
1, 38, :_reduce_65,
|
455
|
+
2, 35, :_reduce_66,
|
456
|
+
2, 35, :_reduce_67,
|
457
|
+
2, 35, :_reduce_68,
|
458
|
+
1, 35, :_reduce_69,
|
459
|
+
1, 35, :_reduce_none,
|
460
|
+
1, 35, :_reduce_71,
|
461
|
+
0, 35, :_reduce_72 ]
|
462
|
+
|
463
|
+
racc_reduce_n = 73
|
464
|
+
|
465
|
+
racc_shift_n = 89
|
466
|
+
|
467
|
+
racc_token_table = {
|
468
|
+
false => 0,
|
469
|
+
:error => 1,
|
470
|
+
:DUMMY => 2,
|
471
|
+
:ITEMLISTLINE => 3,
|
472
|
+
:ENUMLISTLINE => 4,
|
473
|
+
:DESCLISTLINE => 5,
|
474
|
+
:METHODLISTLINE => 6,
|
475
|
+
:STRINGLINE => 7,
|
476
|
+
:WHITELINE => 8,
|
477
|
+
:SUBTREE => 9,
|
478
|
+
:HEADLINE => 10,
|
479
|
+
:INCLUDE => 11,
|
480
|
+
:INDENT => 12,
|
481
|
+
:DEDENT => 13 }
|
482
|
+
|
483
|
+
racc_nt_base = 14
|
484
|
+
|
485
|
+
racc_use_result_var = true
|
486
|
+
|
487
|
+
Racc_arg = [
|
488
|
+
racc_action_table,
|
489
|
+
racc_action_check,
|
490
|
+
racc_action_default,
|
491
|
+
racc_action_pointer,
|
492
|
+
racc_goto_table,
|
493
|
+
racc_goto_check,
|
494
|
+
racc_goto_default,
|
495
|
+
racc_goto_pointer,
|
496
|
+
racc_nt_base,
|
497
|
+
racc_reduce_table,
|
498
|
+
racc_token_table,
|
499
|
+
racc_shift_n,
|
500
|
+
racc_reduce_n,
|
501
|
+
racc_use_result_var ]
|
502
|
+
|
503
|
+
Racc_token_to_s_table = [
|
504
|
+
"$end",
|
505
|
+
"error",
|
506
|
+
"DUMMY",
|
507
|
+
"ITEMLISTLINE",
|
508
|
+
"ENUMLISTLINE",
|
509
|
+
"DESCLISTLINE",
|
510
|
+
"METHODLISTLINE",
|
511
|
+
"STRINGLINE",
|
512
|
+
"WHITELINE",
|
513
|
+
"SUBTREE",
|
514
|
+
"HEADLINE",
|
515
|
+
"INCLUDE",
|
516
|
+
"INDENT",
|
517
|
+
"DEDENT",
|
518
|
+
"$start",
|
519
|
+
"document",
|
520
|
+
"blocks",
|
521
|
+
"block",
|
522
|
+
"textblock",
|
523
|
+
"verbatim",
|
524
|
+
"lists",
|
525
|
+
"headline",
|
526
|
+
"include",
|
527
|
+
"textblockcontent",
|
528
|
+
"verbatimcontent",
|
529
|
+
"verbatim_after_lists",
|
530
|
+
"list",
|
531
|
+
"itemlist",
|
532
|
+
"enumlist",
|
533
|
+
"desclist",
|
534
|
+
"methodlist",
|
535
|
+
"lists2",
|
536
|
+
"itemlistitems",
|
537
|
+
"itemlistitem",
|
538
|
+
"first_textblock_in_itemlist",
|
539
|
+
"other_blocks_in_list",
|
540
|
+
"enumlistitems",
|
541
|
+
"enumlistitem",
|
542
|
+
"first_textblock_in_enumlist",
|
543
|
+
"desclistitems",
|
544
|
+
"desclistitem",
|
545
|
+
"description_part",
|
546
|
+
"methodlistitems",
|
547
|
+
"methodlistitem",
|
548
|
+
"whitelines",
|
549
|
+
"blocks_in_list",
|
550
|
+
"block_in_list",
|
551
|
+
"whitelines2" ]
|
552
|
+
|
553
|
+
Racc_debug_parser = false
|
554
|
+
|
555
|
+
##### State transition tables end #####
|
556
|
+
|
557
|
+
# reduce 0 omitted
|
558
|
+
|
559
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 70)
|
560
|
+
def _reduce_1(val, _values, result)
|
561
|
+
result = DocumentElement.new
|
562
|
+
add_children_to_element(result, *val[0])
|
563
|
+
|
564
|
+
result
|
565
|
+
end
|
566
|
+
.,.,
|
567
|
+
|
568
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 74)
|
569
|
+
def _reduce_2(val, _values, result)
|
570
|
+
raise ParseError,
|
571
|
+
"Error: file empty."
|
572
|
+
|
573
|
+
result
|
574
|
+
end
|
575
|
+
.,.,
|
576
|
+
|
577
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 78)
|
578
|
+
def _reduce_3(val, _values, result)
|
579
|
+
result.concat(val[1])
|
580
|
+
result
|
581
|
+
end
|
582
|
+
.,.,
|
583
|
+
|
584
|
+
# reduce 4 omitted
|
585
|
+
|
586
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 81)
|
587
|
+
def _reduce_5(val, _values, result)
|
588
|
+
result = val
|
589
|
+
result
|
590
|
+
end
|
591
|
+
.,.,
|
592
|
+
|
593
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 82)
|
594
|
+
def _reduce_6(val, _values, result)
|
595
|
+
result = val
|
596
|
+
result
|
597
|
+
end
|
598
|
+
.,.,
|
599
|
+
|
600
|
+
# reduce 7 omitted
|
601
|
+
|
602
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 84)
|
603
|
+
def _reduce_8(val, _values, result)
|
604
|
+
result = val
|
605
|
+
result
|
606
|
+
end
|
607
|
+
.,.,
|
608
|
+
|
609
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 85)
|
610
|
+
def _reduce_9(val, _values, result)
|
611
|
+
result = val
|
612
|
+
result
|
613
|
+
end
|
614
|
+
.,.,
|
615
|
+
|
616
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 86)
|
617
|
+
def _reduce_10(val, _values, result)
|
618
|
+
result = []
|
619
|
+
result
|
620
|
+
end
|
621
|
+
.,.,
|
622
|
+
|
623
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 87)
|
624
|
+
def _reduce_11(val, _values, result)
|
625
|
+
result = val[0].blocks
|
626
|
+
result
|
627
|
+
end
|
628
|
+
.,.,
|
629
|
+
|
630
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 90)
|
631
|
+
def _reduce_12(val, _values, result)
|
632
|
+
# val[0] is like [level, title]
|
633
|
+
title = @inline_parser.parse(val[0][1])
|
634
|
+
result = Headline.new(val[0][0])
|
635
|
+
add_children_to_element(result, *title)
|
636
|
+
|
637
|
+
result
|
638
|
+
end
|
639
|
+
.,.,
|
640
|
+
|
641
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 96)
|
642
|
+
def _reduce_13(val, _values, result)
|
643
|
+
result = Include.new(val[0])
|
644
|
+
result
|
645
|
+
end
|
646
|
+
.,.,
|
647
|
+
|
648
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 100)
|
649
|
+
def _reduce_14(val, _values, result)
|
650
|
+
# val[0] is Array of String
|
651
|
+
content = cut_off(val[0]).join("")
|
652
|
+
contents = @inline_parser.parse(content)
|
653
|
+
result = TextBlock.new()
|
654
|
+
add_children_to_element(result, *contents)
|
655
|
+
|
656
|
+
result
|
657
|
+
end
|
658
|
+
.,.,
|
659
|
+
|
660
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 108)
|
661
|
+
def _reduce_15(val, _values, result)
|
662
|
+
result.push(val[1])
|
663
|
+
result
|
664
|
+
end
|
665
|
+
.,.,
|
666
|
+
|
667
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 109)
|
668
|
+
def _reduce_16(val, _values, result)
|
669
|
+
result = val
|
670
|
+
result
|
671
|
+
end
|
672
|
+
.,.,
|
673
|
+
|
674
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 113)
|
675
|
+
def _reduce_17(val, _values, result)
|
676
|
+
# val[1] is Array of String
|
677
|
+
content = cut_off(val[1])
|
678
|
+
result = Verbatim.new(content)
|
679
|
+
# imform to lexer.
|
680
|
+
@in_verbatim = false
|
681
|
+
result
|
682
|
+
end
|
683
|
+
.,.,
|
684
|
+
|
685
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 120)
|
686
|
+
def _reduce_18(val, _values, result)
|
687
|
+
# val[0] is Array of String
|
688
|
+
content = cut_off(val[0])
|
689
|
+
result = Verbatim.new(content)
|
690
|
+
# imform to lexer.
|
691
|
+
@in_verbatim = false
|
692
|
+
result
|
693
|
+
end
|
694
|
+
.,.,
|
695
|
+
|
696
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 127)
|
697
|
+
def _reduce_19(val, _values, result)
|
698
|
+
result.push(val[1])
|
699
|
+
result
|
700
|
+
end
|
701
|
+
.,.,
|
702
|
+
|
703
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 129)
|
704
|
+
def _reduce_20(val, _values, result)
|
705
|
+
result.concat(val[2])
|
706
|
+
result
|
707
|
+
end
|
708
|
+
.,.,
|
709
|
+
|
710
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 131)
|
711
|
+
def _reduce_21(val, _values, result)
|
712
|
+
result.push("\n")
|
713
|
+
result
|
714
|
+
end
|
715
|
+
.,.,
|
716
|
+
|
717
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 132)
|
718
|
+
def _reduce_22(val, _values, result)
|
719
|
+
result = val
|
720
|
+
# imform to lexer.
|
721
|
+
@in_verbatim = true
|
722
|
+
result
|
723
|
+
end
|
724
|
+
.,.,
|
725
|
+
|
726
|
+
# reduce 23 omitted
|
727
|
+
|
728
|
+
# reduce 24 omitted
|
729
|
+
|
730
|
+
# reduce 25 omitted
|
731
|
+
|
732
|
+
# reduce 26 omitted
|
733
|
+
|
734
|
+
# reduce 27 omitted
|
735
|
+
|
736
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 143)
|
737
|
+
def _reduce_28(val, _values, result)
|
738
|
+
result = val[1]
|
739
|
+
result
|
740
|
+
end
|
741
|
+
.,.,
|
742
|
+
|
743
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 145)
|
744
|
+
def _reduce_29(val, _values, result)
|
745
|
+
result = val[1].push(val[2])
|
746
|
+
result
|
747
|
+
end
|
748
|
+
.,.,
|
749
|
+
|
750
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 148)
|
751
|
+
def _reduce_30(val, _values, result)
|
752
|
+
result.push(val[1])
|
753
|
+
result
|
754
|
+
end
|
755
|
+
.,.,
|
756
|
+
|
757
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 149)
|
758
|
+
def _reduce_31(val, _values, result)
|
759
|
+
result = val
|
760
|
+
result
|
761
|
+
end
|
762
|
+
.,.,
|
763
|
+
|
764
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 153)
|
765
|
+
def _reduce_32(val, _values, result)
|
766
|
+
result = ItemList.new
|
767
|
+
add_children_to_element(result, *val[0])
|
768
|
+
|
769
|
+
result
|
770
|
+
end
|
771
|
+
.,.,
|
772
|
+
|
773
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 158)
|
774
|
+
def _reduce_33(val, _values, result)
|
775
|
+
result.push(val[1])
|
776
|
+
result
|
777
|
+
end
|
778
|
+
.,.,
|
779
|
+
|
780
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 159)
|
781
|
+
def _reduce_34(val, _values, result)
|
782
|
+
result = val
|
783
|
+
result
|
784
|
+
end
|
785
|
+
.,.,
|
786
|
+
|
787
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 163)
|
788
|
+
def _reduce_35(val, _values, result)
|
789
|
+
result = ItemListItem.new
|
790
|
+
add_children_to_element(result, val[0], *val[1])
|
791
|
+
|
792
|
+
result
|
793
|
+
end
|
794
|
+
.,.,
|
795
|
+
|
796
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 169)
|
797
|
+
def _reduce_36(val, _values, result)
|
798
|
+
result = EnumList.new
|
799
|
+
add_children_to_element(result, *val[0])
|
800
|
+
|
801
|
+
result
|
802
|
+
end
|
803
|
+
.,.,
|
804
|
+
|
805
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 174)
|
806
|
+
def _reduce_37(val, _values, result)
|
807
|
+
result.push(val[1])
|
808
|
+
result
|
809
|
+
end
|
810
|
+
.,.,
|
811
|
+
|
812
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 175)
|
813
|
+
def _reduce_38(val, _values, result)
|
814
|
+
result = val
|
815
|
+
result
|
816
|
+
end
|
817
|
+
.,.,
|
818
|
+
|
819
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 179)
|
820
|
+
def _reduce_39(val, _values, result)
|
821
|
+
result = EnumListItem.new
|
822
|
+
add_children_to_element(result, val[0], *val[1])
|
823
|
+
|
824
|
+
result
|
825
|
+
end
|
826
|
+
.,.,
|
827
|
+
|
828
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 185)
|
829
|
+
def _reduce_40(val, _values, result)
|
830
|
+
result = DescList.new
|
831
|
+
add_children_to_element(result, *val[0])
|
832
|
+
|
833
|
+
result
|
834
|
+
end
|
835
|
+
.,.,
|
836
|
+
|
837
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 190)
|
838
|
+
def _reduce_41(val, _values, result)
|
839
|
+
result.push(val[1])
|
840
|
+
result
|
841
|
+
end
|
842
|
+
.,.,
|
843
|
+
|
844
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 191)
|
845
|
+
def _reduce_42(val, _values, result)
|
846
|
+
result = val
|
847
|
+
result
|
848
|
+
end
|
849
|
+
.,.,
|
850
|
+
|
851
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 195)
|
852
|
+
def _reduce_43(val, _values, result)
|
853
|
+
term = DescListItem::Term.new
|
854
|
+
term_contents = @inline_parser.parse(val[0].strip)
|
855
|
+
add_children_to_element(term, *term_contents)
|
856
|
+
|
857
|
+
result = DescListItem.new
|
858
|
+
set_term_to_element(result, term)
|
859
|
+
add_children_to_element(result, *val[1])
|
860
|
+
|
861
|
+
result
|
862
|
+
end
|
863
|
+
.,.,
|
864
|
+
|
865
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 206)
|
866
|
+
def _reduce_44(val, _values, result)
|
867
|
+
result = MethodList.new
|
868
|
+
add_children_to_element(result, *val[0])
|
869
|
+
|
870
|
+
result
|
871
|
+
end
|
872
|
+
.,.,
|
873
|
+
|
874
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 211)
|
875
|
+
def _reduce_45(val, _values, result)
|
876
|
+
result.push(val[1])
|
877
|
+
result
|
878
|
+
end
|
879
|
+
.,.,
|
880
|
+
|
881
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 212)
|
882
|
+
def _reduce_46(val, _values, result)
|
883
|
+
result = val
|
884
|
+
result
|
885
|
+
end
|
886
|
+
.,.,
|
887
|
+
|
888
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 216)
|
889
|
+
def _reduce_47(val, _values, result)
|
890
|
+
term = MethodListItem::Term.new(val[0].strip)
|
891
|
+
result = MethodListItem.new
|
892
|
+
set_term_to_element(result, term)
|
893
|
+
add_children_to_element(result, *val[1])
|
894
|
+
|
895
|
+
result
|
896
|
+
end
|
897
|
+
.,.,
|
898
|
+
|
899
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 224)
|
900
|
+
def _reduce_48(val, _values, result)
|
901
|
+
result = [val[1]].concat(val[2])
|
902
|
+
result
|
903
|
+
end
|
904
|
+
.,.,
|
905
|
+
|
906
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 225)
|
907
|
+
def _reduce_49(val, _values, result)
|
908
|
+
result = [val[1]]
|
909
|
+
result
|
910
|
+
end
|
911
|
+
.,.,
|
912
|
+
|
913
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 227)
|
914
|
+
def _reduce_50(val, _values, result)
|
915
|
+
result = val[2]
|
916
|
+
result
|
917
|
+
end
|
918
|
+
.,.,
|
919
|
+
|
920
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 228)
|
921
|
+
def _reduce_51(val, _values, result)
|
922
|
+
result = []
|
923
|
+
result
|
924
|
+
end
|
925
|
+
.,.,
|
926
|
+
|
927
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 231)
|
928
|
+
def _reduce_52(val, _values, result)
|
929
|
+
result.concat(val[1])
|
930
|
+
result
|
931
|
+
end
|
932
|
+
.,.,
|
933
|
+
|
934
|
+
# reduce 53 omitted
|
935
|
+
|
936
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 234)
|
937
|
+
def _reduce_54(val, _values, result)
|
938
|
+
result = val
|
939
|
+
result
|
940
|
+
end
|
941
|
+
.,.,
|
942
|
+
|
943
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 235)
|
944
|
+
def _reduce_55(val, _values, result)
|
945
|
+
result = val
|
946
|
+
result
|
947
|
+
end
|
948
|
+
.,.,
|
949
|
+
|
950
|
+
# reduce 56 omitted
|
951
|
+
|
952
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 237)
|
953
|
+
def _reduce_57(val, _values, result)
|
954
|
+
result = []
|
955
|
+
result
|
956
|
+
end
|
957
|
+
.,.,
|
958
|
+
|
959
|
+
# reduce 58 omitted
|
960
|
+
|
961
|
+
# reduce 59 omitted
|
962
|
+
|
963
|
+
# reduce 60 omitted
|
964
|
+
|
965
|
+
# reduce 61 omitted
|
966
|
+
|
967
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 248)
|
968
|
+
def _reduce_62(val, _values, result)
|
969
|
+
content = cut_off([val[0]].concat(val[1])).join("")
|
970
|
+
contents = @inline_parser.parse(content)
|
971
|
+
result = TextBlock.new()
|
972
|
+
add_children_to_element(result, *contents)
|
973
|
+
|
974
|
+
result
|
975
|
+
end
|
976
|
+
.,.,
|
977
|
+
|
978
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 255)
|
979
|
+
def _reduce_63(val, _values, result)
|
980
|
+
content = cut_off([val[0]]).join("")
|
981
|
+
contents = @inline_parser.parse(content)
|
982
|
+
result = TextBlock.new()
|
983
|
+
add_children_to_element(result, *contents)
|
984
|
+
|
985
|
+
result
|
986
|
+
end
|
987
|
+
.,.,
|
988
|
+
|
989
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 263)
|
990
|
+
def _reduce_64(val, _values, result)
|
991
|
+
content = cut_off([val[0]].concat(val[1])).join("")
|
992
|
+
contents = @inline_parser.parse(content)
|
993
|
+
result = TextBlock.new()
|
994
|
+
add_children_to_element(result, *contents)
|
995
|
+
|
996
|
+
result
|
997
|
+
end
|
998
|
+
.,.,
|
999
|
+
|
1000
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 270)
|
1001
|
+
def _reduce_65(val, _values, result)
|
1002
|
+
content = cut_off([val[0]]).join("")
|
1003
|
+
contents = @inline_parser.parse(content)
|
1004
|
+
result = TextBlock.new()
|
1005
|
+
add_children_to_element(result, *contents)
|
1006
|
+
|
1007
|
+
result
|
1008
|
+
end
|
1009
|
+
.,.,
|
1010
|
+
|
1011
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 277)
|
1012
|
+
def _reduce_66(val, _values, result)
|
1013
|
+
result = [val[0]].concat(val[1])
|
1014
|
+
result
|
1015
|
+
end
|
1016
|
+
.,.,
|
1017
|
+
|
1018
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 278)
|
1019
|
+
def _reduce_67(val, _values, result)
|
1020
|
+
result.concat(val[1])
|
1021
|
+
result
|
1022
|
+
end
|
1023
|
+
.,.,
|
1024
|
+
|
1025
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 279)
|
1026
|
+
def _reduce_68(val, _values, result)
|
1027
|
+
result = val[1]
|
1028
|
+
result
|
1029
|
+
end
|
1030
|
+
.,.,
|
1031
|
+
|
1032
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 280)
|
1033
|
+
def _reduce_69(val, _values, result)
|
1034
|
+
result = val
|
1035
|
+
result
|
1036
|
+
end
|
1037
|
+
.,.,
|
1038
|
+
|
1039
|
+
# reduce 70 omitted
|
1040
|
+
|
1041
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 282)
|
1042
|
+
def _reduce_71(val, _values, result)
|
1043
|
+
result = []
|
1044
|
+
result
|
1045
|
+
end
|
1046
|
+
.,.,
|
1047
|
+
|
1048
|
+
module_eval(<<'.,.,', 'rdblockparser.y', 283)
|
1049
|
+
def _reduce_72(val, _values, result)
|
1050
|
+
result = []
|
1051
|
+
result
|
1052
|
+
end
|
1053
|
+
.,.,
|
1054
|
+
|
1055
|
+
def _reduce_none(val, _values, result)
|
1056
|
+
val[0]
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
end # class RDParser
|
1060
|
+
|
1061
|
+
end # end of module RD
|