1
/* TAPAALCTLQueryParserTokenManager.java */
2
/* Generated By:JavaCC: Do not edit this line. TAPAALCTLQueryParserTokenManager.java */
3
package dk.aau.cs.TCTL.CTLParsing;
4
import java.io.StringReader;
5
import java.util.ArrayList;
6
import dk.aau.cs.TCTL.AritmeticOperator;
7
import dk.aau.cs.TCTL.TCTLTermListNode;
8
import dk.aau.cs.TCTL.TCTLPlaceNode;
9
import dk.aau.cs.TCTL.TCTLTransitionNode;
10
import dk.aau.cs.TCTL.TCTLConstNode;
11
import dk.aau.cs.TCTL.TCTLAFNode;
12
import dk.aau.cs.TCTL.TCTLAGNode;
13
import dk.aau.cs.TCTL.TCTLAUNode;
14
import dk.aau.cs.TCTL.TCTLAXNode;
15
import dk.aau.cs.TCTL.TCTLAbstractProperty;
16
import dk.aau.cs.TCTL.TCTLAbstractStateProperty;
17
import dk.aau.cs.TCTL.TCTLAbstractPathProperty;
18
import dk.aau.cs.TCTL.TCTLAndListNode;
19
import dk.aau.cs.TCTL.TCTLAtomicPropositionNode;
20
import dk.aau.cs.TCTL.TCTLEFNode;
21
import dk.aau.cs.TCTL.TCTLEGNode;
22
import dk.aau.cs.TCTL.TCTLEUNode;
23
import dk.aau.cs.TCTL.TCTLEXNode;
24
import dk.aau.cs.TCTL.TCTLFalseNode;
25
import dk.aau.cs.TCTL.TCTLNotNode;
26
import dk.aau.cs.TCTL.TCTLOrListNode;
27
import dk.aau.cs.TCTL.TCTLTrueNode;
28
import dk.aau.cs.TCTL.TCTLDeadlockNode;
29
import dk.aau.cs.TCTL.TCTLPathToStateConverter;
30
import dk.aau.cs.TCTL.TCTLStateToPathConverter;
33
public class TAPAALCTLQueryParserTokenManager implements TAPAALCTLQueryParserConstants {
36
public java.io.PrintStream debugStream = System.out;
37
/** Set debug output. */
38
public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
39
private final int jjStopStringLiteralDfa_0(int pos, long active0){
43
if ((active0 & 0x100L) != 0L)
45
if ((active0 & 0x240L) != 0L)
47
if ((active0 & 0x1080L) != 0L)
54
private final int jjStartNfa_0(int pos, long active0){
55
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
57
private int jjStopAtPos(int pos, int kind)
63
private int jjMoveStringLiteralDfa0_0(){
67
return jjStopAtPos(0, 26);
69
return jjStopAtPos(0, 27);
71
return jjStopAtPos(0, 18);
73
return jjStopAtPos(0, 16);
75
return jjStopAtPos(0, 17);
77
return jjStopAtPos(0, 28);
80
return jjMoveStringLiteralDfa1_0(0x1000L);
83
return jjMoveStringLiteralDfa1_0(0x200L);
85
return jjStartNfaWithStates_0(0, 8, 49);
87
return jjMoveNfa_0(3, 0);
90
private int jjMoveStringLiteralDfa1_0(long active0){
91
try { curChar = input_stream.readChar(); }
92
catch(java.io.IOException e) {
93
jjStopStringLiteralDfa_0(0, active0);
99
if ((active0 & 0x200L) != 0L)
100
return jjStartNfaWithStates_0(1, 9, 49);
101
else if ((active0 & 0x1000L) != 0L)
102
return jjStartNfaWithStates_0(1, 12, 49);
107
return jjStartNfa_0(0, active0);
109
private int jjStartNfaWithStates_0(int pos, int kind, int state)
111
jjmatchedKind = kind;
113
try { curChar = input_stream.readChar(); }
114
catch(java.io.IOException e) { return pos + 1; }
115
return jjMoveNfa_0(state, pos + 1);
117
private int jjMoveNfa_0(int startState, int curPos)
122
jjstateSet[0] = startState;
123
int kind = 0x7fffffff;
126
if (++jjround == 0x7fffffff)
130
long l = 1L << curChar;
133
switch(jjstateSet[--i])
136
if ((0x3ff000000000000L & l) != 0L)
142
else if ((0x7000000000000000L & l) != 0L)
147
else if (curChar == 33)
149
else if (curChar == 38)
150
jjstateSet[jjnewStateCnt++] = 41;
153
else if (curChar == 61)
155
else if (curChar == 60)
157
else if (curChar == 33)
164
if ((0x3ff000000000000L & l) != 0L)
170
else if (curChar == 60)
171
jjstateSet[jjnewStateCnt++] = 65;
174
if ((0x3ff000000000000L & l) != 0L)
180
else if (curChar == 60)
181
jjstateSet[jjnewStateCnt++] = 58;
184
if (curChar == 38 && kind > 14)
189
jjstateSet[jjnewStateCnt++] = 41;
192
if (curChar == 33 && kind > 15)
196
if ((0x3ff000000000000L & l) == 0L)
203
if ((0x3ff000000000000L & l) == 0L)
210
if ((0x7000000000000000L & l) != 0L && kind > 21)
214
if (curChar == 61 && kind > 21)
234
if (curChar == 62 && kind > 10)
239
jjstateSet[jjnewStateCnt++] = 58;
242
if (curChar == 62 && kind > 4)
247
jjstateSet[jjnewStateCnt++] = 65;
251
} while(i != startsAt);
253
else if (curChar < 128)
255
long l = 1L << (curChar & 077);
258
switch(jjstateSet[--i])
261
if ((0x7fffffe87fffffeL & l) != 0L)
267
else if (curChar == 124)
268
jjstateSet[jjnewStateCnt++] = 36;
270
{ jjAddStates(0, 3); }
271
else if (curChar == 65)
272
{ jjAddStates(4, 7); }
273
else if (curChar == 110)
274
jjstateSet[jjnewStateCnt++] = 44;
275
else if (curChar == 97)
276
jjstateSet[jjnewStateCnt++] = 39;
277
else if (curChar == 111)
278
jjstateSet[jjnewStateCnt++] = 34;
279
else if (curChar == 68)
280
jjstateSet[jjnewStateCnt++] = 32;
281
else if (curChar == 100)
282
jjstateSet[jjnewStateCnt++] = 24;
283
else if (curChar == 70)
284
jjstateSet[jjnewStateCnt++] = 16;
285
else if (curChar == 102)
286
jjstateSet[jjnewStateCnt++] = 11;
287
else if (curChar == 84)
288
jjstateSet[jjnewStateCnt++] = 6;
289
else if (curChar == 116)
290
jjstateSet[jjnewStateCnt++] = 2;
293
if ((0x7fffffe87fffffeL & l) != 0L)
299
else if (curChar == 91)
300
jjstateSet[jjnewStateCnt++] = 68;
306
else if (curChar == 70)
313
if ((0x7fffffe87fffffeL & l) != 0L)
319
else if (curChar == 91)
320
jjstateSet[jjnewStateCnt++] = 61;
326
else if (curChar == 70)
333
if (curChar == 101 && kind > 1)
338
jjstateSet[jjnewStateCnt++] = 0;
342
jjstateSet[jjnewStateCnt++] = 1;
345
if (curChar == 69 && kind > 1)
350
jjstateSet[jjnewStateCnt++] = 4;
354
jjstateSet[jjnewStateCnt++] = 5;
358
jjstateSet[jjnewStateCnt++] = 6;
361
if (curChar == 101 && kind > 2)
366
jjstateSet[jjnewStateCnt++] = 8;
370
jjstateSet[jjnewStateCnt++] = 9;
374
jjstateSet[jjnewStateCnt++] = 10;
378
jjstateSet[jjnewStateCnt++] = 11;
381
if (curChar == 69 && kind > 2)
386
jjstateSet[jjnewStateCnt++] = 13;
390
jjstateSet[jjnewStateCnt++] = 14;
394
jjstateSet[jjnewStateCnt++] = 15;
398
jjstateSet[jjnewStateCnt++] = 16;
401
if (curChar == 107 && kind > 3)
406
jjstateSet[jjnewStateCnt++] = 18;
410
jjstateSet[jjnewStateCnt++] = 19;
414
jjstateSet[jjnewStateCnt++] = 20;
418
jjstateSet[jjnewStateCnt++] = 21;
422
jjstateSet[jjnewStateCnt++] = 22;
426
jjstateSet[jjnewStateCnt++] = 23;
430
jjstateSet[jjnewStateCnt++] = 24;
433
if (curChar == 75 && kind > 3)
438
jjstateSet[jjnewStateCnt++] = 26;
442
jjstateSet[jjnewStateCnt++] = 27;
446
jjstateSet[jjnewStateCnt++] = 28;
450
jjstateSet[jjnewStateCnt++] = 29;
454
jjstateSet[jjnewStateCnt++] = 30;
458
jjstateSet[jjnewStateCnt++] = 31;
462
jjstateSet[jjnewStateCnt++] = 32;
465
if (curChar == 114 && kind > 13)
470
jjstateSet[jjnewStateCnt++] = 34;
473
if (curChar == 124 && kind > 13)
478
jjstateSet[jjnewStateCnt++] = 36;
481
if (curChar == 100 && kind > 14)
486
jjstateSet[jjnewStateCnt++] = 38;
490
jjstateSet[jjnewStateCnt++] = 39;
493
if (curChar == 116 && kind > 15)
498
jjstateSet[jjnewStateCnt++] = 43;
502
jjstateSet[jjnewStateCnt++] = 44;
505
if ((0x7fffffe87fffffeL & l) == 0L)
512
if ((0x7fffffe87fffffeL & l) == 0L)
520
{ jjAddStates(4, 7); }
523
if (curChar == 71 && kind > 11)
527
if (curChar == 93 && kind > 11)
532
jjstateSet[jjnewStateCnt++] = 61;
536
{ jjAddStates(0, 3); }
539
if (curChar == 71 && kind > 5)
543
if (curChar == 93 && kind > 5)
548
jjstateSet[jjnewStateCnt++] = 68;
552
} while(i != startsAt);
556
int i2 = (curChar & 0xff) >> 6;
557
long l2 = 1L << (curChar & 077);
560
switch(jjstateSet[--i])
564
} while(i != startsAt);
566
if (kind != 0x7fffffff)
568
jjmatchedKind = kind;
569
jjmatchedPos = curPos;
573
if ((i = jjnewStateCnt) == (startsAt = 70 - (jjnewStateCnt = startsAt)))
575
try { curChar = input_stream.readChar(); }
576
catch(java.io.IOException e) { return curPos; }
580
/** Token literal values. */
581
public static final String[] jjstrLiteralImages = {
582
"", null, null, null, null, null, "\105", "\101", "\125", "\105\130", null,
583
null, "\101\130", null, null, null, "\53", "\55", "\52", null, null, null, null,
584
null, null, null, "\50", "\51", "\56", };
585
protected Token jjFillToken()
588
final String curTokenImage;
591
final int beginColumn;
593
String im = jjstrLiteralImages[jjmatchedKind];
594
curTokenImage = (im == null) ? input_stream.GetImage() : im;
595
beginLine = input_stream.getBeginLine();
596
beginColumn = input_stream.getBeginColumn();
597
endLine = input_stream.getEndLine();
598
endColumn = input_stream.getEndColumn();
599
t = Token.newToken(jjmatchedKind);
600
t.kind = jjmatchedKind;
601
t.image = curTokenImage;
603
t.beginLine = beginLine;
605
t.beginColumn = beginColumn;
606
t.endColumn = endColumn;
610
static final int[] jjnextStates = {
611
64, 66, 67, 69, 57, 59, 60, 62,
615
int defaultLexState = 0;
621
/** Get the next Token. */
622
public Token getNextToken()
632
curChar = input_stream.BeginToken();
638
matchedToken = jjFillToken();
642
try { input_stream.backup(0);
643
while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
644
curChar = input_stream.BeginToken();
646
catch (java.io.IOException e1) { continue EOFLoop; }
647
jjmatchedKind = 0x7fffffff;
649
curPos = jjMoveStringLiteralDfa0_0();
650
if (jjmatchedKind != 0x7fffffff)
652
if (jjmatchedPos + 1 < curPos)
653
input_stream.backup(curPos - jjmatchedPos - 1);
654
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
656
matchedToken = jjFillToken();
664
int error_line = input_stream.getEndLine();
665
int error_column = input_stream.getEndColumn();
666
String error_after = null;
667
boolean EOFSeen = false;
668
try { input_stream.readChar(); input_stream.backup(1); }
669
catch (java.io.IOException e1) {
671
error_after = curPos <= 1 ? "" : input_stream.GetImage();
672
if (curChar == '\n' || curChar == '\r') {
680
input_stream.backup(1);
681
error_after = curPos <= 1 ? "" : input_stream.GetImage();
683
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
687
void SkipLexicalActions(Token matchedToken)
689
switch(jjmatchedKind)
695
void MoreLexicalActions()
697
jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
698
switch(jjmatchedKind)
704
void TokenLexicalActions(Token matchedToken)
706
switch(jjmatchedKind)
712
private void jjCheckNAdd(int state)
714
if (jjrounds[state] != jjround)
716
jjstateSet[jjnewStateCnt++] = state;
717
jjrounds[state] = jjround;
720
private void jjAddStates(int start, int end)
723
jjstateSet[jjnewStateCnt++] = jjnextStates[start];
724
} while (start++ != end);
726
private void jjCheckNAddTwoStates(int state1, int state2)
733
public TAPAALCTLQueryParserTokenManager(SimpleCharStream stream){
735
if (SimpleCharStream.staticFlag)
736
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
738
input_stream = stream;
742
public TAPAALCTLQueryParserTokenManager (SimpleCharStream stream, int lexState){
747
/** Reinitialise parser. */
749
public void ReInit(SimpleCharStream stream)
756
curLexState = defaultLexState;
757
input_stream = stream;
761
private void ReInitRounds()
764
jjround = 0x80000001;
765
for (i = 70; i-- > 0;)
766
jjrounds[i] = 0x80000000;
769
/** Reinitialise parser. */
770
public void ReInit(SimpleCharStream stream, int lexState)
777
/** Switch to specified lex state. */
778
public void SwitchTo(int lexState)
780
if (lexState >= 1 || lexState < 0)
781
throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
783
curLexState = lexState;
787
/** Lexer state names. */
788
public static final String[] lexStateNames = {
792
/** Lex State array. */
793
public static final int[] jjnewLexState = {
794
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
797
static final long[] jjtoToken = {
800
static final long[] jjtoSkip = {
803
static final long[] jjtoSpecial = {
806
static final long[] jjtoMore = {
809
protected SimpleCharStream input_stream;
811
private final int[] jjrounds = new int[70];
812
private final int[] jjstateSet = new int[2 * 70];
813
private final StringBuilder jjimage = new StringBuilder();
814
private StringBuilder image = jjimage;
815
private int jjimageLen;
816
private int lengthOfMatch;
817
protected int curChar;