1
- # jay skeleton for Java
1
+ # jay skeleton for Java
2
2
3
- # character in column 1 determines outcome...
4
- # # is a comment
5
- # . is copied
6
- # t is copied as //t if -t is set
7
- # other lines are interpreted to call jay procedures
3
+ # character in column 1 determines outcome...
4
+ # # is a comment
5
+ # . is copied
6
+ # t is copied as //t if -t is set
7
+ # other lines are interpreted to call jay procedures
8
8
9
- version Java 1.0 (c) 2002 ats@cs.rit.edu
9
+ version Java 1.0 (c) 2002 ats@cs.rit.edu
10
10
.
11
- prolog ## %{ ... %} prior to the first %%
11
+ prolog ## %{ ... %} prior to the first %%
12
12
13
13
. // %token constants
14
- tokens public static final int
14
+ tokens public static final int
15
15
.
16
16
. /** number of final state.
17
17
. */
18
- yyFinal protected static final int yyFinal =
18
+ yyFinal protected static final int yyFinal =
19
19
.
20
20
. /** parser tables.
21
21
. Order is mandated by <i>jay</i>.
@@ -130,16 +130,16 @@ t this.yydebug = (org.truffleruby.parser.parser.YYDebug) ayydebug;
130
130
. @return result of the last reduction, if any.
131
131
. */
132
132
. public Object yyparse (RubyLexer yyLex) {
133
- . if (yyMax <= 0) yyMax = 256; // initial size
134
- . int yyState = 0, yyStates[] = new int[yyMax]; // state stack
135
- . Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
136
- . int yyToken = -1; // current input
137
- . int yyErrorFlag = 0; // #tokens to shift
133
+ . if (yyMax <= 0) yyMax = 256; // initial size
134
+ . int yyState = 0, yyStates[] = new int[yyMax]; // state stack
135
+ . Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
136
+ . int yyToken = -1; // current input
137
+ . int yyErrorFlag = 0; // #tokens to shift
138
138
.
139
- local ## %{ ... %} after the first %%
139
+ local ## %{ ... %} after the first %%
140
140
141
141
. yyLoop: for (int yyTop = 0;; ++ yyTop) {
142
- . if (yyTop >= yyStates.length) { // dynamically increase
142
+ . if (yyTop >= yyStates.length) { // dynamically increase
143
143
. int[] i = new int[yyStates.length+yyMax];
144
144
. System.arraycopy(yyStates, 0, i, 0, yyStates.length);
145
145
. yyStates = i;
@@ -151,9 +151,9 @@ t this.yydebug = (org.truffleruby.parser.parser.YYDebug) ayydebug;
151
151
. yyVals[yyTop] = yyVal;
152
152
t if (yydebug != null) yydebug.push(yyState, yyVal);
153
153
.
154
- . yyDiscarded: for (;;) { // discarding a token does not change stack
154
+ . yyDiscarded: for (;;) { // discarding a token does not change stack
155
155
. int yyN;
156
- . if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
156
+ . if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
157
157
. if (yyToken < 0) {
158
158
.// yyToken = yyLex.advance() ? yyLex.token() : 0;
159
159
. yyToken = yyLex.nextToken();
@@ -164,15 +164,15 @@ t yydebug.lex(yyState, yyToken, yyName(yyToken), yyLex.value());
164
164
. && yyN < yyTable.length && yyCheck[yyN] == yyToken) {
165
165
t if (yydebug != null)
166
166
t yydebug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
167
- . yyState = yyTable[yyN]; // shift to yyN
167
+ . yyState = yyTable[yyN]; // shift to yyN
168
168
. yyVal = yyLex.value();
169
169
. yyToken = -1;
170
170
. if (yyErrorFlag > 0) -- yyErrorFlag;
171
171
. continue yyLoop;
172
172
. }
173
173
. if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
174
174
. && yyN < yyTable.length && yyCheck[yyN] == yyToken)
175
- . yyN = yyTable[yyN]; // reduce (yyN)
175
+ . yyN = yyTable[yyN]; // reduce (yyN)
176
176
. else
177
177
. switch (yyErrorFlag) {
178
178
.
@@ -206,9 +206,9 @@ t if (yydebug != null) yydebug.reject();
206
206
. }
207
207
t if (yydebug != null)
208
208
t yydebug.discard(yyState, yyToken, yyName(yyToken),
209
- t yyLex.value());
209
+ t yyLex.value());
210
210
. yyToken = -1;
211
- . continue yyDiscarded; // leave stack alone
211
+ . continue yyDiscarded; // leave stack alone
212
212
. }
213
213
. }
214
214
. int yyV = yyTop + 1-yyLen[yyN];
@@ -223,7 +223,7 @@ t yydebug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]
223
223
.// switch (yyN) {
224
224
.// ACTIONS_BEGIN
225
225
226
- actions ## code from the actions within the grammar
226
+ actions ## code from the actions within the grammar
227
227
228
228
.// ACTIONS_END
229
229
.// }
@@ -257,4 +257,4 @@ t if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
257
257
. }
258
258
.
259
259
.// ACTION_BODIES
260
- epilog ## text following second %%
260
+ epilog ## text following second %%
0 commit comments