racc 1.5.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.ja.rdoc +0 -1
- data/README.rdoc +6 -7
- data/{rdoc → doc}/en/NEWS.en.rdoc +0 -0
- data/{rdoc → doc}/en/grammar.en.rdoc +27 -31
- data/doc/en/grammar2.en.rdoc +219 -0
- data/{rdoc → doc}/ja/NEWS.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/command.ja.html +0 -0
- data/{rdoc → doc}/ja/debug.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/grammar.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/index.ja.html +0 -0
- data/{rdoc → doc}/ja/parser.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/usage.ja.html +0 -0
- data/ext/racc/cparse/cparse.c +1 -1
- data/ext/racc/cparse/extconf.rb +1 -0
- data/lib/racc/info.rb +1 -1
- data/lib/racc/parser-text.rb +1 -1
- data/lib/racc/parser.rb +1 -1
- data/lib/racc/parserfilegenerator.rb +0 -44
- data/lib/racc/statetransitiontable.rb +2 -8
- metadata +15 -121
- data/Rakefile +0 -79
- data/ext/racc/com/headius/racc/Cparse.java +0 -849
- data/lib/racc/pre-setup +0 -13
- data/sample/array.y +0 -67
- data/sample/array2.y +0 -59
- data/sample/calc-ja.y +0 -66
- data/sample/calc.y +0 -65
- data/sample/conflict.y +0 -15
- data/sample/hash.y +0 -60
- data/sample/lalr.y +0 -17
- data/sample/lists.y +0 -57
- data/sample/syntax.y +0 -46
- data/sample/yyerr.y +0 -46
- data/test/assets/cadenza.y +0 -170
- data/test/assets/cast.y +0 -926
- data/test/assets/chk.y +0 -126
- data/test/assets/conf.y +0 -16
- data/test/assets/csspool.y +0 -729
- data/test/assets/digraph.y +0 -29
- data/test/assets/echk.y +0 -118
- data/test/assets/edtf.y +0 -583
- data/test/assets/err.y +0 -60
- data/test/assets/error_recovery.y +0 -35
- data/test/assets/expect.y +0 -7
- data/test/assets/firstline.y +0 -4
- data/test/assets/huia.y +0 -318
- data/test/assets/ichk.y +0 -102
- data/test/assets/intp.y +0 -546
- data/test/assets/journey.y +0 -47
- data/test/assets/liquor.y +0 -313
- data/test/assets/machete.y +0 -423
- data/test/assets/macruby.y +0 -2197
- data/test/assets/mailp.y +0 -437
- data/test/assets/mediacloth.y +0 -599
- data/test/assets/mof.y +0 -649
- data/test/assets/namae.y +0 -302
- data/test/assets/nasl.y +0 -626
- data/test/assets/newsyn.y +0 -25
- data/test/assets/noend.y +0 -4
- data/test/assets/nokogiri-css.y +0 -255
- data/test/assets/nonass.y +0 -41
- data/test/assets/normal.y +0 -27
- data/test/assets/norule.y +0 -4
- data/test/assets/nullbug1.y +0 -25
- data/test/assets/nullbug2.y +0 -15
- data/test/assets/opal.y +0 -1807
- data/test/assets/opt.y +0 -123
- data/test/assets/percent.y +0 -35
- data/test/assets/php_serialization.y +0 -98
- data/test/assets/recv.y +0 -97
- data/test/assets/riml.y +0 -665
- data/test/assets/rrconf.y +0 -14
- data/test/assets/ruby18.y +0 -1943
- data/test/assets/ruby19.y +0 -2174
- data/test/assets/ruby20.y +0 -2350
- data/test/assets/ruby21.y +0 -2359
- data/test/assets/ruby22.y +0 -2381
- data/test/assets/scan.y +0 -72
- data/test/assets/syntax.y +0 -50
- data/test/assets/tp_plus.y +0 -622
- data/test/assets/twowaysql.y +0 -278
- data/test/assets/unterm.y +0 -5
- data/test/assets/useless.y +0 -12
- data/test/assets/yyerr.y +0 -46
- data/test/bench.y +0 -36
- data/test/helper.rb +0 -115
- data/test/infini.y +0 -8
- data/test/regress/cadenza +0 -796
- data/test/regress/cast +0 -3428
- data/test/regress/csspool +0 -2314
- data/test/regress/edtf +0 -1794
- data/test/regress/huia +0 -1392
- data/test/regress/journey +0 -222
- data/test/regress/liquor +0 -885
- data/test/regress/machete +0 -833
- data/test/regress/mediacloth +0 -1463
- data/test/regress/mof +0 -1368
- data/test/regress/namae +0 -634
- data/test/regress/nasl +0 -2058
- data/test/regress/nokogiri-css +0 -836
- data/test/regress/opal +0 -6431
- data/test/regress/php_serialization +0 -336
- data/test/regress/riml +0 -3283
- data/test/regress/ruby18 +0 -6344
- data/test/regress/ruby22 +0 -7460
- data/test/regress/tp_plus +0 -1933
- data/test/regress/twowaysql +0 -556
- data/test/scandata/brace +0 -7
- data/test/scandata/gvar +0 -1
- data/test/scandata/normal +0 -4
- data/test/scandata/percent +0 -18
- data/test/scandata/slash +0 -10
- data/test/src.intp +0 -34
- data/test/start.y +0 -20
- data/test/test_chk_y.rb +0 -52
- data/test/test_grammar_file_parser.rb +0 -15
- data/test/test_racc_command.rb +0 -339
- data/test/test_scan_y.rb +0 -52
- data/test/testscanner.rb +0 -51
- data/web/racc.en.rhtml +0 -42
- data/web/racc.ja.rhtml +0 -51
@@ -1,849 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Cparse.java -- Racc Runtime Core for JRuby
|
3
|
-
|
4
|
-
Copyright (c) 2016 Charles Oliver Nutter <headius@headius.com>
|
5
|
-
|
6
|
-
Ported from and distributed under the same licence as cparse.c
|
7
|
-
|
8
|
-
cparse.c -- Racc Runtime Core
|
9
|
-
|
10
|
-
Copyright (c) 1999-2006 Minero Aoki
|
11
|
-
|
12
|
-
This library is free software.
|
13
|
-
You can distribute/modify this program under the same terms of ruby.
|
14
|
-
*/
|
15
|
-
package com.headius.racc;
|
16
|
-
|
17
|
-
import org.jruby.Ruby;
|
18
|
-
import org.jruby.RubyArray;
|
19
|
-
import org.jruby.RubyBasicObject;
|
20
|
-
import org.jruby.RubyClass;
|
21
|
-
import org.jruby.RubyContinuation;
|
22
|
-
import org.jruby.RubyFixnum;
|
23
|
-
import org.jruby.RubyHash;
|
24
|
-
import org.jruby.RubyKernel;
|
25
|
-
import org.jruby.RubyModule;
|
26
|
-
import org.jruby.RubyNumeric;
|
27
|
-
import org.jruby.RubyObject;
|
28
|
-
import org.jruby.RubySymbol;
|
29
|
-
import org.jruby.anno.JRubyMethod;
|
30
|
-
import org.jruby.exceptions.JumpException;
|
31
|
-
import org.jruby.internal.runtime.methods.AttrReaderMethod;
|
32
|
-
import org.jruby.internal.runtime.methods.AttrWriterMethod;
|
33
|
-
import org.jruby.internal.runtime.methods.CallConfiguration;
|
34
|
-
import org.jruby.runtime.Arity;
|
35
|
-
import org.jruby.runtime.Block;
|
36
|
-
import org.jruby.runtime.BlockCallback;
|
37
|
-
import org.jruby.runtime.CallBlock19;
|
38
|
-
import org.jruby.runtime.CallSite;
|
39
|
-
import org.jruby.runtime.Helpers;
|
40
|
-
import org.jruby.runtime.MethodIndex;
|
41
|
-
import org.jruby.runtime.ObjectAllocator;
|
42
|
-
import org.jruby.runtime.Signature;
|
43
|
-
import org.jruby.runtime.ThreadContext;
|
44
|
-
import org.jruby.runtime.Visibility;
|
45
|
-
import org.jruby.runtime.builtin.IRubyObject;
|
46
|
-
import org.jruby.runtime.load.Library;
|
47
|
-
|
48
|
-
public class Cparse implements Library {
|
49
|
-
public static final String RACC_VERSION = "1.4.15"; // TODO: parse from Cparse.c
|
50
|
-
|
51
|
-
public enum TokenType {
|
52
|
-
DEFAULT(-1),
|
53
|
-
FINAL(0),
|
54
|
-
ERROR(1);
|
55
|
-
|
56
|
-
private final int id;
|
57
|
-
TokenType(int id) { this.id = id; }
|
58
|
-
}
|
59
|
-
|
60
|
-
private RubyFixnum vDEFAULT_TOKEN;
|
61
|
-
private RubyFixnum vERROR_TOKEN;
|
62
|
-
private RubyFixnum vFINAL_TOKEN;
|
63
|
-
|
64
|
-
private RubyClass RaccBug;
|
65
|
-
private RubyClass CparseParams;
|
66
|
-
|
67
|
-
private static final String ID_YYDEBUG = "@yydebug";
|
68
|
-
private static final String ID_NEXTTOKEN = "next_token";
|
69
|
-
private static final String ID_ONERROR = "on_error";
|
70
|
-
private static final String ID_NOREDUCE = "_reduce_none";
|
71
|
-
private static final String ID_ERRSTATUS = "@racc_error_status";
|
72
|
-
|
73
|
-
private static final String ID_D_SHIFT = "racc_shift";
|
74
|
-
private static final String ID_D_REDUCE = "racc_reduce";
|
75
|
-
private static final String ID_D_ACCEPT = "racc_accept";
|
76
|
-
private static final String ID_D_READ_TOKEN = "racc_read_token";
|
77
|
-
private static final String ID_D_NEXT_STATE = "racc_next_state";
|
78
|
-
private static final String ID_D_E_POP = "racc_e_pop";
|
79
|
-
|
80
|
-
private RubySymbol sym_noreduce;
|
81
|
-
private CallSite call_nexttoken;
|
82
|
-
private CallSite call_onerror;
|
83
|
-
private CallSite call_d_shift;
|
84
|
-
private CallSite call_d_reduce;
|
85
|
-
private CallSite call_d_accept;
|
86
|
-
private CallSite call_d_read_token;
|
87
|
-
private CallSite call_d_next_state;
|
88
|
-
private CallSite call_d_e_pop;
|
89
|
-
|
90
|
-
private static RubySymbol value_to_id(ThreadContext context, IRubyObject v) {
|
91
|
-
if (!(v instanceof RubySymbol)) {
|
92
|
-
throw context.runtime.newTypeError("not symbol");
|
93
|
-
}
|
94
|
-
return (RubySymbol)v;
|
95
|
-
}
|
96
|
-
|
97
|
-
private static int num_to_int(IRubyObject n) {
|
98
|
-
return assert_integer(n);
|
99
|
-
}
|
100
|
-
|
101
|
-
private static IRubyObject AREF(ThreadContext context, IRubyObject s, int idx) {
|
102
|
-
return ((0 <= idx && idx < ((RubyArray)s).size()) ? ((RubyArray)s).entry(idx) : context.nil);
|
103
|
-
}
|
104
|
-
|
105
|
-
private static IRubyObject get_stack_tail(ThreadContext context, RubyArray stack, int len) {
|
106
|
-
if (len < 0) return context.nil;
|
107
|
-
int size = stack.size();
|
108
|
-
len = Math.min(len, size);
|
109
|
-
return stack.subseq(size - len, len);
|
110
|
-
}
|
111
|
-
|
112
|
-
private static void cut_stack_tail(ThreadContext context, RubyArray stack, int len) {
|
113
|
-
while (len > 0) {
|
114
|
-
stack.pop(context);
|
115
|
-
len--;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
private static final int STACK_INIT_LEN = 64;
|
120
|
-
private static RubyArray NEW_STACK(ThreadContext context) {
|
121
|
-
return context.runtime.newArray(STACK_INIT_LEN);
|
122
|
-
}
|
123
|
-
private static IRubyObject PUSH(RubyArray stack, IRubyObject i) {
|
124
|
-
return stack.append(i);
|
125
|
-
}
|
126
|
-
private static IRubyObject POP(ThreadContext context, RubyArray stack) {
|
127
|
-
return stack.pop(context);
|
128
|
-
}
|
129
|
-
private static IRubyObject LAST_I(ThreadContext context, RubyArray stack) {
|
130
|
-
return stack.size() > 0 ? stack.last() : context.nil;
|
131
|
-
}
|
132
|
-
private static IRubyObject GET_TAIL(ThreadContext context, RubyArray stack, int len) {
|
133
|
-
return get_stack_tail(context, stack, len);
|
134
|
-
}
|
135
|
-
private static void CUT_TAIL(ThreadContext context, RubyArray stack, int len) {
|
136
|
-
cut_stack_tail(context, stack, len);
|
137
|
-
}
|
138
|
-
|
139
|
-
static final int CP_FIN_ACCEPT = 1;
|
140
|
-
static final int CP_FIN_EOT = 2;
|
141
|
-
static final int CP_FIN_CANTPOP = 3;
|
142
|
-
|
143
|
-
public class CparseParams extends RubyObject {
|
144
|
-
public CparseParams(Ruby runtime, RubyClass rubyClass) {
|
145
|
-
super(runtime, rubyClass);
|
146
|
-
}
|
147
|
-
|
148
|
-
public void initialize_params(ThreadContext context, Parser parser, IRubyObject arg, IRubyObject lexer, IRubyObject lexmid) {
|
149
|
-
Ruby runtime = context.runtime;
|
150
|
-
this.parser = parser;
|
151
|
-
this.lexer = lexer;
|
152
|
-
if (!lexmid.isNil()) {
|
153
|
-
this.lexmid = value_to_id(context, lexmid);
|
154
|
-
this.call_lexmid = MethodIndex.getFunctionalCallSite(this.lexmid.toString());
|
155
|
-
}
|
156
|
-
|
157
|
-
this.debug = parser.getInstanceVariable(ID_YYDEBUG).isTrue();
|
158
|
-
|
159
|
-
RubyArray argAry = arg.convertToArray();
|
160
|
-
if (!(13 <= argAry.size() && argAry.size() <= 14)) {
|
161
|
-
throw runtime.newRaiseException(RaccBug, "[Racc Bug] wrong arg.size " + argAry.size());
|
162
|
-
}
|
163
|
-
this.action_table = assert_array(argAry.eltOk(0));
|
164
|
-
this.action_check = assert_array(argAry.eltOk(1));
|
165
|
-
this.action_default = assert_array(argAry.eltOk(2));
|
166
|
-
this.action_pointer = assert_array(argAry.eltOk(3));
|
167
|
-
this.goto_table = assert_array(argAry.eltOk(4));
|
168
|
-
this.goto_check = assert_array(argAry.eltOk(5));
|
169
|
-
this.goto_default = assert_array(argAry.eltOk(6));
|
170
|
-
this.goto_pointer = assert_array(argAry.eltOk(7));
|
171
|
-
this.nt_base = assert_integer(argAry.eltOk(8));
|
172
|
-
this.reduce_table = assert_array(argAry.eltOk(9));
|
173
|
-
this.token_table = assert_hash(argAry.eltOk(10));
|
174
|
-
this.shift_n = assert_integer(argAry.eltOk(11));
|
175
|
-
this.reduce_n = assert_integer(argAry.eltOk(12));
|
176
|
-
if (argAry.size() > 13) {
|
177
|
-
this.use_result_var = argAry.eltOk(13).isTrue();
|
178
|
-
} else {
|
179
|
-
this.use_result_var = true;
|
180
|
-
}
|
181
|
-
|
182
|
-
this.tstack = this.debug ? NEW_STACK(context) : null;
|
183
|
-
this.vstack = NEW_STACK(context);
|
184
|
-
this.state = NEW_STACK(context);
|
185
|
-
this.curstate = 0;
|
186
|
-
PUSH(this.state, RubyFixnum.zero(runtime));
|
187
|
-
this.t = runtime.newFixnum(TokenType.FINAL.id + 1); // must not init to FINAL_TOKEN
|
188
|
-
this.nerr = 0;
|
189
|
-
this.errstatus = 0;
|
190
|
-
this.parser.setInstanceVariable(ID_ERRSTATUS, runtime.newFixnum(this.errstatus));
|
191
|
-
|
192
|
-
this.retval = context.nil;
|
193
|
-
this.fin = 0;
|
194
|
-
|
195
|
-
this.lex_is_iterator = false;
|
196
|
-
|
197
|
-
parser.setInstanceVariable("@vstack", this.vstack);
|
198
|
-
if (this.debug) {
|
199
|
-
parser.setInstanceVariable("@tstack", this.tstack);
|
200
|
-
}
|
201
|
-
else {
|
202
|
-
parser.setInstanceVariable("@tstack", context.nil);
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
public void extract_user_token(ThreadContext context, IRubyObject block_args, IRubyObject[] tokVal) {
|
207
|
-
if (block_args.isNil()) {
|
208
|
-
/* EOF */
|
209
|
-
tokVal[0] = context.runtime.getFalse();
|
210
|
-
tokVal[1] = context.runtime.newString("$");
|
211
|
-
return;
|
212
|
-
}
|
213
|
-
|
214
|
-
if (!(block_args instanceof RubyArray)) {
|
215
|
-
throw context.runtime.newTypeError(
|
216
|
-
(lex_is_iterator ? lexmid.asJavaString() : "next_token") +
|
217
|
-
" " +
|
218
|
-
(lex_is_iterator ? "yielded" : "returned") +
|
219
|
-
" " +
|
220
|
-
block_args.getMetaClass().getName() +
|
221
|
-
" (must be Array[2])");
|
222
|
-
}
|
223
|
-
RubyArray block_args_ary = (RubyArray)block_args;
|
224
|
-
if (block_args_ary.size() != 2) {
|
225
|
-
throw context.runtime.newTypeError(
|
226
|
-
(lex_is_iterator ? lexmid.asJavaString() : "next_token") +
|
227
|
-
" " +
|
228
|
-
(lex_is_iterator ? "yielded" : "returned") +
|
229
|
-
" wrong size of array (" +
|
230
|
-
block_args_ary.size() +
|
231
|
-
" for 2)");
|
232
|
-
}
|
233
|
-
tokVal[0] = ((RubyArray) block_args).eltOk(0);
|
234
|
-
tokVal[1] = ((RubyArray) block_args).eltOk(1);
|
235
|
-
}
|
236
|
-
|
237
|
-
private static final int RESUME = 1;
|
238
|
-
private static final int NOTFOUND = 2;
|
239
|
-
private static final int ERROR_RECOVERED = 3;
|
240
|
-
private static final int ERROR = 4;
|
241
|
-
private static final int HANDLE_ACT = 5;
|
242
|
-
private static final int ACT_FIXED = 6;
|
243
|
-
private static final int ACCEPT = 7;
|
244
|
-
private static final int USER_YYERROR = 8;
|
245
|
-
private static final int ERROR_POP = 9;
|
246
|
-
private static final int TRANSIT = 9;
|
247
|
-
|
248
|
-
private void SHIFT(ThreadContext context, int act, IRubyObject tok, IRubyObject val) {
|
249
|
-
shift(context, act, tok, val);
|
250
|
-
}
|
251
|
-
|
252
|
-
public void parse_main(ThreadContext context, IRubyObject tok, IRubyObject val, boolean resume) {
|
253
|
-
Ruby runtime = context.runtime;
|
254
|
-
|
255
|
-
int i = 0; /* table index */
|
256
|
-
int act = 0; /* action type */
|
257
|
-
IRubyObject act_value; /* action type, VALUE version */
|
258
|
-
boolean read_next = true; /* true if we need to read next token */
|
259
|
-
IRubyObject tmp;
|
260
|
-
|
261
|
-
int branch = 0;
|
262
|
-
|
263
|
-
if (resume) {
|
264
|
-
branch = RESUME;
|
265
|
-
}
|
266
|
-
|
267
|
-
BRANCH: while (true) {
|
268
|
-
switch (branch) {
|
269
|
-
case 0:
|
270
|
-
|
271
|
-
D_puts("");
|
272
|
-
D_puts("---- enter new loop ----");
|
273
|
-
D_puts("");
|
274
|
-
|
275
|
-
D_printf("(act) k1=%ld\n", this.curstate);
|
276
|
-
tmp = AREF(context, this.action_pointer, this.curstate);
|
277
|
-
if (tmp.isNil()) {branch = NOTFOUND; continue BRANCH;}
|
278
|
-
D_puts("(act) pointer[k1] ok");
|
279
|
-
i = assert_integer(tmp);
|
280
|
-
|
281
|
-
D_printf("read_next=%d\n", read_next);
|
282
|
-
if (read_next && (!this.t.equals(vFINAL_TOKEN))) {
|
283
|
-
if (this.lex_is_iterator) {
|
284
|
-
D_puts("resuming...");
|
285
|
-
if (this.fin != 0) throw runtime.newArgumentError("token given after EOF");
|
286
|
-
this.i = i; /* save i */
|
287
|
-
return;
|
288
|
-
|
289
|
-
// remainder of case duplicated from here for RESUME case
|
290
|
-
//D_puts(this, "resumed");
|
291
|
-
//i = this.i; /* load i */
|
292
|
-
}
|
293
|
-
else {
|
294
|
-
D_puts("next_token");
|
295
|
-
tmp = call_nexttoken.call(context, this.parser, this.parser);
|
296
|
-
IRubyObject[] tokVal = {tok, val};
|
297
|
-
extract_user_token(context, tmp, tokVal);
|
298
|
-
tok = tokVal[0];
|
299
|
-
val = tokVal[1];
|
300
|
-
}
|
301
|
-
/* convert token */
|
302
|
-
this.t = ((RubyHash)this.token_table).op_aref(context, tok);
|
303
|
-
if (this.t.isNil()) {
|
304
|
-
this.t = vERROR_TOKEN;
|
305
|
-
}
|
306
|
-
D_printf("(act) t(k2)=%ld\n", assert_integer(this.t));
|
307
|
-
if (this.debug) {
|
308
|
-
call_d_read_token.call(context, this.parser, this.parser, this.t, tok, val);
|
309
|
-
}
|
310
|
-
}
|
311
|
-
|
312
|
-
// duplicated logic from above for RESUME case
|
313
|
-
case RESUME:
|
314
|
-
if (branch == RESUME) {
|
315
|
-
D_puts("resumed");
|
316
|
-
i = this.i; /* load i */
|
317
|
-
|
318
|
-
/* convert token */
|
319
|
-
this.t = ((RubyHash)this.token_table).op_aref(context, tok);
|
320
|
-
if (this.t.isNil()) {
|
321
|
-
this.t = vERROR_TOKEN;
|
322
|
-
}
|
323
|
-
D_printf("(act) t(k2)=%ld\n", assert_integer(this.t));
|
324
|
-
if (this.debug) {
|
325
|
-
call_d_read_token.call(context, this.parser, this.parser, this.t, tok, val);
|
326
|
-
}
|
327
|
-
}
|
328
|
-
|
329
|
-
read_next = false;
|
330
|
-
|
331
|
-
i += assert_integer(this.t);
|
332
|
-
D_printf("(act) i=%ld\n", i);
|
333
|
-
if (i < 0) {branch = NOTFOUND; continue BRANCH;}
|
334
|
-
|
335
|
-
act_value = AREF(context, this.action_table, i);
|
336
|
-
if (act_value.isNil()) {branch = NOTFOUND; continue BRANCH;}
|
337
|
-
act = assert_integer(act_value);
|
338
|
-
D_printf("(act) table[i]=%ld\n", act);
|
339
|
-
|
340
|
-
tmp = AREF(context, this.action_check, i);
|
341
|
-
if (tmp.isNil()) {branch = NOTFOUND; continue BRANCH;}
|
342
|
-
if (assert_integer(tmp) != this.curstate) {branch = NOTFOUND; continue BRANCH;}
|
343
|
-
D_printf("(act) check[i]=%ld\n", assert_integer(tmp));
|
344
|
-
|
345
|
-
D_puts("(act) found");
|
346
|
-
|
347
|
-
case ACT_FIXED:
|
348
|
-
D_printf("act=%ld\n", act);
|
349
|
-
branch = HANDLE_ACT; continue BRANCH;
|
350
|
-
|
351
|
-
case NOTFOUND:
|
352
|
-
D_puts("(act) not found: use default");
|
353
|
-
act_value = AREF(context, this.action_default, this.curstate);
|
354
|
-
act = assert_integer(act_value);
|
355
|
-
branch = ACT_FIXED; continue BRANCH;
|
356
|
-
|
357
|
-
case HANDLE_ACT:
|
358
|
-
if (act > 0 && act < this.shift_n) {
|
359
|
-
D_puts("shift");
|
360
|
-
if (this.errstatus > 0) {
|
361
|
-
this.errstatus--;
|
362
|
-
this.parser.setInstanceVariable(ID_ERRSTATUS, runtime.newFixnum(this.errstatus));
|
363
|
-
}
|
364
|
-
SHIFT(context, act, this.t, val);
|
365
|
-
read_next = true;
|
366
|
-
}
|
367
|
-
else if (act < 0 && act > -(this.reduce_n)) {
|
368
|
-
D_puts("reduce");
|
369
|
-
{ // macro REDUCE
|
370
|
-
switch (reduce(context, act)) {
|
371
|
-
case 0: /* normal */
|
372
|
-
break;
|
373
|
-
case 1: /* yyerror */
|
374
|
-
branch = USER_YYERROR;
|
375
|
-
continue BRANCH;
|
376
|
-
case 2: /* yyaccept */
|
377
|
-
D_puts("u accept");
|
378
|
-
branch = ACCEPT;
|
379
|
-
continue BRANCH;
|
380
|
-
default:
|
381
|
-
break;
|
382
|
-
}
|
383
|
-
}
|
384
|
-
}
|
385
|
-
else if (act == -(this.reduce_n)) {
|
386
|
-
branch = ERROR; continue BRANCH;
|
387
|
-
}
|
388
|
-
else if (act == this.shift_n) {
|
389
|
-
D_puts("accept");
|
390
|
-
branch = ACCEPT; continue BRANCH;
|
391
|
-
}
|
392
|
-
else {
|
393
|
-
throw runtime.newRaiseException(RaccBug, "[Cparse Bug] unknown act value " + act);
|
394
|
-
}
|
395
|
-
|
396
|
-
// fall through
|
397
|
-
case ERROR_RECOVERED:
|
398
|
-
|
399
|
-
if (this.debug) {
|
400
|
-
call_d_next_state.call(context, this.parser, this.parser, runtime.newFixnum(this.curstate), this.state);
|
401
|
-
}
|
402
|
-
branch = 0; continue BRANCH;
|
403
|
-
|
404
|
-
/* not reach */
|
405
|
-
|
406
|
-
case ACCEPT:
|
407
|
-
if (this.debug) call_d_accept.call(context, this.parser, this.parser);
|
408
|
-
this.retval = this.vstack.eltOk(0);
|
409
|
-
this.fin = CP_FIN_ACCEPT;
|
410
|
-
return;
|
411
|
-
|
412
|
-
case ERROR:
|
413
|
-
D_printf("error detected, status=%ld\n", this.errstatus);
|
414
|
-
if (this.errstatus == 0) {
|
415
|
-
this.nerr++;
|
416
|
-
call_onerror.call(context, this.parser, this.parser, this.t, val, this.vstack);
|
417
|
-
}
|
418
|
-
|
419
|
-
// fall through
|
420
|
-
case USER_YYERROR:
|
421
|
-
if (this.errstatus == 3) {
|
422
|
-
if (this.t.equals(vFINAL_TOKEN)) {
|
423
|
-
this.retval = runtime.getFalse();
|
424
|
-
this.fin = CP_FIN_EOT;
|
425
|
-
return;
|
426
|
-
}
|
427
|
-
read_next = true;
|
428
|
-
}
|
429
|
-
this.errstatus = 3;
|
430
|
-
this.parser.setInstanceVariable(ID_ERRSTATUS, runtime.newFixnum(this.errstatus));
|
431
|
-
|
432
|
-
/* check if we can shift/reduce error token */
|
433
|
-
D_printf("(err) k1=%ld\n", this.curstate);
|
434
|
-
D_printf("(err) k2=%d (error)\n", TokenType.ERROR.id);
|
435
|
-
|
436
|
-
int branch2 = 0;
|
437
|
-
|
438
|
-
BRANCH2: while (true) {
|
439
|
-
switch (branch2) {
|
440
|
-
case 0:
|
441
|
-
tmp = AREF(context, this.action_pointer, this.curstate);
|
442
|
-
if (tmp.isNil()) {branch2 = ERROR_POP; continue BRANCH2;}
|
443
|
-
D_puts("(err) pointer[k1] ok");
|
444
|
-
|
445
|
-
i = assert_integer(tmp) + TokenType.ERROR.id;
|
446
|
-
D_printf("(err) i=%ld\n", i);
|
447
|
-
if (i < 0) {branch2 = ERROR_POP; continue BRANCH2;}
|
448
|
-
|
449
|
-
act_value = AREF(context, this.action_table, i);
|
450
|
-
if (act_value.isNil()) {
|
451
|
-
D_puts("(err) table[i] == nil");
|
452
|
-
branch2 = ERROR_POP; continue BRANCH2;
|
453
|
-
}
|
454
|
-
act = assert_integer(act_value);
|
455
|
-
D_printf("(err) table[i]=%ld\n", act);
|
456
|
-
|
457
|
-
tmp = AREF(context, this.action_check, i);
|
458
|
-
if (tmp.isNil()) {
|
459
|
-
D_puts("(err) check[i] == nil");
|
460
|
-
branch2 = ERROR_POP; continue BRANCH2;
|
461
|
-
}
|
462
|
-
if (assert_integer(tmp) != this.curstate) {
|
463
|
-
D_puts("(err) check[i] != k1");
|
464
|
-
branch2 = ERROR_POP; continue BRANCH2;
|
465
|
-
}
|
466
|
-
|
467
|
-
D_puts("(err) found: can handle error token");
|
468
|
-
break BRANCH2;
|
469
|
-
|
470
|
-
case ERROR_POP:
|
471
|
-
D_puts("(err) act not found: can't handle error token; pop");
|
472
|
-
|
473
|
-
if (this.state.size() <= 1) {
|
474
|
-
this.retval = context.nil;
|
475
|
-
this.fin = CP_FIN_CANTPOP;
|
476
|
-
return;
|
477
|
-
}
|
478
|
-
POP(context, this.state);
|
479
|
-
POP(context, this.vstack);
|
480
|
-
this.curstate = assert_integer(LAST_I(context, this.state));
|
481
|
-
if (this.debug) {
|
482
|
-
POP(context, this.tstack);
|
483
|
-
call_d_e_pop.call(context, this.parser, this.parser, this.state, this.tstack, this.vstack);
|
484
|
-
}
|
485
|
-
}
|
486
|
-
}
|
487
|
-
|
488
|
-
/* shift/reduce error token */
|
489
|
-
if (act > 0 && act < this.shift_n) {
|
490
|
-
D_puts("e shift");
|
491
|
-
SHIFT(context, act, runtime.newFixnum(TokenType.ERROR.id), val);
|
492
|
-
}
|
493
|
-
else if (act < 0 && act > -(this.reduce_n)) {
|
494
|
-
D_puts("e reduce");
|
495
|
-
{ // macro REDUCE
|
496
|
-
switch (reduce(context, act)) {
|
497
|
-
case 0: /* normal */
|
498
|
-
break;
|
499
|
-
case 1: /* yyerror */
|
500
|
-
branch = USER_YYERROR;
|
501
|
-
continue BRANCH;
|
502
|
-
case 2: /* yyaccept */
|
503
|
-
D_puts("u accept");
|
504
|
-
branch = ACCEPT;
|
505
|
-
continue BRANCH;
|
506
|
-
default:
|
507
|
-
break;
|
508
|
-
}
|
509
|
-
}
|
510
|
-
}
|
511
|
-
else if (act == this.shift_n) {
|
512
|
-
D_puts("e accept");
|
513
|
-
branch = ACCEPT; continue BRANCH;
|
514
|
-
}
|
515
|
-
else {
|
516
|
-
throw runtime.newRaiseException(RaccBug, "[Cparse Bug] unknown act value " + act);
|
517
|
-
}
|
518
|
-
branch = ERROR_RECOVERED; continue BRANCH;
|
519
|
-
}
|
520
|
-
}
|
521
|
-
}
|
522
|
-
|
523
|
-
private void shift(ThreadContext context, int act, IRubyObject tok, IRubyObject val) {
|
524
|
-
PUSH(vstack, val);
|
525
|
-
if (debug) {
|
526
|
-
PUSH(tstack, tok);
|
527
|
-
call_d_shift.call(context, this.parser, this.parser, tok, tstack, vstack);
|
528
|
-
}
|
529
|
-
curstate = act;
|
530
|
-
PUSH(state, context.runtime.newFixnum(curstate));
|
531
|
-
}
|
532
|
-
|
533
|
-
private int reduce(ThreadContext context, int act) {
|
534
|
-
ruleno = -act * 3;
|
535
|
-
IRubyObject tag = context.runtime.newSymbol("racc_jump");
|
536
|
-
IRubyObject code = RubyKernel.rbCatch19(context, this,
|
537
|
-
tag,
|
538
|
-
CallBlock19.newCallClosure(this, getMetaClass(), Signature.NO_ARGUMENTS,
|
539
|
-
new BlockCallback() {
|
540
|
-
@Override
|
541
|
-
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
|
542
|
-
return reduce0(context);
|
543
|
-
}
|
544
|
-
}, context));
|
545
|
-
errstatus = assert_integer(parser.getInstanceVariable(ID_ERRSTATUS));
|
546
|
-
return assert_integer(code);
|
547
|
-
}
|
548
|
-
|
549
|
-
private IRubyObject reduce0(ThreadContext context) {
|
550
|
-
Ruby runtime = context.runtime;
|
551
|
-
|
552
|
-
IRubyObject reduce_to, reduce_len, method_id;
|
553
|
-
int len;
|
554
|
-
RubySymbol mid;
|
555
|
-
IRubyObject tmp, tmp_t = RubyBasicObject.UNDEF, tmp_v = RubyBasicObject.UNDEF;
|
556
|
-
int i, k1 = 0, k2;
|
557
|
-
IRubyObject goto_state = context.nil;
|
558
|
-
|
559
|
-
reduce_len = this.reduce_table.entry(this.ruleno);
|
560
|
-
reduce_to = this.reduce_table.entry(this.ruleno+1);
|
561
|
-
method_id = this.reduce_table.entry(this.ruleno+2);
|
562
|
-
len = assert_integer(reduce_len);
|
563
|
-
mid = value_to_id(context, method_id);
|
564
|
-
|
565
|
-
int branch = 0;
|
566
|
-
BRANCH: while (true) {
|
567
|
-
switch (branch) {
|
568
|
-
case 0:
|
569
|
-
|
570
|
-
/* call action */
|
571
|
-
if (len == 0) {
|
572
|
-
tmp = context.nil;
|
573
|
-
if (!mid.equals(sym_noreduce))
|
574
|
-
tmp_v = runtime.newArray();
|
575
|
-
if (this.debug)
|
576
|
-
tmp_t = runtime.newArray();
|
577
|
-
}
|
578
|
-
else {
|
579
|
-
if (!mid.equals(sym_noreduce)) {
|
580
|
-
tmp_v = GET_TAIL(context, this.vstack, len);
|
581
|
-
tmp = ((RubyArray)tmp_v).entry(0);
|
582
|
-
}
|
583
|
-
else {
|
584
|
-
tmp = this.vstack.entry(this.vstack.size() - len);
|
585
|
-
}
|
586
|
-
CUT_TAIL(context, this.vstack, len);
|
587
|
-
if (this.debug) {
|
588
|
-
tmp_t = GET_TAIL(context, this.tstack, len);
|
589
|
-
CUT_TAIL(context, this.tstack, len);
|
590
|
-
}
|
591
|
-
CUT_TAIL(context, this.state, len);
|
592
|
-
}
|
593
|
-
if (!mid.equals(sym_noreduce)) {
|
594
|
-
if (this.use_result_var) {
|
595
|
-
tmp = Helpers.invoke(context, this.parser, mid.toString(), tmp_v, this.vstack, tmp);
|
596
|
-
}
|
597
|
-
else {
|
598
|
-
tmp = Helpers.invoke(context, this.parser, mid.toString(), tmp_v, this.vstack);
|
599
|
-
}
|
600
|
-
}
|
601
|
-
|
602
|
-
/* then push result */
|
603
|
-
PUSH(this.vstack, tmp);
|
604
|
-
if (this.debug) {
|
605
|
-
PUSH(this.tstack, reduce_to);
|
606
|
-
call_d_reduce.call(context, this.parser, this.parser, tmp_t, reduce_to, this.tstack, this.vstack);
|
607
|
-
}
|
608
|
-
|
609
|
-
/* calculate transition state */
|
610
|
-
if (state.size() == 0)
|
611
|
-
throw runtime.newRaiseException(RaccBug, "state stack unexpectedly empty");
|
612
|
-
k2 = assert_integer(LAST_I(context, this.state));
|
613
|
-
k1 = assert_integer(reduce_to) - this.nt_base;
|
614
|
-
D_printf("(goto) k1=%ld\n", k1);
|
615
|
-
D_printf("(goto) k2=%ld\n", k2);
|
616
|
-
|
617
|
-
tmp = AREF(context, this.goto_pointer, k1);
|
618
|
-
if (tmp.isNil()) {branch = NOTFOUND; continue BRANCH;}
|
619
|
-
|
620
|
-
i = assert_integer(tmp) + k2;
|
621
|
-
D_printf("(goto) i=%ld\n", i);
|
622
|
-
if (i < 0) {branch = NOTFOUND; continue BRANCH;}
|
623
|
-
|
624
|
-
goto_state = AREF(context, this.goto_table, i);
|
625
|
-
if (goto_state.isNil()) {
|
626
|
-
D_puts("(goto) table[i] == nil");
|
627
|
-
branch = NOTFOUND; continue BRANCH;
|
628
|
-
}
|
629
|
-
D_printf("(goto) table[i]=%ld (goto_state)\n", goto_state.convertToInteger().getLongValue());
|
630
|
-
|
631
|
-
tmp = AREF(context, this.goto_check, i);
|
632
|
-
if (tmp.isNil()) {
|
633
|
-
D_puts("(goto) check[i] == nil");
|
634
|
-
branch = NOTFOUND; continue BRANCH;
|
635
|
-
}
|
636
|
-
if (!tmp.equals(runtime.newFixnum(k1))) {
|
637
|
-
D_puts("(goto) check[i] != table[i]");
|
638
|
-
branch = NOTFOUND; continue BRANCH;
|
639
|
-
}
|
640
|
-
D_printf("(goto) check[i]=%ld\n", tmp.convertToInteger().getLongValue());
|
641
|
-
|
642
|
-
D_puts("(goto) found");
|
643
|
-
|
644
|
-
case TRANSIT:
|
645
|
-
PUSH(this.state, goto_state);
|
646
|
-
this.curstate = assert_integer(goto_state);
|
647
|
-
return RubyFixnum.zero(runtime);
|
648
|
-
|
649
|
-
case NOTFOUND:
|
650
|
-
D_puts("(goto) not found: use default");
|
651
|
-
/* overwrite `goto-state' by default value */
|
652
|
-
goto_state = AREF(context, this.goto_default, k1);
|
653
|
-
branch = TRANSIT; continue BRANCH;
|
654
|
-
}
|
655
|
-
}
|
656
|
-
}
|
657
|
-
|
658
|
-
private void D_puts(String msg) {
|
659
|
-
if (sys_debug) {
|
660
|
-
System.out.println(msg);
|
661
|
-
}
|
662
|
-
}
|
663
|
-
|
664
|
-
private void D_printf(String fmt, long arg) {
|
665
|
-
if (sys_debug) {
|
666
|
-
System.out.println(fmt + ": " + arg);
|
667
|
-
}
|
668
|
-
}
|
669
|
-
|
670
|
-
private void D_printf(String fmt, boolean arg) {
|
671
|
-
if (sys_debug) {
|
672
|
-
System.out.println(fmt + ": " + arg);
|
673
|
-
}
|
674
|
-
}
|
675
|
-
|
676
|
-
Parser parser; /* parser object */
|
677
|
-
|
678
|
-
boolean lex_is_iterator;
|
679
|
-
IRubyObject lexer; /* scanner object */
|
680
|
-
RubySymbol lexmid; /* name of scanner method (must be an iterator) */
|
681
|
-
CallSite call_lexmid; /* call site for scanner method */
|
682
|
-
|
683
|
-
/* State transition tables (immutable)
|
684
|
-
Data structure is from Dragon Book 4.9 */
|
685
|
-
/* action table */
|
686
|
-
IRubyObject action_table;
|
687
|
-
IRubyObject action_check;
|
688
|
-
IRubyObject action_default;
|
689
|
-
IRubyObject action_pointer;
|
690
|
-
/* goto table */
|
691
|
-
IRubyObject goto_table;
|
692
|
-
IRubyObject goto_check;
|
693
|
-
IRubyObject goto_default;
|
694
|
-
IRubyObject goto_pointer;
|
695
|
-
|
696
|
-
int nt_base; /* NonTerminal BASE index */
|
697
|
-
RubyArray reduce_table; /* reduce data table */
|
698
|
-
IRubyObject token_table; /* token conversion table */
|
699
|
-
|
700
|
-
/* parser stacks and parameters */
|
701
|
-
RubyArray state;
|
702
|
-
int curstate;
|
703
|
-
RubyArray vstack;
|
704
|
-
RubyArray tstack;
|
705
|
-
IRubyObject t;
|
706
|
-
int shift_n;
|
707
|
-
int reduce_n;
|
708
|
-
int ruleno;
|
709
|
-
|
710
|
-
int errstatus; /* nonzero in error recovering mode */
|
711
|
-
int nerr; /* number of error */
|
712
|
-
|
713
|
-
boolean use_result_var;
|
714
|
-
|
715
|
-
IRubyObject retval; /* return IRubyObject of parser routine */
|
716
|
-
int fin; /* parse result status */
|
717
|
-
|
718
|
-
boolean debug; /* user level debug */
|
719
|
-
boolean sys_debug; /* system level debug */
|
720
|
-
|
721
|
-
int i; /* table index */
|
722
|
-
}
|
723
|
-
|
724
|
-
private static RubyArray assert_array(IRubyObject a) {
|
725
|
-
return a.convertToArray();
|
726
|
-
}
|
727
|
-
|
728
|
-
private static RubyHash assert_hash(IRubyObject h) {
|
729
|
-
return h.convertToHash();
|
730
|
-
}
|
731
|
-
|
732
|
-
private static int assert_integer(IRubyObject i) {
|
733
|
-
return (int)i.convertToInteger().getLongValue();
|
734
|
-
}
|
735
|
-
|
736
|
-
public class Parser extends RubyObject {
|
737
|
-
public Parser(Ruby runtime, RubyClass rubyClass) {
|
738
|
-
super(runtime, rubyClass);
|
739
|
-
}
|
740
|
-
|
741
|
-
public static final String Racc_Runtime_Core_Version_C = RACC_VERSION;
|
742
|
-
public static final String Racc_Runtime_Core_Id_C = "$originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $";
|
743
|
-
|
744
|
-
@JRubyMethod(name = "_racc_do_parse_c", frame = true)
|
745
|
-
public IRubyObject racc_cparse(ThreadContext context, IRubyObject arg, IRubyObject sysdebug) {
|
746
|
-
CparseParams v = new CparseParams(context.runtime, CparseParams);
|
747
|
-
|
748
|
-
v.D_puts("starting cparse");
|
749
|
-
v.sys_debug = sysdebug.isTrue();
|
750
|
-
v.initialize_params(context, this, arg, context.nil, context.nil);
|
751
|
-
v.lex_is_iterator = false;
|
752
|
-
v.parse_main(context, context.nil, context.nil, false);
|
753
|
-
|
754
|
-
return v.retval;
|
755
|
-
}
|
756
|
-
|
757
|
-
@JRubyMethod(name = "_racc_yyparse_c", frame = true, required = 4)
|
758
|
-
public IRubyObject racc_yyparse(ThreadContext context, IRubyObject[] args) {
|
759
|
-
Ruby runtime = context.runtime;
|
760
|
-
CparseParams v = new CparseParams(context.runtime, CparseParams);
|
761
|
-
|
762
|
-
IRubyObject lexer = args[0], lexmid = args[1], arg = args[2], sysdebug = args[3];
|
763
|
-
|
764
|
-
v.sys_debug = sysdebug.isTrue();
|
765
|
-
v.D_puts("start C yyparse");
|
766
|
-
v.initialize_params(context, this, arg, lexer, lexmid);
|
767
|
-
v.lex_is_iterator = true;
|
768
|
-
v.D_puts("params initialized");
|
769
|
-
v.parse_main(context, context.nil, context.nil, false);
|
770
|
-
call_lexer(context, v);
|
771
|
-
if (v.fin == 0) {
|
772
|
-
throw runtime.newArgumentError(v.lexmid + " is finished before EndOfToken");
|
773
|
-
}
|
774
|
-
|
775
|
-
return v.retval;
|
776
|
-
}
|
777
|
-
|
778
|
-
private class LexerUnroll extends RuntimeException {
|
779
|
-
public Throwable fillInStackTrace() {
|
780
|
-
return this;
|
781
|
-
}
|
782
|
-
}
|
783
|
-
|
784
|
-
private void call_lexer(ThreadContext context, final CparseParams v) {
|
785
|
-
final LexerUnroll lexerUnroll = new LexerUnroll();
|
786
|
-
try {
|
787
|
-
v.call_lexmid.call(context, v.lexer, v.lexer, CallBlock19.newCallClosure(v, v.getMetaClass(), Arity.ONE_ARGUMENT, new BlockCallback() {
|
788
|
-
@Override
|
789
|
-
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
|
790
|
-
Ruby runtime = context.getRuntime();
|
791
|
-
if (v.fin != 0) {
|
792
|
-
throw runtime.newArgumentError("extra token after EndOfToken");
|
793
|
-
}
|
794
|
-
IRubyObject[] tokVal = {null, null};
|
795
|
-
v.extract_user_token(context, args[0], tokVal);
|
796
|
-
v.parse_main(context, tokVal[0], tokVal[1], true);
|
797
|
-
if (v.fin != 0 && v.fin != CP_FIN_ACCEPT) {
|
798
|
-
throw lexerUnroll;
|
799
|
-
}
|
800
|
-
|
801
|
-
return context.nil;
|
802
|
-
}
|
803
|
-
}, context));
|
804
|
-
} catch (LexerUnroll maybeOurs) {
|
805
|
-
if (maybeOurs.equals(lexerUnroll)) {
|
806
|
-
return;
|
807
|
-
}
|
808
|
-
}
|
809
|
-
}
|
810
|
-
}
|
811
|
-
|
812
|
-
public void load(Ruby runtime, boolean wrap) {
|
813
|
-
RubyModule racc = runtime.getOrCreateModule("Racc");
|
814
|
-
RubyClass parser = racc.defineOrGetClassUnder("Parser", runtime.getObject());
|
815
|
-
parser.setAllocator(new ObjectAllocator() {
|
816
|
-
@Override
|
817
|
-
public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
|
818
|
-
return new Parser(ruby, rubyClass);
|
819
|
-
}
|
820
|
-
});
|
821
|
-
|
822
|
-
parser.defineAnnotatedMethods(Parser.class);
|
823
|
-
|
824
|
-
parser.defineConstant("Racc_Runtime_Core_Version_C", runtime.newString(Parser.Racc_Runtime_Core_Version_C));
|
825
|
-
parser.defineConstant("Racc_Runtime_Core_Id_C", runtime.newString(Parser.Racc_Runtime_Core_Id_C));
|
826
|
-
|
827
|
-
CparseParams = racc.defineClassUnder("CparseParams", runtime.getObject(), new ObjectAllocator() {
|
828
|
-
@Override
|
829
|
-
public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
|
830
|
-
return new CparseParams(ruby, rubyClass);
|
831
|
-
}
|
832
|
-
});
|
833
|
-
|
834
|
-
RaccBug = runtime.getRuntimeError();
|
835
|
-
sym_noreduce = runtime.newSymbol(ID_NOREDUCE);
|
836
|
-
call_nexttoken = MethodIndex.getFunctionalCallSite(ID_NEXTTOKEN);
|
837
|
-
call_onerror = MethodIndex.getFunctionalCallSite(ID_ONERROR);
|
838
|
-
call_d_shift = MethodIndex.getFunctionalCallSite(ID_D_SHIFT);
|
839
|
-
call_d_reduce = MethodIndex.getFunctionalCallSite(ID_D_REDUCE);
|
840
|
-
call_d_accept = MethodIndex.getFunctionalCallSite(ID_D_ACCEPT);
|
841
|
-
call_d_read_token = MethodIndex.getFunctionalCallSite(ID_D_READ_TOKEN);
|
842
|
-
call_d_next_state = MethodIndex.getFunctionalCallSite(ID_D_NEXT_STATE);
|
843
|
-
call_d_e_pop = MethodIndex.getFunctionalCallSite(ID_D_E_POP);
|
844
|
-
|
845
|
-
vDEFAULT_TOKEN = runtime.newFixnum(TokenType.DEFAULT.id);
|
846
|
-
vERROR_TOKEN = runtime.newFixnum(TokenType.ERROR.id);
|
847
|
-
vFINAL_TOKEN = runtime.newFixnum(TokenType.FINAL.id);
|
848
|
-
}
|
849
|
-
}
|