depager 0.2.3 → 0.3.0.b20160729

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/README.en +4 -19
  3. data/README.ja +42 -79
  4. data/bin/depager +42 -45
  5. data/examples/action_pl0d/pl0d.action.dr +421 -0
  6. data/examples/action_pl0d/test.pl0ds +49 -0
  7. data/examples/c89/c89.dr +493 -496
  8. data/examples/c89/test.c89 +10 -10
  9. data/examples/extension/astdf.rb +10 -0
  10. data/examples/extension/atree.dr +55 -0
  11. data/examples/{sample_calc → extension}/calc.atree.dr +42 -43
  12. data/examples/extension/calc.simple_action.dr +33 -0
  13. data/examples/extension/paction.dr +16 -15
  14. data/examples/extension/pactiontest.dr +14 -14
  15. data/examples/extension/simple_action.rb +44 -0
  16. data/examples/pl0d/pl0ds.dr +337 -334
  17. data/examples/pl0d/test.pl0ds +33 -33
  18. data/examples/rie_calc/calc.rie.dr +57 -0
  19. data/examples/rie_calc/test.calc +4 -0
  20. data/examples/rie_dcuse/dcuse.rie.dr +71 -0
  21. data/examples/rie_dcuse/test.dcuse +1 -0
  22. data/examples/rie_pl0/orig_ex/exerrdg.pl0 +44 -0
  23. data/examples/rie_pl0/orig_ex/exerrm.pl0 +19 -0
  24. data/examples/rie_pl0/orig_ex/exerrmre.pl0 +20 -0
  25. data/examples/rie_pl0/orig_ex/exerrtok.pl0 +18 -0
  26. data/examples/rie_pl0/orig_ex/exmdg.pl0 +40 -0
  27. data/examples/rie_pl0/orig_ex/exmdgwwl.pl0 +43 -0
  28. data/examples/rie_pl0/orig_ex/exmrw.pl0 +22 -0
  29. data/examples/rie_pl0/orig_ex/exmwwl.pl0 +18 -0
  30. data/examples/rie_pl0/orig_ex/exnorw.pl0 +17 -0
  31. data/examples/rie_pl0/pl0.rie.dr +450 -0
  32. data/examples/rie_pl0/test.pl0 +10 -0
  33. data/examples/sample_calc/calc.action.dr +33 -33
  34. data/examples/sample_calc/calc.ast.action.dr +65 -66
  35. data/examples/sample_calc/calc.ast.dr +55 -55
  36. data/examples/sample_calc/calc.cst.dr +45 -45
  37. data/examples/sample_calc/calc.dr +43 -43
  38. data/examples/sample_calc/calc.lex.dr +29 -29
  39. data/examples/sample_calc/{calc_prec.nvaction.dr → calc_prec.action.dr} +31 -31
  40. data/examples/slex_test/divreg.slex.dr +29 -29
  41. data/examples/slex_test/ljoin.slex.dr +36 -36
  42. data/examples/slex_test/test.divreg +1 -1
  43. data/examples/slex_test/test.ljoin +3 -3
  44. data/lib/depager.rb +582 -670
  45. data/lib/depager/grammar.rb +256 -291
  46. data/lib/depager/lr.rb +574 -579
  47. data/lib/depager/parser.rb +282 -277
  48. data/lib/depager/ruby/plugins/_rie_debug.rb +35 -0
  49. data/lib/depager/ruby/plugins/action.rb +53 -43
  50. data/lib/depager/ruby/plugins/ast.dr +364 -269
  51. data/lib/depager/ruby/plugins/ast.rb +1367 -1308
  52. data/lib/depager/ruby/plugins/cst.dr +172 -180
  53. data/lib/depager/ruby/plugins/cst.rb +587 -626
  54. data/lib/depager/ruby/plugins/lex.dr +85 -89
  55. data/lib/depager/ruby/plugins/lex.rb +310 -336
  56. data/lib/depager/ruby/plugins/rie.dr +723 -0
  57. data/lib/depager/ruby/plugins/rie.rb +1653 -0
  58. data/lib/depager/ruby/plugins/slex.dr +202 -200
  59. data/lib/depager/ruby/plugins/slex.rb +780 -817
  60. data/lib/depager/ruby/plugins/srp.rb +56 -51
  61. data/lib/depager/ruby/templates/extension_lalr_master.erb +46 -51
  62. data/lib/depager/ruby/templates/extension_lalr_slave.erb +99 -107
  63. data/lib/depager/ruby/templates/single_lalr_parser.erb +115 -117
  64. data/lib/depager/utils.rb +148 -318
  65. data/lib/depager/version.rb +4 -3
  66. metadata +52 -60
  67. data/ChangeLog +0 -16
  68. data/data/depager/pre-setup.rb +0 -3
  69. data/examples/c89/c89.tab.rb +0 -7127
  70. data/examples/pl0d/pl0ds.tab.rb +0 -2698
  71. data/examples/sample_calc/calc.action.tab.rb +0 -457
  72. data/examples/sample_calc/calc.ast.action.tab.rb +0 -749
  73. data/examples/sample_calc/calc.ast.tab.rb +0 -665
  74. data/examples/sample_calc/calc.astdf.dr +0 -54
  75. data/examples/sample_calc/calc.astdf.tab.rb +0 -672
  76. data/examples/sample_calc/calc.atree.tab.rb +0 -451
  77. data/examples/sample_calc/calc.cst.tab.rb +0 -644
  78. data/examples/sample_calc/calc.lex.tab.rb +0 -374
  79. data/examples/sample_calc/calc.nvaction.dr +0 -33
  80. data/examples/sample_calc/calc.nvaction.tab.rb +0 -465
  81. data/examples/sample_calc/calc.tab.rb +0 -365
  82. data/examples/sample_calc/calc_prec.nvaction.tab.rb +0 -431
  83. data/examples/slex_test/divreg.slex.tab.rb +0 -303
  84. data/examples/slex_test/ljoin.slex.tab.rb +0 -370
  85. data/lib/depager/ruby/plugins/_ast_tmpl.rb +0 -73
  86. data/lib/depager/ruby/plugins/astdf.rb +0 -6
  87. data/lib/depager/ruby/plugins/atree.dr +0 -55
  88. data/lib/depager/ruby/plugins/atree.rb +0 -347
  89. data/lib/depager/ruby/plugins/nvaction.rb +0 -19
  90. data/lib/depager/ruby/templates/simple.erb +0 -23
  91. data/setup.rb +0 -1585
