depager 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/Manifest.txt +52 -0
- data/README.en +64 -0
- data/README.ja +128 -0
- data/bin/depager +47 -0
- data/data/depager/misc/depager-mode.el +209 -0
- data/data/depager/sample/extension/paction.dr +15 -0
- data/data/depager/sample/extension/pactiontest.dr +14 -0
- data/data/depager/sample/pl0d/pl0ds.dr +334 -0
- data/data/depager/sample/pl0d/pl0test.pl0 +34 -0
- data/data/depager/sample/sample_calc/calc.action.dr +33 -0
- data/data/depager/sample/sample_calc/calc.astdf.dr +54 -0
- data/data/depager/sample/sample_calc/calc.astl.action.dr +66 -0
- data/data/depager/sample/sample_calc/calc.astl.dr +55 -0
- data/data/depager/sample/sample_calc/calc.atree.dr +43 -0
- data/data/depager/sample/sample_calc/calc.cst.dr +45 -0
- data/data/depager/sample/sample_calc/calc.dr +43 -0
- data/data/depager/sample/sample_calc/calc.lex.dr +29 -0
- data/data/depager/sample/sample_calc/calc.nvaction.dr +33 -0
- data/data/depager/sample/sample_calc/calc_prec.nvaction.dr +31 -0
- data/data/depager/sample/slex_test/slextest1.dr +37 -0
- data/data/depager/sample/slex_test/slextest2.dr +33 -0
- data/lib/depager.rb +608 -0
- data/lib/depager/Rakefile +30 -0
- data/lib/depager/action.rb +47 -0
- data/lib/depager/ast_base.dr +232 -0
- data/lib/depager/ast_base.rb +1249 -0
- data/lib/depager/astdf.rb +10 -0
- data/lib/depager/astl.rb +14 -0
- data/lib/depager/atree.dr +55 -0
- data/lib/depager/atree.rb +336 -0
- data/lib/depager/cst.dr +182 -0
- data/lib/depager/cst.rb +625 -0
- data/lib/depager/lex.dr +76 -0
- data/lib/depager/lex.rb +306 -0
- data/lib/depager/lr.rb +604 -0
- data/lib/depager/nvaction.rb +21 -0
- data/lib/depager/parse_action.rb +24 -0
- data/lib/depager/parser.rb +248 -0
- data/lib/depager/psrtmpl.rb +33 -0
- data/lib/depager/slex.dr +161 -0
- data/lib/depager/slex.rb +646 -0
- data/lib/depager/srp.rb +50 -0
- data/lib/depager/template/astdf.erbs +57 -0
- data/lib/depager/template/astl.erbs +57 -0
- data/lib/depager/template/extension_lalr_master.erb +51 -0
- data/lib/depager/template/extension_lalr_slave.erb +107 -0
- data/lib/depager/template/simple.erb +21 -0
- data/lib/depager/template/single_lalr_parser.erb +97 -0
- data/lib/depager/utils.rb +355 -0
- data/lib/depager/version.rb +9 -0
- data/setup.rb +1585 -0
- metadata +103 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
Dir.chdir(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
task :default => [".extensions"]
|
6
|
+
|
7
|
+
SRC = FileList["*.dr"]
|
8
|
+
SRC.delete('lex.dr')
|
9
|
+
SRC.unshift('lex.dr')
|
10
|
+
OBJ = SRC.ext('rb')
|
11
|
+
CLEAN.include(OBJ)
|
12
|
+
# CLOBBER.include('extensions')
|
13
|
+
PREFIX="../.."
|
14
|
+
LIBDIR = "#{PREFIX}/lib"
|
15
|
+
BINDIR = "#{PREFIX}/bin"
|
16
|
+
|
17
|
+
SRC.each do |fn|
|
18
|
+
fn = fn.sub(/\.[^.]*$/, '')
|
19
|
+
file("#{fn}.rb" => [
|
20
|
+
"#{fn}.dr",
|
21
|
+
'template/extension_lalr_master.erb',
|
22
|
+
'template/extension_lalr_slave.erb',
|
23
|
+
]) do
|
24
|
+
sh "ruby -I#{LIBDIR} #{BINDIR}/depager -g -o #{fn}.rb #{fn}.dr"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
file ".extensions" => OBJ do
|
29
|
+
#sh "touch .extensions"
|
30
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'depager/parser.rb'
|
2
|
+
require 'depager/parse_action.rb'
|
3
|
+
|
4
|
+
class ActionExtension #:nodoc:all
|
5
|
+
include Depager::ExtensionUtils
|
6
|
+
include Depager::ActionParser
|
7
|
+
def initialize
|
8
|
+
@line0 = @line = @oldline = ''
|
9
|
+
@optouter = []
|
10
|
+
@on_reduce = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def modify_action_code code
|
14
|
+
return code, 0
|
15
|
+
end
|
16
|
+
|
17
|
+
def preRuleList
|
18
|
+
if g_parser.line0 =~ /^%ACTION\{\s*$/
|
19
|
+
while line = getline
|
20
|
+
break if line =~ /^%\}\s*$/
|
21
|
+
@optouter.push line
|
22
|
+
end
|
23
|
+
fixline ''
|
24
|
+
gettoken
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def postRhs
|
29
|
+
if token[0] == '{'
|
30
|
+
@line0, @line = g_parser.line0, g_parser.oldline
|
31
|
+
lineno = g_parser.lineno
|
32
|
+
code, d = modify_action_code(parse_action)
|
33
|
+
@optouter <<
|
34
|
+
gen_defm_code("_act_#{nrules} val", code, lineno, d)
|
35
|
+
fixline @line
|
36
|
+
gettoken
|
37
|
+
@on_reduce[nrules] = ":_act_#{nrules}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def postRuleList
|
42
|
+
g_parser.optouter <<
|
43
|
+
gen_action_decorator_code(
|
44
|
+
target_name, paramkey,
|
45
|
+
@on_reduce, @optouter, g_parser.mixin)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,232 @@
|
|
1
|
+
%defext ASTBuilderBaseExtension
|
2
|
+
%extend Lexer ('depager/lex.rb')
|
3
|
+
%extend NVAction ('depager/nvaction.rb')
|
4
|
+
%decorate @NVAction
|
5
|
+
#%decorate ShiftReducePrinter ('depager/srp.rb')
|
6
|
+
%inner{
|
7
|
+
attr_accessor :optouter, :on_reduce, :visitor
|
8
|
+
def init_parser
|
9
|
+
super
|
10
|
+
@visitor = Hash.new{|hash, key| hash[key] = []}
|
11
|
+
@optouter = []
|
12
|
+
@on_reduce = []
|
13
|
+
end
|
14
|
+
def postRuleList
|
15
|
+
g_parser.optouter <<
|
16
|
+
gen_action_decorator_code(target_name, paramkey,
|
17
|
+
@on_reduce, @optouter)
|
18
|
+
end
|
19
|
+
%}
|
20
|
+
%hook prerulelist /%AST\{\s*\Z/ skip
|
21
|
+
%banner '%AST{ ... }'
|
22
|
+
%mixin ActionParser ('depager/parse_action')
|
23
|
+
%%
|
24
|
+
|
25
|
+
%LEX{
|
26
|
+
/\s+/, /#.*/ { }
|
27
|
+
/%\}\s*\Z/ { @line = $'; yield nil,nil }
|
28
|
+
/Node/ { yield _Token(:NODE, $&) }
|
29
|
+
/Visitor/ { yield _Token(:VISITOR, $&) }
|
30
|
+
/[a-zA-Z][a-zA-Z0-9_]*/ { yield _Token(:ID, $&) }
|
31
|
+
/\{/ { ln = lineno; yield _Token(:ACTION, parse_action, ln); //=~'' }
|
32
|
+
/./ { yield _Token($&, $&) }
|
33
|
+
%}
|
34
|
+
|
35
|
+
#begin-rule
|
36
|
+
start:
|
37
|
+
opt_defnode opt_defvis defnode_list
|
38
|
+
{
|
39
|
+
g_parser.optouter.push _opt_defnode, val[2]
|
40
|
+
g_parser.optouter.push %{
|
41
|
+
class Visitor
|
42
|
+
def visit node
|
43
|
+
node.accept(self)
|
44
|
+
end
|
45
|
+
#{master.visitor[nil]}
|
46
|
+
end
|
47
|
+
};#code
|
48
|
+
master.visitor.each do |k, v|
|
49
|
+
g_parser.optouter.push %{
|
50
|
+
class Visitor_#{k}
|
51
|
+
#{v}
|
52
|
+
end
|
53
|
+
} if k ;#code
|
54
|
+
end
|
55
|
+
}
|
56
|
+
;
|
57
|
+
opt_defnode:
|
58
|
+
{ "" }
|
59
|
+
| NODE opt_attr ACTION
|
60
|
+
{
|
61
|
+
ini = %{
|
62
|
+
def initialize
|
63
|
+
#{_ACTION.value}
|
64
|
+
end
|
65
|
+
};#code
|
66
|
+
master.gen_tmpl_code(:defnode, binding)
|
67
|
+
}
|
68
|
+
;
|
69
|
+
opt_defvis:
|
70
|
+
{ [] }
|
71
|
+
| VISITOR opt_action
|
72
|
+
{
|
73
|
+
_opt_action[nil] = Token['', 0] unless _opt_action[nil]
|
74
|
+
_opt_action.each do |pass, act|
|
75
|
+
master.visitor[pass].unshift(
|
76
|
+
master.gen_meval_code(act.lineno, 0, act.value.to_s))
|
77
|
+
end
|
78
|
+
}
|
79
|
+
;
|
80
|
+
defnode_list:
|
81
|
+
defnode { _defnode }
|
82
|
+
| defnode_list defnode { _defnode_list << _defnode}
|
83
|
+
;
|
84
|
+
defnode:
|
85
|
+
defnode_header opt_attr opt_action
|
86
|
+
{
|
87
|
+
name, args = _defnode_header
|
88
|
+
nodes, accept, attrs = [], '', _opt_attr
|
89
|
+
args.each do |i|
|
90
|
+
if i =~ /\-(.*)/
|
91
|
+
nodes.push $1
|
92
|
+
attrs.push $1
|
93
|
+
else
|
94
|
+
nodes.push i
|
95
|
+
accept << master.gen_accept_code(i)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
_opt_action[nil] = Token['', 0] unless _opt_action[nil]
|
99
|
+
_opt_action.each do |pass, act|
|
100
|
+
vis_code = master.modify_action_code(act.value, nodes - attrs)
|
101
|
+
master.visitor[pass] <<
|
102
|
+
master.gen_defm_code("visit_Node_#{name} node",
|
103
|
+
vis_code, act.lineno)
|
104
|
+
end
|
105
|
+
master.gen_tmpl_code(:node, binding)
|
106
|
+
}
|
107
|
+
;
|
108
|
+
defnode_header:
|
109
|
+
ID '(' ')' { [_ID.value, nil]}
|
110
|
+
| ID '(' fact_list ')' { [_ID.value, _fact_list] }
|
111
|
+
;
|
112
|
+
opt_attr:
|
113
|
+
{ [] }
|
114
|
+
| '[' ']' { [] }
|
115
|
+
| '[' id_list ']' { _id_list }
|
116
|
+
;
|
117
|
+
fact_list:
|
118
|
+
fact { [_fact] }
|
119
|
+
| fact_list ',' fact { _fact_list.push _fact }
|
120
|
+
;
|
121
|
+
fact:
|
122
|
+
ID { _ID.value }
|
123
|
+
| '-' ID { '-' + _ID.value }
|
124
|
+
;
|
125
|
+
id_list:
|
126
|
+
ID { [ _ID.value ] }
|
127
|
+
| id_list ',' ID { _id_list.push _ID.value }
|
128
|
+
;
|
129
|
+
opt_action:
|
130
|
+
{ {nil => Token['', 0]} }
|
131
|
+
| ACTION { {nil => _ACTION} }
|
132
|
+
| pass_action_list
|
133
|
+
{
|
134
|
+
Hash.new(_pass_action_list).marge({nil => Token['', 0]})
|
135
|
+
}
|
136
|
+
;
|
137
|
+
pass_action_list:
|
138
|
+
pass_action { _pass_action }
|
139
|
+
| pass_action_list pass_action { _pass_action_list << _pass_action }
|
140
|
+
;
|
141
|
+
|
142
|
+
pass_action:
|
143
|
+
'<' ID '>' ACTION { [_ID.value, _ACTION]}
|
144
|
+
;
|
145
|
+
#end-rule
|
146
|
+
%%
|
147
|
+
%hook postrhs
|
148
|
+
%banner '=>...'
|
149
|
+
%prec{
|
150
|
+
left LL '@'
|
151
|
+
%}
|
152
|
+
%%
|
153
|
+
|
154
|
+
%LEX{
|
155
|
+
/[ \t]+/ { }
|
156
|
+
/\r?\n/ { yield nil, nil }
|
157
|
+
/<</ { yield _Token(:LL, $&) }
|
158
|
+
/=>/ { yield _Token(:EG, $&) }
|
159
|
+
/%([a-zA-Z0-9_]+)((::[a-zA-Z0-9_]+)*)/
|
160
|
+
{ yield _Token(:CONST, $1+$2) }
|
161
|
+
/%\((.+)\)%/ { yield _Token(:EMBED, $1) }
|
162
|
+
'nil' { yield _Token(:NIL, $&) }
|
163
|
+
/[0-9]+/ { yield _Token(:NUMBER, $&.to_i) }
|
164
|
+
/:[a-zA-Z0-9_]+/ { yield _Token(:SYMBOL, $&) }
|
165
|
+
/[a-zA-Z][a-zA-Z0-9_]*/ { yield _Token(:ID, $&) }
|
166
|
+
/'(.+)'/ { yield _Token(:STR, $1) }
|
167
|
+
/./ { yield _Token($&, $&) }
|
168
|
+
%}
|
169
|
+
#begin-rule
|
170
|
+
start:
|
171
|
+
EG fnl
|
172
|
+
{
|
173
|
+
n = master.nrules
|
174
|
+
master.optouter <<
|
175
|
+
master.gen_defm_code("_ast_#{n} val", _fnl, _EG.lineno)
|
176
|
+
master.on_reduce[n] = ":_ast_#{n}"
|
177
|
+
}
|
178
|
+
;
|
179
|
+
node:
|
180
|
+
ID '(' ')' { "Node_#{_ID.value}.new(basis.file.lineno)" }
|
181
|
+
| ID '(' fnlpair ')'
|
182
|
+
{
|
183
|
+
if g_parser.rhs.size > 0
|
184
|
+
"Node_#{_ID.value}.new(val[0].lineno, #{_fnlpair.join(', ')})"
|
185
|
+
else
|
186
|
+
"Node_#{_ID.value}.new(basis.file.lineno, #{_fnlpair.join(', ')})"
|
187
|
+
end
|
188
|
+
}
|
189
|
+
;
|
190
|
+
fnlpair:
|
191
|
+
fnl { [_fnl] }
|
192
|
+
| fnlpair ',' fnl { _fnlpair << _fnl }
|
193
|
+
;
|
194
|
+
fnl:
|
195
|
+
fact { _fact }
|
196
|
+
| node { _node }
|
197
|
+
| list { _list }
|
198
|
+
;
|
199
|
+
fact:
|
200
|
+
ID opt_embed
|
201
|
+
{
|
202
|
+
unless i = g_parser.name_to_rhs_index(val[0].value)
|
203
|
+
warn "#{g_parser.lineno}: ?#{val[0].value}"
|
204
|
+
raise
|
205
|
+
end
|
206
|
+
"val[#{i}]#{val[1]}"
|
207
|
+
}
|
208
|
+
| CONST { "Depager::Token[#{_CONST.value}]" }
|
209
|
+
| SYMBOL { "Depager::Token[#{_SYMBOL.value}]" }
|
210
|
+
| STR { "Depager::Token['#{_STR.value}']" }
|
211
|
+
| NIL { "nil" }
|
212
|
+
| NUMBER { "Depager::Token[#{_NUMBER.value}]" }
|
213
|
+
;
|
214
|
+
opt_embed:
|
215
|
+
{ '' }
|
216
|
+
| EMBED { _EMBED.value }
|
217
|
+
;
|
218
|
+
list:
|
219
|
+
'['']' { "NodeList.new(basis.file.lineno, [])" }
|
220
|
+
| '['fnlpair']'
|
221
|
+
{
|
222
|
+
if g_parser.rhs.size > 0
|
223
|
+
"NodeList.new(val[0].lineno, [#{_fnlpair.join(', ')}])"
|
224
|
+
else
|
225
|
+
"NodeList.new(basis.file.lineno, #{_fnlpair.join(', ')})"
|
226
|
+
end
|
227
|
+
}
|
228
|
+
| fnl-l LL fnl-r { "#{_l}.push(#{_r})" }
|
229
|
+
| fnl-l '@' fnl-r { "#{_l}.concat(#{_r})" }
|
230
|
+
;
|
231
|
+
#end-rule
|
232
|
+
%%
|
@@ -0,0 +1,1249 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
### ASTBuilderBaseExtension - Depager Extension (master)
|
4
|
+
###
|
5
|
+
require 'pp.rb'
|
6
|
+
require 'depager/parser.rb'
|
7
|
+
require 'depager/parse_action'
|
8
|
+
|
9
|
+
|
10
|
+
module D4ASTBuilderBaseExtension #:nodoc:all
|
11
|
+
end
|
12
|
+
|
13
|
+
class ASTBuilderBaseExtension #:nodoc:all
|
14
|
+
include Depager::ExtensionUtils
|
15
|
+
|
16
|
+
attr_accessor :h2p
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@master = self
|
20
|
+
@hook = []
|
21
|
+
@h2p = {}
|
22
|
+
init_parser
|
23
|
+
end
|
24
|
+
|
25
|
+
def __regext__ p
|
26
|
+
super p, :default, nil
|
27
|
+
|
28
|
+
@hook[0] = ASTBuilderBaseExtension_prerulelist.new(p, @nparam, self)
|
29
|
+
@h2p['prerulelist'] = @hook[0]
|
30
|
+
p.prerulelist.push [@hook[0], :do_parse]
|
31
|
+
|
32
|
+
@hook[1] = ASTBuilderBaseExtension_postrhs.new(p, @nparam, self)
|
33
|
+
@h2p['postrhs'] = @hook[1]
|
34
|
+
p.postrhs.push [@hook[1], :do_parse]
|
35
|
+
|
36
|
+
regext p
|
37
|
+
end
|
38
|
+
|
39
|
+
### Inner Code
|
40
|
+
attr_accessor :optouter, :on_reduce, :visitor
|
41
|
+
def init_parser
|
42
|
+
super
|
43
|
+
@visitor = Hash.new{|hash, key| hash[key] = []}
|
44
|
+
@optouter = []
|
45
|
+
@on_reduce = []
|
46
|
+
end
|
47
|
+
def postRuleList
|
48
|
+
g_parser.optouter <<
|
49
|
+
gen_action_decorator_code(target_name, paramkey,
|
50
|
+
@on_reduce, @optouter)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
### Outer Code
|
56
|
+
|
57
|
+
###
|
58
|
+
### ASTBuilderBaseExtension_prerulelist - Part of Depager Extension (slave)
|
59
|
+
###
|
60
|
+
module D4ASTBuilderBaseExtension_prerulelist #:nodoc:all
|
61
|
+
end
|
62
|
+
|
63
|
+
class ASTBuilderBaseExtension_prerulelist < Basis #:nodoc:all
|
64
|
+
include Depager::ExtensionUtils
|
65
|
+
|
66
|
+
include ActionParser
|
67
|
+
|
68
|
+
### Reduce Table
|
69
|
+
reduce_table = [
|
70
|
+
[ -1, 1 ],
|
71
|
+
[ 0, 3 ],
|
72
|
+
[ 1, 0 ],
|
73
|
+
[ 1, 3 ],
|
74
|
+
[ 2, 0 ],
|
75
|
+
[ 2, 2 ],
|
76
|
+
[ 3, 1 ],
|
77
|
+
[ 3, 2 ],
|
78
|
+
[ 6, 3 ],
|
79
|
+
[ 7, 3 ],
|
80
|
+
[ 7, 4 ],
|
81
|
+
[ 4, 0 ],
|
82
|
+
[ 4, 2 ],
|
83
|
+
[ 4, 3 ],
|
84
|
+
[ 8, 1 ],
|
85
|
+
[ 8, 3 ],
|
86
|
+
[ 10, 1 ],
|
87
|
+
[ 10, 2 ],
|
88
|
+
[ 9, 1 ],
|
89
|
+
[ 9, 3 ],
|
90
|
+
[ 5, 0 ],
|
91
|
+
[ 5, 1 ],
|
92
|
+
[ 5, 1 ],
|
93
|
+
[ 11, 1 ],
|
94
|
+
[ 11, 2 ],
|
95
|
+
[ 12, 4 ],
|
96
|
+
]
|
97
|
+
### Extension Params
|
98
|
+
nparams = {
|
99
|
+
'NVAction' => 2,
|
100
|
+
}
|
101
|
+
### Term to Int
|
102
|
+
t2i = {
|
103
|
+
nil => 0,
|
104
|
+
false => 1,
|
105
|
+
:NODE => 2,
|
106
|
+
:ACTION => 3,
|
107
|
+
:VISITOR => 4,
|
108
|
+
:ID => 5,
|
109
|
+
"(" => 6,
|
110
|
+
")" => 7,
|
111
|
+
"[" => 8,
|
112
|
+
"]" => 9,
|
113
|
+
"," => 10,
|
114
|
+
"-" => 11,
|
115
|
+
"<" => 12,
|
116
|
+
">" => 13,
|
117
|
+
}
|
118
|
+
### Int to Term
|
119
|
+
i2t = [
|
120
|
+
nil,
|
121
|
+
false,
|
122
|
+
:NODE,
|
123
|
+
:ACTION,
|
124
|
+
:VISITOR,
|
125
|
+
:ID,
|
126
|
+
"(",
|
127
|
+
")",
|
128
|
+
"[",
|
129
|
+
"]",
|
130
|
+
",",
|
131
|
+
"-",
|
132
|
+
"<",
|
133
|
+
">",
|
134
|
+
]
|
135
|
+
### Action Table
|
136
|
+
action_table = [
|
137
|
+
[ nil, nil, 1, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
138
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 5, nil, nil, nil, nil, nil, ],
|
139
|
+
[ ACC, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
140
|
+
[ nil, nil, nil, nil, 6, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
141
|
+
[ nil, nil, nil, 8, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
142
|
+
[ nil, nil, nil, nil, nil, 10, nil, nil, nil, 9, nil, nil, nil, nil, ],
|
143
|
+
[ nil, nil, nil, 12, nil, nil, nil, nil, nil, nil, nil, nil, 16, nil, ],
|
144
|
+
[ nil, nil, nil, nil, nil, 18, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
145
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
146
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
147
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
148
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, 21, 22, nil, nil, nil, ],
|
149
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
150
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
151
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 16, nil, ],
|
152
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
153
|
+
[ nil, nil, nil, nil, nil, 24, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
154
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
155
|
+
[ nil, nil, nil, nil, nil, nil, 25, nil, nil, nil, nil, nil, nil, nil, ],
|
156
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 5, nil, nil, nil, nil, nil, ],
|
157
|
+
[ nil, nil, nil, nil, nil, 18, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
158
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
159
|
+
[ nil, nil, nil, nil, nil, 28, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
160
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
161
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 29, ],
|
162
|
+
[ nil, nil, nil, nil, nil, 31, nil, 34, nil, nil, nil, 32, nil, nil, ],
|
163
|
+
[ nil, nil, nil, 12, nil, nil, nil, nil, nil, nil, nil, nil, 16, nil, ],
|
164
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
165
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
166
|
+
[ nil, nil, nil, 36, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
167
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
168
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
169
|
+
[ nil, nil, nil, nil, nil, 37, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
170
|
+
[ nil, nil, nil, nil, nil, nil, nil, 39, nil, nil, 38, nil, nil, nil, ],
|
171
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
172
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
173
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
174
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
175
|
+
[ nil, nil, nil, nil, nil, 31, nil, nil, nil, nil, nil, 32, nil, nil, ],
|
176
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
177
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
178
|
+
]
|
179
|
+
### Default Reduce Table
|
180
|
+
defred_table = [
|
181
|
+
-2,
|
182
|
+
-11,
|
183
|
+
nil,
|
184
|
+
-4,
|
185
|
+
nil,
|
186
|
+
nil,
|
187
|
+
-20,
|
188
|
+
nil,
|
189
|
+
-3,
|
190
|
+
-12,
|
191
|
+
-18,
|
192
|
+
nil,
|
193
|
+
-21,
|
194
|
+
-5,
|
195
|
+
-22,
|
196
|
+
-23,
|
197
|
+
nil,
|
198
|
+
-6,
|
199
|
+
nil,
|
200
|
+
-11,
|
201
|
+
-1,
|
202
|
+
-13,
|
203
|
+
nil,
|
204
|
+
-24,
|
205
|
+
nil,
|
206
|
+
nil,
|
207
|
+
-20,
|
208
|
+
-7,
|
209
|
+
-19,
|
210
|
+
nil,
|
211
|
+
-14,
|
212
|
+
-16,
|
213
|
+
nil,
|
214
|
+
nil,
|
215
|
+
-9,
|
216
|
+
-8,
|
217
|
+
-25,
|
218
|
+
-17,
|
219
|
+
nil,
|
220
|
+
-10,
|
221
|
+
-15,
|
222
|
+
]
|
223
|
+
defred_after_shift_table = [
|
224
|
+
nil,
|
225
|
+
nil,
|
226
|
+
nil,
|
227
|
+
nil,
|
228
|
+
nil,
|
229
|
+
nil,
|
230
|
+
nil,
|
231
|
+
nil,
|
232
|
+
-3,
|
233
|
+
-12,
|
234
|
+
-18,
|
235
|
+
nil,
|
236
|
+
-21,
|
237
|
+
-5,
|
238
|
+
nil,
|
239
|
+
-23,
|
240
|
+
nil,
|
241
|
+
-6,
|
242
|
+
nil,
|
243
|
+
nil,
|
244
|
+
nil,
|
245
|
+
-13,
|
246
|
+
nil,
|
247
|
+
-24,
|
248
|
+
nil,
|
249
|
+
nil,
|
250
|
+
nil,
|
251
|
+
-7,
|
252
|
+
-19,
|
253
|
+
nil,
|
254
|
+
-14,
|
255
|
+
-16,
|
256
|
+
nil,
|
257
|
+
nil,
|
258
|
+
-9,
|
259
|
+
-8,
|
260
|
+
-25,
|
261
|
+
-17,
|
262
|
+
nil,
|
263
|
+
-10,
|
264
|
+
-15,
|
265
|
+
]
|
266
|
+
### Nonterm to Int
|
267
|
+
nt2i = {
|
268
|
+
:start => 0,
|
269
|
+
:opt_defnode => 1,
|
270
|
+
:opt_defvis => 2,
|
271
|
+
:defnode_list => 3,
|
272
|
+
:opt_attr => 4,
|
273
|
+
:opt_action => 5,
|
274
|
+
:defnode => 6,
|
275
|
+
:defnode_header => 7,
|
276
|
+
:fact_list => 8,
|
277
|
+
:id_list => 9,
|
278
|
+
:fact => 10,
|
279
|
+
:pass_action_list => 11,
|
280
|
+
:pass_action => 12,
|
281
|
+
}
|
282
|
+
### Int to Nonterm
|
283
|
+
i2nt = [
|
284
|
+
:start,
|
285
|
+
:opt_defnode,
|
286
|
+
:opt_defvis,
|
287
|
+
:defnode_list,
|
288
|
+
:opt_attr,
|
289
|
+
:opt_action,
|
290
|
+
:defnode,
|
291
|
+
:defnode_header,
|
292
|
+
:fact_list,
|
293
|
+
:id_list,
|
294
|
+
:fact,
|
295
|
+
:pass_action_list,
|
296
|
+
:pass_action,
|
297
|
+
]
|
298
|
+
### Goto Table
|
299
|
+
goto_table = [
|
300
|
+
[ 2, 3, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
301
|
+
[ nil, nil, nil, nil, 4, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
302
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
303
|
+
[ nil, nil, 7, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
304
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
305
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, 11, nil, nil, nil, ],
|
306
|
+
[ nil, nil, nil, nil, nil, 13, nil, nil, nil, nil, nil, 14, 15, ],
|
307
|
+
[ nil, nil, nil, 20, nil, nil, 17, 19, nil, nil, nil, nil, nil, ],
|
308
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
309
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
310
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
311
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
312
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
313
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
314
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 23, ],
|
315
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
316
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
317
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
318
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
319
|
+
[ nil, nil, nil, nil, 26, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
320
|
+
[ nil, nil, nil, nil, nil, nil, 27, 19, nil, nil, nil, nil, nil, ],
|
321
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
322
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
323
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
324
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
325
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 33, nil, 30, nil, nil, ],
|
326
|
+
[ nil, nil, nil, nil, nil, 35, nil, nil, nil, nil, nil, 14, 15, ],
|
327
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
328
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
329
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
330
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
331
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
332
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
333
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
334
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
335
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
336
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
337
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
338
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 40, nil, nil, ],
|
339
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
340
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
341
|
+
]
|
342
|
+
|
343
|
+
Tables = [ reduce_table, nparams, action_table,
|
344
|
+
defred_table, defred_after_shift_table, goto_table,
|
345
|
+
t2i, i2t, nt2i, i2nt ]
|
346
|
+
|
347
|
+
attr_accessor :p, :m
|
348
|
+
def initialize p, nparam, master = nil
|
349
|
+
super()
|
350
|
+
@g_parser = @p = p
|
351
|
+
@master = @m = master
|
352
|
+
@nparam = nparam
|
353
|
+
@dect = D4ASTBuilderBaseExtension_prerulelist::NVAction.new(self)
|
354
|
+
init_parser
|
355
|
+
end
|
356
|
+
|
357
|
+
|
358
|
+
def do_parse?
|
359
|
+
if @line =~ /^\s*%AST\{\s*\Z/
|
360
|
+
@line = $'
|
361
|
+
true
|
362
|
+
else
|
363
|
+
false
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
|
368
|
+
def banner
|
369
|
+
"%AST{ ... } / #{@master.class.name}"
|
370
|
+
end
|
371
|
+
|
372
|
+
### Inner Code
|
373
|
+
|
374
|
+
def lex
|
375
|
+
begin
|
376
|
+
until @line.empty? do
|
377
|
+
case @line
|
378
|
+
when /\A\s+/, /\A#.*/
|
379
|
+
|
380
|
+
when /\A%\}\s*\Z/
|
381
|
+
@line = $'; yield nil,nil
|
382
|
+
when /\ANode/
|
383
|
+
yield _Token(:NODE, $&)
|
384
|
+
when /\AVisitor/
|
385
|
+
yield _Token(:VISITOR, $&)
|
386
|
+
when /\A[a-zA-Z][a-zA-Z0-9_]*/
|
387
|
+
yield _Token(:ID, $&)
|
388
|
+
when /\A\{/
|
389
|
+
ln = lineno; yield _Token(:ACTION, parse_action, ln); //=~''
|
390
|
+
when /\A./
|
391
|
+
yield _Token($&, $&)
|
392
|
+
|
393
|
+
else
|
394
|
+
raise RuntimeError, "must not happen #{@line}"
|
395
|
+
end
|
396
|
+
@oldline = @line
|
397
|
+
@line = $'
|
398
|
+
end
|
399
|
+
end while @line = getline
|
400
|
+
yield nil, nil
|
401
|
+
end
|
402
|
+
|
403
|
+
end
|
404
|
+
|
405
|
+
### Outer Code
|
406
|
+
|
407
|
+
class D4ASTBuilderBaseExtension_prerulelist::NVAction < Depager::Action #:nodoc:all
|
408
|
+
include Depager::DecoratorUtils
|
409
|
+
include ActionParser
|
410
|
+
|
411
|
+
on_reduce = [
|
412
|
+
nil,
|
413
|
+
:_act_0,
|
414
|
+
:_act_1,
|
415
|
+
:_act_2,
|
416
|
+
:_act_3,
|
417
|
+
:_act_4,
|
418
|
+
:_act_5,
|
419
|
+
:_act_6,
|
420
|
+
:_act_7,
|
421
|
+
:_act_8,
|
422
|
+
:_act_9,
|
423
|
+
:_act_10,
|
424
|
+
:_act_11,
|
425
|
+
:_act_12,
|
426
|
+
:_act_13,
|
427
|
+
:_act_14,
|
428
|
+
:_act_15,
|
429
|
+
:_act_16,
|
430
|
+
:_act_17,
|
431
|
+
:_act_18,
|
432
|
+
:_act_19,
|
433
|
+
:_act_20,
|
434
|
+
:_act_21,
|
435
|
+
:_act_22,
|
436
|
+
:_act_23,
|
437
|
+
:_act_24,
|
438
|
+
|
439
|
+
]
|
440
|
+
Tables = [on_reduce]
|
441
|
+
def initialize inside
|
442
|
+
super inside, 'NVAction'
|
443
|
+
@on_reduce, = self.class::Tables
|
444
|
+
init_parser
|
445
|
+
end
|
446
|
+
|
447
|
+
|
448
|
+
module_eval <<-'.,.,11802814595060.,.,', 'ast_base.dr', 36
|
449
|
+
def _act_0 val
|
450
|
+
_opt_defnode, _opt_defvis, _defnode_list = *val
|
451
|
+
|
452
|
+
g_parser.optouter.push _opt_defnode, val[2]
|
453
|
+
g_parser.optouter.push %{
|
454
|
+
class Visitor
|
455
|
+
def visit node
|
456
|
+
node.accept(self)
|
457
|
+
end
|
458
|
+
#{master.visitor[nil]}
|
459
|
+
end
|
460
|
+
};#code
|
461
|
+
master.visitor.each do |k, v|
|
462
|
+
g_parser.optouter.push %{
|
463
|
+
class Visitor_#{k}
|
464
|
+
#{v}
|
465
|
+
end
|
466
|
+
} if k ;#code
|
467
|
+
end
|
468
|
+
|
469
|
+
end
|
470
|
+
|
471
|
+
.,.,11802814595060.,.,
|
472
|
+
|
473
|
+
module_eval <<-'.,.,118028145910468.,.,', 'ast_base.dr', 56
|
474
|
+
def _act_1 val
|
475
|
+
""
|
476
|
+
|
477
|
+
end
|
478
|
+
|
479
|
+
.,.,118028145910468.,.,
|
480
|
+
|
481
|
+
module_eval <<-'.,.,118028145948978.,.,', 'ast_base.dr', 58
|
482
|
+
def _act_2 val
|
483
|
+
_NODE, _opt_attr, _ACTION = *val
|
484
|
+
|
485
|
+
ini = %{
|
486
|
+
def initialize
|
487
|
+
#{_ACTION.value}
|
488
|
+
end
|
489
|
+
};#code
|
490
|
+
master.gen_tmpl_code(:defnode, binding)
|
491
|
+
|
492
|
+
end
|
493
|
+
|
494
|
+
.,.,118028145948978.,.,
|
495
|
+
|
496
|
+
module_eval <<-'.,.,118028145959009.,.,', 'ast_base.dr', 68
|
497
|
+
def _act_3 val
|
498
|
+
[]
|
499
|
+
|
500
|
+
end
|
501
|
+
|
502
|
+
.,.,118028145959009.,.,
|
503
|
+
|
504
|
+
module_eval <<-'.,.,118028145914706.,.,', 'ast_base.dr', 70
|
505
|
+
def _act_4 val
|
506
|
+
_VISITOR, _opt_action = *val
|
507
|
+
|
508
|
+
_opt_action[nil] = Token['', 0] unless _opt_action[nil]
|
509
|
+
_opt_action.each do |pass, act|
|
510
|
+
master.visitor[pass].unshift(
|
511
|
+
master.gen_meval_code(act.lineno, 0, act.value.to_s))
|
512
|
+
end
|
513
|
+
|
514
|
+
end
|
515
|
+
|
516
|
+
.,.,118028145914706.,.,
|
517
|
+
|
518
|
+
module_eval <<-'.,.,118028145935339.,.,', 'ast_base.dr', 79
|
519
|
+
def _act_5 val
|
520
|
+
_defnode = *val
|
521
|
+
_defnode
|
522
|
+
|
523
|
+
end
|
524
|
+
|
525
|
+
.,.,118028145935339.,.,
|
526
|
+
|
527
|
+
module_eval <<-'.,.,11802814593872.,.,', 'ast_base.dr', 80
|
528
|
+
def _act_6 val
|
529
|
+
_defnode_list, _defnode = *val
|
530
|
+
_defnode_list << _defnode
|
531
|
+
|
532
|
+
end
|
533
|
+
|
534
|
+
.,.,11802814593872.,.,
|
535
|
+
|
536
|
+
module_eval <<-'.,.,118028145918044.,.,', 'ast_base.dr', 84
|
537
|
+
def _act_7 val
|
538
|
+
_defnode_header, _opt_attr, _opt_action = *val
|
539
|
+
|
540
|
+
name, args = _defnode_header
|
541
|
+
nodes, accept, attrs = [], '', _opt_attr
|
542
|
+
args.each do |i|
|
543
|
+
if i =~ /\-(.*)/
|
544
|
+
nodes.push $1
|
545
|
+
attrs.push $1
|
546
|
+
else
|
547
|
+
nodes.push i
|
548
|
+
accept << master.gen_accept_code(i)
|
549
|
+
end
|
550
|
+
end
|
551
|
+
_opt_action[nil] = Token['', 0] unless _opt_action[nil]
|
552
|
+
_opt_action.each do |pass, act|
|
553
|
+
vis_code = master.modify_action_code(act.value, nodes - attrs)
|
554
|
+
master.visitor[pass] <<
|
555
|
+
master.gen_defm_code("visit_Node_#{name} node",
|
556
|
+
vis_code, act.lineno)
|
557
|
+
end
|
558
|
+
master.gen_tmpl_code(:node, binding)
|
559
|
+
|
560
|
+
end
|
561
|
+
|
562
|
+
.,.,118028145918044.,.,
|
563
|
+
|
564
|
+
module_eval <<-'.,.,118028145922702.,.,', 'ast_base.dr', 107
|
565
|
+
def _act_8 val
|
566
|
+
_ID, _, _ = *val
|
567
|
+
[_ID.value, nil]
|
568
|
+
|
569
|
+
end
|
570
|
+
|
571
|
+
.,.,118028145922702.,.,
|
572
|
+
|
573
|
+
module_eval <<-'.,.,118028145943087.,.,', 'ast_base.dr', 108
|
574
|
+
def _act_9 val
|
575
|
+
_ID, _, _fact_list, _ = *val
|
576
|
+
[_ID.value, _fact_list]
|
577
|
+
|
578
|
+
end
|
579
|
+
|
580
|
+
.,.,118028145943087.,.,
|
581
|
+
|
582
|
+
module_eval <<-'.,.,118028145952231.,.,', 'ast_base.dr', 111
|
583
|
+
def _act_10 val
|
584
|
+
[]
|
585
|
+
|
586
|
+
end
|
587
|
+
|
588
|
+
.,.,118028145952231.,.,
|
589
|
+
|
590
|
+
module_eval <<-'.,.,118028145935942.,.,', 'ast_base.dr', 112
|
591
|
+
def _act_11 val
|
592
|
+
_, _ = *val
|
593
|
+
[]
|
594
|
+
|
595
|
+
end
|
596
|
+
|
597
|
+
.,.,118028145935942.,.,
|
598
|
+
|
599
|
+
module_eval <<-'.,.,11802814593749.,.,', 'ast_base.dr', 113
|
600
|
+
def _act_12 val
|
601
|
+
_, _id_list, _ = *val
|
602
|
+
_id_list
|
603
|
+
|
604
|
+
end
|
605
|
+
|
606
|
+
.,.,11802814593749.,.,
|
607
|
+
|
608
|
+
module_eval <<-'.,.,118028145926271.,.,', 'ast_base.dr', 116
|
609
|
+
def _act_13 val
|
610
|
+
_fact = *val
|
611
|
+
[_fact]
|
612
|
+
|
613
|
+
end
|
614
|
+
|
615
|
+
.,.,118028145926271.,.,
|
616
|
+
|
617
|
+
module_eval <<-'.,.,118028145923579.,.,', 'ast_base.dr', 117
|
618
|
+
def _act_14 val
|
619
|
+
_fact_list, _, _fact = *val
|
620
|
+
_fact_list.push _fact
|
621
|
+
|
622
|
+
end
|
623
|
+
|
624
|
+
.,.,118028145923579.,.,
|
625
|
+
|
626
|
+
module_eval <<-'.,.,118028145926511.,.,', 'ast_base.dr', 120
|
627
|
+
def _act_15 val
|
628
|
+
_ID = *val
|
629
|
+
_ID.value
|
630
|
+
|
631
|
+
end
|
632
|
+
|
633
|
+
.,.,118028145926511.,.,
|
634
|
+
|
635
|
+
module_eval <<-'.,.,118028145913425.,.,', 'ast_base.dr', 121
|
636
|
+
def _act_16 val
|
637
|
+
_, _ID = *val
|
638
|
+
'-' + _ID.value
|
639
|
+
|
640
|
+
end
|
641
|
+
|
642
|
+
.,.,118028145913425.,.,
|
643
|
+
|
644
|
+
module_eval <<-'.,.,118028145915593.,.,', 'ast_base.dr', 124
|
645
|
+
def _act_17 val
|
646
|
+
_ID = *val
|
647
|
+
[ _ID.value ]
|
648
|
+
|
649
|
+
end
|
650
|
+
|
651
|
+
.,.,118028145915593.,.,
|
652
|
+
|
653
|
+
module_eval <<-'.,.,118028145940054.,.,', 'ast_base.dr', 125
|
654
|
+
def _act_18 val
|
655
|
+
_id_list, _, _ID = *val
|
656
|
+
_id_list.push _ID.value
|
657
|
+
|
658
|
+
end
|
659
|
+
|
660
|
+
.,.,118028145940054.,.,
|
661
|
+
|
662
|
+
module_eval <<-'.,.,118028145930606.,.,', 'ast_base.dr', 128
|
663
|
+
def _act_19 val
|
664
|
+
{nil => Token['', 0]}
|
665
|
+
|
666
|
+
end
|
667
|
+
|
668
|
+
.,.,118028145930606.,.,
|
669
|
+
|
670
|
+
module_eval <<-'.,.,118028145946101.,.,', 'ast_base.dr', 129
|
671
|
+
def _act_20 val
|
672
|
+
_ACTION = *val
|
673
|
+
{nil => _ACTION}
|
674
|
+
|
675
|
+
end
|
676
|
+
|
677
|
+
.,.,118028145946101.,.,
|
678
|
+
|
679
|
+
module_eval <<-'.,.,11802814595489.,.,', 'ast_base.dr', 131
|
680
|
+
def _act_21 val
|
681
|
+
_pass_action_list = *val
|
682
|
+
|
683
|
+
Hash.new(_pass_action_list).marge({nil => Token['', 0]})
|
684
|
+
|
685
|
+
end
|
686
|
+
|
687
|
+
.,.,11802814595489.,.,
|
688
|
+
|
689
|
+
module_eval <<-'.,.,118028145917240.,.,', 'ast_base.dr', 136
|
690
|
+
def _act_22 val
|
691
|
+
_pass_action = *val
|
692
|
+
_pass_action
|
693
|
+
|
694
|
+
end
|
695
|
+
|
696
|
+
.,.,118028145917240.,.,
|
697
|
+
|
698
|
+
module_eval <<-'.,.,118028145943695.,.,', 'ast_base.dr', 137
|
699
|
+
def _act_23 val
|
700
|
+
_pass_action_list, _pass_action = *val
|
701
|
+
_pass_action_list << _pass_action
|
702
|
+
|
703
|
+
end
|
704
|
+
|
705
|
+
.,.,118028145943695.,.,
|
706
|
+
|
707
|
+
module_eval <<-'.,.,118028145933103.,.,', 'ast_base.dr', 141
|
708
|
+
def _act_24 val
|
709
|
+
_, _ID, _, _ACTION = *val
|
710
|
+
[_ID.value, _ACTION]
|
711
|
+
|
712
|
+
end
|
713
|
+
|
714
|
+
.,.,118028145933103.,.,
|
715
|
+
|
716
|
+
end
|
717
|
+
|
718
|
+
|
719
|
+
###
|
720
|
+
### ASTBuilderBaseExtension_postrhs - Part of Depager Extension (slave)
|
721
|
+
###
|
722
|
+
module D4ASTBuilderBaseExtension_postrhs #:nodoc:all
|
723
|
+
end
|
724
|
+
|
725
|
+
class ASTBuilderBaseExtension_postrhs < Basis #:nodoc:all
|
726
|
+
include Depager::ExtensionUtils
|
727
|
+
|
728
|
+
|
729
|
+
### Reduce Table
|
730
|
+
reduce_table = [
|
731
|
+
[ -1, 1 ],
|
732
|
+
[ 0, 2 ],
|
733
|
+
[ 2, 3 ],
|
734
|
+
[ 2, 4 ],
|
735
|
+
[ 3, 1 ],
|
736
|
+
[ 3, 3 ],
|
737
|
+
[ 1, 1 ],
|
738
|
+
[ 1, 1 ],
|
739
|
+
[ 1, 1 ],
|
740
|
+
[ 4, 2 ],
|
741
|
+
[ 4, 1 ],
|
742
|
+
[ 4, 1 ],
|
743
|
+
[ 4, 1 ],
|
744
|
+
[ 4, 1 ],
|
745
|
+
[ 4, 1 ],
|
746
|
+
[ 6, 0 ],
|
747
|
+
[ 6, 1 ],
|
748
|
+
[ 5, 2 ],
|
749
|
+
[ 5, 3 ],
|
750
|
+
[ 5, 3 ],
|
751
|
+
[ 5, 3 ],
|
752
|
+
]
|
753
|
+
### Extension Params
|
754
|
+
nparams = {
|
755
|
+
'NVAction' => 2,
|
756
|
+
}
|
757
|
+
### Term to Int
|
758
|
+
t2i = {
|
759
|
+
nil => 0,
|
760
|
+
false => 1,
|
761
|
+
:EG => 2,
|
762
|
+
:ID => 3,
|
763
|
+
"(" => 4,
|
764
|
+
")" => 5,
|
765
|
+
"," => 6,
|
766
|
+
:CONST => 7,
|
767
|
+
:SYMBOL => 8,
|
768
|
+
:STR => 9,
|
769
|
+
:NIL => 10,
|
770
|
+
:NUMBER => 11,
|
771
|
+
:EMBED => 12,
|
772
|
+
"[" => 13,
|
773
|
+
"]" => 14,
|
774
|
+
:LL => 15,
|
775
|
+
"@" => 16,
|
776
|
+
}
|
777
|
+
### Int to Term
|
778
|
+
i2t = [
|
779
|
+
nil,
|
780
|
+
false,
|
781
|
+
:EG,
|
782
|
+
:ID,
|
783
|
+
"(",
|
784
|
+
")",
|
785
|
+
",",
|
786
|
+
:CONST,
|
787
|
+
:SYMBOL,
|
788
|
+
:STR,
|
789
|
+
:NIL,
|
790
|
+
:NUMBER,
|
791
|
+
:EMBED,
|
792
|
+
"[",
|
793
|
+
"]",
|
794
|
+
:LL,
|
795
|
+
"@",
|
796
|
+
]
|
797
|
+
### Action Table
|
798
|
+
action_table = [
|
799
|
+
[ nil, nil, 2, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
800
|
+
[ ACC, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
801
|
+
[ nil, nil, nil, 5, nil, nil, nil, 12, 3, 6, 8, 10, nil, 13, nil, nil, nil, ],
|
802
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
803
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
804
|
+
[ nil, nil, nil, nil, 14, nil, nil, nil, nil, nil, nil, nil, 16, nil, nil, nil, nil, ],
|
805
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
806
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
807
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
808
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 17, 18, ],
|
809
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
810
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
811
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
812
|
+
[ nil, nil, nil, 5, nil, nil, nil, 12, 3, 6, 8, 10, nil, 13, 19, nil, nil, ],
|
813
|
+
[ nil, nil, nil, 5, nil, 22, nil, 12, 3, 6, 8, 10, nil, 13, nil, nil, nil, ],
|
814
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
815
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
816
|
+
[ nil, nil, nil, 5, nil, nil, nil, 12, 3, 6, 8, 10, nil, 13, nil, nil, nil, ],
|
817
|
+
[ nil, nil, nil, 5, nil, nil, nil, 12, 3, 6, 8, 10, nil, 13, nil, nil, nil, ],
|
818
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
819
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 17, 18, ],
|
820
|
+
[ nil, nil, nil, nil, nil, nil, 27, nil, nil, nil, nil, nil, nil, nil, 26, nil, nil, ],
|
821
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
822
|
+
[ nil, nil, nil, nil, nil, 28, 27, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
823
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 17, 18, ],
|
824
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 17, 18, ],
|
825
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
826
|
+
[ nil, nil, nil, 5, nil, nil, nil, 12, 3, 6, 8, 10, nil, 13, nil, nil, nil, ],
|
827
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
828
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 17, 18, ],
|
829
|
+
]
|
830
|
+
### Default Reduce Table
|
831
|
+
defred_table = [
|
832
|
+
nil,
|
833
|
+
nil,
|
834
|
+
nil,
|
835
|
+
-11,
|
836
|
+
-6,
|
837
|
+
-15,
|
838
|
+
-12,
|
839
|
+
-8,
|
840
|
+
-13,
|
841
|
+
-1,
|
842
|
+
-14,
|
843
|
+
-7,
|
844
|
+
-10,
|
845
|
+
nil,
|
846
|
+
nil,
|
847
|
+
-9,
|
848
|
+
-16,
|
849
|
+
nil,
|
850
|
+
nil,
|
851
|
+
-17,
|
852
|
+
-4,
|
853
|
+
nil,
|
854
|
+
-2,
|
855
|
+
nil,
|
856
|
+
-19,
|
857
|
+
-20,
|
858
|
+
-18,
|
859
|
+
nil,
|
860
|
+
-3,
|
861
|
+
-5,
|
862
|
+
]
|
863
|
+
defred_after_shift_table = [
|
864
|
+
nil,
|
865
|
+
nil,
|
866
|
+
nil,
|
867
|
+
-11,
|
868
|
+
-6,
|
869
|
+
nil,
|
870
|
+
-12,
|
871
|
+
-8,
|
872
|
+
-13,
|
873
|
+
nil,
|
874
|
+
-14,
|
875
|
+
-7,
|
876
|
+
-10,
|
877
|
+
nil,
|
878
|
+
nil,
|
879
|
+
-9,
|
880
|
+
-16,
|
881
|
+
nil,
|
882
|
+
nil,
|
883
|
+
-17,
|
884
|
+
nil,
|
885
|
+
nil,
|
886
|
+
-2,
|
887
|
+
nil,
|
888
|
+
nil,
|
889
|
+
nil,
|
890
|
+
-18,
|
891
|
+
nil,
|
892
|
+
-3,
|
893
|
+
nil,
|
894
|
+
]
|
895
|
+
### Nonterm to Int
|
896
|
+
nt2i = {
|
897
|
+
:start => 0,
|
898
|
+
:fnl => 1,
|
899
|
+
:node => 2,
|
900
|
+
:fnlpair => 3,
|
901
|
+
:fact => 4,
|
902
|
+
:list => 5,
|
903
|
+
:opt_embed => 6,
|
904
|
+
}
|
905
|
+
### Int to Nonterm
|
906
|
+
i2nt = [
|
907
|
+
:start,
|
908
|
+
:fnl,
|
909
|
+
:node,
|
910
|
+
:fnlpair,
|
911
|
+
:fact,
|
912
|
+
:list,
|
913
|
+
:opt_embed,
|
914
|
+
]
|
915
|
+
### Goto Table
|
916
|
+
goto_table = [
|
917
|
+
[ 1, nil, nil, nil, nil, nil, nil, ],
|
918
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
919
|
+
[ nil, 9, 11, nil, 4, 7, nil, ],
|
920
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
921
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
922
|
+
[ nil, nil, nil, nil, nil, nil, 15, ],
|
923
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
924
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
925
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
926
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
927
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
928
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
929
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
930
|
+
[ nil, 20, 11, 21, 4, 7, nil, ],
|
931
|
+
[ nil, 20, 11, 23, 4, 7, nil, ],
|
932
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
933
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
934
|
+
[ nil, 24, 11, nil, 4, 7, nil, ],
|
935
|
+
[ nil, 25, 11, nil, 4, 7, nil, ],
|
936
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
937
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
938
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
939
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
940
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
941
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
942
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
943
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
944
|
+
[ nil, 29, 11, nil, 4, 7, nil, ],
|
945
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
946
|
+
[ nil, nil, nil, nil, nil, nil, nil, ],
|
947
|
+
]
|
948
|
+
|
949
|
+
Tables = [ reduce_table, nparams, action_table,
|
950
|
+
defred_table, defred_after_shift_table, goto_table,
|
951
|
+
t2i, i2t, nt2i, i2nt ]
|
952
|
+
|
953
|
+
attr_accessor :p, :m
|
954
|
+
def initialize p, nparam, master = nil
|
955
|
+
super()
|
956
|
+
@g_parser = @p = p
|
957
|
+
@master = @m = master
|
958
|
+
@nparam = nparam
|
959
|
+
@dect = D4ASTBuilderBaseExtension_postrhs::NVAction.new(self)
|
960
|
+
init_parser
|
961
|
+
end
|
962
|
+
|
963
|
+
|
964
|
+
|
965
|
+
def banner
|
966
|
+
"=>... / #{@master.class.name}"
|
967
|
+
end
|
968
|
+
|
969
|
+
### Inner Code
|
970
|
+
|
971
|
+
def lex
|
972
|
+
begin
|
973
|
+
until @line.empty? do
|
974
|
+
case @line
|
975
|
+
when /\A[ \t]+/
|
976
|
+
|
977
|
+
when /\A\r?\n/
|
978
|
+
yield nil, nil
|
979
|
+
when /\A<</
|
980
|
+
yield _Token(:LL, $&)
|
981
|
+
when /\A=>/
|
982
|
+
yield _Token(:EG, $&)
|
983
|
+
when /\A%([a-zA-Z0-9_]+)((::[a-zA-Z0-9_]+)*)/
|
984
|
+
yield _Token(:CONST, $1+$2)
|
985
|
+
when /\A%\((.+)\)%/
|
986
|
+
yield _Token(:EMBED, $1)
|
987
|
+
when /\Anil/
|
988
|
+
yield _Token(:NIL, $&)
|
989
|
+
when /\A[0-9]+/
|
990
|
+
yield _Token(:NUMBER, $&.to_i)
|
991
|
+
when /\A:[a-zA-Z0-9_]+/
|
992
|
+
yield _Token(:SYMBOL, $&)
|
993
|
+
when /\A[a-zA-Z][a-zA-Z0-9_]*/
|
994
|
+
yield _Token(:ID, $&)
|
995
|
+
when /\A'(.+)'/
|
996
|
+
yield _Token(:STR, $1)
|
997
|
+
when /\A./
|
998
|
+
yield _Token($&, $&)
|
999
|
+
|
1000
|
+
else
|
1001
|
+
raise RuntimeError, "must not happen #{@line}"
|
1002
|
+
end
|
1003
|
+
@oldline = @line
|
1004
|
+
@line = $'
|
1005
|
+
end
|
1006
|
+
end while @line = getline
|
1007
|
+
yield nil, nil
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
### Outer Code
|
1013
|
+
|
1014
|
+
class D4ASTBuilderBaseExtension_postrhs::NVAction < Depager::Action #:nodoc:all
|
1015
|
+
include Depager::DecoratorUtils
|
1016
|
+
|
1017
|
+
on_reduce = [
|
1018
|
+
nil,
|
1019
|
+
:_act_0,
|
1020
|
+
:_act_1,
|
1021
|
+
:_act_2,
|
1022
|
+
:_act_3,
|
1023
|
+
:_act_4,
|
1024
|
+
:_act_5,
|
1025
|
+
:_act_6,
|
1026
|
+
:_act_7,
|
1027
|
+
:_act_8,
|
1028
|
+
:_act_9,
|
1029
|
+
:_act_10,
|
1030
|
+
:_act_11,
|
1031
|
+
:_act_12,
|
1032
|
+
:_act_13,
|
1033
|
+
:_act_14,
|
1034
|
+
:_act_15,
|
1035
|
+
:_act_16,
|
1036
|
+
:_act_17,
|
1037
|
+
:_act_18,
|
1038
|
+
:_act_19,
|
1039
|
+
|
1040
|
+
]
|
1041
|
+
Tables = [on_reduce]
|
1042
|
+
def initialize inside
|
1043
|
+
super inside, 'NVAction'
|
1044
|
+
@on_reduce, = self.class::Tables
|
1045
|
+
init_parser
|
1046
|
+
end
|
1047
|
+
|
1048
|
+
|
1049
|
+
module_eval <<-'.,.,118028145920523.,.,', 'ast_base.dr', 170
|
1050
|
+
def _act_0 val
|
1051
|
+
_EG, _fnl = *val
|
1052
|
+
|
1053
|
+
n = master.nrules
|
1054
|
+
master.optouter <<
|
1055
|
+
master.gen_defm_code("_ast_#{n} val", _fnl, _EG.lineno)
|
1056
|
+
master.on_reduce[n] = ":_ast_#{n}"
|
1057
|
+
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
.,.,118028145920523.,.,
|
1061
|
+
|
1062
|
+
module_eval <<-'.,.,118028145933310.,.,', 'ast_base.dr', 178
|
1063
|
+
def _act_1 val
|
1064
|
+
_ID, _, _ = *val
|
1065
|
+
"Node_#{_ID.value}.new(basis.file.lineno)"
|
1066
|
+
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
.,.,118028145933310.,.,
|
1070
|
+
|
1071
|
+
module_eval <<-'.,.,118028145931729.,.,', 'ast_base.dr', 180
|
1072
|
+
def _act_2 val
|
1073
|
+
_ID, _, _fnlpair, _ = *val
|
1074
|
+
|
1075
|
+
if g_parser.rhs.size > 0
|
1076
|
+
"Node_#{_ID.value}.new(val[0].lineno, #{_fnlpair.join(', ')})"
|
1077
|
+
else
|
1078
|
+
"Node_#{_ID.value}.new(basis.file.lineno, #{_fnlpair.join(', ')})"
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
.,.,118028145931729.,.,
|
1084
|
+
|
1085
|
+
module_eval <<-'.,.,118028145932240.,.,', 'ast_base.dr', 189
|
1086
|
+
def _act_3 val
|
1087
|
+
_fnl = *val
|
1088
|
+
[_fnl]
|
1089
|
+
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
.,.,118028145932240.,.,
|
1093
|
+
|
1094
|
+
module_eval <<-'.,.,11802814592286.,.,', 'ast_base.dr', 190
|
1095
|
+
def _act_4 val
|
1096
|
+
_fnlpair, _, _fnl = *val
|
1097
|
+
_fnlpair << _fnl
|
1098
|
+
|
1099
|
+
end
|
1100
|
+
|
1101
|
+
.,.,11802814592286.,.,
|
1102
|
+
|
1103
|
+
module_eval <<-'.,.,118028145958117.,.,', 'ast_base.dr', 193
|
1104
|
+
def _act_5 val
|
1105
|
+
_fact = *val
|
1106
|
+
_fact
|
1107
|
+
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
.,.,118028145958117.,.,
|
1111
|
+
|
1112
|
+
module_eval <<-'.,.,118028145929246.,.,', 'ast_base.dr', 194
|
1113
|
+
def _act_6 val
|
1114
|
+
_node = *val
|
1115
|
+
_node
|
1116
|
+
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
.,.,118028145929246.,.,
|
1120
|
+
|
1121
|
+
module_eval <<-'.,.,11802814599659.,.,', 'ast_base.dr', 195
|
1122
|
+
def _act_7 val
|
1123
|
+
_list = *val
|
1124
|
+
_list
|
1125
|
+
|
1126
|
+
end
|
1127
|
+
|
1128
|
+
.,.,11802814599659.,.,
|
1129
|
+
|
1130
|
+
module_eval <<-'.,.,11802814595130.,.,', 'ast_base.dr', 199
|
1131
|
+
def _act_8 val
|
1132
|
+
_ID, _opt_embed = *val
|
1133
|
+
|
1134
|
+
unless i = g_parser.name_to_rhs_index(val[0].value)
|
1135
|
+
warn "#{g_parser.lineno}: ?#{val[0].value}"
|
1136
|
+
raise
|
1137
|
+
end
|
1138
|
+
"val[#{i}]#{val[1]}"
|
1139
|
+
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
.,.,11802814595130.,.,
|
1143
|
+
|
1144
|
+
module_eval <<-'.,.,118028145918865.,.,', 'ast_base.dr', 206
|
1145
|
+
def _act_9 val
|
1146
|
+
_CONST = *val
|
1147
|
+
"Depager::Token[#{_CONST.value}]"
|
1148
|
+
|
1149
|
+
end
|
1150
|
+
|
1151
|
+
.,.,118028145918865.,.,
|
1152
|
+
|
1153
|
+
module_eval <<-'.,.,118028145942743.,.,', 'ast_base.dr', 207
|
1154
|
+
def _act_10 val
|
1155
|
+
_SYMBOL = *val
|
1156
|
+
"Depager::Token[#{_SYMBOL.value}]"
|
1157
|
+
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
.,.,118028145942743.,.,
|
1161
|
+
|
1162
|
+
module_eval <<-'.,.,118028145949711.,.,', 'ast_base.dr', 208
|
1163
|
+
def _act_11 val
|
1164
|
+
_STR = *val
|
1165
|
+
"Depager::Token['#{_STR.value}']"
|
1166
|
+
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
.,.,118028145949711.,.,
|
1170
|
+
|
1171
|
+
module_eval <<-'.,.,118028145937354.,.,', 'ast_base.dr', 209
|
1172
|
+
def _act_12 val
|
1173
|
+
_NIL = *val
|
1174
|
+
"nil"
|
1175
|
+
|
1176
|
+
end
|
1177
|
+
|
1178
|
+
.,.,118028145937354.,.,
|
1179
|
+
|
1180
|
+
module_eval <<-'.,.,11802814595860.,.,', 'ast_base.dr', 210
|
1181
|
+
def _act_13 val
|
1182
|
+
_NUMBER = *val
|
1183
|
+
"Depager::Token[#{_NUMBER.value}]"
|
1184
|
+
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
.,.,11802814595860.,.,
|
1188
|
+
|
1189
|
+
module_eval <<-'.,.,118028145945394.,.,', 'ast_base.dr', 213
|
1190
|
+
def _act_14 val
|
1191
|
+
''
|
1192
|
+
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
.,.,118028145945394.,.,
|
1196
|
+
|
1197
|
+
module_eval <<-'.,.,11802814596768.,.,', 'ast_base.dr', 214
|
1198
|
+
def _act_15 val
|
1199
|
+
_EMBED = *val
|
1200
|
+
_EMBED.value
|
1201
|
+
|
1202
|
+
end
|
1203
|
+
|
1204
|
+
.,.,11802814596768.,.,
|
1205
|
+
|
1206
|
+
module_eval <<-'.,.,118028145922451.,.,', 'ast_base.dr', 217
|
1207
|
+
def _act_16 val
|
1208
|
+
_, _ = *val
|
1209
|
+
"NodeList.new(basis.file.lineno, [])"
|
1210
|
+
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
.,.,118028145922451.,.,
|
1214
|
+
|
1215
|
+
module_eval <<-'.,.,118028145947303.,.,', 'ast_base.dr', 219
|
1216
|
+
def _act_17 val
|
1217
|
+
_, _fnlpair, _ = *val
|
1218
|
+
|
1219
|
+
if g_parser.rhs.size > 0
|
1220
|
+
"NodeList.new(val[0].lineno, [#{_fnlpair.join(', ')}])"
|
1221
|
+
else
|
1222
|
+
"NodeList.new(basis.file.lineno, #{_fnlpair.join(', ')})"
|
1223
|
+
end
|
1224
|
+
|
1225
|
+
end
|
1226
|
+
|
1227
|
+
.,.,118028145947303.,.,
|
1228
|
+
|
1229
|
+
module_eval <<-'.,.,118028145933697.,.,', 'ast_base.dr', 226
|
1230
|
+
def _act_18 val
|
1231
|
+
_l, _LL, _r = *val
|
1232
|
+
"#{_l}.push(#{_r})"
|
1233
|
+
|
1234
|
+
end
|
1235
|
+
|
1236
|
+
.,.,118028145933697.,.,
|
1237
|
+
|
1238
|
+
module_eval <<-'.,.,118028145918237.,.,', 'ast_base.dr', 227
|
1239
|
+
def _act_19 val
|
1240
|
+
_l, _, _r = *val
|
1241
|
+
"#{_l}.concat(#{_r})"
|
1242
|
+
|
1243
|
+
end
|
1244
|
+
|
1245
|
+
.,.,118028145918237.,.,
|
1246
|
+
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
|