1 /* Generated By:JavaCC: Do not edit this line. ESFParserTokenManager.java */
4 public class ESFParserTokenManager
implements ESFParserConstants
{
5 public java
.io
.PrintStream debugStream
= System
.out
;
7 public void setDebugStream(java
.io
.PrintStream ds
) {
11 private final int jjStopStringLiteralDfa_0(int pos
, long active0
) {
18 private final int jjStartNfa_0(int pos
, long active0
) {
19 return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos
, active0
), pos
+ 1);
22 private final int jjStopAtPos(int pos
, int kind
) {
28 private final int jjStartNfaWithStates_0(int pos
, int kind
, int state
) {
32 curChar
= input_stream
.readChar();
34 catch (java
.io
.IOException e
) {
37 return jjMoveNfa_0(state
, pos
+ 1);
40 private final int jjMoveStringLiteralDfa0_0() {
43 return jjStopAtPos(0, 5);
45 return jjStopAtPos(0, 13);
47 return jjStopAtPos(0, 11);
49 return jjStopAtPos(0, 12);
51 return jjMoveNfa_0(0, 0);
55 private final void jjCheckNAdd(int state
) {
56 if (jjrounds
[state
] != jjround
) {
57 jjstateSet
[jjnewStateCnt
++] = state
;
58 jjrounds
[state
] = jjround
;
62 private final void jjAddStates(int start
, int end
) {
64 jjstateSet
[jjnewStateCnt
++] = jjnextStates
[start
];
65 } while (start
++ != end
);
68 private final void jjCheckNAddTwoStates(int state1
, int state2
) {
73 private final void jjCheckNAddStates(int start
, int end
) {
75 jjCheckNAdd(jjnextStates
[start
]);
76 } while (start
++ != end
);
79 private final void jjCheckNAddStates(int start
) {
80 jjCheckNAdd(jjnextStates
[start
]);
81 jjCheckNAdd(jjnextStates
[start
+ 1]);
84 private final int jjMoveNfa_0(int startState
, int curPos
) {
89 jjstateSet
[0] = startState
;
90 int j
, kind
= 0x7fffffff;
92 if (++jjround
== 0x7fffffff) {
96 long l
= 1L << curChar
;
99 switch (jjstateSet
[--i
]) {
101 if ((0x7ff000000000000L
& l
) == 0L) {
105 jjstateSet
[jjnewStateCnt
++] = 0;
110 } while (i
!= startsAt
);
112 else if (curChar
< 128) {
113 long l
= 1L << (curChar
& 077);
116 switch (jjstateSet
[--i
]) {
118 if ((0x7fffffe87fffffeL
& l
) == 0L) {
122 jjstateSet
[jjnewStateCnt
++] = 0;
127 } while (i
!= startsAt
);
130 int i2
= (curChar
& 0xff) >> 6;
131 long l2
= 1L << (curChar
& 077);
134 switch (jjstateSet
[--i
]) {
138 } while (i
!= startsAt
);
140 if (kind
!= 0x7fffffff) {
141 jjmatchedKind
= kind
;
142 jjmatchedPos
= curPos
;
146 if ((i
= jjnewStateCnt
) == (startsAt
= 1 - (jjnewStateCnt
= startsAt
))) {
150 curChar
= input_stream
.readChar();
152 catch (java
.io
.IOException e
) {
158 private final int jjMoveStringLiteralDfa0_1() {
161 return jjStopAtPos(0, 6);
164 return jjMoveStringLiteralDfa1_1(0x100L
);
170 private final int jjMoveStringLiteralDfa1_1(long active0
) {
172 curChar
= input_stream
.readChar();
174 catch (java
.io
.IOException e
) {
179 if ((active0
& 0x100L
) != 0L) {
180 return jjStopAtPos(1, 8);
189 static final int[] jjnextStates
= {
191 public static final String
[] jjstrLiteralImages
= {
192 "", null, null, null, null, null, null, null, null, null, null, "\173",
194 public static final String
[] lexStateNames
= {
198 public static final int[] jjnewLexState
= {
199 -1, -1, -1, -1, -1, 1, 0, 0, 0, -1, -1, -1, -1, -1,
201 static final long[] jjtoToken
= {
204 static final long[] jjtoSkip
= {
207 static final long[] jjtoMore
= {
210 protected SimpleCharStream input_stream
;
211 private final int[] jjrounds
= new int[1];
212 private final int[] jjstateSet
= new int[2];
213 protected char curChar
;
215 public ESFParserTokenManager(SimpleCharStream stream
) {
216 if (SimpleCharStream
.staticFlag
) {
217 throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
219 input_stream
= stream
;
222 public ESFParserTokenManager(SimpleCharStream stream
, int lexState
) {
227 public void reInit(SimpleCharStream stream
) {
228 jjmatchedPos
= jjnewStateCnt
= 0;
229 curLexState
= defaultLexState
;
230 input_stream
= stream
;
234 private void reInitRounds() {
236 jjround
= 0x80000001;
237 for (i
= 1; i
-- > 0;) {
238 jjrounds
[i
] = 0x80000000;
242 public void reInit(SimpleCharStream stream
, int lexState
) {
247 public void switchTo(int lexState
) {
248 if (lexState
>= 2 || lexState
< 0) {
249 throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState
+ ". State unchanged.",
250 TokenMgrError
.INVALID_LEXICAL_STATE
);
253 curLexState
= lexState
;
257 protected Token
jjFillToken() {
258 Token t
= Token
.newToken(jjmatchedKind
);
259 t
.kind
= jjmatchedKind
;
260 String im
= jjstrLiteralImages
[jjmatchedKind
];
261 t
.image
= (im
== null) ? input_stream
.getImage() : im
;
262 t
.beginLine
= input_stream
.getBeginLine();
263 t
.beginColumn
= input_stream
.getBeginColumn();
264 t
.endLine
= input_stream
.getEndLine();
265 t
.endColumn
= input_stream
.getEndColumn();
270 int defaultLexState
= 0;
276 public Token
getNextToken() {
278 Token specialToken
= null;
285 curChar
= input_stream
.beginToken();
287 catch (java
.io
.IOException e
) {
289 matchedToken
= jjFillToken();
294 switch (curLexState
) {
297 input_stream
.backup(0);
298 while (curChar
<= 32 && (0x100002600L
& (1L << curChar
)) != 0L) {
299 curChar
= input_stream
.beginToken();
302 catch (java
.io
.IOException e1
) {
305 jjmatchedKind
= 0x7fffffff;
307 curPos
= jjMoveStringLiteralDfa0_0();
310 jjmatchedKind
= 0x7fffffff;
312 curPos
= jjMoveStringLiteralDfa0_1();
313 if (jjmatchedPos
== 0 && jjmatchedKind
> 9) {
318 if (jjmatchedKind
!= 0x7fffffff) {
319 if (jjmatchedPos
+ 1 < curPos
) {
320 input_stream
.backup(curPos
- jjmatchedPos
- 1);
322 if ((jjtoToken
[jjmatchedKind
>> 6] & (1L << (jjmatchedKind
& 077))) != 0L) {
323 matchedToken
= jjFillToken();
324 if (jjnewLexState
[jjmatchedKind
] != -1) {
325 curLexState
= jjnewLexState
[jjmatchedKind
];
329 else if ((jjtoSkip
[jjmatchedKind
>> 6] & (1L << (jjmatchedKind
& 077))) != 0L) {
330 if (jjnewLexState
[jjmatchedKind
] != -1) {
331 curLexState
= jjnewLexState
[jjmatchedKind
];
335 if (jjnewLexState
[jjmatchedKind
] != -1) {
336 curLexState
= jjnewLexState
[jjmatchedKind
];
339 jjmatchedKind
= 0x7fffffff;
341 curChar
= input_stream
.readChar();
344 catch (java
.io
.IOException e1
) {
347 int error_line
= input_stream
.getEndLine();
348 int error_column
= input_stream
.getEndColumn();
349 String error_after
= null;
350 boolean EOFSeen
= false;
352 input_stream
.readChar();
353 input_stream
.backup(1);
355 catch (java
.io
.IOException e1
) {
357 error_after
= curPos
<= 1 ?
"" : input_stream
.getImage();
358 if (curChar
== '\n' || curChar
== '\r') {
367 input_stream
.backup(1);
368 error_after
= curPos
<= 1 ?
"" : input_stream
.getImage();
370 throw new TokenMgrError(EOFSeen
,
376 TokenMgrError
.LEXICAL_ERROR
);