@@ -0,0 +1,1653 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ ###
4
+ ### Depager::RieExtension - Depager Extension (master)
5
+ ###
6
+ require 'depager/parser.rb'
7
+
8
+
9
+ module Depager ; end
10
+
11
+ class Depager::RieExtension < Depager::Extension
12
+
13
+ def initialize
14
+ @master = self
15
+ @slaves = []
16
+ end
17
+
18
+ def extension_registered g_parser
19
+ super g_parser
20
+
21
+ @slaves[0] = Depager::RieExtension::Slave_post_lhs::Parser.new(g_parser, self)
22
+ g_parser.hooks[:post_lhs].push [@slaves[0], :do_parse]
23
+ @slaves[1] = Depager::RieExtension::Slave_post_rhs::Parser.new(g_parser, self)
24
+ g_parser.hooks[:post_rhs].push [@slaves[1], :do_parse]
25
+ end
26
+
27
+ module_eval <<'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 8
28
+ module Nodes
29
+ N_THREAD = Struct.new :lineno, :targets, :excepts
30
+ N_TRANSFER = Struct.new :lineno, :targets, :excepts
31
+ N_EXCEPT = Struct.new :lineno, :let_or_ids
32
+ N_LET = Struct.new :lineno, :atoc, :expr, :state
33
+ N_ACTION = Struct.new :lineno, :expr
34
+ N_ATOC = Struct.new :lineno, :sym_name, :attr_name, :rx
35
+ end
36
+ include Nodes
37
+
38
+ begin
39
+ Depager.debug_mode? and require 'plugins/_rie_debug.rb'
40
+ rescue LoadError
41
+ end
42
+
43
+ attr_accessor :action_code, :on_reduce, :semantics, :attributes, :ecs
44
+ attr_reader :grammar
45
+
46
+ def init_extension
47
+ @action_code = ''
48
+ @on_reduce = []
49
+ @on_state = []
50
+ @attributes = []
51
+ @semantics = [[]]
52
+ @locals = [{}]
53
+ @ecs = {}
54
+ if Depager.debug_mode?
55
+ @debug_output_path = "#{g_parser.file.path}.rie_debug.output"
56
+ File.unlink @debug_output_path rescue nil
57
+ end
58
+ end
59
+
60
+ def term_extension
61
+ $grammar = @grammar = g_parser.table.grammar
62
+ expand_short_hand_notation
63
+ error_exit_if_error_pending
64
+
65
+ check_lattr
66
+ error_exit_if_error_pending
67
+ debug_info "locals:\n#{@locals.pretty_inspect}"
68
+
69
+ generate_action
70
+ g_parser.outer_code << generate_rie_decorator_code(@on_reduce, @on_state, @action_code)
71
+ end
72
+
73
+ def expand_short_hand_notation
74
+ semantics = []
75
+ @semantics.each_with_index do |rule_semantics, x|
76
+ res = []
77
+ (rule_semantics || []).each do |semantic|
78
+ case semantic
79
+ when N_TRANSFER ; expand_transfer res, semantic, grammar[x]
80
+ when N_THREAD ; expand_thread res, semantic, grammar[x]
81
+ else res << semantic
82
+ end
83
+ end
84
+ semantics << res
85
+ end
86
+ @semantics = semantics
87
+ end
88
+
89
+ def expand_transfer res, transfer, rule
90
+ lineno = transfer.lineno
91
+ transfer.targets.each do |attr_name|
92
+ unless @attributes[rule.lhs].include?(attr_name)
93
+ pending_error "#{attr_name} is not lhs attribute.", lineno
94
+ next
95
+ end
96
+ used = false
97
+ rule.rhs.each_with_index do |rsym, i|
98
+ next unless grammar.nonterm? rsym
99
+
100
+ rname = rule.rhs_names[i]
101
+ rattrs = @attributes[rsym] || []
102
+ next if !rattrs.include?(attr_name) || transfer.excepts.find do |e|
103
+ rname == e.sym_name and rattrs.include?(e.attr_name)
104
+ end
105
+ if attr_name[0] == ?_ # inherited attr
106
+ res << N_LET[lineno, N_ATOC[lineno, rname, attr_name, rule.n],
107
+ [N_ATOC[lineno, '$', attr_name, rule.n]]]
108
+ used = true
109
+ else
110
+ if used
111
+ pending_error "transfer `$.#{attr_name}' has too many source."
112
+ break
113
+ end
114
+ res << N_LET[lineno, N_ATOC[lineno, '$', attr_name, rule.n],
115
+ [N_ATOC[lineno, rname, attr_name, rule.n]]]
116
+ used = true
117
+ end
118
+ end
119
+ unless used
120
+ pending_error "no rhs symbol have attribute `#{attr_name}'", lineno
121
+ end
122
+ end
123
+ end
124
+
125
+ def expand_thread res, thread, rule
126
+ lineno, excepts = thread.lineno, thread.excepts.dup
127
+ thread.targets.each do |syn_name|
128
+ inh_name = '_' + syn_name
129
+ from, used = nil, false
130
+
131
+ lname = rule.lhs_name
132
+ lattrs = @attributes[rule.lhs]
133
+
134
+ if lattrs.include?(inh_name)
135
+ from = N_ATOC[lineno, '$', inh_name, rule.n]
136
+ end
137
+ rule.rhs.each_with_index do |rsym, i|
138
+ rname = rule.rhs_names[i]
139
+ rattrs = @attributes[rsym] || []
140
+
141
+ if from and rattrs.include? inh_name and
142
+ not excepts.find{|e| rname == e.sym_name && rattrs.include?(e.attr_name) }
143
+ res << N_LET[lineno, N_ATOC[lineno, rname, inh_name, rule.n], [from]]
144
+ used = true
145
+ end
146
+ if rattrs.include? syn_name
147
+ from = N_ATOC[lineno, rname, syn_name, rule.n]
148
+ end
149
+ end
150
+ if from and lattrs.include?(syn_name) and
151
+ not excepts.find{|e| lname == e.sym_name && lattrs.include?(e.attr_name) }
152
+ res << N_LET[lineno, N_ATOC[lineno, '$', syn_name, rule.n], [from]]
153
+ used = true
154
+ end
155
+ unless used
156
+ pending_error "no rhs symbol have attribute `#{syn_name}'", lineno
157
+ end
158
+ end
159
+ end
160
+
161
+ def check_lattr
162
+ @inhs_of_nonterms = []
163
+ @semantics.each_with_index do |rule_semantics, x|
164
+ rule = grammar[x]
165
+ assigned = {}
166
+ locals = @locals[rule.n] = {}
167
+ rule_semantics.each do |semantic|
168
+ semantic.is_a? N_LET and check_lattr_let semantic, rule, locals, assigned
169
+ end
170
+
171
+ next if x == 0
172
+ lineno = rule_semantics.last.lineno rescue 0
173
+ @attributes[rule.lhs].each do |a|
174
+ if a[0] != ?_ and not assigned[['$', a]]
175
+ pending_error "attribute `$.#{a}' is not assigned.", lineno
176
+ end
177
+ end
178
+ rule.rhs.each_with_index do |rsym, y|
179
+ next unless grammar.nonterm? rsym
180
+ rname = rule.rhs_names[y]
181
+ @attributes[rsym].each do |a|
182
+ if a[0] == ?_ and not assigned[[rname, a]]
183
+ pending_error "attribute `#{rname}.#{a}' is not assigned.", lineno
184
+ end
185
+ end
186
+ end
187
+ end
188
+ end
189
+
190
+ def check_lattr_let let, rule, locals, assigned
191
+ lineno = let.lineno
192
+ attr_name = let.atoc.attr_name
193
+ sym_name = let.atoc.sym_name
194
+
195
+ # left hand side of let
196
+ unless valid_atoc? let.atoc
197
+ pending_error "invalid attribute occurrence `#{sym_name}.#{attr_name}'.", lineno
198
+ return
199
+ end
200
+ if let.atoc.sym_name == '$' and inh_atoc?(let.atoc)
201
+ pending_error "cannot assign `$.#{attr_name}'(LHS INH).", lineno
202
+ return
203
+ elsif let.atoc.sym_name != '$' and syn_atoc?(let.atoc)
204
+ pending_error "cannot assign `#{sym_name}.#{attr_name}'(RHS SYN).", lineno
205
+ return
206
+ end
207
+ if local_atoc?(let.atoc)
208
+ if locals[attr_name]
209
+ warning "local attributes `#{attr_name}' is reassigned.", lineno
210
+ end
211
+ locals[attr_name] = 0
212
+ else
213
+ if assigned[[sym_name, attr_name]]
214
+ warning "attributes `#{sym_name}.#{attr_name}' is reassined.", lineno
215
+ else
216
+ assigned[[sym_name, attr_name]] = true
217
+ end
218
+ end
219
+
220
+ # right hand side of let
221
+ let.expr.find_all{|i| i.is_a? N_ATOC }.each do |expr_atoc|
222
+ unless valid_atoc? expr_atoc
223
+ next unless valid_atoc_name? expr_atoc # it is not atoc
224
+ pending_error "invalid attribute occurrence"<<
225
+ " `#{expr_atoc.sym_name}.#{expr_atoc.attr_name}'.", lineno
226
+ next
227
+ end
228
+ if expr_atoc.sym_name == '$' and syn_atoc?(expr_atoc)
229
+ pending_error "cannot refer `$.#{expr_atoc.attr_name}'(LHS SYN).", lineno
230
+ next
231
+ elsif expr_atoc.sym_name != '$' and inh_atoc?(expr_atoc)
232
+ pending_error "cannot refer `#{expr_atoc.sym_name}." <<
233
+ "#{expr_atoc.attr_name}'(RHS INH).", lineno
234
+ next
235
+ end
236
+ if local_atoc?(let.atoc)
237
+ if local_atoc?(expr_atoc) # local<-local
238
+ n = locals[expr_atoc.attr_name]
239
+ elsif syn_atoc?(expr_atoc) # local<-rsym.syn
240
+ n = rhs_index(expr_atoc)+1
241
+ else # local<-$.inh
242
+ n = 0
243
+ end
244
+ locals[attr_name] = n if locals[attr_name] < n
245
+ elsif sym_name != '$' and local_atoc?(expr_atoc) and # rhs<-local
246
+ rhs_index(let.atoc) <= locals[expr_atoc.attr_name]
247
+ pending_error "L-attribute violation.", lineno
248
+ next
249
+ elsif sym_name != '$' and expr_atoc.sym_name != '$' and # rhs<-rhs
250
+ rhs_index(let.atoc) <= rhs_index(expr_atoc)
251
+ pending_error "L-attribute violation.", lineno
252
+ next
253
+ end
254
+ end
255
+ end
256
+
257
+ def generate_action
258
+ # Actions on state change.
259
+ g_parser.table.states.each_with_index do |state, x|
260
+ actions = [ ]
261
+ inhs, locals = check_state_uniqueness(state)
262
+ inhs.each do |key, exprs| ; sym, attr_name = key
263
+ atoc = N_ATOC[0, "%#{sym}", attr_name]
264
+ actions << node_to_code(N_LET[0, atoc, exprs], state)
265
+ end
266
+ locals.each do |rx, attr_name, exprs|
267
+ atoc = N_ATOC[0, nil, attr_name, rx]
268
+ actions << node_to_code(N_LET[0, atoc, exprs], state)
269
+ end
270
+ unless actions.empty?
271
+ @action_code << "def _rie_state_#{x}\n #{actions.join("\n ")}\nend\n"
272
+ @on_state[x] = ":_rie_state_#{x}"
273
+ end
274
+ end
275
+
276
+ # Actions on reduce
277
+ @semantics.each_with_index do |rule_semantics, x|
278
+ actions = [ ]
279
+ rule = grammar[x]
280
+ rule_semantics.each do |semantic|
281
+ if semantic.is_a?(N_LET)
282
+ next if inh_atoc?(semantic.atoc)
283
+ next if local_atoc?(semantic.atoc) and not
284
+ @locals[x].find{|k,v| k == semantic.atoc.attr_name && v == rule.rhs.size }
285
+ end
286
+ code = node_to_code(semantic)
287
+ actions << code
288
+ end
289
+ unless actions.empty?
290
+ @action_code << "def _rie_reduce_#{x}\n #{actions.join("\n ")}\nend\n"
291
+ @on_reduce[x] = ":_rie_reduce_#{x}"
292
+ end
293
+ end
294
+ end
295
+
296
+ def node_to_code node, state=nil
297
+ case node
298
+ when N_LET
299
+ node_to_code(node.atoc, state) +" = "+
300
+ node_to_code(N_ACTION[0, node.expr], state)
301
+ when N_ACTION
302
+ node.expr.inject('') do |r, i|
303
+ r << (i.is_a?(N_ATOC) ? node_to_code(i, state) :
304
+ i.match(/^\s*[\{\[\(]$/) ? i : " #{i}")
305
+ end
306
+ when N_ATOC
307
+ return " #{node.sym_name}.#{node.attr_name}" unless valid_atoc? node
308
+ dot = 0
309
+ if state and item = state.closure.find{|i| i.rule.n == node.rx }
310
+ dot = item.n
311
+ elsif node.rx
312
+ dot = grammar[node.rx].rhs.size
313
+ end
314
+ if grammar.term? atoc_to_sym(node)
315
+ x = rhs_index(node) - dot
316
+ " _sstack(#{x}).syn.#{node.attr_name}"
317
+ elsif local_atoc? node
318
+ x = -dot
319
+ " _sstack(#{x-1}).local['#{node.attr_name}@#{node.rx}']"
320
+ elsif inh_atoc? node
321
+ # NEVER ASN LHS($).INH
322
+ if node.sym_name =~ /^%/ # ASN RHS.INH
323
+ x, sym = 0, $'
324
+ else # REF LHS($).INH / RHS.INH
325
+ x, sym = (rhs_index(node) || 0) - dot, atoc_to_sym(node)
326
+ end
327
+ ec = @ecs[[sym, node.attr_name]]
328
+ " _sstack(#{x-1}).inh['#{ec || sym}.#{node.attr_name}']"
329
+ else # syn_atoc?
330
+ # NEVER ASN RHS.SYN
331
+ if node.sym_name == '$' # ASN/REF LHS($).SYN
332
+ " @_rie_reduce_syn['#{node.attr_name}']"
333
+ else # REF RHS.SYN
334
+ x = rhs_index(node) - dot
335
+ " _sstack(#{x}).syn['#{node.attr_name}']"
336
+ end
337
+ end
338
+ else ; raise "cannot happen(#{node.inspect})."
339
+ end
340
+ rescue ; warn node.pretty_inspect ; raise
341
+ end
342
+
343
+ def check_state_uniqueness state
344
+ inhs, ec_inhs, locals = {}, {}, []
345
+ state.closure.each do |item|
346
+ rule = item.rule
347
+ @semantics[rule.n].each do |let|
348
+ next if !let.is_a?(N_LET)
349
+ next if item.n == rule.rhs.size
350
+ if local_atoc?(let.atoc)
351
+ @locals[rule.n].find{|k, v| k == let.atoc.attr_name && v == item.n } and
352
+ locals << [rule.n, let.atoc.attr_name, let.expr]
353
+ next
354
+ end
355
+ next if syn_atoc?(let.atoc) or rhs_index(let.atoc) != item.n
356
+
357
+ # ok, atoc is A._inh(B -> alpa _ A beta). set E_state(atoc).
358
+ attr_name = let.atoc.attr_name
359
+ sym = atoc_to_sym(let.atoc)
360
+ key = [sym, attr_name]
361
+ if expr = inhs[key]
362
+ if expr.size == 1 and expr[0].is_a?(N_ATOC) and
363
+ atoc_to_sym(expr[0]) == sym and expr[0].attr_name == attr_name
364
+ # older is self copy, update it.
365
+ inhs.delete(key)
366
+ inhs[key] = replace_atoc expr, inhs
367
+ elsif let.expr.size == 1 and let.expr[0].is_a?(N_ATOC) and
368
+ atoc_to_sym(let.expr[0]) == sym and let.expr[0].attr_name == attr_name
369
+ # newer is self copy, skip.
370
+ elsif not same_semantic? expr, let.expr
371
+ error_exit "LALR-attribute violation."
372
+ end
373
+ else
374
+ inhs[key] = replace_atoc let.expr, inhs
375
+ end
376
+ end
377
+ end
378
+
379
+ # check eclr
380
+ inhs.each do |k, v|
381
+ sym, attr_name = k
382
+ if ec = @ecs[k]
383
+ key = [ec, attr_name]
384
+ if ec_inhs[key]
385
+ unless same_semantic? ec_inhs[key], v
386
+ error_exit "ECLR-attribute violation."
387
+ end
388
+ else
389
+ ec_inhs[key] = v
390
+ end
391
+ else
392
+ ec_inhs[k] = v
393
+ end
394
+ end
395
+
396
+ debug_info "\n----------\n#{state}"
397
+ ec_inhs.each{|k,v| s,a=k;debug_info "#{grammar.symname s}:#{s}.#{a}=>#{v.pretty_inspect}" }
398
+ locals.each{|x,k,v| debug_info "#{x}.#{k}=>#{v.pretty_inspect}"}
399
+ return ec_inhs, locals
400
+ end
401
+
402
+ def same_semantic? sa, sb
403
+ return false unless sa.size == sb.size
404
+ sa.size.times do |x| a, b = sa[x], sb[x]
405
+ return false unless a.class == b.class
406
+ if a.is_a? N_ATOC
407
+ asym = a.sym_name == '$' ? atoc_to_sym(a) : a.sym_name
408
+ bsym = b.sym_name == '$' ? atoc_to_sym(b) : b.sym_name
409
+ asym = @ecs[[asym, a.attr_name]] if @ecs[[asym, a.attr_name]]
410
+ bsym = @ecs[[bsym, b.attr_name]] if @ecs[[bsym, b.attr_name]]
411
+ return false unless asym == bsym && a.attr_name == b.attr_name
412
+ else
413
+ return false unless a == b
414
+ end
415
+ end
416
+ return true
417
+ end
418
+
419
+ def replace_atoc expr, inhs={}
420
+ # warn "REPLACE:#{expr.pretty_inspect}"
421
+ res = []
422
+ expr and expr.each do |node|
423
+ if node.is_a? N_ATOC
424
+ if replace_to = inhs[[atoc_to_sym(node), node.attr_name]]
425
+ res.concat replace_to
426
+ else
427
+ res << node
428
+ end
429
+ elsif node.is_a? N_LET or node.is_a? N_ACTION
430
+ replaced = node.dup
431
+ replaced.expr = replace_atoc(node.expr, inhs)
432
+ res << replaced
433
+ else
434
+ res << node
435
+ end
436
+ end
437
+ # warn "=====>:#{res.pretty_inspect}"
438
+ return res
439
+ end
440
+
441
+ def valid_atoc_name? atoc
442
+ return true if local_atoc?(atoc)
443
+ return true if atoc.sym_name == '$'
444
+ return grammar[atoc.rx].rhs_name_to_sym(atoc.sym_name) ? true : false
445
+ end
446
+
447
+ def valid_atoc? atoc
448
+ return true if local_atoc?(atoc)
449
+ return true if atoc.sym_name =~ /^[%#]/
450
+ rule = grammar[atoc.rx]
451
+ sym = atoc.sym_name == '$' ? rule.lhs : rule.rhs_name_to_sym(atoc.sym_name)
452
+ return true if sym and atoc.sym_name =~ /^[A-Z]/ # term(no check)
453
+ sym and @attributes[sym] and @attributes[sym].include?(atoc.attr_name)
454
+ rescue ; warn "ATOC?:#{atoc.pretty_inspect}"; false
455
+ end
456
+
457
+ def rhs_index atoc
458
+ return nil if local_atoc?(atoc)
459
+ grammar[atoc.rx].rhs_names.index(atoc.sym_name)
460
+ end
461
+
462
+ def atoc_to_sym atoc
463
+ return nil if local_atoc?(atoc)
464
+ return $1.to_i if atoc.sym_name =~ /^%(\d+)$/
465
+ return grammar[atoc.rx].lhs if atoc.sym_name == '$'
466
+ grammar[atoc.rx].rhs_name_to_sym(atoc.sym_name) rescue nil
467
+ end
468
+
469
+ def local_atoc? atoc
470
+ atoc.sym_name == nil
471
+ end
472
+
473
+ def inh_atoc? atoc
474
+ !local_atoc?(atoc) and atoc.attr_name[0] == ?_
475
+ end
476
+
477
+ def syn_atoc? atoc
478
+ !local_atoc?(atoc) and atoc.attr_name[0] != ?_
479
+ end
480
+
481
+ def pending_error *args
482
+ @pending_errors ||= []
483
+ @pending_errors << g_parser.error_message(*args)
484
+ end
485
+
486
+ def error_exit_if_error_pending
487
+ @pending_errors and (warn @pending_errors.join("\n") ; exit 1)
488
+ end
489
+
490
+ def debug_info s
491
+ Depager.debug_mode? and File.open(@debug_output_path, 'a'){|f| f.write s}
492
+ end
493
+
494
+ def generate_rie_decorator_code on_reduce, on_state, action_code
495
+ on_reduce_code = on_reduce.map{|i| " #{i||'nil'},\n"}
496
+ on_state_code = on_state.map{|i| " #{i||'nil'},\n"}
497
+
498
+ generate_decorator_code(decorator_name, "#{d_parser.parsing_method}::AdvancedParser", %{
499
+ on_reduce = [\n#{on_reduce_code.join}
500
+ ]
501
+ on_state = [\n#{on_state_code.join}
502
+ ]
503
+ Tables = [on_reduce, on_state]
504
+ RieATTR = Struct.new(:inh, :syn, :local)
505
+ def initialize inside
506
+ super inside
507
+ @on_reduce, @on_state = self.class::Tables
508
+ end
509
+ def before_parse
510
+ after_shift
511
+ end
512
+ def after_shift
513
+ msg = @on_state[stack.last] and send(msg)
514
+ end
515
+ def before_reduce
516
+ stack.last == 0 and after_shift
517
+ @_rie_reduce_syn = {}
518
+ mes = @on_reduce[-action_value] and send(mes)
519
+ end
520
+ require 'pp'
521
+ def after_reduce
522
+ _sstack(-1); stack[-2][decorator_index].syn = @_rie_reduce_syn
523
+ after_shift
524
+ end
525
+ def _sstack n
526
+ n = n * 2
527
+ if -n == stack.size + 1
528
+ @_attr_for_state0 ||= RieATTR[{}, {}, {}]
529
+ else
530
+ stack[n][decorator_index] ||= RieATTR[{}, stack[n][1] == :NT ? {} : stack[n][1], {}]
531
+ end
532
+ rescue
533
+ warn "N:\#{n}"
534
+ raise
535
+ end
536
+ \n#{action_code}
537
+ }) #code
538
+ end
539
+
540
+ DEPAGER_EXPANDED_CODE
541
+
542
+ end
543
+
544
+ ###
545
+ ### Depager::RieExtension::Slave_post_lhs - Part of Depager Extension (slave)
546
+ ###
547
+
548
+ module Depager::RieExtension::Slave_post_lhs #:nodoc:all
549
+ class Parser < Depager::LALR::Basis #:nodoc:all
550
+ include Depager::Utils::ExtensionSlaveMethods
551
+
552
+
553
+ ### Reduce Table
554
+ reduce_table = [
555
+ [ -1, 1 ],
556
+ [ 0, 3 ],
557
+ [ 1, 1 ],
558
+ [ 1, 3 ],
559
+ [ 2, 1 ],
560
+ [ 2, 3 ],
561
+ ]
562
+ ### Term to Int
563
+ term_to_int = {
564
+ nil => 0,
565
+ false => 1,
566
+ "[" => 2,
567
+ "]" => 3,
568
+ "," => 4,
569
+ :ID => 5,
570
+ ":" => 6,
571
+ }
572
+ ### Int to Term
573
+ int_to_term = [
574
+ nil,
575
+ false,
576
+ "[",
577
+ "]",
578
+ ",",
579
+ :ID,
580
+ ":",
581
+ ]
582
+ ### Action Table
583
+ action_table = [
584
+ [ nil, nil, 2, nil, nil, nil, nil, ],
585
+ [ ACC, nil, nil, nil, nil, nil, nil, ],
586
+ [ nil, nil, nil, nil, nil, 5, nil, ],
587
+ [ nil, nil, nil, 6, 7, nil, nil, ],
588
+ [ nil, nil, nil, nil, nil, nil, nil, ],
589
+ [ nil, nil, nil, nil, nil, nil, 8, ],
590
+ [ nil, nil, nil, nil, nil, nil, nil, ],
591
+ [ nil, nil, nil, nil, nil, 5, nil, ],
592
+ [ nil, nil, nil, nil, nil, 10, nil, ],
593
+ [ nil, nil, nil, nil, nil, nil, nil, ],
594
+ [ nil, nil, nil, nil, nil, nil, nil, ],
595
+ ]
596
+ ### Default Reduce Table
597
+ defred_table = [
598
+ nil,
599
+ nil,
600
+ nil,
601
+ nil,
602
+ -2,
603
+ -4,
604
+ -1,
605
+ nil,
606
+ nil,
607
+ -3,
608
+ -5,
609
+ ]
610
+ defred_after_shift_table = [
611
+ nil,
612
+ nil,
613
+ nil,
614
+ nil,
615
+ -2,
616
+ nil,
617
+ -1,
618
+ nil,
619
+ nil,
620
+ -3,
621
+ -5,
622
+ ]
623
+ ### Nonterm to Int
624
+ nonterm_to_int = {
625
+ :start => 0,
626
+ :attr_list => 1,
627
+ :attr => 2,
628
+ }
629
+ ### Int to Nonterm
630
+ int_to_nonterm = [
631
+ :start,
632
+ :attr_list,
633
+ :attr,
634
+ ]
635
+ ### Goto Table
636
+ goto_table = [
637
+ [ 1, nil, nil, ],
638
+ [ nil, nil, nil, ],
639
+ [ nil, 3, 4, ],
640
+ [ nil, nil, nil, ],
641
+ [ nil, nil, nil, ],
642
+ [ nil, nil, nil, ],
643
+ [ nil, nil, nil, ],
644
+ [ nil, nil, 9, ],
645
+ [ nil, nil, nil, ],
646
+ [ nil, nil, nil, ],
647
+ [ nil, nil, nil, ],
648
+ ]
649
+
650
+ Tables = [ reduce_table, action_table,
651
+ defred_table, defred_after_shift_table, goto_table,
652
+ term_to_int, int_to_term, nonterm_to_int, int_to_nonterm ]
653
+
654
+ def initialize g_parser, master
655
+ super()
656
+ @g_parser = g_parser
657
+ @d_parser = g_parser.d_parser
658
+ @master = master
659
+ @decorated = Action.new(self)
660
+ end
661
+
662
+
663
+ def do_parse?
664
+ if @line.match(/^\s*\[/)
665
+
666
+ true
667
+ else
668
+ false
669
+ end
670
+ end
671
+
672
+
673
+ def banner
674
+ "[...] / Depager::RieExtension"
675
+ end
676
+
677
+
678
+ def lex
679
+ begin
680
+ until @line.empty?
681
+ case @line
682
+
683
+ when /\A\s+/
684
+ @line = $'
685
+
686
+
687
+
688
+ when /\A[a-zA-Z_]\w*/
689
+ @line = $'
690
+ yield token(:ID, $&)
691
+
692
+
693
+ when /\A\]/
694
+ @line = $'
695
+ yield token(']'); yield token(nil)
696
+
697
+
698
+ when /\A./
699
+ @line = $'
700
+ yield token($&)
701
+
702
+
703
+ else
704
+ raise RuntimeError, "must not happen #{@line}"
705
+ end
706
+ end
707
+ end while @original_line = @line = file.gets
708
+ yield nil, nil
709
+ end
710
+ module_eval <<'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 523
711
+ def do_default
712
+ master.attributes[g_parser.lhs] = []
713
+ end
714
+
715
+ DEPAGER_EXPANDED_CODE
716
+
717
+ end
718
+ end
719
+
720
+
721
+ class Depager::RieExtension::Slave_post_lhs::Action < Depager::LALR::Action #:nodoc:all
722
+ include Depager::Utils::ExtensionSlaveDecoratorMethods
723
+
724
+ on_reduce = [
725
+ nil,
726
+ :_act_1,
727
+ :_act_2,
728
+ :_act_3,
729
+ :_act_4,
730
+ :_act_5,
731
+
732
+ ]
733
+ Tables = [ on_reduce ]
734
+
735
+
736
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 534
737
+ def _act_1 val
738
+ _, _attr_list, _, = *val
739
+ master.attributes[g_parser.lhs] = _attr_list
740
+
741
+ end
742
+ DEPAGER_EXPANDED_CODE
743
+
744
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 537
745
+ def _act_2 val
746
+ _attr, = *val
747
+ [ _attr ]
748
+
749
+ end
750
+ DEPAGER_EXPANDED_CODE
751
+
752
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 539
753
+ def _act_3 val
754
+ _attr_list, _, _attr, = *val
755
+
756
+ if _attr_list.include? _attr
757
+ warning "attribute `#{_attr}' reappeared."
758
+ _attr_list
759
+ else
760
+ _attr_list << _attr
761
+ end
762
+
763
+ end
764
+ DEPAGER_EXPANDED_CODE
765
+
766
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 549
767
+ def _act_4 val
768
+ _ID, = *val
769
+ _ID.value
770
+
771
+ end
772
+ DEPAGER_EXPANDED_CODE
773
+
774
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 551
775
+ def _act_5 val
776
+ _ID, _, _ec, = *val
777
+
778
+ unless _ID.value[0] == ?_
779
+ error_exit "EC must be inherited attribute.", _ec.lineno
780
+ else
781
+ master.ecs[[g_parser.lhs, _ID.value]] = _ec.value
782
+ end
783
+ _ID.value
784
+
785
+ end
786
+ DEPAGER_EXPANDED_CODE
787
+
788
+
789
+ end
790
+
791
+ ###
792
+ ### Depager::RieExtension::Slave_post_rhs - Part of Depager Extension (slave)
793
+ ###
794
+
795
+ module Depager::RieExtension::Slave_post_rhs #:nodoc:all
796
+ class Parser < Depager::LALR::Basis #:nodoc:all
797
+ include Depager::Utils::ExtensionSlaveMethods
798
+
799
+
800
+ ### Reduce Table
801
+ reduce_table = [
802
+ [ -1, 1 ],
803
+ [ 0, 3 ],
804
+ [ 1, 1 ],
805
+ [ 1, 3 ],
806
+ [ 2, 0 ],
807
+ [ 2, 2 ],
808
+ [ 2, 2 ],
809
+ [ 2, 2 ],
810
+ [ 2, 4 ],
811
+ [ 2, 3 ],
812
+ [ 2, 3 ],
813
+ [ 2, 3 ],
814
+ [ 2, 1 ],
815
+ [ 7, 1 ],
816
+ [ 7, 2 ],
817
+ [ 7, 3 ],
818
+ [ 6, 1 ],
819
+ [ 6, 2 ],
820
+ [ 8, 1 ],
821
+ [ 8, 1 ],
822
+ [ 8, 1 ],
823
+ [ 8, 1 ],
824
+ [ 8, 1 ],
825
+ [ 8, 1 ],
826
+ [ 8, 2 ],
827
+ [ 8, 3 ],
828
+ [ 8, 2 ],
829
+ [ 8, 3 ],
830
+ [ 8, 2 ],
831
+ [ 8, 3 ],
832
+ [ 4, 1 ],
833
+ [ 4, 3 ],
834
+ [ 5, 3 ],
835
+ [ 3, 1 ],
836
+ [ 3, 3 ],
837
+ ]
838
+ ### Term to Int
839
+ term_to_int = {
840
+ nil => 0,
841
+ false => 1,
842
+ "{" => 2,
843
+ "}" => 3,
844
+ ";" => 4,
845
+ :THREAD => 5,
846
+ :TRANSFER => 6,
847
+ :EXCEPT => 7,
848
+ "=" => 8,
849
+ :LID => 9,
850
+ :ID => 10,
851
+ :RBTOKEN => 11,
852
+ "." => 12,
853
+ "," => 13,
854
+ "[" => 14,
855
+ "]" => 15,
856
+ "(" => 16,
857
+ ")" => 17,
858
+ }
859
+ ### Int to Term
860
+ int_to_term = [
861
+ nil,
862
+ false,
863
+ "{",
864
+ "}",
865
+ ";",
866
+ :THREAD,
867
+ :TRANSFER,
868
+ :EXCEPT,
869
+ "=",
870
+ :LID,
871
+ :ID,
872
+ :RBTOKEN,
873
+ ".",
874
+ ",",
875
+ "[",
876
+ "]",
877
+ "(",
878
+ ")",
879
+ ]
880
+ ### Action Table
881
+ action_table = [
882
+ [ nil, nil, 2, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
883
+ [ ACC, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
884
+ [ nil, nil, 17, nil, nil, 5, 6, 7, nil, 9, 10, 13, 14, 15, 16, nil, 18, nil, ],
885
+ [ nil, nil, nil, 19, 20, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
886
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
887
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 22, nil, nil, nil, nil, nil, nil, nil, ],
888
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 22, nil, nil, nil, nil, nil, nil, nil, ],
889
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, ],
890
+ [ nil, nil, nil, nil, nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
891
+ [ nil, nil, nil, nil, nil, nil, nil, nil, 28, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
892
+ [ nil, nil, nil, nil, nil, nil, nil, nil, 29, nil, nil, nil, 30, nil, nil, nil, nil, nil, ],
893
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
894
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
895
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
896
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
897
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
898
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, 35, 18, nil, ],
899
+ [ nil, nil, 17, 38, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
900
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, 40, ],
901
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
902
+ [ nil, nil, 17, nil, nil, 5, 6, 7, nil, 9, 10, 13, 14, 15, 16, nil, 18, nil, ],
903
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 43, nil, nil, nil, nil, ],
904
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
905
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 43, nil, nil, nil, nil, ],
906
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 44, nil, nil, nil, nil, ],
907
+ [ nil, nil, nil, nil, nil, nil, nil, nil, 45, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
908
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 30, nil, nil, nil, nil, nil, ],
909
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
910
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
911
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
912
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 49, nil, nil, nil, nil, nil, nil, nil, ],
913
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
914
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
915
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 30, nil, nil, nil, nil, nil, ],
916
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
917
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
918
+ [ nil, nil, nil, nil, 51, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 50, nil, nil, ],
919
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
920
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
921
+ [ nil, nil, nil, 52, 51, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
922
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
923
+ [ nil, nil, nil, nil, 51, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 53, ],
924
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
925
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 54, nil, nil, nil, nil, nil, nil, nil, ],
926
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, ],
927
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
928
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
929
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
930
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
931
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
932
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
933
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
934
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
935
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
936
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
937
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
938
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
939
+ [ nil, nil, 17, nil, nil, nil, nil, nil, nil, 34, 33, 13, 14, 15, 16, nil, 18, nil, ],
940
+ ]
941
+ ### Default Reduce Table
942
+ defred_table = [
943
+ nil,
944
+ nil,
945
+ -4,
946
+ nil,
947
+ -2,
948
+ nil,
949
+ nil,
950
+ nil,
951
+ -18,
952
+ -20,
953
+ -19,
954
+ -12,
955
+ -16,
956
+ -21,
957
+ -22,
958
+ -23,
959
+ nil,
960
+ nil,
961
+ nil,
962
+ -1,
963
+ -4,
964
+ -5,
965
+ -33,
966
+ -6,
967
+ -7,
968
+ -30,
969
+ nil,
970
+ nil,
971
+ nil,
972
+ nil,
973
+ nil,
974
+ -17,
975
+ -18,
976
+ -19,
977
+ -20,
978
+ -24,
979
+ nil,
980
+ -13,
981
+ -26,
982
+ nil,
983
+ -28,
984
+ nil,
985
+ -3,
986
+ nil,
987
+ nil,
988
+ nil,
989
+ -9,
990
+ -10,
991
+ -11,
992
+ -32,
993
+ -25,
994
+ -14,
995
+ -27,
996
+ -29,
997
+ -34,
998
+ -31,
999
+ -8,
1000
+ -15,
1001
+ ]
1002
+ defred_after_shift_table = [
1003
+ nil,
1004
+ nil,
1005
+ nil,
1006
+ nil,
1007
+ -2,
1008
+ nil,
1009
+ nil,
1010
+ nil,
1011
+ nil,
1012
+ nil,
1013
+ nil,
1014
+ nil,
1015
+ -16,
1016
+ -21,
1017
+ -22,
1018
+ -23,
1019
+ nil,
1020
+ nil,
1021
+ nil,
1022
+ -1,
1023
+ nil,
1024
+ nil,
1025
+ -33,
1026
+ nil,
1027
+ nil,
1028
+ nil,
1029
+ nil,
1030
+ nil,
1031
+ nil,
1032
+ nil,
1033
+ nil,
1034
+ -17,
1035
+ -18,
1036
+ nil,
1037
+ -20,
1038
+ -24,
1039
+ nil,
1040
+ nil,
1041
+ -26,
1042
+ nil,
1043
+ -28,
1044
+ nil,
1045
+ -3,
1046
+ nil,
1047
+ nil,
1048
+ nil,
1049
+ nil,
1050
+ nil,
1051
+ nil,
1052
+ -32,
1053
+ -25,
1054
+ nil,
1055
+ -27,
1056
+ -29,
1057
+ -34,
1058
+ -31,
1059
+ nil,
1060
+ nil,
1061
+ ]
1062
+ ### Nonterm to Int
1063
+ nonterm_to_int = {
1064
+ :start => 0,
1065
+ :stmt_list => 1,
1066
+ :stmt => 2,
1067
+ :id_list => 3,
1068
+ :lhs_list => 4,
1069
+ :lhs => 5,
1070
+ :rbexpr => 6,
1071
+ :rbexpr_list => 7,
1072
+ :rbelem => 8,
1073
+ }
1074
+ ### Int to Nonterm
1075
+ int_to_nonterm = [
1076
+ :start,
1077
+ :stmt_list,
1078
+ :stmt,
1079
+ :id_list,
1080
+ :lhs_list,
1081
+ :lhs,
1082
+ :rbexpr,
1083
+ :rbexpr_list,
1084
+ :rbelem,
1085
+ ]
1086
+ ### Goto Table
1087
+ goto_table = [
1088
+ [ 1, nil, nil, nil, nil, nil, nil, nil, nil, ],
1089
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1090
+ [ nil, 3, 4, nil, nil, 8, 11, nil, 12, ],
1091
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1092
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1093
+ [ nil, nil, nil, 21, nil, nil, nil, nil, nil, ],
1094
+ [ nil, nil, nil, 23, nil, nil, nil, nil, nil, ],
1095
+ [ nil, nil, nil, nil, 24, 25, nil, nil, nil, ],
1096
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1097
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1098
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1099
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1100
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1101
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1102
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1103
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1104
+ [ nil, nil, nil, nil, nil, 32, 37, 36, 12, ],
1105
+ [ nil, nil, nil, nil, nil, 32, 37, 39, 12, ],
1106
+ [ nil, nil, nil, nil, nil, 32, 37, 41, 12, ],
1107
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1108
+ [ nil, nil, 42, nil, nil, 8, 11, nil, 12, ],
1109
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1110
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1111
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1112
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1113
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1114
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1115
+ [ nil, nil, nil, nil, nil, 32, 46, nil, 12, ],
1116
+ [ nil, nil, nil, nil, nil, 32, 47, nil, 12, ],
1117
+ [ nil, nil, nil, nil, nil, 32, 48, nil, 12, ],
1118
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1119
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1120
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1121
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1122
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1123
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1124
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1125
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1126
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1127
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1128
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1129
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1130
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1131
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1132
+ [ nil, nil, nil, nil, nil, 55, nil, nil, nil, ],
1133
+ [ nil, nil, nil, nil, nil, 32, 56, nil, 12, ],
1134
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1135
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1136
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1137
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1138
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1139
+ [ nil, nil, nil, nil, nil, 32, 57, nil, 12, ],
1140
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1141
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1142
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1143
+ [ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
1144
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1145
+ [ nil, nil, nil, nil, nil, 32, nil, nil, 31, ],
1146
+ ]
1147
+
1148
+ Tables = [ reduce_table, action_table,
1149
+ defred_table, defred_after_shift_table, goto_table,
1150
+ term_to_int, int_to_term, nonterm_to_int, int_to_nonterm ]
1151
+
1152
+ def initialize g_parser, master
1153
+ super()
1154
+ @g_parser = g_parser
1155
+ @d_parser = g_parser.d_parser
1156
+ @master = master
1157
+ @decorated = Action.new(self)
1158
+ end
1159
+
1160
+
1161
+ def do_parse?
1162
+ if @line.match(/^\s*\{/)
1163
+
1164
+ true
1165
+ else
1166
+ false
1167
+ end
1168
+ end
1169
+
1170
+
1171
+ def banner
1172
+ "{...} / Depager::RieExtension"
1173
+ end
1174
+
1175
+
1176
+ def lex
1177
+ begin
1178
+ until @line.empty?
1179
+ case @line
1180
+
1181
+ when /\A#.*/
1182
+ @line = $'
1183
+
1184
+
1185
+
1186
+ when /\A[ \t]+/
1187
+ @line = $'
1188
+
1189
+
1190
+
1191
+ when /\A\r?\n/
1192
+ @line = $'
1193
+ yield token(';')
1194
+
1195
+
1196
+ when /\A\s*\(/
1197
+ @line = $'
1198
+ yield token('(', $&) ; skip_space
1199
+
1200
+
1201
+ when /\A\s*\[/
1202
+ @line = $'
1203
+ yield token('[', $&) ; skip_space
1204
+
1205
+
1206
+ when /\A\s*\{/
1207
+ @line = $'
1208
+ yield token('{', $&) ; skip_space ; @nest +=1
1209
+
1210
+
1211
+ when /\A\}/
1212
+ @line = $'
1213
+ yield token('}'); (@nest-=1) == 0 and yield token(nil)
1214
+
1215
+
1216
+ when /\A\./
1217
+ @line = $'
1218
+ yield token('.') ; @_mode = :AFTER_DOT
1219
+
1220
+
1221
+ when /\A,/
1222
+ @line = $'
1223
+ yield token(','); @line.match(/[\s\n]*/) and @line = $'
1224
+
1225
+
1226
+ when /\A%transfer/
1227
+ @line = $'
1228
+ yield token(:TRANSFER)
1229
+
1230
+
1231
+ when /\A%thread/
1232
+ @line = $'
1233
+ yield token(:THREAD)
1234
+
1235
+
1236
+ when /\A%except/
1237
+ @line = $'
1238
+ yield token(:EXCEPT)
1239
+
1240
+
1241
+ when /\A\$\./
1242
+ @line = $'
1243
+ yield token(:ID, '$'); yield token('.') ; @_mode = :AFTER_DOT
1244
+
1245
+
1246
+ when /\A'([^'\\]+|\\.)*'/, /\A"([^"\\]+|\\.)*"/, /\A\/([^\/\\]+|\\.)*\//, /\A(@|$|:)[a-zA-Z_]\w*/, /\A[a-zA-Z_]\w*[!?]/, /\A\d+/
1247
+ @line = $'
1248
+ yield token(:RBTOKEN, $&)
1249
+
1250
+
1251
+ when /\A(<=|>=|=>|==|===|!=|and|or)/, /\A([+!~*\-\/%^<>&|?:]+|\.\.\.?)/
1252
+ @line = $'
1253
+ yield token(:RBTOKEN, $&) ; skip_space
1254
+
1255
+
1256
+ when /\A=/
1257
+ @line = $'
1258
+ yield token('=') ; skip_space
1259
+
1260
+
1261
+ when /\A[a-zA-Z_]\w*/
1262
+ @line = $'
1263
+
1264
+ if @_mode != :AFTER_DOT and @locals[$&]
1265
+ yield token(:LID, $&)
1266
+ else
1267
+ @_mode = nil
1268
+ yield token(:ID, $&)
1269
+ end
1270
+
1271
+
1272
+ when /\A./
1273
+ @line = $'
1274
+ yield token($&)
1275
+
1276
+
1277
+ else
1278
+ raise RuntimeError, "must not happen #{@line}"
1279
+ end
1280
+ end
1281
+ end while @original_line = @line = file.gets
1282
+ yield nil, nil
1283
+ end
1284
+ module_eval <<'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 567
1285
+ attr_accessor :locals
1286
+ def before_parse
1287
+ @nest = 0
1288
+ @locals = {}
1289
+ end
1290
+ def do_default
1291
+ master.semantics[g_parser.rules.size-1] = []
1292
+ end
1293
+ def skip_space
1294
+ begin
1295
+ @line.match(/^[\s\n]+(#[.\n]*)?/) and @line = $'
1296
+ break unless @line.empty?
1297
+ end while @original_line = @line = getline
1298
+ end
1299
+ def getline
1300
+ begin ; line = @file.gets
1301
+ end while line and line =~ /^\s*(#.*)?$/
1302
+ line
1303
+ end
1304
+
1305
+ DEPAGER_EXPANDED_CODE
1306
+
1307
+ end
1308
+ end
1309
+
1310
+
1311
+ class Depager::RieExtension::Slave_post_rhs::Action < Depager::LALR::Action #:nodoc:all
1312
+ include Depager::Utils::ExtensionSlaveDecoratorMethods
1313
+
1314
+ on_reduce = [
1315
+ nil,
1316
+ :_act_1,
1317
+ :_act_2,
1318
+ :_act_3,
1319
+ :_act_4,
1320
+ :_act_5,
1321
+ :_act_6,
1322
+ :_act_7,
1323
+ :_act_8,
1324
+ :_act_9,
1325
+ :_act_10,
1326
+ :_act_11,
1327
+ :_act_12,
1328
+ :_act_13,
1329
+ :_act_14,
1330
+ :_act_15,
1331
+ :_act_16,
1332
+ :_act_17,
1333
+ :_act_18,
1334
+ :_act_19,
1335
+ :_act_20,
1336
+ :_act_21,
1337
+ :_act_22,
1338
+ :_act_23,
1339
+ :_act_24,
1340
+ :_act_25,
1341
+ :_act_26,
1342
+ :_act_27,
1343
+ :_act_28,
1344
+ :_act_29,
1345
+ :_act_30,
1346
+ :_act_31,
1347
+ :_act_32,
1348
+ :_act_33,
1349
+ :_act_34,
1350
+
1351
+ ]
1352
+ Tables = [ on_reduce ]
1353
+
1354
+ include Depager::RieExtension::Nodes
1355
+
1356
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 631
1357
+ def _act_1 val
1358
+ _, _stmt_list, _, = *val
1359
+
1360
+ basis.locals.clear
1361
+ master.semantics[g_parser.rules.size-1] = _stmt_list.compact
1362
+
1363
+ end
1364
+ DEPAGER_EXPANDED_CODE
1365
+
1366
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 640
1367
+ def _act_2 val
1368
+ _stmt, = *val
1369
+
1370
+ if _stmt.is_a? N_EXCEPT
1371
+ error_exit "invalid %except.", _stmt.lineno
1372
+ end
1373
+ [ _stmt ]
1374
+
1375
+ end
1376
+ DEPAGER_EXPANDED_CODE
1377
+
1378
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 647
1379
+ def _act_3 val
1380
+ _stmt_list, _, _stmt, = *val
1381
+
1382
+ if _stmt.is_a? N_EXCEPT
1383
+ unless [N_THREAD, N_TRANSFER].include?(_stmt_list.last.class)
1384
+ error_exit "invalid %except.", _stmt.lineno
1385
+ end
1386
+ let_or_ids = _stmt.let_or_ids
1387
+ if let_or_ids.is_a? N_LET
1388
+ _stmt_list.last.excepts << let_or_ids.atoc
1389
+ _stmt_list.insert(_stmt_list.size-1, let_or_ids)
1390
+ else
1391
+ _stmt_list.last.excepts.concat(let_or_ids)
1392
+ _stmt_list
1393
+ end
1394
+ else
1395
+ _stmt ? (_stmt_list << _stmt) : _stmt_list
1396
+ end
1397
+
1398
+ end
1399
+ DEPAGER_EXPANDED_CODE
1400
+
1401
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 666
1402
+ def _act_4 val
1403
+ nil
1404
+
1405
+ end
1406
+ DEPAGER_EXPANDED_CODE
1407
+
1408
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 667
1409
+ def _act_5 val
1410
+ _THREAD, _id_list, = *val
1411
+ N_THREAD[val[0].lineno, _id_list, []]
1412
+
1413
+ end
1414
+ DEPAGER_EXPANDED_CODE
1415
+
1416
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 668
1417
+ def _act_6 val
1418
+ _TRANSFER, _id_list, = *val
1419
+ N_TRANSFER[val[0].lineno, _id_list, []]
1420
+
1421
+ end
1422
+ DEPAGER_EXPANDED_CODE
1423
+
1424
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 669
1425
+ def _act_7 val
1426
+ _EXCEPT, _lhs_list, = *val
1427
+ N_EXCEPT[val[0].lineno, lhs_list]
1428
+
1429
+ end
1430
+ DEPAGER_EXPANDED_CODE
1431
+
1432
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 670
1433
+ def _act_8 val
1434
+ _EXCEPT, _lhs, _, _rbexpr, = *val
1435
+ N_EXCEPT[val[0].lineno, N_LET[_lhs.lineno, _lhs, _rbexpr]]
1436
+
1437
+ end
1438
+ DEPAGER_EXPANDED_CODE
1439
+
1440
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 671
1441
+ def _act_9 val
1442
+ _lhs, _, _rbexpr, = *val
1443
+ N_LET[_lhs.lineno, _lhs, _rbexpr]
1444
+
1445
+ end
1446
+ DEPAGER_EXPANDED_CODE
1447
+
1448
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 673
1449
+ def _act_10 val
1450
+ _LID, _, _rbexpr, = *val
1451
+
1452
+ N_LET[val[0].lineno, N_ATOC[val[0].lineno, nil, _LID.value, g_parser.rules.size-1], _rbexpr]
1453
+
1454
+ end
1455
+ DEPAGER_EXPANDED_CODE
1456
+
1457
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 677
1458
+ def _act_11 val
1459
+ _ID, _, _rbexpr, = *val
1460
+
1461
+ basis.locals[_ID.value] = true
1462
+ N_LET[val[0].lineno, N_ATOC[val[0].lineno, nil, _ID.value, g_parser.rules.size-1], _rbexpr]
1463
+
1464
+ end
1465
+ DEPAGER_EXPANDED_CODE
1466
+
1467
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 681
1468
+ def _act_12 val
1469
+ _rbexpr, = *val
1470
+ N_ACTION[basis.file.lineno, _rbexpr ]
1471
+
1472
+ end
1473
+ DEPAGER_EXPANDED_CODE
1474
+
1475
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 685
1476
+ def _act_13 val
1477
+ _rbexpr, = *val
1478
+ _rbexpr
1479
+
1480
+ end
1481
+ DEPAGER_EXPANDED_CODE
1482
+
1483
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 686
1484
+ def _act_14 val
1485
+ _rbexpr_list, _, = *val
1486
+ _rbexpr_list
1487
+
1488
+ end
1489
+ DEPAGER_EXPANDED_CODE
1490
+
1491
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 687
1492
+ def _act_15 val
1493
+ _rbexpr_list, _, _rbexpr, = *val
1494
+ (_rbexpr_list << ';').concat _rbexpr
1495
+
1496
+ end
1497
+ DEPAGER_EXPANDED_CODE
1498
+
1499
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 690
1500
+ def _act_16 val
1501
+ _rbelem, = *val
1502
+ _rbelem
1503
+
1504
+ end
1505
+ DEPAGER_EXPANDED_CODE
1506
+
1507
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 691
1508
+ def _act_17 val
1509
+ _rbexpr, _rbelem, = *val
1510
+ _rbexpr.concat _rbelem
1511
+
1512
+ end
1513
+ DEPAGER_EXPANDED_CODE
1514
+
1515
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 694
1516
+ def _act_18 val
1517
+ _lhs, = *val
1518
+ [_lhs]
1519
+
1520
+ end
1521
+ DEPAGER_EXPANDED_CODE
1522
+
1523
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 695
1524
+ def _act_19 val
1525
+ _ID, = *val
1526
+ [_ID.value]
1527
+
1528
+ end
1529
+ DEPAGER_EXPANDED_CODE
1530
+
1531
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 696
1532
+ def _act_20 val
1533
+ _LID, = *val
1534
+ [ N_ATOC[_LID.lineno, nil, _LID.value, g_parser.rules.size-1] ]
1535
+
1536
+ end
1537
+ DEPAGER_EXPANDED_CODE
1538
+
1539
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 697
1540
+ def _act_21 val
1541
+ _RBTOKEN, = *val
1542
+ [_RBTOKEN.value]
1543
+
1544
+ end
1545
+ DEPAGER_EXPANDED_CODE
1546
+
1547
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 698
1548
+ def _act_22 val
1549
+ _, = *val
1550
+ ['.']
1551
+
1552
+ end
1553
+ DEPAGER_EXPANDED_CODE
1554
+
1555
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 699
1556
+ def _act_23 val
1557
+ _, = *val
1558
+ [',']
1559
+
1560
+ end
1561
+ DEPAGER_EXPANDED_CODE
1562
+
1563
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 700
1564
+ def _act_24 val
1565
+ _, _, = *val
1566
+ [ val[0].value, ']' ]
1567
+
1568
+ end
1569
+ DEPAGER_EXPANDED_CODE
1570
+
1571
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 701
1572
+ def _act_25 val
1573
+ _, _rbexpr_list, _, = *val
1574
+ [ val[0].value ].concat(_rbexpr_list) << ']'
1575
+
1576
+ end
1577
+ DEPAGER_EXPANDED_CODE
1578
+
1579
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 702
1580
+ def _act_26 val
1581
+ _, _, = *val
1582
+ [ val[0].value, '}' ]
1583
+
1584
+ end
1585
+ DEPAGER_EXPANDED_CODE
1586
+
1587
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 703
1588
+ def _act_27 val
1589
+ _, _rbexpr_list, _, = *val
1590
+ [ val[0].value ].concat(_rbexpr_list) << '}'
1591
+
1592
+ end
1593
+ DEPAGER_EXPANDED_CODE
1594
+
1595
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 704
1596
+ def _act_28 val
1597
+ _, _, = *val
1598
+ [ val[0].value, ')' ]
1599
+
1600
+ end
1601
+ DEPAGER_EXPANDED_CODE
1602
+
1603
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 705
1604
+ def _act_29 val
1605
+ _, _rbexpr_list, _, = *val
1606
+ [ val[0].value ].concat(_rbexpr_list) << ')'
1607
+
1608
+ end
1609
+ DEPAGER_EXPANDED_CODE
1610
+
1611
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 710
1612
+ def _act_30 val
1613
+ _lhs, = *val
1614
+ [ _lhs ]
1615
+
1616
+ end
1617
+ DEPAGER_EXPANDED_CODE
1618
+
1619
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 711
1620
+ def _act_31 val
1621
+ _lhs_list, _, _lhs, = *val
1622
+ lhs_list << lhs
1623
+
1624
+ end
1625
+ DEPAGER_EXPANDED_CODE
1626
+
1627
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 714
1628
+ def _act_32 val
1629
+ _ID, _, _attr, = *val
1630
+ N_ATOC[_ID.lineno, _ID.value, _attr.value, g_parser.rules.size-1]
1631
+
1632
+ end
1633
+ DEPAGER_EXPANDED_CODE
1634
+
1635
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 717
1636
+ def _act_33 val
1637
+ _ID, = *val
1638
+ [ _ID.value ]
1639
+
1640
+ end
1641
+ DEPAGER_EXPANDED_CODE
1642
+
1643
+ module_eval <<-'DEPAGER_EXPANDED_CODE', 'lib/depager/ruby/plugins/rie.dr', 718
1644
+ def _act_34 val
1645
+ _id_list, _, _ID, = *val
1646
+ _id_list << _ID.value
1647
+
1648
+ end
1649
+ DEPAGER_EXPANDED_CODE
1650
+
1651
+
1652
+ end
1653
+