depager 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/README.ja +27 -28
- data/examples/c89/c89.dr +34 -34
- data/examples/c89/c89.tab.rb +3074 -3074
- data/examples/extension/paction.dr +4 -4
- data/examples/extension/pactiontest.dr +1 -1
- data/examples/pl0d/pl0ds.dr +27 -27
- data/examples/pl0d/pl0ds.tab.rb +626 -643
- data/examples/sample_calc/calc.action.dr +6 -6
- data/examples/sample_calc/calc.action.tab.rb +90 -90
- data/examples/sample_calc/calc.ast.action.dr +7 -7
- data/examples/sample_calc/calc.ast.action.tab.rb +121 -127
- data/examples/sample_calc/calc.ast.dr +6 -6
- data/examples/sample_calc/calc.ast.tab.rb +102 -109
- data/examples/sample_calc/calc.astdf.dr +6 -6
- data/examples/sample_calc/calc.astdf.tab.rb +102 -109
- data/examples/sample_calc/calc.atree.dr +6 -6
- data/examples/sample_calc/calc.atree.tab.rb +90 -90
- data/examples/sample_calc/calc.cst.dr +5 -5
- data/examples/sample_calc/calc.cst.tab.rb +106 -106
- data/examples/sample_calc/calc.dr +1 -1
- data/examples/sample_calc/calc.lex.dr +4 -4
- data/examples/sample_calc/calc.lex.tab.rb +73 -73
- data/examples/sample_calc/calc.nvaction.dr +6 -6
- data/examples/sample_calc/calc.nvaction.tab.rb +90 -90
- data/examples/sample_calc/calc.tab.rb +71 -71
- data/examples/sample_calc/calc_prec.nvaction.dr +6 -6
- data/examples/sample_calc/calc_prec.nvaction.tab.rb +46 -46
- data/examples/slex_test/divreg.slex.dr +7 -7
- data/examples/slex_test/divreg.slex.tab.rb +20 -20
- data/examples/slex_test/ljoin.slex.dr +7 -7
- data/examples/slex_test/ljoin.slex.tab.rb +15 -15
- data/lib/depager.rb +45 -83
- data/lib/depager/grammar.rb +3 -7
- data/lib/depager/lr.rb +123 -1
- data/lib/depager/parser.rb +29 -48
- data/lib/depager/{template/ast.erbs → ruby/plugins/_ast_tmpl.rb} +11 -7
- data/lib/depager/{action.rb → ruby/plugins/action.rb} +7 -11
- data/lib/depager/{ast.dr → ruby/plugins/ast.dr} +24 -25
- data/lib/depager/{ast.rb → ruby/plugins/ast.rb} +241 -243
- data/lib/depager/{astdf.rb → ruby/plugins/astdf.rb} +1 -2
- data/lib/depager/{atree.dr → ruby/plugins/atree.dr} +5 -5
- data/lib/depager/{atree.rb → ruby/plugins/atree.rb} +39 -39
- data/lib/depager/{cst.dr → ruby/plugins/cst.dr} +17 -21
- data/lib/depager/{cst.rb → ruby/plugins/cst.rb} +62 -68
- data/lib/depager/{lex.dr → ruby/plugins/lex.dr} +3 -4
- data/lib/depager/{lex.rb → ruby/plugins/lex.rb} +29 -31
- data/lib/depager/{nvaction.rb → ruby/plugins/nvaction.rb} +1 -3
- data/lib/depager/{slex.dr → ruby/plugins/slex.dr} +16 -17
- data/lib/depager/{slex.rb → ruby/plugins/slex.rb} +115 -117
- data/lib/depager/{srp.rb → ruby/plugins/srp.rb} +4 -4
- data/lib/depager/{template → ruby/templates}/extension_lalr_master.erb +6 -6
- data/lib/depager/{template → ruby/templates}/extension_lalr_slave.erb +0 -0
- data/lib/depager/{template → ruby/templates}/simple.erb +0 -0
- data/lib/depager/{template → ruby/templates}/single_lalr_parser.erb +0 -0
- data/lib/depager/utils.rb +30 -69
- data/lib/depager/version.rb +1 -1
- metadata +59 -56
- data/examples/Rakefile +0 -36
- data/lib/depager/Rakefile +0 -34
- data/lib/depager/lr_put_table.rb +0 -116
- data/lib/depager/parse_action.rb +0 -24
@@ -1,21 +1,21 @@
|
|
1
1
|
%defext ATreeBuilderExtension
|
2
|
-
%extend NVAction ('
|
3
|
-
%extend Lexer ('
|
2
|
+
%extend NVAction ('plugins/nvaction.rb')
|
3
|
+
%extend Lexer ('plugins/lex.rb')
|
4
4
|
%decorate @NVAction
|
5
|
-
#%decorate ShiftReducePrinter ('
|
5
|
+
#%decorate ShiftReducePrinter ('plugins/srp.rb')
|
6
6
|
%inner{
|
7
7
|
attr_accessor :optouter, :on_reduce
|
8
8
|
def init_parser
|
9
9
|
@optouter = []
|
10
10
|
@on_reduce = []
|
11
11
|
end
|
12
|
-
def
|
12
|
+
def post_rule_list
|
13
13
|
g_parser.optouter <<
|
14
14
|
gen_action_decorator_code(target_name, paramkey,
|
15
15
|
@on_reduce, @optouter)
|
16
16
|
end
|
17
17
|
%}
|
18
|
-
%hook
|
18
|
+
%hook post_rhs
|
19
19
|
%banner '=>...'
|
20
20
|
%%
|
21
21
|
%LEX{
|
@@ -24,9 +24,9 @@ class ATreeBuilderExtension #:nodoc:all
|
|
24
24
|
def __regext__ p
|
25
25
|
super p, :default, nil
|
26
26
|
|
27
|
-
@hook[0] =
|
28
|
-
@h2p['
|
29
|
-
p.
|
27
|
+
@hook[0] = ATreeBuilderExtension_post_rhs.new(p, @nparam, self)
|
28
|
+
@h2p['post_rhs'] = @hook[0]
|
29
|
+
p.hooks[:post_rhs].push [@hook[0], :do_parse]
|
30
30
|
|
31
31
|
regext p
|
32
32
|
end
|
@@ -37,7 +37,7 @@ class ATreeBuilderExtension #:nodoc:all
|
|
37
37
|
@optouter = []
|
38
38
|
@on_reduce = []
|
39
39
|
end
|
40
|
-
def
|
40
|
+
def post_rule_list
|
41
41
|
g_parser.optouter <<
|
42
42
|
gen_action_decorator_code(target_name, paramkey,
|
43
43
|
@on_reduce, @optouter)
|
@@ -48,12 +48,12 @@ end
|
|
48
48
|
### Outer Code
|
49
49
|
|
50
50
|
###
|
51
|
-
###
|
51
|
+
### ATreeBuilderExtension_post_rhs - Part of Depager Extension (slave)
|
52
52
|
###
|
53
|
-
module
|
53
|
+
module D4ATreeBuilderExtension_post_rhs #:nodoc:all
|
54
54
|
end
|
55
55
|
|
56
|
-
class
|
56
|
+
class ATreeBuilderExtension_post_rhs < Depager::LALR::Basis #:nodoc:all
|
57
57
|
include Depager::ExtensionUtils
|
58
58
|
|
59
59
|
|
@@ -102,14 +102,14 @@ class ATreeBuilderExtension_postrhs < Depager::LALR::Basis #:nodoc:all
|
|
102
102
|
[ nil, nil, nil, 4, nil, nil, nil, nil, ],
|
103
103
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
104
104
|
[ nil, nil, nil, nil, 5, nil, nil, nil, ],
|
105
|
-
[ nil, nil, nil,
|
105
|
+
[ nil, nil, nil, 7, nil, 10, nil, 6, ],
|
106
106
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
107
|
-
[ nil, nil, nil, nil, nil, 11, 12, nil, ],
|
108
107
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
108
|
+
[ nil, nil, nil, nil, nil, 12, 11, nil, ],
|
109
109
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
110
110
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
111
|
+
[ nil, nil, nil, 7, nil, nil, nil, 6, ],
|
111
112
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
112
|
-
[ nil, nil, nil, 9, nil, nil, nil, 10, ],
|
113
113
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
114
114
|
]
|
115
115
|
### Default Reduce Table
|
@@ -120,13 +120,13 @@ class ATreeBuilderExtension_postrhs < Depager::LALR::Basis #:nodoc:all
|
|
120
120
|
-1,
|
121
121
|
-4,
|
122
122
|
nil,
|
123
|
-
-
|
123
|
+
-8,
|
124
|
+
-7,
|
124
125
|
nil,
|
125
126
|
-5,
|
126
|
-
-
|
127
|
-
-8,
|
128
|
-
-3,
|
127
|
+
-2,
|
129
128
|
nil,
|
129
|
+
-3,
|
130
130
|
-6,
|
131
131
|
]
|
132
132
|
defred_after_shift_table = [
|
@@ -136,13 +136,13 @@ class ATreeBuilderExtension_postrhs < Depager::LALR::Basis #:nodoc:all
|
|
136
136
|
-1,
|
137
137
|
nil,
|
138
138
|
nil,
|
139
|
-
-
|
139
|
+
-8,
|
140
|
+
-7,
|
140
141
|
nil,
|
141
142
|
-5,
|
142
|
-
-
|
143
|
-
-8,
|
144
|
-
-3,
|
143
|
+
-2,
|
145
144
|
nil,
|
145
|
+
-3,
|
146
146
|
-6,
|
147
147
|
]
|
148
148
|
### Nonterm to Int
|
@@ -166,8 +166,7 @@ class ATreeBuilderExtension_postrhs < Depager::LALR::Basis #:nodoc:all
|
|
166
166
|
[ nil, 3, nil, nil, ],
|
167
167
|
[ nil, nil, nil, nil, ],
|
168
168
|
[ nil, nil, nil, nil, ],
|
169
|
-
[ nil, nil,
|
170
|
-
[ nil, nil, nil, nil, ],
|
169
|
+
[ nil, nil, 8, 9, ],
|
171
170
|
[ nil, nil, nil, nil, ],
|
172
171
|
[ nil, nil, nil, nil, ],
|
173
172
|
[ nil, nil, nil, nil, ],
|
@@ -175,6 +174,7 @@ class ATreeBuilderExtension_postrhs < Depager::LALR::Basis #:nodoc:all
|
|
175
174
|
[ nil, nil, nil, nil, ],
|
176
175
|
[ nil, nil, nil, 13, ],
|
177
176
|
[ nil, nil, nil, nil, ],
|
177
|
+
[ nil, nil, nil, nil, ],
|
178
178
|
]
|
179
179
|
|
180
180
|
Tables = [ reduce_table, nparams, action_table,
|
@@ -187,7 +187,7 @@ class ATreeBuilderExtension_postrhs < Depager::LALR::Basis #:nodoc:all
|
|
187
187
|
@g_parser = @p = p
|
188
188
|
@master = @m = master
|
189
189
|
@nparam = nparam
|
190
|
-
@dect =
|
190
|
+
@dect = D4ATreeBuilderExtension_post_rhs::NVAction.new(self)
|
191
191
|
init_parser
|
192
192
|
end
|
193
193
|
|
@@ -251,9 +251,9 @@ end
|
|
251
251
|
|
252
252
|
### Outer Code
|
253
253
|
|
254
|
-
class
|
254
|
+
class D4ATreeBuilderExtension_post_rhs::NVAction < Depager::LALR::Action #:nodoc:all
|
255
255
|
include Depager::DecoratorUtils
|
256
|
-
|
256
|
+
|
257
257
|
on_reduce = [
|
258
258
|
nil,
|
259
259
|
:_act_0,
|
@@ -274,7 +274,7 @@ class D4ATreeBuilderExtension_postrhs::NVAction < Depager::LALR::Action #:nodoc:
|
|
274
274
|
end
|
275
275
|
|
276
276
|
|
277
|
-
module_eval <<-'.,.,
|
277
|
+
module_eval <<-'.,.,122745803312021.,.,', 'atree.dr', 32
|
278
278
|
def _act_0 val
|
279
279
|
_EG, _ast, = *val
|
280
280
|
|
@@ -284,63 +284,63 @@ def _act_0 val
|
|
284
284
|
master.on_reduce[n] = ":_atree_#{n}"
|
285
285
|
|
286
286
|
end
|
287
|
-
.,.,
|
287
|
+
.,.,122745803312021.,.,
|
288
288
|
|
289
|
-
module_eval <<-'.,.,
|
289
|
+
module_eval <<-'.,.,122745803352334.,.,', 'atree.dr', 40
|
290
290
|
def _act_1 val
|
291
291
|
_ID, _, _, = *val
|
292
292
|
"[:#{_ID.value}]"
|
293
293
|
|
294
294
|
end
|
295
|
-
.,.,
|
295
|
+
.,.,122745803352334.,.,
|
296
296
|
|
297
|
-
module_eval <<-'.,.,
|
297
|
+
module_eval <<-'.,.,122745803310141.,.,', 'atree.dr', 41
|
298
298
|
def _act_2 val
|
299
299
|
_ID, _, _fact_list, _, = *val
|
300
300
|
"[:#{_ID.value}, #{_fact_list.join(',')}]"
|
301
301
|
|
302
302
|
end
|
303
|
-
.,.,
|
303
|
+
.,.,122745803310141.,.,
|
304
304
|
|
305
|
-
module_eval <<-'.,.,
|
305
|
+
module_eval <<-'.,.,12274580336943.,.,', 'atree.dr', 42
|
306
306
|
def _act_3 val
|
307
307
|
_ID, = *val
|
308
308
|
"val[#{g_parser.name_to_rhs_index(_ID.value)}]"
|
309
309
|
|
310
310
|
end
|
311
|
-
.,.,
|
311
|
+
.,.,12274580336943.,.,
|
312
312
|
|
313
|
-
module_eval <<-'.,.,
|
313
|
+
module_eval <<-'.,.,122745803340243.,.,', 'atree.dr', 45
|
314
314
|
def _act_4 val
|
315
315
|
_fact, = *val
|
316
316
|
[ _fact ]
|
317
317
|
|
318
318
|
end
|
319
|
-
.,.,
|
319
|
+
.,.,122745803340243.,.,
|
320
320
|
|
321
|
-
module_eval <<-'.,.,
|
321
|
+
module_eval <<-'.,.,122745803340227.,.,', 'atree.dr', 46
|
322
322
|
def _act_5 val
|
323
323
|
_fact_list, _, _fact, = *val
|
324
324
|
_fact_list.push _fact
|
325
325
|
|
326
326
|
end
|
327
|
-
.,.,
|
327
|
+
.,.,122745803340227.,.,
|
328
328
|
|
329
|
-
module_eval <<-'.,.,
|
329
|
+
module_eval <<-'.,.,122745803346290.,.,', 'atree.dr', 49
|
330
330
|
def _act_6 val
|
331
331
|
_ID, = *val
|
332
332
|
"val[#{g_parser.name_to_rhs_index(_ID.value)}]"
|
333
333
|
|
334
334
|
end
|
335
|
-
.,.,
|
335
|
+
.,.,122745803346290.,.,
|
336
336
|
|
337
|
-
module_eval <<-'.,.,
|
337
|
+
module_eval <<-'.,.,122745803310739.,.,', 'atree.dr', 50
|
338
338
|
def _act_7 val
|
339
339
|
_STR, = *val
|
340
340
|
"'#{_STR.value}'"
|
341
341
|
|
342
342
|
end
|
343
|
-
.,.,
|
343
|
+
.,.,122745803310739.,.,
|
344
344
|
|
345
345
|
end
|
346
346
|
|
@@ -1,9 +1,8 @@
|
|
1
1
|
%defext CSTBuilderExtension
|
2
|
-
%extend Lexer ('
|
3
|
-
%extend NVAction ('
|
2
|
+
%extend Lexer ('plugins/lex.rb')
|
3
|
+
%extend NVAction ('plugins/nvaction.rb')
|
4
4
|
%decorate @NVAction
|
5
|
-
#%decorate ShiftReducePrinter ('
|
6
|
-
%mixin ActionParser ('depager/parse_action')
|
5
|
+
#%decorate ShiftReducePrinter ('plugins/srp.rb')
|
7
6
|
%inner{
|
8
7
|
attr_accessor :optouter, :nodes_code
|
9
8
|
def init_parser
|
@@ -17,15 +16,13 @@
|
|
17
16
|
def modify_action_code code
|
18
17
|
code.gsub(/~([a-z_])/, 'node.\1')
|
19
18
|
end
|
20
|
-
def
|
21
|
-
code = ''
|
22
|
-
|
23
|
-
|
24
|
-
@line0, @line = g_parser.line0, g_parser.oldline
|
19
|
+
def post_rhs
|
20
|
+
code, lineno = '', g_parser.lineno
|
21
|
+
if g_parser.line =~ /\s*\{/
|
22
|
+
@line0, @line = g_parser.line0, g_parser.line
|
25
23
|
code = parse_action
|
26
|
-
|
27
|
-
|
28
|
-
gettoken
|
24
|
+
|
25
|
+
g_parser.update_context @line
|
29
26
|
end
|
30
27
|
|
31
28
|
node_name = "#{lhs_name}_#{nrhs}"
|
@@ -67,7 +64,7 @@
|
|
67
64
|
|
68
65
|
@on_reduce[nrules] = ":_cst_#{nrules}"
|
69
66
|
end
|
70
|
-
def
|
67
|
+
def post_rule_list
|
71
68
|
code = unindent %{
|
72
69
|
class Node
|
73
70
|
def accept
|
@@ -88,16 +85,15 @@
|
|
88
85
|
@on_reduce, @optouter)
|
89
86
|
end
|
90
87
|
%}
|
91
|
-
%hook
|
88
|
+
%hook pre_rule_list /%CST\{\s*\Z/ skip
|
92
89
|
%banner '%CST{ ... }'
|
93
|
-
%mixin ActionParser ('depager/parse_action')
|
94
90
|
%%
|
95
91
|
|
96
92
|
%LEX{
|
97
93
|
/\s+/, /#.*/ { }
|
98
94
|
/%\}\s*\Z/ { yield nil,nil }
|
99
|
-
'Node' { yield
|
100
|
-
'{' ! { ln = lineno; yield
|
95
|
+
'Node' { yield token(:NODE, $&) }
|
96
|
+
'{' ! { ln = lineno; yield token(:ACTION, parse_action, ln) }
|
101
97
|
%}
|
102
98
|
|
103
99
|
#begin-rule
|
@@ -127,7 +123,7 @@
|
|
127
123
|
;
|
128
124
|
#end-rule
|
129
125
|
%%
|
130
|
-
%hook
|
126
|
+
%hook post_lhs /\[/ skip
|
131
127
|
%banner '[ ... ]'
|
132
128
|
%inner{
|
133
129
|
def do_default
|
@@ -146,9 +142,9 @@
|
|
146
142
|
/\A\s+/ { } #skip blank
|
147
143
|
/""/,/''/,/[0-9]+/,
|
148
144
|
/\{\s*\}/,/\[\s*\]/,
|
149
|
-
/nil/ { yield
|
150
|
-
/\A[a-z][a-z_]*/ { yield
|
151
|
-
/\A(.)/ { yield
|
145
|
+
/nil/ { yield token(:LIT, $&) }
|
146
|
+
/\A[a-z][a-z_]*/ { yield token(:ID, $&) }
|
147
|
+
/\A(.)/ { yield token($&, $&) }
|
152
148
|
%}
|
153
149
|
|
154
150
|
#begin-rule
|
@@ -4,7 +4,6 @@
|
|
4
4
|
###
|
5
5
|
require 'pp.rb'
|
6
6
|
require 'depager/parser.rb'
|
7
|
-
require 'depager/parse_action'
|
8
7
|
|
9
8
|
|
10
9
|
module D4CSTBuilderExtension #:nodoc:all
|
@@ -13,7 +12,6 @@ end
|
|
13
12
|
class CSTBuilderExtension #:nodoc:all
|
14
13
|
include Depager::ExtensionUtils
|
15
14
|
|
16
|
-
include ActionParser
|
17
15
|
attr_accessor :h2p
|
18
16
|
|
19
17
|
def initialize
|
@@ -26,13 +24,13 @@ class CSTBuilderExtension #:nodoc:all
|
|
26
24
|
def __regext__ p
|
27
25
|
super p, :default, nil
|
28
26
|
|
29
|
-
@hook[0] =
|
30
|
-
@h2p['
|
31
|
-
p.
|
27
|
+
@hook[0] = CSTBuilderExtension_post_lhs.new(p, @nparam, self)
|
28
|
+
@h2p['post_lhs'] = @hook[0]
|
29
|
+
p.hooks[:post_lhs].push [@hook[0], :do_parse]
|
32
30
|
|
33
|
-
@hook[1] =
|
34
|
-
@h2p['
|
35
|
-
p.
|
31
|
+
@hook[1] = CSTBuilderExtension_pre_rule_list.new(p, @nparam, self)
|
32
|
+
@h2p['pre_rule_list'] = @hook[1]
|
33
|
+
p.hooks[:pre_rule_list].push [@hook[1], :do_parse]
|
36
34
|
|
37
35
|
regext p
|
38
36
|
end
|
@@ -50,15 +48,13 @@ class CSTBuilderExtension #:nodoc:all
|
|
50
48
|
def modify_action_code code
|
51
49
|
code.gsub(/~([a-z_])/, 'node.\1')
|
52
50
|
end
|
53
|
-
def
|
54
|
-
code = ''
|
55
|
-
|
56
|
-
|
57
|
-
@line0, @line = g_parser.line0, g_parser.oldline
|
51
|
+
def post_rhs
|
52
|
+
code, lineno = '', g_parser.lineno
|
53
|
+
if g_parser.line =~ /\s*\{/
|
54
|
+
@line0, @line = g_parser.line0, g_parser.line
|
58
55
|
code = parse_action
|
59
|
-
|
60
|
-
|
61
|
-
gettoken
|
56
|
+
|
57
|
+
g_parser.update_context @line
|
62
58
|
end
|
63
59
|
|
64
60
|
node_name = "#{lhs_name}_#{nrhs}"
|
@@ -100,7 +96,7 @@ class CSTBuilderExtension #:nodoc:all
|
|
100
96
|
|
101
97
|
@on_reduce[nrules] = ":_cst_#{nrules}"
|
102
98
|
end
|
103
|
-
def
|
99
|
+
def post_rule_list
|
104
100
|
code = unindent %{
|
105
101
|
class Node
|
106
102
|
def accept
|
@@ -126,15 +122,14 @@ end
|
|
126
122
|
### Outer Code
|
127
123
|
|
128
124
|
###
|
129
|
-
###
|
125
|
+
### CSTBuilderExtension_pre_rule_list - Part of Depager Extension (slave)
|
130
126
|
###
|
131
|
-
module
|
127
|
+
module D4CSTBuilderExtension_pre_rule_list #:nodoc:all
|
132
128
|
end
|
133
129
|
|
134
|
-
class
|
130
|
+
class CSTBuilderExtension_pre_rule_list < Depager::LALR::Basis #:nodoc:all
|
135
131
|
include Depager::ExtensionUtils
|
136
132
|
|
137
|
-
include ActionParser
|
138
133
|
|
139
134
|
### Reduce Table
|
140
135
|
reduce_table = [
|
@@ -167,10 +162,10 @@ class CSTBuilderExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
167
162
|
]
|
168
163
|
### Action Table
|
169
164
|
action_table = [
|
170
|
-
[ nil, nil,
|
165
|
+
[ nil, nil, 1, nil, nil, ],
|
166
|
+
[ nil, nil, nil, 4, nil, ],
|
171
167
|
[ ACC, nil, nil, nil, nil, ],
|
172
168
|
[ nil, nil, nil, nil, 5, ],
|
173
|
-
[ nil, nil, nil, 6, nil, ],
|
174
169
|
[ nil, nil, nil, nil, nil, ],
|
175
170
|
[ nil, nil, nil, 7, nil, ],
|
176
171
|
[ nil, nil, nil, nil, nil, ],
|
@@ -180,11 +175,11 @@ class CSTBuilderExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
180
175
|
defred_table = [
|
181
176
|
-2,
|
182
177
|
nil,
|
178
|
+
nil,
|
183
179
|
-4,
|
180
|
+
-3,
|
184
181
|
nil,
|
185
182
|
-1,
|
186
|
-
nil,
|
187
|
-
-3,
|
188
183
|
-5,
|
189
184
|
]
|
190
185
|
defred_after_shift_table = [
|
@@ -192,9 +187,9 @@ class CSTBuilderExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
192
187
|
nil,
|
193
188
|
nil,
|
194
189
|
nil,
|
195
|
-
-1,
|
196
|
-
nil,
|
197
190
|
-3,
|
191
|
+
nil,
|
192
|
+
-1,
|
198
193
|
-5,
|
199
194
|
]
|
200
195
|
### Nonterm to Int
|
@@ -211,10 +206,10 @@ class CSTBuilderExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
211
206
|
]
|
212
207
|
### Goto Table
|
213
208
|
goto_table = [
|
214
|
-
[
|
209
|
+
[ 2, 3, nil, ],
|
215
210
|
[ nil, nil, nil, ],
|
216
|
-
[ nil, nil, 4, ],
|
217
211
|
[ nil, nil, nil, ],
|
212
|
+
[ nil, nil, 6, ],
|
218
213
|
[ nil, nil, nil, ],
|
219
214
|
[ nil, nil, nil, ],
|
220
215
|
[ nil, nil, nil, ],
|
@@ -231,7 +226,7 @@ class CSTBuilderExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
231
226
|
@g_parser = @p = p
|
232
227
|
@master = @m = master
|
233
228
|
@nparam = nparam
|
234
|
-
@dect =
|
229
|
+
@dect = D4CSTBuilderExtension_pre_rule_list::NVAction.new(self)
|
235
230
|
init_parser
|
236
231
|
end
|
237
232
|
|
@@ -269,12 +264,12 @@ class CSTBuilderExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
269
264
|
|
270
265
|
when /\ANode/
|
271
266
|
@oldline = @line; @line = $'
|
272
|
-
yield
|
267
|
+
yield token(:NODE, $&)
|
273
268
|
|
274
269
|
|
275
270
|
when /\A\{/
|
276
271
|
#
|
277
|
-
ln = lineno; yield
|
272
|
+
ln = lineno; yield token(:ACTION, parse_action, ln)
|
278
273
|
|
279
274
|
|
280
275
|
else
|
@@ -289,9 +284,9 @@ end
|
|
289
284
|
|
290
285
|
### Outer Code
|
291
286
|
|
292
|
-
class
|
287
|
+
class D4CSTBuilderExtension_pre_rule_list::NVAction < Depager::LALR::Action #:nodoc:all
|
293
288
|
include Depager::DecoratorUtils
|
294
|
-
|
289
|
+
|
295
290
|
on_reduce = [
|
296
291
|
nil,
|
297
292
|
:_act_0,
|
@@ -309,7 +304,7 @@ class D4CSTBuilderExtension_prerulelist::NVAction < Depager::LALR::Action #:nodo
|
|
309
304
|
end
|
310
305
|
|
311
306
|
|
312
|
-
module_eval <<-'.,.,
|
307
|
+
module_eval <<-'.,.,122745803312555.,.,', 'cst.dr', 100
|
313
308
|
def _act_0 val
|
314
309
|
_opt_node, _opt_visitor, = *val
|
315
310
|
|
@@ -326,51 +321,50 @@ def _act_0 val
|
|
326
321
|
.sub!('$$!!@ VISITOR @!!$$', _opt_visitor)
|
327
322
|
|
328
323
|
end
|
329
|
-
.,.,
|
324
|
+
.,.,122745803312555.,.,
|
330
325
|
|
331
|
-
module_eval <<-'.,.,
|
326
|
+
module_eval <<-'.,.,12274580333994.,.,', 'cst.dr', 115
|
332
327
|
def _act_1 val
|
333
328
|
''
|
334
329
|
|
335
330
|
end
|
336
|
-
.,.,
|
331
|
+
.,.,12274580333994.,.,
|
337
332
|
|
338
|
-
module_eval <<-'.,.,
|
333
|
+
module_eval <<-'.,.,122745803355803.,.,', 'cst.dr', 116
|
339
334
|
def _act_2 val
|
340
335
|
_NODE, _ACTION, = *val
|
341
336
|
_ACTION.value
|
342
337
|
|
343
338
|
end
|
344
|
-
.,.,
|
339
|
+
.,.,122745803355803.,.,
|
345
340
|
|
346
|
-
module_eval <<-'.,.,
|
341
|
+
module_eval <<-'.,.,122745803313768.,.,', 'cst.dr', 119
|
347
342
|
def _act_3 val
|
348
343
|
''
|
349
344
|
|
350
345
|
end
|
351
|
-
.,.,
|
346
|
+
.,.,122745803313768.,.,
|
352
347
|
|
353
|
-
module_eval <<-'.,.,
|
348
|
+
module_eval <<-'.,.,122745803342911.,.,', 'cst.dr', 120
|
354
349
|
def _act_4 val
|
355
350
|
_VISITOR, _ACTION, = *val
|
356
351
|
_ACTION.value
|
357
352
|
|
358
353
|
end
|
359
|
-
.,.,
|
354
|
+
.,.,122745803342911.,.,
|
360
355
|
|
361
356
|
end
|
362
357
|
|
363
358
|
|
364
359
|
###
|
365
|
-
###
|
360
|
+
### CSTBuilderExtension_post_lhs - Part of Depager Extension (slave)
|
366
361
|
###
|
367
|
-
module
|
362
|
+
module D4CSTBuilderExtension_post_lhs #:nodoc:all
|
368
363
|
end
|
369
364
|
|
370
|
-
class
|
365
|
+
class CSTBuilderExtension_post_lhs < Depager::LALR::Basis #:nodoc:all
|
371
366
|
include Depager::ExtensionUtils
|
372
367
|
|
373
|
-
include ActionParser
|
374
368
|
|
375
369
|
### Reduce Table
|
376
370
|
reduce_table = [
|
@@ -409,9 +403,9 @@ class CSTBuilderExtension_postlhs < Depager::LALR::Basis #:nodoc:all
|
|
409
403
|
]
|
410
404
|
### Action Table
|
411
405
|
action_table = [
|
412
|
-
[ nil, nil,
|
413
|
-
[ ACC, nil, nil, nil, nil, nil, nil, nil, ],
|
406
|
+
[ nil, nil, 1, nil, nil, nil, nil, nil, ],
|
414
407
|
[ nil, nil, nil, nil, nil, 5, nil, nil, ],
|
408
|
+
[ ACC, nil, nil, nil, nil, nil, nil, nil, ],
|
415
409
|
[ nil, nil, nil, 6, 7, nil, nil, nil, ],
|
416
410
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
417
411
|
[ nil, nil, nil, nil, nil, nil, 8, nil, ],
|
@@ -462,13 +456,13 @@ class CSTBuilderExtension_postlhs < Depager::LALR::Basis #:nodoc:all
|
|
462
456
|
]
|
463
457
|
### Goto Table
|
464
458
|
goto_table = [
|
465
|
-
[
|
466
|
-
[ nil, nil, nil, ],
|
459
|
+
[ 2, nil, nil, ],
|
467
460
|
[ nil, 3, 4, ],
|
468
461
|
[ nil, nil, nil, ],
|
469
462
|
[ nil, nil, nil, ],
|
470
463
|
[ nil, nil, nil, ],
|
471
464
|
[ nil, nil, nil, ],
|
465
|
+
[ nil, nil, nil, ],
|
472
466
|
[ nil, nil, 9, ],
|
473
467
|
[ nil, nil, nil, ],
|
474
468
|
[ nil, nil, nil, ],
|
@@ -485,7 +479,7 @@ class CSTBuilderExtension_postlhs < Depager::LALR::Basis #:nodoc:all
|
|
485
479
|
@g_parser = @p = p
|
486
480
|
@master = @m = master
|
487
481
|
@nparam = nparam
|
488
|
-
@dect =
|
482
|
+
@dect = D4CSTBuilderExtension_post_lhs::NVAction.new(self)
|
489
483
|
init_parser
|
490
484
|
end
|
491
485
|
|
@@ -518,17 +512,17 @@ class CSTBuilderExtension_postlhs < Depager::LALR::Basis #:nodoc:all
|
|
518
512
|
|
519
513
|
when /\A""/, /\A''/, /\A[0-9]+/, /\A\{\s*\}/, /\A\[\s*\]/, /\Anil/
|
520
514
|
@oldline = @line; @line = $'
|
521
|
-
yield
|
515
|
+
yield token(:LIT, $&)
|
522
516
|
|
523
517
|
|
524
518
|
when /\A\A[a-z][a-z_]*/
|
525
519
|
@oldline = @line; @line = $'
|
526
|
-
yield
|
520
|
+
yield token(:ID, $&)
|
527
521
|
|
528
522
|
|
529
523
|
when /\A\A(.)/
|
530
524
|
@oldline = @line; @line = $'
|
531
|
-
yield
|
525
|
+
yield token($&, $&)
|
532
526
|
|
533
527
|
|
534
528
|
else
|
@@ -552,9 +546,9 @@ end
|
|
552
546
|
|
553
547
|
### Outer Code
|
554
548
|
|
555
|
-
class
|
549
|
+
class D4CSTBuilderExtension_post_lhs::NVAction < Depager::LALR::Action #:nodoc:all
|
556
550
|
include Depager::DecoratorUtils
|
557
|
-
|
551
|
+
|
558
552
|
on_reduce = [
|
559
553
|
nil,
|
560
554
|
:_act_0,
|
@@ -572,7 +566,7 @@ class D4CSTBuilderExtension_postlhs::NVAction < Depager::LALR::Action #:nodoc:al
|
|
572
566
|
end
|
573
567
|
|
574
568
|
|
575
|
-
module_eval <<-'.,.,
|
569
|
+
module_eval <<-'.,.,122745803313978.,.,', 'cst.dr', 151
|
576
570
|
def _act_0 val
|
577
571
|
_, _pair, _, = *val
|
578
572
|
|
@@ -593,39 +587,39 @@ def _act_0 val
|
|
593
587
|
}; #code
|
594
588
|
|
595
589
|
end
|
596
|
-
.,.,
|
590
|
+
.,.,122745803313978.,.,
|
597
591
|
|
598
|
-
module_eval <<-'.,.,
|
592
|
+
module_eval <<-'.,.,122745803351295.,.,', 'cst.dr', 170
|
599
593
|
def _act_1 val
|
600
594
|
_expr, = *val
|
601
595
|
[ _expr ]
|
602
596
|
|
603
597
|
end
|
604
|
-
.,.,
|
598
|
+
.,.,122745803351295.,.,
|
605
599
|
|
606
|
-
module_eval <<-'.,.,
|
600
|
+
module_eval <<-'.,.,122745803357565.,.,', 'cst.dr', 171
|
607
601
|
def _act_2 val
|
608
602
|
_pair, _, _expr, = *val
|
609
603
|
_pair << _expr
|
610
604
|
|
611
605
|
end
|
612
|
-
.,.,
|
606
|
+
.,.,122745803357565.,.,
|
613
607
|
|
614
|
-
module_eval <<-'.,.,
|
608
|
+
module_eval <<-'.,.,122745803313793.,.,', 'cst.dr', 174
|
615
609
|
def _act_3 val
|
616
610
|
_ID, = *val
|
617
611
|
[ _ID.value, nil]
|
618
612
|
|
619
613
|
end
|
620
|
-
.,.,
|
614
|
+
.,.,122745803313793.,.,
|
621
615
|
|
622
|
-
module_eval <<-'.,.,
|
616
|
+
module_eval <<-'.,.,12274580337259.,.,', 'cst.dr', 175
|
623
617
|
def _act_4 val
|
624
618
|
_ID, _, _LIT, = *val
|
625
619
|
[ _ID.value, _LIT.value ]
|
626
620
|
|
627
621
|
end
|
628
|
-
.,.,
|
622
|
+
.,.,12274580337259.,.,
|
629
623
|
|
630
624
|
end
|
631
625
|
|