depager 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README.en +5 -10
- data/bin/depager +17 -20
- data/examples/c89/c89.tab.rb +5632 -702
- data/examples/pl0d/pl0ds.dr +41 -41
- data/examples/pl0d/pl0ds.tab.rb +1887 -874
- data/examples/sample_calc/calc.action.tab.rb +243 -69
- data/examples/sample_calc/{calc.astl.action.dr → calc.ast.action.dr} +7 -7
- data/examples/sample_calc/calc.ast.action.tab.rb +755 -0
- data/examples/sample_calc/{calc.astl.dr → calc.ast.dr} +7 -7
- data/examples/sample_calc/calc.ast.tab.rb +672 -0
- data/examples/sample_calc/calc.astdf.dr +5 -5
- data/examples/sample_calc/calc.astdf.tab.rb +405 -202
- data/examples/sample_calc/calc.atree.tab.rb +243 -69
- data/examples/sample_calc/calc.cst.tab.rb +275 -109
- data/examples/sample_calc/calc.lex.tab.rb +210 -28
- data/examples/sample_calc/calc.nvaction.tab.rb +251 -77
- data/examples/sample_calc/calc.tab.rb +210 -28
- data/examples/sample_calc/calc_prec.nvaction.tab.rb +224 -50
- data/examples/slex_test/divreg.slex.tab.rb +97 -21
- data/examples/slex_test/ljoin.slex.tab.rb +128 -35
- data/lib/depager.rb +77 -44
- data/lib/depager/{ast_base.dr → ast.dr} +56 -18
- data/lib/depager/{ast_base.rb → ast.rb} +432 -424
- data/lib/depager/astdf.rb +3 -6
- data/lib/depager/atree.rb +54 -62
- data/lib/depager/cst.dr +2 -2
- data/lib/depager/cst.rb +64 -77
- data/lib/depager/grammar.rb +225 -66
- data/lib/depager/lex.dr +1 -1
- data/lib/depager/lex.rb +45 -54
- data/lib/depager/lr.rb +181 -262
- data/lib/depager/lr_put_table.rb +116 -0
- data/lib/depager/nvaction.rb +1 -1
- data/lib/depager/parser.rb +23 -2
- data/lib/depager/slex.dr +3 -3
- data/lib/depager/slex.rb +148 -169
- data/lib/depager/srp.rb +1 -1
- data/lib/depager/template/ast.erbs +69 -0
- data/lib/depager/template/extension_lalr_master.erb +3 -3
- data/lib/depager/template/extension_lalr_slave.erb +7 -7
- data/lib/depager/template/simple.erb +4 -2
- data/lib/depager/template/single_lalr_parser.erb +30 -10
- data/lib/depager/utils.rb +10 -9
- data/lib/depager/version.rb +2 -8
- metadata +10 -11
- data/examples/sample_calc/calc.astl.action.tab.rb +0 -593
- data/examples/sample_calc/calc.astl.tab.rb +0 -501
- data/lib/depager/astl.rb +0 -14
- data/lib/depager/template/astdf.erbs +0 -57
- data/lib/depager/template/astl.erbs +0 -57
@@ -0,0 +1,116 @@
|
|
1
|
+
class Depager::LALR::Table
|
2
|
+
def state_info
|
3
|
+
@state_info
|
4
|
+
end
|
5
|
+
|
6
|
+
#puts grammar.closure.values.join("\n")
|
7
|
+
#puts "-----"
|
8
|
+
#puts grammar.memo_closure1.sort_by{|k,v| k}.map{|k,v| "#{k.inspect}:\n#{v.join("\n")}"}
|
9
|
+
#puts 'mk'; mk.each{|k, v| p "#{k}=>#{v}"}
|
10
|
+
#trn = trn.uniq
|
11
|
+
#puts 'trn',trn.map{|a| "<#{a[2].n}>#{a[0]} => <#{a[3].n}>#{a[1]}"}
|
12
|
+
|
13
|
+
def gen_state_info
|
14
|
+
g = grammar
|
15
|
+
@state_info = []
|
16
|
+
@action_table.each_with_index {|s,x|
|
17
|
+
shi, red, acc = "", "", ""
|
18
|
+
s.each_with_index {|t, y|
|
19
|
+
next unless t
|
20
|
+
hd = (" %-15s" % g.symname(y + g.nonterms.size))
|
21
|
+
if t == 'ACC'
|
22
|
+
acc = "#{hd} accept\n\n"
|
23
|
+
elsif t < 0
|
24
|
+
red << "#{hd} reduce using rule #{-t} (#{g.symname g[-t].lhs})\n"
|
25
|
+
else
|
26
|
+
shi << "#{hd} shift, and goto to state #{t}\n"
|
27
|
+
end
|
28
|
+
}
|
29
|
+
if t = @defred_table[x]
|
30
|
+
as = @defred_after_shift_table[x] ? " [after shift]" : ""
|
31
|
+
red << (" %-15s" % '$default') <<
|
32
|
+
"reduce using rule #{-t} (#{g.symname g[-t].lhs}) #{as}\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
@state_info << (@states[x].to_s << "\n\n#{shi}\n#{red}\n#{acc}")
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def verbose dp
|
40
|
+
g, output = grammar, []
|
41
|
+
|
42
|
+
if $MP_DEBUG.match(/f/)
|
43
|
+
output << "** FIRST1 **"
|
44
|
+
str = g.first1.map{|k, v|
|
45
|
+
"#{g.symname k} => #{v.map{|i| g.symname i}.join(' ')}"
|
46
|
+
}.join("\n")
|
47
|
+
output << "#{str}\n\n"
|
48
|
+
end
|
49
|
+
|
50
|
+
if $MP_DEBUG.match(/e/)
|
51
|
+
output << "** Empty Reduction **"
|
52
|
+
str = g.f0e.map {|k, v|
|
53
|
+
"#{g.symname k} =>\n" << v.map{|n, f|
|
54
|
+
" #{rulelist[n]} ? #{f.map{|i| g.symname i}.join(' ')}"
|
55
|
+
}.join("\n")
|
56
|
+
}.join("\n")
|
57
|
+
output << "#{str}\n\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
if $MP_DEBUG.match(/s/)
|
61
|
+
output << "** SYMBOLS **"
|
62
|
+
str = g.syms.map{|k,_| "#{"%03i" % k} #{ g.symname k}"}.sort.join("\n")
|
63
|
+
output << "#{str}\n\n"
|
64
|
+
end
|
65
|
+
|
66
|
+
if $MP_DEBUG.match(/g/)
|
67
|
+
output << "*** Grammar ***"
|
68
|
+
str = g.rulelist.join("\n")
|
69
|
+
output << "#{str}\n\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
if $MP_DEBUG.match(/c/)
|
73
|
+
output << "*** States ***"
|
74
|
+
output << @state_info.to_s
|
75
|
+
end
|
76
|
+
|
77
|
+
nssize = g.nonterms.size
|
78
|
+
if $MP_DEBUG.match(/t/)
|
79
|
+
output << "*** Action Table ***"
|
80
|
+
ws = (nssize...g.syms.size).map{|i| j = g.symname(i).size; j < 6 ? 6 : j}
|
81
|
+
str = " |"
|
82
|
+
(nssize...g.syms.size).each_with_index{|i, x|
|
83
|
+
str << ("%0#{ws[x]}s|" % g.symname(i))
|
84
|
+
}; str << " $default|\n"
|
85
|
+
|
86
|
+
@action_table.each_with_index{|i,x|
|
87
|
+
str << ("%03i|" % x)
|
88
|
+
i.each_with_index{|j, y|
|
89
|
+
str << ("%0#{ws[y]}s|" % j)
|
90
|
+
}
|
91
|
+
str << ("%04s,%04s|\n" % [@defred_table[x], @defred_after_shift_table[x]])
|
92
|
+
}
|
93
|
+
output << "#{str}\n\n"
|
94
|
+
|
95
|
+
output << "*** Goto Table ***"
|
96
|
+
ws = (1...nssize).map{|i| j = g.symname(i).size; j < 6 ? 6 : j}
|
97
|
+
str = " |"
|
98
|
+
(1...nssize).each_with_index{|i, x|
|
99
|
+
str << ("%0#{ws[x]}s|" % g.symname(i))
|
100
|
+
}; str << "\n"
|
101
|
+
|
102
|
+
@goto_table.each_with_index{|i,x|
|
103
|
+
str << ("%03i|" % x)
|
104
|
+
i.each_with_index{|j, y|
|
105
|
+
str << ("%0#{ws[y]}s|" % j)
|
106
|
+
}
|
107
|
+
str << "\n"
|
108
|
+
}
|
109
|
+
output << "#{str}\n\n"
|
110
|
+
end
|
111
|
+
|
112
|
+
File.open("#{File.basename(dp.files.fname, '.dr')}.output", "w"){|f|
|
113
|
+
f.write output.join("\n")
|
114
|
+
}
|
115
|
+
end
|
116
|
+
end
|
data/lib/depager/nvaction.rb
CHANGED
data/lib/depager/parser.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Depager; end
|
3
2
|
#
|
4
3
|
# Token
|
5
4
|
#
|
@@ -104,6 +103,28 @@ module Depager::LALR
|
|
104
103
|
end
|
105
104
|
def reduce
|
106
105
|
end
|
106
|
+
|
107
|
+
def enable?(act, sym)
|
108
|
+
case act
|
109
|
+
when :shift
|
110
|
+
la = @basis.t2i[sym] || @basis.t2i[false]
|
111
|
+
val = @basis.action_table[@basis.stack.last][la]
|
112
|
+
else
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def enables(act, sym)
|
117
|
+
case act
|
118
|
+
when :shift
|
119
|
+
la = @basis.t2i[sym] || @basis.t2i[false]
|
120
|
+
res = []
|
121
|
+
@basis.action_table.each_with_index{|i, x|
|
122
|
+
i[la] and res.push(x)
|
123
|
+
}
|
124
|
+
return res
|
125
|
+
else
|
126
|
+
end
|
127
|
+
end
|
107
128
|
end
|
108
129
|
|
109
130
|
class Basis < Parser
|
data/lib/depager/slex.dr
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
ll << %{
|
107
107
|
def lex_#{m}(&block)
|
108
108
|
case @line
|
109
|
-
#{l
|
109
|
+
#{l}
|
110
110
|
else
|
111
111
|
#{else_code}
|
112
112
|
end
|
@@ -140,7 +140,7 @@
|
|
140
140
|
| ':' ID { _ID.value }
|
141
141
|
;
|
142
142
|
lexactlist:
|
143
|
-
lexact {
|
143
|
+
lexact { _lexact }
|
144
144
|
| lexactlist lexact { _lexactlist << _lexact }
|
145
145
|
;
|
146
146
|
lexact:
|
@@ -159,7 +159,7 @@
|
|
159
159
|
;
|
160
160
|
lexlist:
|
161
161
|
LEX { [ _LEX.value ] }
|
162
|
-
| lexlist ',' LEX { _lexlist.push _LEX }
|
162
|
+
| lexlist ',' LEX { _lexlist.push _LEX.value }
|
163
163
|
;
|
164
164
|
#end-rule
|
165
165
|
%%
|
data/lib/depager/slex.rb
CHANGED
@@ -31,10 +31,10 @@ class StatefulLexerExtension #:nodoc:all
|
|
31
31
|
|
32
32
|
@hook[1] = StatefulLexerExtension_prerhs_postsymbol.new(p, @nparam, self)
|
33
33
|
@h2p['prerhs_postsymbol'] = @hook[1]
|
34
|
-
p.
|
34
|
+
p.prerhs.push [@hook[1], :do_parse]
|
35
35
|
|
36
36
|
# use @hook[1](StatefulLexerExtension_prerhs_postsymbol)
|
37
|
-
p.
|
37
|
+
p.postsymbol.push [@hook[1], :do_parse]
|
38
38
|
|
39
39
|
regext p
|
40
40
|
end
|
@@ -170,20 +170,20 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
170
170
|
action_table = [
|
171
171
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
172
172
|
[ ACC, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
173
|
-
[ nil, nil,
|
174
|
-
[ nil, nil, nil,
|
175
|
-
[ nil, nil, nil,
|
176
|
-
[ nil, nil, nil, nil, nil,
|
177
|
-
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
173
|
+
[ nil, nil, 4, nil, nil, nil, nil, nil, nil, nil, ],
|
174
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 8, nil, ],
|
175
|
+
[ nil, nil, nil, 9, nil, nil, nil, nil, nil, nil, ],
|
176
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 8, nil, ],
|
178
177
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
179
178
|
[ nil, nil, nil, nil, nil, nil, nil, 12, nil, 13, ],
|
180
|
-
[ nil, nil, nil, nil, nil, nil, nil, nil, 6, nil, ],
|
181
|
-
[ nil, nil, nil, nil, 16, nil, nil, nil, nil, nil, ],
|
182
|
-
[ nil, nil, nil, 17, nil, nil, nil, nil, nil, nil, ],
|
183
179
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
184
|
-
[ nil, nil, nil, nil, nil,
|
185
|
-
[ nil, nil, nil, nil, nil, nil,
|
180
|
+
[ nil, nil, nil, nil, nil, 15, nil, nil, nil, nil, ],
|
181
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
182
|
+
[ nil, nil, nil, nil, nil, nil, 16, nil, nil, nil, ],
|
186
183
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
184
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 17, nil, ],
|
185
|
+
[ nil, nil, nil, nil, 18, nil, nil, nil, nil, nil, ],
|
186
|
+
[ nil, nil, nil, 19, nil, nil, nil, nil, nil, nil, ],
|
187
187
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
188
188
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
189
189
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
@@ -196,21 +196,21 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
196
196
|
-1,
|
197
197
|
nil,
|
198
198
|
nil,
|
199
|
-
-
|
200
|
-
-12,
|
199
|
+
-3,
|
201
200
|
-7,
|
202
201
|
-10,
|
203
|
-
-
|
204
|
-
|
202
|
+
-12,
|
203
|
+
-5,
|
204
|
+
-8,
|
205
205
|
nil,
|
206
206
|
-11,
|
207
207
|
nil,
|
208
208
|
nil,
|
209
|
-
|
209
|
+
nil,
|
210
|
+
-9,
|
211
|
+
-13,
|
210
212
|
-4,
|
211
213
|
-6,
|
212
|
-
-13,
|
213
|
-
-9,
|
214
214
|
]
|
215
215
|
defred_after_shift_table = [
|
216
216
|
-2,
|
@@ -219,20 +219,20 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
219
219
|
nil,
|
220
220
|
nil,
|
221
221
|
nil,
|
222
|
-
-12,
|
223
222
|
-7,
|
224
223
|
nil,
|
224
|
+
-12,
|
225
225
|
nil,
|
226
|
-
|
226
|
+
-8,
|
227
227
|
nil,
|
228
228
|
-11,
|
229
229
|
nil,
|
230
230
|
nil,
|
231
|
-
|
231
|
+
nil,
|
232
|
+
-9,
|
233
|
+
-13,
|
232
234
|
-4,
|
233
235
|
-6,
|
234
|
-
-13,
|
235
|
-
-9,
|
236
236
|
]
|
237
237
|
### Nonterm to Int
|
238
238
|
nt2i = {
|
@@ -260,14 +260,14 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
260
260
|
goto_table = [
|
261
261
|
[ 1, 2, nil, nil, nil, nil, nil, nil, ],
|
262
262
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
263
|
-
[ nil, nil,
|
263
|
+
[ nil, nil, 3, nil, nil, nil, nil, nil, ],
|
264
|
+
[ nil, nil, nil, 5, nil, 6, 7, nil, ],
|
264
265
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
265
|
-
[ nil, nil, nil,
|
266
|
-
[ nil, nil, nil, nil, 10, nil, nil, nil, ],
|
266
|
+
[ nil, nil, nil, nil, nil, 10, 7, nil, ],
|
267
267
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
268
|
+
[ nil, nil, nil, nil, nil, nil, nil, 11, ],
|
268
269
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
269
|
-
[ nil, nil, nil, nil,
|
270
|
-
[ nil, nil, nil, nil, nil, 15, 8, nil, ],
|
270
|
+
[ nil, nil, nil, nil, 14, nil, nil, nil, ],
|
271
271
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
272
272
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
273
273
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
@@ -368,8 +368,7 @@ end
|
|
368
368
|
|
369
369
|
class D4StatefulLexerExtension_prerulelist::NVAction < Depager::LALR::Action #:nodoc:all
|
370
370
|
include Depager::DecoratorUtils
|
371
|
-
|
372
|
-
|
371
|
+
[" include ActionParser\n"]
|
373
372
|
on_reduce = [
|
374
373
|
nil,
|
375
374
|
:_act_0,
|
@@ -395,9 +394,9 @@ class D4StatefulLexerExtension_prerulelist::NVAction < Depager::LALR::Action #:n
|
|
395
394
|
end
|
396
395
|
|
397
396
|
|
398
|
-
module_eval <<-'.,.,
|
399
|
-
|
400
|
-
_mode_list = *val
|
397
|
+
module_eval <<-'.,.,120998292328650.,.,', 'slex.dr', 96
|
398
|
+
def _act_0 val
|
399
|
+
_mode_list, = *val
|
401
400
|
|
402
401
|
ll = ''
|
403
402
|
_mode_list.each do |m, s, l|
|
@@ -409,7 +408,7 @@ module_eval <<-'.,.,118754107818868.,.,', 'slex.dr', 96
|
|
409
408
|
ll << %{
|
410
409
|
def lex_#{m}(&block)
|
411
410
|
case @line
|
412
|
-
#{l
|
411
|
+
#{l}
|
413
412
|
else
|
414
413
|
#{else_code}
|
415
414
|
end
|
@@ -430,74 +429,66 @@ module_eval <<-'.,.,118754107818868.,.,', 'slex.dr', 96
|
|
430
429
|
end
|
431
430
|
}; #code
|
432
431
|
|
433
|
-
|
434
|
-
|
435
|
-
.,.,118754107818868.,.,
|
432
|
+
end
|
433
|
+
.,.,120998292328650.,.,
|
436
434
|
|
437
|
-
module_eval <<-'.,.,
|
438
|
-
|
435
|
+
module_eval <<-'.,.,120998292354849.,.,', 'slex.dr', 130
|
436
|
+
def _act_1 val
|
439
437
|
[ ]
|
440
438
|
|
441
|
-
|
442
|
-
|
443
|
-
.,.,118754107863583.,.,
|
439
|
+
end
|
440
|
+
.,.,120998292354849.,.,
|
444
441
|
|
445
|
-
module_eval <<-'.,.,
|
446
|
-
|
447
|
-
_mode_list, _mode, _lexactlist = *val
|
442
|
+
module_eval <<-'.,.,120998292352082.,.,', 'slex.dr', 131
|
443
|
+
def _act_2 val
|
444
|
+
_mode_list, _mode, _lexactlist, = *val
|
448
445
|
_mode_list << [_mode[0], _mode[1], _lexactlist]
|
449
446
|
|
450
|
-
|
451
|
-
|
452
|
-
.,.,118754107817072.,.,
|
447
|
+
end
|
448
|
+
.,.,120998292352082.,.,
|
453
449
|
|
454
|
-
module_eval <<-'.,.,
|
455
|
-
|
456
|
-
_, _ID, _opt_super, _ = *val
|
450
|
+
module_eval <<-'.,.,12099829232991.,.,', 'slex.dr', 134
|
451
|
+
def _act_3 val
|
452
|
+
_, _ID, _opt_super, _, = *val
|
457
453
|
[ _ID.value, _opt_super ]
|
458
454
|
|
459
|
-
|
460
|
-
|
461
|
-
.,.,118754107816434.,.,
|
455
|
+
end
|
456
|
+
.,.,12099829232991.,.,
|
462
457
|
|
463
|
-
module_eval <<-'.,.,
|
464
|
-
|
458
|
+
module_eval <<-'.,.,12099829237562.,.,', 'slex.dr', 137
|
459
|
+
def _act_4 val
|
465
460
|
nil
|
466
461
|
|
467
|
-
|
468
|
-
|
469
|
-
.,.,118754107840777.,.,
|
462
|
+
end
|
463
|
+
.,.,12099829237562.,.,
|
470
464
|
|
471
|
-
module_eval <<-'.,.,
|
472
|
-
|
473
|
-
_, _ID = *val
|
465
|
+
module_eval <<-'.,.,120998292348892.,.,', 'slex.dr', 138
|
466
|
+
def _act_5 val
|
467
|
+
_, _ID, = *val
|
474
468
|
_ID.value
|
475
469
|
|
476
|
-
|
477
|
-
|
478
|
-
.,.,118754107819808.,.,
|
470
|
+
end
|
471
|
+
.,.,120998292348892.,.,
|
479
472
|
|
480
|
-
module_eval <<-'.,.,
|
481
|
-
|
482
|
-
_lexact = *val
|
483
|
-
|
473
|
+
module_eval <<-'.,.,120998292360134.,.,', 'slex.dr', 141
|
474
|
+
def _act_6 val
|
475
|
+
_lexact, = *val
|
476
|
+
_lexact
|
484
477
|
|
485
|
-
|
486
|
-
|
487
|
-
.,.,118754107825523.,.,
|
478
|
+
end
|
479
|
+
.,.,120998292360134.,.,
|
488
480
|
|
489
|
-
module_eval <<-'.,.,
|
490
|
-
|
491
|
-
_lexactlist, _lexact = *val
|
481
|
+
module_eval <<-'.,.,120998292332012.,.,', 'slex.dr', 142
|
482
|
+
def _act_7 val
|
483
|
+
_lexactlist, _lexact, = *val
|
492
484
|
_lexactlist << _lexact
|
493
485
|
|
494
|
-
|
495
|
-
|
496
|
-
.,.,11875410787826.,.,
|
486
|
+
end
|
487
|
+
.,.,120998292332012.,.,
|
497
488
|
|
498
|
-
module_eval <<-'.,.,
|
499
|
-
|
500
|
-
_lexlist, _opt_noskip, _ACTION = *val
|
489
|
+
module_eval <<-'.,.,12099829232968.,.,', 'slex.dr', 146
|
490
|
+
def _act_8 val
|
491
|
+
_lexlist, _opt_noskip, _ACTION, = *val
|
501
492
|
|
502
493
|
%{
|
503
494
|
when #{_lexlist.join(', ')}
|
@@ -505,44 +496,39 @@ module_eval <<-'.,.,118754107820340.,.,', 'slex.dr', 146
|
|
505
496
|
#{ _ACTION.value }
|
506
497
|
}; #code
|
507
498
|
|
508
|
-
|
509
|
-
|
510
|
-
.,.,118754107820340.,.,
|
499
|
+
end
|
500
|
+
.,.,12099829232968.,.,
|
511
501
|
|
512
|
-
module_eval <<-'.,.,
|
513
|
-
|
502
|
+
module_eval <<-'.,.,120998292350935.,.,', 'slex.dr', 155
|
503
|
+
def _act_9 val
|
514
504
|
false
|
515
505
|
|
516
|
-
|
517
|
-
|
518
|
-
.,.,118754107818518.,.,
|
506
|
+
end
|
507
|
+
.,.,120998292350935.,.,
|
519
508
|
|
520
|
-
module_eval <<-'.,.,
|
521
|
-
|
522
|
-
_ = *val
|
509
|
+
module_eval <<-'.,.,120998292356440.,.,', 'slex.dr', 156
|
510
|
+
def _act_10 val
|
511
|
+
_, = *val
|
523
512
|
true
|
524
513
|
|
525
|
-
|
526
|
-
|
527
|
-
.,.,118754107850066.,.,
|
514
|
+
end
|
515
|
+
.,.,120998292356440.,.,
|
528
516
|
|
529
|
-
module_eval <<-'.,.,
|
530
|
-
|
531
|
-
_LEX = *val
|
517
|
+
module_eval <<-'.,.,120998292318605.,.,', 'slex.dr', 159
|
518
|
+
def _act_11 val
|
519
|
+
_LEX, = *val
|
532
520
|
[ _LEX.value ]
|
533
521
|
|
534
|
-
|
535
|
-
|
536
|
-
.,.,118754107825362.,.,
|
522
|
+
end
|
523
|
+
.,.,120998292318605.,.,
|
537
524
|
|
538
|
-
module_eval <<-'.,.,
|
539
|
-
|
540
|
-
_lexlist, _, _LEX = *val
|
541
|
-
_lexlist.push _LEX
|
542
|
-
|
543
|
-
end
|
525
|
+
module_eval <<-'.,.,120998292362428.,.,', 'slex.dr', 160
|
526
|
+
def _act_12 val
|
527
|
+
_lexlist, _, _LEX, = *val
|
528
|
+
_lexlist.push _LEX.value
|
544
529
|
|
545
|
-
|
530
|
+
end
|
531
|
+
.,.,120998292362428.,.,
|
546
532
|
|
547
533
|
end
|
548
534
|
|
@@ -598,21 +584,21 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
598
584
|
]
|
599
585
|
### Action Table
|
600
586
|
action_table = [
|
601
|
-
[ nil, nil,
|
602
|
-
[ nil, nil, nil, nil, nil, 7, nil, 3, 4, ],
|
587
|
+
[ nil, nil, 2, nil, nil, nil, nil, nil, nil, ],
|
603
588
|
[ ACC, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
604
|
-
[ nil, nil, nil, nil, nil,
|
605
|
-
[ nil, nil, nil,
|
606
|
-
[ nil, nil, nil, 10, 11, 7, nil, 3, 4, ],
|
589
|
+
[ nil, nil, nil, nil, nil, 5, nil, 6, 7, ],
|
590
|
+
[ nil, nil, nil, 8, 10, 5, nil, 6, 7, ],
|
607
591
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
592
|
+
[ nil, nil, nil, nil, nil, nil, 11, nil, nil, ],
|
593
|
+
[ nil, nil, nil, nil, nil, nil, 12, nil, nil, ],
|
608
594
|
[ nil, nil, nil, nil, nil, nil, 13, nil, nil, ],
|
609
595
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
610
596
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
611
|
-
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
612
597
|
[ nil, nil, nil, 14, nil, nil, nil, nil, nil, ],
|
613
598
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
614
599
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
615
600
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
601
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
616
602
|
]
|
617
603
|
### Default Reduce Table
|
618
604
|
defred_table = [
|
@@ -620,16 +606,16 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
620
606
|
nil,
|
621
607
|
nil,
|
622
608
|
nil,
|
609
|
+
-3,
|
623
610
|
nil,
|
624
611
|
nil,
|
625
|
-
-3,
|
626
612
|
nil,
|
627
|
-
-6,
|
628
|
-
-7,
|
629
613
|
-1,
|
630
|
-
nil,
|
631
614
|
-4,
|
615
|
+
nil,
|
632
616
|
-5,
|
617
|
+
-6,
|
618
|
+
-7,
|
633
619
|
-2,
|
634
620
|
]
|
635
621
|
defred_after_shift_table = [
|
@@ -637,16 +623,16 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
637
623
|
nil,
|
638
624
|
nil,
|
639
625
|
nil,
|
626
|
+
-3,
|
640
627
|
nil,
|
641
628
|
nil,
|
642
|
-
-3,
|
643
629
|
nil,
|
644
|
-
-6,
|
645
|
-
-7,
|
646
630
|
-1,
|
647
|
-
nil,
|
648
631
|
-4,
|
632
|
+
nil,
|
649
633
|
-5,
|
634
|
+
-6,
|
635
|
+
-7,
|
650
636
|
-2,
|
651
637
|
]
|
652
638
|
### Nonterm to Int
|
@@ -663,12 +649,12 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
663
649
|
]
|
664
650
|
### Goto Table
|
665
651
|
goto_table = [
|
666
|
-
[
|
667
|
-
[ nil, 5, 6, ],
|
652
|
+
[ 1, nil, nil, ],
|
668
653
|
[ nil, nil, nil, ],
|
654
|
+
[ nil, 3, 4, ],
|
655
|
+
[ nil, nil, 9, ],
|
669
656
|
[ nil, nil, nil, ],
|
670
657
|
[ nil, nil, nil, ],
|
671
|
-
[ nil, nil, 12, ],
|
672
658
|
[ nil, nil, nil, ],
|
673
659
|
[ nil, nil, nil, ],
|
674
660
|
[ nil, nil, nil, ],
|
@@ -750,7 +736,7 @@ end
|
|
750
736
|
|
751
737
|
class D4StatefulLexerExtension_prerhs_postsymbol::NVAction < Depager::LALR::Action #:nodoc:all
|
752
738
|
include Depager::DecoratorUtils
|
753
|
-
|
739
|
+
[]
|
754
740
|
on_reduce = [
|
755
741
|
nil,
|
756
742
|
:_act_0,
|
@@ -770,70 +756,63 @@ class D4StatefulLexerExtension_prerhs_postsymbol::NVAction < Depager::LALR::Acti
|
|
770
756
|
end
|
771
757
|
|
772
758
|
|
773
|
-
module_eval <<-'.,.,
|
774
|
-
|
775
|
-
_, _option_list, _ = *val
|
759
|
+
module_eval <<-'.,.,120998292310380.,.,', 'slex.dr', 180
|
760
|
+
def _act_0 val
|
761
|
+
_, _option_list, _, = *val
|
776
762
|
|
777
763
|
master.ins.push [g_parser.rhs.size, _option_list, false]
|
778
764
|
|
779
|
-
|
780
|
-
|
781
|
-
.,.,11875410786796.,.,
|
765
|
+
end
|
766
|
+
.,.,120998292310380.,.,
|
782
767
|
|
783
|
-
module_eval <<-'.,.,
|
784
|
-
|
785
|
-
_, _option_list, _, _ = *val
|
768
|
+
module_eval <<-'.,.,120998292354182.,.,', 'slex.dr', 184
|
769
|
+
def _act_1 val
|
770
|
+
_, _option_list, _, _, = *val
|
786
771
|
|
787
772
|
master.ins.push [g_parser.rhs.size, _option_list, true]
|
788
773
|
|
789
|
-
|
790
|
-
|
791
|
-
.,.,118754107862281.,.,
|
774
|
+
end
|
775
|
+
.,.,120998292354182.,.,
|
792
776
|
|
793
|
-
module_eval <<-'.,.,
|
794
|
-
|
795
|
-
_option = *val
|
777
|
+
module_eval <<-'.,.,120998292345458.,.,', 'slex.dr', 190
|
778
|
+
def _act_2 val
|
779
|
+
_option, = *val
|
796
780
|
[_option]
|
797
781
|
|
798
|
-
|
799
|
-
|
800
|
-
.,.,118754107859502.,.,
|
782
|
+
end
|
783
|
+
.,.,120998292345458.,.,
|
801
784
|
|
802
|
-
module_eval <<-'.,.,
|
803
|
-
|
804
|
-
_option_list, _option = *val
|
785
|
+
module_eval <<-'.,.,120998292359833.,.,', 'slex.dr', 191
|
786
|
+
def _act_3 val
|
787
|
+
_option_list, _option, = *val
|
805
788
|
_option_list << _option
|
806
789
|
|
807
|
-
|
808
|
-
|
809
|
-
.,.,118754107825820.,.,
|
790
|
+
end
|
791
|
+
.,.,120998292359833.,.,
|
810
792
|
|
811
|
-
module_eval <<-'.,.,
|
812
|
-
|
813
|
-
_, _SYMBOL = *val
|
793
|
+
module_eval <<-'.,.,120998292340459.,.,', 'slex.dr', 194
|
794
|
+
def _act_4 val
|
795
|
+
_, _SYMBOL, = *val
|
814
796
|
[:GOTO, _SYMBOL.value]
|
815
797
|
|
816
|
-
|
817
|
-
|
818
|
-
.,.,118754107852027.,.,
|
798
|
+
end
|
799
|
+
.,.,120998292340459.,.,
|
819
800
|
|
820
|
-
module_eval <<-'.,.,
|
821
|
-
|
822
|
-
_, _SYMBOL = *val
|
801
|
+
module_eval <<-'.,.,120998292339947.,.,', 'slex.dr', 195
|
802
|
+
def _act_5 val
|
803
|
+
_, _SYMBOL, = *val
|
823
804
|
[:ADD, _SYMBOL.value]
|
824
805
|
|
825
|
-
|
826
|
-
|
827
|
-
.,.,118754107811272.,.,
|
806
|
+
end
|
807
|
+
.,.,120998292339947.,.,
|
828
808
|
|
829
|
-
module_eval <<-'.,.,
|
830
|
-
|
831
|
-
_, _SYMBOL = *val
|
809
|
+
module_eval <<-'.,.,120998292319195.,.,', 'slex.dr', 196
|
810
|
+
def _act_6 val
|
811
|
+
_, _SYMBOL, = *val
|
832
812
|
[:SUB, _SYMBOL.value]
|
833
813
|
|
834
|
-
|
835
|
-
|
836
|
-
.,.,118754107839236.,.,
|
814
|
+
end
|
815
|
+
.,.,120998292319195.,.,
|
837
816
|
|
838
817
|
end
|
839
818
|
|