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,11 +1,10 @@
|
|
1
1
|
%defext LexerExtension
|
2
|
-
%extend NVAction ('
|
2
|
+
%extend NVAction ('plugins/nvaction.rb')
|
3
3
|
%decorate @NVAction
|
4
|
-
#%decorate ShiftReducePrinter ('
|
4
|
+
#%decorate ShiftReducePrinter ('plugins/srp.rb')
|
5
5
|
%param :none
|
6
|
-
%hook
|
6
|
+
%hook pre_rule_list /%LEX\{\s*\Z/ skip
|
7
7
|
%banner '%LEX{ ... }'
|
8
|
-
%mixin ActionParser ('depager/parse_action')
|
9
8
|
%inner{
|
10
9
|
def init_parser
|
11
10
|
super
|
@@ -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 D4LexerExtension #:nodoc:all
|
@@ -25,9 +24,9 @@ class LexerExtension #:nodoc:all
|
|
25
24
|
def __regext__ p
|
26
25
|
super p, :none, nil
|
27
26
|
|
28
|
-
@hook[0] =
|
29
|
-
@h2p['
|
30
|
-
p.
|
27
|
+
@hook[0] = LexerExtension_pre_rule_list.new(p, @nparam, self)
|
28
|
+
@h2p['pre_rule_list'] = @hook[0]
|
29
|
+
p.hooks[:pre_rule_list].push [@hook[0], :do_parse]
|
31
30
|
|
32
31
|
regext p
|
33
32
|
end
|
@@ -39,15 +38,14 @@ end
|
|
39
38
|
### Outer Code
|
40
39
|
|
41
40
|
###
|
42
|
-
###
|
41
|
+
### LexerExtension_pre_rule_list - Part of Depager Extension (slave)
|
43
42
|
###
|
44
|
-
module
|
43
|
+
module D4LexerExtension_pre_rule_list #:nodoc:all
|
45
44
|
end
|
46
45
|
|
47
|
-
class
|
46
|
+
class LexerExtension_pre_rule_list < Depager::LALR::Basis #:nodoc:all
|
48
47
|
include Depager::ExtensionUtils
|
49
48
|
|
50
|
-
include ActionParser
|
51
49
|
|
52
50
|
### Reduce Table
|
53
51
|
reduce_table = [
|
@@ -89,14 +87,14 @@ class LexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
89
87
|
[ ACC, nil, nil, nil, nil, nil, ],
|
90
88
|
[ nil, nil, nil, nil, 5, nil, ],
|
91
89
|
[ nil, nil, nil, nil, nil, nil, ],
|
92
|
-
[ nil, nil, nil,
|
90
|
+
[ nil, nil, nil, 9, nil, 8, ],
|
93
91
|
[ nil, nil, nil, nil, nil, nil, ],
|
94
92
|
[ nil, nil, nil, nil, nil, nil, ],
|
95
93
|
[ nil, nil, 10, nil, nil, nil, ],
|
96
|
-
[ nil, nil, nil, nil, nil, nil, ],
|
97
94
|
[ nil, nil, nil, nil, 11, nil, ],
|
98
95
|
[ nil, nil, nil, nil, nil, nil, ],
|
99
96
|
[ nil, nil, nil, nil, nil, nil, ],
|
97
|
+
[ nil, nil, nil, nil, nil, nil, ],
|
100
98
|
]
|
101
99
|
### Default Reduce Table
|
102
100
|
defred_table = [
|
@@ -108,8 +106,8 @@ class LexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
108
106
|
-7,
|
109
107
|
-3,
|
110
108
|
nil,
|
111
|
-
-6,
|
112
109
|
nil,
|
110
|
+
-6,
|
113
111
|
-4,
|
114
112
|
-8,
|
115
113
|
]
|
@@ -122,8 +120,8 @@ class LexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
122
120
|
-7,
|
123
121
|
-3,
|
124
122
|
nil,
|
125
|
-
-6,
|
126
123
|
nil,
|
124
|
+
-6,
|
127
125
|
-4,
|
128
126
|
-8,
|
129
127
|
]
|
@@ -169,7 +167,7 @@ class LexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
169
167
|
@g_parser = @p = p
|
170
168
|
@master = @m = master
|
171
169
|
@nparam = nparam
|
172
|
-
@dect =
|
170
|
+
@dect = D4LexerExtension_pre_rule_list::NVAction.new(self)
|
173
171
|
init_parser
|
174
172
|
end
|
175
173
|
|
@@ -228,9 +226,9 @@ end
|
|
228
226
|
|
229
227
|
### Outer Code
|
230
228
|
|
231
|
-
class
|
229
|
+
class D4LexerExtension_pre_rule_list::NVAction < Depager::LALR::Action #:nodoc:all
|
232
230
|
include Depager::DecoratorUtils
|
233
|
-
|
231
|
+
|
234
232
|
on_reduce = [
|
235
233
|
nil,
|
236
234
|
:_act_0,
|
@@ -251,7 +249,7 @@ class D4LexerExtension_prerulelist::NVAction < Depager::LALR::Action #:nodoc:all
|
|
251
249
|
end
|
252
250
|
|
253
251
|
|
254
|
-
module_eval <<-'.,.,
|
252
|
+
module_eval <<-'.,.,122745803340181.,.,', 'lex.dr', 47
|
255
253
|
def _act_0 val
|
256
254
|
_lexactlist, = *val
|
257
255
|
|
@@ -271,25 +269,25 @@ def _act_0 val
|
|
271
269
|
}; #code
|
272
270
|
|
273
271
|
end
|
274
|
-
.,.,
|
272
|
+
.,.,122745803340181.,.,
|
275
273
|
|
276
|
-
module_eval <<-'.,.,
|
274
|
+
module_eval <<-'.,.,122745803321867.,.,', 'lex.dr', 65
|
277
275
|
def _act_1 val
|
278
276
|
_lexact, = *val
|
279
277
|
_lexact
|
280
278
|
|
281
279
|
end
|
282
|
-
.,.,
|
280
|
+
.,.,122745803321867.,.,
|
283
281
|
|
284
|
-
module_eval <<-'.,.,
|
282
|
+
module_eval <<-'.,.,122745803341492.,.,', 'lex.dr', 66
|
285
283
|
def _act_2 val
|
286
284
|
_lexactlist, _lexact, = *val
|
287
285
|
_lexactlist << _lexact
|
288
286
|
|
289
287
|
end
|
290
|
-
.,.,
|
288
|
+
.,.,122745803341492.,.,
|
291
289
|
|
292
|
-
module_eval <<-'.,.,
|
290
|
+
module_eval <<-'.,.,1227458033110.,.,', 'lex.dr', 70
|
293
291
|
def _act_3 val
|
294
292
|
_lexlist, _opt_noskip, _ACTION, = *val
|
295
293
|
|
@@ -300,38 +298,38 @@ def _act_3 val
|
|
300
298
|
}; #code
|
301
299
|
|
302
300
|
end
|
303
|
-
.,.,
|
301
|
+
.,.,1227458033110.,.,
|
304
302
|
|
305
|
-
module_eval <<-'.,.,
|
303
|
+
module_eval <<-'.,.,122745803341618.,.,', 'lex.dr', 79
|
306
304
|
def _act_4 val
|
307
305
|
false
|
308
306
|
|
309
307
|
end
|
310
|
-
.,.,
|
308
|
+
.,.,122745803341618.,.,
|
311
309
|
|
312
|
-
module_eval <<-'.,.,
|
310
|
+
module_eval <<-'.,.,122745803352625.,.,', 'lex.dr', 80
|
313
311
|
def _act_5 val
|
314
312
|
_, = *val
|
315
313
|
true
|
316
314
|
|
317
315
|
end
|
318
|
-
.,.,
|
316
|
+
.,.,122745803352625.,.,
|
319
317
|
|
320
|
-
module_eval <<-'.,.,
|
318
|
+
module_eval <<-'.,.,122745803357424.,.,', 'lex.dr', 83
|
321
319
|
def _act_6 val
|
322
320
|
_LEX, = *val
|
323
321
|
[ _LEX ]
|
324
322
|
|
325
323
|
end
|
326
|
-
.,.,
|
324
|
+
.,.,122745803357424.,.,
|
327
325
|
|
328
|
-
module_eval <<-'.,.,
|
326
|
+
module_eval <<-'.,.,122745803338595.,.,', 'lex.dr', 84
|
329
327
|
def _act_7 val
|
330
328
|
_lexlist, _, _LEX, = *val
|
331
329
|
_lexlist << _LEX
|
332
330
|
|
333
331
|
end
|
334
|
-
.,.,
|
332
|
+
.,.,122745803338595.,.,
|
335
333
|
|
336
334
|
end
|
337
335
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
%defext StatefulLexerExtension
|
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 ('
|
5
|
+
#%decorate ShiftReducePrinter ('plugins/srp.rb')
|
6
6
|
%inner{
|
7
7
|
attr_accessor :ins, :code, :optval
|
8
8
|
def init_parser
|
@@ -12,7 +12,7 @@
|
|
12
12
|
@on_reduce = []
|
13
13
|
@addition = []
|
14
14
|
end
|
15
|
-
def
|
15
|
+
def post_rule_list
|
16
16
|
@optouter << %{
|
17
17
|
def afterError
|
18
18
|
warn "StatefulLex: lex_state==\#{@basis.lex_state}" if $MP_DEBUG
|
@@ -22,7 +22,7 @@
|
|
22
22
|
gen_action_decorator_code(target_name, paramkey,
|
23
23
|
@on_reduce, @optouter)
|
24
24
|
end
|
25
|
-
def
|
25
|
+
def post_rhs
|
26
26
|
j = 0
|
27
27
|
rhs = g_parser.rhs
|
28
28
|
@ins.each do |i, option_list, debug|
|
@@ -60,7 +60,7 @@
|
|
60
60
|
end
|
61
61
|
@ins.clear
|
62
62
|
end
|
63
|
-
def
|
63
|
+
def post_rhs_list
|
64
64
|
@addition.each do |isym, m_name|
|
65
65
|
g_parser.add_rule isym, []
|
66
66
|
@on_reduce[nrules] = ':'+m_name
|
@@ -71,26 +71,25 @@
|
|
71
71
|
######################################################################
|
72
72
|
# Define Tokens
|
73
73
|
######################################################################
|
74
|
-
%hook
|
75
|
-
%mixin ActionParser ('depager/parse_action')
|
74
|
+
%hook pre_rule_list /%LEX\{\s*\Z/ skip
|
76
75
|
%banner '%LEX{ ... }'
|
77
76
|
%%
|
78
77
|
%LEX{
|
79
78
|
/\s+/, /#.*\Z/ { }
|
80
|
-
/[A-Z]+/ { yield
|
79
|
+
/[A-Z]+/ { yield token(:ID, $&) }
|
81
80
|
/\%\}\s*\Z/ { yield nil,nil }
|
82
|
-
/\/(([^\/\\]+|\\.)*)\// { yield
|
81
|
+
/\/(([^\/\\]+|\\.)*)\// { yield token(:LEX, "/\\A#{$1}/") }
|
83
82
|
/'([^'\\]+|\\.)*'/,
|
84
83
|
/"([^"\\]+|\\.)*"/
|
85
84
|
{
|
86
|
-
yield
|
85
|
+
yield token(:LEX, "/\\A#{Regexp.escape($1).gsub('/', '\/')}/")
|
87
86
|
}
|
88
87
|
'{' !
|
89
88
|
{
|
90
89
|
_lineno = lineno
|
91
|
-
yield
|
90
|
+
yield token(:ACTION, parse_action, _lineno)
|
92
91
|
}
|
93
|
-
/./ { yield
|
92
|
+
/./ { yield token($&, $&) }
|
94
93
|
%}
|
95
94
|
#begin-rule
|
96
95
|
start:
|
@@ -166,14 +165,14 @@
|
|
166
165
|
######################################################################
|
167
166
|
# Change State
|
168
167
|
######################################################################
|
169
|
-
%hook
|
168
|
+
%hook pre_rhs post_symbol /\[/
|
170
169
|
%banner '[> ...]'
|
171
170
|
%%
|
172
171
|
%LEX{
|
173
172
|
/\s+/ { }
|
174
|
-
/:[a-zA-Z_]+\??/ { yield
|
175
|
-
/\]/ { yield
|
176
|
-
/./ { yield
|
173
|
+
/:[a-zA-Z_]+\??/ { yield token(:SYMBOL, $&) }
|
174
|
+
/\]/ { yield token($&, $&); @line = $'; yield nil, nil }
|
175
|
+
/./ { yield token($&, $&) }
|
177
176
|
%}
|
178
177
|
|
179
178
|
#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 D4StatefulLexerExtension #:nodoc:all
|
@@ -25,16 +24,16 @@ class StatefulLexerExtension #:nodoc:all
|
|
25
24
|
def __regext__ p
|
26
25
|
super p, :default, nil
|
27
26
|
|
28
|
-
@hook[0] =
|
29
|
-
@h2p['
|
30
|
-
p.
|
27
|
+
@hook[0] = StatefulLexerExtension_pre_rhs__post_symbol.new(p, @nparam, self)
|
28
|
+
@h2p['pre_rhs__post_symbol'] = @hook[0]
|
29
|
+
p.hooks[:post_symbol].push [@hook[0], :do_parse]
|
31
30
|
|
32
|
-
@hook[1] =
|
33
|
-
@h2p['
|
34
|
-
p.
|
31
|
+
@hook[1] = StatefulLexerExtension_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]
|
35
34
|
|
36
|
-
# use @hook[
|
37
|
-
p.
|
35
|
+
# use @hook[0](StatefulLexerExtension_pre_rhs__post_symbol)
|
36
|
+
p.hooks[:pre_rhs].push [@hook[0], :do_parse]
|
38
37
|
|
39
38
|
regext p
|
40
39
|
end
|
@@ -48,7 +47,7 @@ class StatefulLexerExtension #:nodoc:all
|
|
48
47
|
@on_reduce = []
|
49
48
|
@addition = []
|
50
49
|
end
|
51
|
-
def
|
50
|
+
def post_rule_list
|
52
51
|
@optouter << %{
|
53
52
|
def afterError
|
54
53
|
warn "StatefulLex: lex_state==\#{@basis.lex_state}" if $MP_DEBUG
|
@@ -58,7 +57,7 @@ class StatefulLexerExtension #:nodoc:all
|
|
58
57
|
gen_action_decorator_code(target_name, paramkey,
|
59
58
|
@on_reduce, @optouter)
|
60
59
|
end
|
61
|
-
def
|
60
|
+
def post_rhs
|
62
61
|
j = 0
|
63
62
|
rhs = g_parser.rhs
|
64
63
|
@ins.each do |i, option_list, debug|
|
@@ -96,7 +95,7 @@ class StatefulLexerExtension #:nodoc:all
|
|
96
95
|
end
|
97
96
|
@ins.clear
|
98
97
|
end
|
99
|
-
def
|
98
|
+
def post_rhs_list
|
100
99
|
@addition.each do |isym, m_name|
|
101
100
|
g_parser.add_rule isym, []
|
102
101
|
@on_reduce[nrules] = ':'+m_name
|
@@ -109,15 +108,14 @@ end
|
|
109
108
|
### Outer Code
|
110
109
|
|
111
110
|
###
|
112
|
-
###
|
111
|
+
### StatefulLexerExtension_pre_rule_list - Part of Depager Extension (slave)
|
113
112
|
###
|
114
|
-
module
|
113
|
+
module D4StatefulLexerExtension_pre_rule_list #:nodoc:all
|
115
114
|
end
|
116
115
|
|
117
|
-
class
|
116
|
+
class StatefulLexerExtension_pre_rule_list < Depager::LALR::Basis #:nodoc:all
|
118
117
|
include Depager::ExtensionUtils
|
119
118
|
|
120
|
-
include ActionParser
|
121
119
|
|
122
120
|
### Reduce Table
|
123
121
|
reduce_table = [
|
@@ -170,20 +168,20 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
170
168
|
action_table = [
|
171
169
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
172
170
|
[ 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,
|
171
|
+
[ nil, nil, 3, nil, nil, nil, nil, nil, nil, nil, ],
|
172
|
+
[ nil, nil, nil, 5, nil, nil, nil, nil, nil, nil, ],
|
173
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 6, nil, ],
|
174
|
+
[ nil, nil, nil, nil, nil, 11, nil, nil, nil, nil, ],
|
177
175
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
178
|
-
[ nil, nil, nil, nil, nil, nil, nil, 12, nil, 13, ],
|
179
176
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
180
|
-
[ nil, nil, nil, nil, nil,
|
177
|
+
[ nil, nil, nil, nil, nil, nil, nil, 12, nil, 13, ],
|
178
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 6, nil, ],
|
179
|
+
[ nil, nil, nil, nil, 16, nil, nil, nil, nil, nil, ],
|
180
|
+
[ nil, nil, nil, 17, nil, nil, nil, nil, nil, nil, ],
|
181
181
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
182
|
-
[ nil, nil, nil, nil, nil, nil,
|
182
|
+
[ nil, nil, nil, nil, nil, nil, nil, nil, 18, nil, ],
|
183
|
+
[ nil, nil, nil, nil, nil, nil, 19, nil, nil, nil, ],
|
183
184
|
[ 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
185
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
188
186
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
189
187
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
@@ -196,21 +194,21 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
196
194
|
-1,
|
197
195
|
nil,
|
198
196
|
nil,
|
199
|
-
-
|
197
|
+
-5,
|
198
|
+
-12,
|
200
199
|
-7,
|
201
200
|
-10,
|
202
|
-
-
|
203
|
-
-5,
|
204
|
-
-8,
|
201
|
+
-3,
|
205
202
|
nil,
|
206
|
-
-11,
|
207
203
|
nil,
|
204
|
+
-11,
|
208
205
|
nil,
|
209
206
|
nil,
|
210
|
-
-
|
211
|
-
-13,
|
207
|
+
-8,
|
212
208
|
-4,
|
213
209
|
-6,
|
210
|
+
-13,
|
211
|
+
-9,
|
214
212
|
]
|
215
213
|
defred_after_shift_table = [
|
216
214
|
-2,
|
@@ -219,20 +217,20 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
219
217
|
nil,
|
220
218
|
nil,
|
221
219
|
nil,
|
220
|
+
-12,
|
222
221
|
-7,
|
223
222
|
nil,
|
224
|
-
-12,
|
225
223
|
nil,
|
226
|
-
-8,
|
227
224
|
nil,
|
228
|
-
-11,
|
229
225
|
nil,
|
226
|
+
-11,
|
230
227
|
nil,
|
231
228
|
nil,
|
232
|
-
-
|
233
|
-
-13,
|
229
|
+
-8,
|
234
230
|
-4,
|
235
231
|
-6,
|
232
|
+
-13,
|
233
|
+
-9,
|
236
234
|
]
|
237
235
|
### Nonterm to Int
|
238
236
|
nt2i = {
|
@@ -260,14 +258,14 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
260
258
|
goto_table = [
|
261
259
|
[ 1, 2, nil, nil, nil, nil, nil, nil, ],
|
262
260
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
263
|
-
[ nil, nil,
|
264
|
-
[ nil, nil, nil, 5, nil, 6, 7, nil, ],
|
261
|
+
[ nil, nil, 4, nil, nil, nil, nil, nil, ],
|
265
262
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
266
|
-
[ nil, nil, nil,
|
263
|
+
[ nil, nil, nil, 9, nil, 7, 8, nil, ],
|
264
|
+
[ nil, nil, nil, nil, 10, nil, nil, nil, ],
|
267
265
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
268
|
-
[ nil, nil, nil, nil, nil, nil, nil, 11, ],
|
269
266
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
270
|
-
[ nil, nil, nil, nil,
|
267
|
+
[ nil, nil, nil, nil, nil, nil, nil, 14, ],
|
268
|
+
[ nil, nil, nil, nil, nil, 15, 8, nil, ],
|
271
269
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
272
270
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
273
271
|
[ nil, nil, nil, nil, nil, nil, nil, nil, ],
|
@@ -290,7 +288,7 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
290
288
|
@g_parser = @p = p
|
291
289
|
@master = @m = master
|
292
290
|
@nparam = nparam
|
293
|
-
@dect =
|
291
|
+
@dect = D4StatefulLexerExtension_pre_rule_list::NVAction.new(self)
|
294
292
|
init_parser
|
295
293
|
end
|
296
294
|
|
@@ -323,7 +321,7 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
323
321
|
|
324
322
|
when /\A[A-Z]+/
|
325
323
|
@oldline = @line; @line = $'
|
326
|
-
yield
|
324
|
+
yield token(:ID, $&)
|
327
325
|
|
328
326
|
|
329
327
|
when /\A\%\}\s*\Z/
|
@@ -333,25 +331,25 @@ class StatefulLexerExtension_prerulelist < Depager::LALR::Basis #:nodoc:all
|
|
333
331
|
|
334
332
|
when /\A\/(([^\/\\]+|\\.)*)\//
|
335
333
|
@oldline = @line; @line = $'
|
336
|
-
yield
|
334
|
+
yield token(:LEX, "/\\A#{$1}/")
|
337
335
|
|
338
336
|
|
339
337
|
when /\A'([^'\\]+|\\.)*'/, /\A"([^"\\]+|\\.)*"/
|
340
338
|
@oldline = @line; @line = $'
|
341
339
|
|
342
|
-
yield
|
340
|
+
yield token(:LEX, "/\\A#{Regexp.escape($1).gsub('/', '\/')}/")
|
343
341
|
|
344
342
|
|
345
343
|
when /\A\{/
|
346
344
|
#
|
347
345
|
|
348
346
|
_lineno = lineno
|
349
|
-
yield
|
347
|
+
yield token(:ACTION, parse_action, _lineno)
|
350
348
|
|
351
349
|
|
352
350
|
when /\A./
|
353
351
|
@oldline = @line; @line = $'
|
354
|
-
yield
|
352
|
+
yield token($&, $&)
|
355
353
|
|
356
354
|
|
357
355
|
else
|
@@ -366,9 +364,9 @@ end
|
|
366
364
|
|
367
365
|
### Outer Code
|
368
366
|
|
369
|
-
class
|
367
|
+
class D4StatefulLexerExtension_pre_rule_list::NVAction < Depager::LALR::Action #:nodoc:all
|
370
368
|
include Depager::DecoratorUtils
|
371
|
-
|
369
|
+
|
372
370
|
on_reduce = [
|
373
371
|
nil,
|
374
372
|
:_act_0,
|
@@ -394,7 +392,7 @@ class D4StatefulLexerExtension_prerulelist::NVAction < Depager::LALR::Action #:n
|
|
394
392
|
end
|
395
393
|
|
396
394
|
|
397
|
-
module_eval <<-'.,.,
|
395
|
+
module_eval <<-'.,.,1227458033159.,.,', 'slex.dr', 95
|
398
396
|
def _act_0 val
|
399
397
|
_mode_list, = *val
|
400
398
|
|
@@ -430,63 +428,63 @@ def _act_0 val
|
|
430
428
|
}; #code
|
431
429
|
|
432
430
|
end
|
433
|
-
.,.,
|
431
|
+
.,.,1227458033159.,.,
|
434
432
|
|
435
|
-
module_eval <<-'.,.,
|
433
|
+
module_eval <<-'.,.,122745803342120.,.,', 'slex.dr', 129
|
436
434
|
def _act_1 val
|
437
435
|
[ ]
|
438
436
|
|
439
437
|
end
|
440
|
-
.,.,
|
438
|
+
.,.,122745803342120.,.,
|
441
439
|
|
442
|
-
module_eval <<-'.,.,
|
440
|
+
module_eval <<-'.,.,12274580336600.,.,', 'slex.dr', 130
|
443
441
|
def _act_2 val
|
444
442
|
_mode_list, _mode, _lexactlist, = *val
|
445
443
|
_mode_list << [_mode[0], _mode[1], _lexactlist]
|
446
444
|
|
447
445
|
end
|
448
|
-
.,.,
|
446
|
+
.,.,12274580336600.,.,
|
449
447
|
|
450
|
-
module_eval <<-'.,.,
|
448
|
+
module_eval <<-'.,.,122745803347797.,.,', 'slex.dr', 133
|
451
449
|
def _act_3 val
|
452
450
|
_, _ID, _opt_super, _, = *val
|
453
451
|
[ _ID.value, _opt_super ]
|
454
452
|
|
455
453
|
end
|
456
|
-
.,.,
|
454
|
+
.,.,122745803347797.,.,
|
457
455
|
|
458
|
-
module_eval <<-'.,.,
|
456
|
+
module_eval <<-'.,.,122745803312942.,.,', 'slex.dr', 136
|
459
457
|
def _act_4 val
|
460
458
|
nil
|
461
459
|
|
462
460
|
end
|
463
|
-
.,.,
|
461
|
+
.,.,122745803312942.,.,
|
464
462
|
|
465
|
-
module_eval <<-'.,.,
|
463
|
+
module_eval <<-'.,.,122745803315084.,.,', 'slex.dr', 137
|
466
464
|
def _act_5 val
|
467
465
|
_, _ID, = *val
|
468
466
|
_ID.value
|
469
467
|
|
470
468
|
end
|
471
|
-
.,.,
|
469
|
+
.,.,122745803315084.,.,
|
472
470
|
|
473
|
-
module_eval <<-'.,.,
|
471
|
+
module_eval <<-'.,.,12274580334440.,.,', 'slex.dr', 140
|
474
472
|
def _act_6 val
|
475
473
|
_lexact, = *val
|
476
474
|
_lexact
|
477
475
|
|
478
476
|
end
|
479
|
-
.,.,
|
477
|
+
.,.,12274580334440.,.,
|
480
478
|
|
481
|
-
module_eval <<-'.,.,
|
479
|
+
module_eval <<-'.,.,122745803358254.,.,', 'slex.dr', 141
|
482
480
|
def _act_7 val
|
483
481
|
_lexactlist, _lexact, = *val
|
484
482
|
_lexactlist << _lexact
|
485
483
|
|
486
484
|
end
|
487
|
-
.,.,
|
485
|
+
.,.,122745803358254.,.,
|
488
486
|
|
489
|
-
module_eval <<-'.,.,
|
487
|
+
module_eval <<-'.,.,122745803337351.,.,', 'slex.dr', 145
|
490
488
|
def _act_8 val
|
491
489
|
_lexlist, _opt_noskip, _ACTION, = *val
|
492
490
|
|
@@ -497,49 +495,49 @@ def _act_8 val
|
|
497
495
|
}; #code
|
498
496
|
|
499
497
|
end
|
500
|
-
.,.,
|
498
|
+
.,.,122745803337351.,.,
|
501
499
|
|
502
|
-
module_eval <<-'.,.,
|
500
|
+
module_eval <<-'.,.,122745803316408.,.,', 'slex.dr', 154
|
503
501
|
def _act_9 val
|
504
502
|
false
|
505
503
|
|
506
504
|
end
|
507
|
-
.,.,
|
505
|
+
.,.,122745803316408.,.,
|
508
506
|
|
509
|
-
module_eval <<-'.,.,
|
507
|
+
module_eval <<-'.,.,122745803341193.,.,', 'slex.dr', 155
|
510
508
|
def _act_10 val
|
511
509
|
_, = *val
|
512
510
|
true
|
513
511
|
|
514
512
|
end
|
515
|
-
.,.,
|
513
|
+
.,.,122745803341193.,.,
|
516
514
|
|
517
|
-
module_eval <<-'.,.,
|
515
|
+
module_eval <<-'.,.,12274580332500.,.,', 'slex.dr', 158
|
518
516
|
def _act_11 val
|
519
517
|
_LEX, = *val
|
520
518
|
[ _LEX.value ]
|
521
519
|
|
522
520
|
end
|
523
|
-
.,.,
|
521
|
+
.,.,12274580332500.,.,
|
524
522
|
|
525
|
-
module_eval <<-'.,.,
|
523
|
+
module_eval <<-'.,.,122745803323427.,.,', 'slex.dr', 159
|
526
524
|
def _act_12 val
|
527
525
|
_lexlist, _, _LEX, = *val
|
528
526
|
_lexlist.push _LEX.value
|
529
527
|
|
530
528
|
end
|
531
|
-
.,.,
|
529
|
+
.,.,122745803323427.,.,
|
532
530
|
|
533
531
|
end
|
534
532
|
|
535
533
|
|
536
534
|
###
|
537
|
-
###
|
535
|
+
### StatefulLexerExtension_pre_rhs__post_symbol - Part of Depager Extension (slave)
|
538
536
|
###
|
539
|
-
module
|
537
|
+
module D4StatefulLexerExtension_pre_rhs__post_symbol #:nodoc:all
|
540
538
|
end
|
541
539
|
|
542
|
-
class
|
540
|
+
class StatefulLexerExtension_pre_rhs__post_symbol < Depager::LALR::Basis #:nodoc:all
|
543
541
|
include Depager::ExtensionUtils
|
544
542
|
|
545
543
|
|
@@ -584,18 +582,18 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
584
582
|
]
|
585
583
|
### Action Table
|
586
584
|
action_table = [
|
587
|
-
[ nil, nil,
|
585
|
+
[ nil, nil, 1, nil, nil, nil, nil, nil, nil, ],
|
586
|
+
[ nil, nil, nil, nil, nil, 7, nil, 3, 4, ],
|
588
587
|
[ ACC, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
589
|
-
[ nil, nil, nil, nil, nil,
|
590
|
-
[ nil, nil, nil,
|
588
|
+
[ nil, nil, nil, nil, nil, nil, 8, nil, nil, ],
|
589
|
+
[ nil, nil, nil, nil, nil, nil, 9, nil, nil, ],
|
590
|
+
[ nil, nil, nil, 10, 11, 7, nil, 3, 4, ],
|
591
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, ],
|
594
592
|
[ nil, nil, nil, nil, nil, nil, 13, nil, nil, ],
|
595
593
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
596
594
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
597
|
-
[ nil, nil, nil, 14, nil, nil, nil, nil, nil, ],
|
598
595
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
596
|
+
[ nil, nil, nil, 14, nil, nil, nil, nil, nil, ],
|
599
597
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
600
598
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
601
599
|
[ nil, nil, nil, nil, nil, nil, nil, nil, nil, ],
|
@@ -606,16 +604,16 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
606
604
|
nil,
|
607
605
|
nil,
|
608
606
|
nil,
|
609
|
-
-3,
|
610
607
|
nil,
|
611
608
|
nil,
|
609
|
+
-3,
|
612
610
|
nil,
|
611
|
+
-6,
|
612
|
+
-7,
|
613
613
|
-1,
|
614
|
-
-4,
|
615
614
|
nil,
|
615
|
+
-4,
|
616
616
|
-5,
|
617
|
-
-6,
|
618
|
-
-7,
|
619
617
|
-2,
|
620
618
|
]
|
621
619
|
defred_after_shift_table = [
|
@@ -623,16 +621,16 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
623
621
|
nil,
|
624
622
|
nil,
|
625
623
|
nil,
|
626
|
-
-3,
|
627
624
|
nil,
|
628
625
|
nil,
|
626
|
+
-3,
|
629
627
|
nil,
|
628
|
+
-6,
|
629
|
+
-7,
|
630
630
|
-1,
|
631
|
-
-4,
|
632
631
|
nil,
|
632
|
+
-4,
|
633
633
|
-5,
|
634
|
-
-6,
|
635
|
-
-7,
|
636
634
|
-2,
|
637
635
|
]
|
638
636
|
### Nonterm to Int
|
@@ -649,12 +647,12 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
649
647
|
]
|
650
648
|
### Goto Table
|
651
649
|
goto_table = [
|
652
|
-
[
|
650
|
+
[ 2, nil, nil, ],
|
651
|
+
[ nil, 5, 6, ],
|
653
652
|
[ nil, nil, nil, ],
|
654
|
-
[ nil, 3, 4, ],
|
655
|
-
[ nil, nil, 9, ],
|
656
653
|
[ nil, nil, nil, ],
|
657
654
|
[ nil, nil, nil, ],
|
655
|
+
[ nil, nil, 12, ],
|
658
656
|
[ nil, nil, nil, ],
|
659
657
|
[ nil, nil, nil, ],
|
660
658
|
[ nil, nil, nil, ],
|
@@ -676,7 +674,7 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
676
674
|
@g_parser = @p = p
|
677
675
|
@master = @m = master
|
678
676
|
@nparam = nparam
|
679
|
-
@dect =
|
677
|
+
@dect = D4StatefulLexerExtension_pre_rhs__post_symbol::NVAction.new(self)
|
680
678
|
init_parser
|
681
679
|
end
|
682
680
|
|
@@ -709,17 +707,17 @@ class StatefulLexerExtension_prerhs_postsymbol < Depager::LALR::Basis #:nodoc:al
|
|
709
707
|
|
710
708
|
when /\A:[a-zA-Z_]+\??/
|
711
709
|
@oldline = @line; @line = $'
|
712
|
-
yield
|
710
|
+
yield token(:SYMBOL, $&)
|
713
711
|
|
714
712
|
|
715
713
|
when /\A\]/
|
716
714
|
@oldline = @line; @line = $'
|
717
|
-
yield
|
715
|
+
yield token($&, $&); @line = $'; yield nil, nil
|
718
716
|
|
719
717
|
|
720
718
|
when /\A./
|
721
719
|
@oldline = @line; @line = $'
|
722
|
-
yield
|
720
|
+
yield token($&, $&)
|
723
721
|
|
724
722
|
|
725
723
|
else
|
@@ -734,9 +732,9 @@ end
|
|
734
732
|
|
735
733
|
### Outer Code
|
736
734
|
|
737
|
-
class
|
735
|
+
class D4StatefulLexerExtension_pre_rhs__post_symbol::NVAction < Depager::LALR::Action #:nodoc:all
|
738
736
|
include Depager::DecoratorUtils
|
739
|
-
|
737
|
+
|
740
738
|
on_reduce = [
|
741
739
|
nil,
|
742
740
|
:_act_0,
|
@@ -756,63 +754,63 @@ class D4StatefulLexerExtension_prerhs_postsymbol::NVAction < Depager::LALR::Acti
|
|
756
754
|
end
|
757
755
|
|
758
756
|
|
759
|
-
module_eval <<-'.,.,
|
757
|
+
module_eval <<-'.,.,122745803310395.,.,', 'slex.dr', 179
|
760
758
|
def _act_0 val
|
761
759
|
_, _option_list, _, = *val
|
762
760
|
|
763
761
|
master.ins.push [g_parser.rhs.size, _option_list, false]
|
764
762
|
|
765
763
|
end
|
766
|
-
.,.,
|
764
|
+
.,.,122745803310395.,.,
|
767
765
|
|
768
|
-
module_eval <<-'.,.,
|
766
|
+
module_eval <<-'.,.,122745803327506.,.,', 'slex.dr', 183
|
769
767
|
def _act_1 val
|
770
768
|
_, _option_list, _, _, = *val
|
771
769
|
|
772
770
|
master.ins.push [g_parser.rhs.size, _option_list, true]
|
773
771
|
|
774
772
|
end
|
775
|
-
.,.,
|
773
|
+
.,.,122745803327506.,.,
|
776
774
|
|
777
|
-
module_eval <<-'.,.,
|
775
|
+
module_eval <<-'.,.,122745803335394.,.,', 'slex.dr', 189
|
778
776
|
def _act_2 val
|
779
777
|
_option, = *val
|
780
778
|
[_option]
|
781
779
|
|
782
780
|
end
|
783
|
-
.,.,
|
781
|
+
.,.,122745803335394.,.,
|
784
782
|
|
785
|
-
module_eval <<-'.,.,
|
783
|
+
module_eval <<-'.,.,122745803345722.,.,', 'slex.dr', 190
|
786
784
|
def _act_3 val
|
787
785
|
_option_list, _option, = *val
|
788
786
|
_option_list << _option
|
789
787
|
|
790
788
|
end
|
791
|
-
.,.,
|
789
|
+
.,.,122745803345722.,.,
|
792
790
|
|
793
|
-
module_eval <<-'.,.,
|
791
|
+
module_eval <<-'.,.,122745803311899.,.,', 'slex.dr', 193
|
794
792
|
def _act_4 val
|
795
793
|
_, _SYMBOL, = *val
|
796
794
|
[:GOTO, _SYMBOL.value]
|
797
795
|
|
798
796
|
end
|
799
|
-
.,.,
|
797
|
+
.,.,122745803311899.,.,
|
800
798
|
|
801
|
-
module_eval <<-'.,.,
|
799
|
+
module_eval <<-'.,.,122745803346690.,.,', 'slex.dr', 194
|
802
800
|
def _act_5 val
|
803
801
|
_, _SYMBOL, = *val
|
804
802
|
[:ADD, _SYMBOL.value]
|
805
803
|
|
806
804
|
end
|
807
|
-
.,.,
|
805
|
+
.,.,122745803346690.,.,
|
808
806
|
|
809
|
-
module_eval <<-'.,.,
|
807
|
+
module_eval <<-'.,.,122745803330412.,.,', 'slex.dr', 195
|
810
808
|
def _act_6 val
|
811
809
|
_, _SYMBOL, = *val
|
812
810
|
[:SUB, _SYMBOL.value]
|
813
811
|
|
814
812
|
end
|
815
|
-
.,.,
|
813
|
+
.,.,122745803330412.,.,
|
816
814
|
|
817
815
|
end
|
818
816
|
|