From: Tim P <ti...@us...> - 2008-03-17 23:50:00
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/parser In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23551/src/org/webmacro/parser Modified Files: WMParser_implTokenManager.java Log Message: Generated with 4.1, not 3.0, comments in grammar maintained in generated code, unused code no longer generated Index: WMParser_implTokenManager.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implTokenManager.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** WMParser_implTokenManager.java 29 Jan 2008 10:08:57 -0000 1.31 --- WMParser_implTokenManager.java 17 Mar 2008 23:49:48 -0000 1.32 *************** *** 2,10 **** --- 2,14 ---- package org.webmacro.parser; + /** Token Manager. */ public class WMParser_implTokenManager implements WMParser_implConstants { // Required by SetState void backup(int n) { input_stream.backup(n); } + + /** Debug output. */ public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_4(int pos, long active0) *************** *** 24,28 **** return jjMoveNfa_4(jjStopStringLiteralDfa_4(pos, active0), pos + 1); } ! private final int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; --- 28,32 ---- return jjMoveNfa_4(jjStopStringLiteralDfa_4(pos, active0), pos + 1); } ! private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; *************** *** 30,34 **** return pos + 1; } ! private final int jjStartNfaWithStates_4(int pos, int kind, int state) { jjmatchedKind = kind; --- 34,38 ---- return pos + 1; } ! private int jjStartNfaWithStates_4(int pos, int kind, int state) { jjmatchedKind = kind; *************** *** 38,42 **** return jjMoveNfa_4(state, pos + 1); } ! private final int jjMoveStringLiteralDfa0_4() { switch(curChar) --- 42,46 ---- return jjMoveNfa_4(state, pos + 1); } ! private int jjMoveStringLiteralDfa0_4() { switch(curChar) *************** *** 57,61 **** } } ! private final int jjMoveStringLiteralDfa1_4(long active0) { try { curChar = input_stream.readChar(); } --- 61,65 ---- } } ! private int jjMoveStringLiteralDfa1_4(long active0) { try { curChar = input_stream.readChar(); } *************** *** 79,83 **** return jjStartNfa_4(0, active0); } ! private final int jjMoveStringLiteralDfa2_4(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 83,87 ---- return jjStartNfa_4(0, active0); } ! private int jjMoveStringLiteralDfa2_4(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 99,103 **** return jjStartNfa_4(1, active0); } ! private final int jjMoveStringLiteralDfa3_4(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 103,107 ---- return jjStartNfa_4(1, active0); } ! private int jjMoveStringLiteralDfa3_4(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 121,125 **** return jjStartNfa_4(2, active0); } ! private final int jjMoveStringLiteralDfa4_4(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 125,129 ---- return jjStartNfa_4(2, active0); } ! private int jjMoveStringLiteralDfa4_4(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 139,143 **** return jjStartNfa_4(3, active0); } ! private final int jjMoveStringLiteralDfa5_4(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 143,147 ---- return jjStartNfa_4(3, active0); } ! private int jjMoveStringLiteralDfa5_4(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 159,192 **** return jjStartNfa_4(4, active0); } - private final void jjCheckNAdd(int state) - { - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - private final void jjAddStates(int start, int end) - { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); - } - private final void jjCheckNAddTwoStates(int state1, int state2) - { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - private final void jjCheckNAddStates(int start, int end) - { - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); - } - private final void jjCheckNAddStates(int start) - { - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); - } static final long[] jjbitVec0 = { 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL --- 163,166 ---- *************** *** 195,206 **** 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; ! private final int jjMoveNfa_4(int startState, int curPos) { ! int[] nextStates; int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; ! int j, kind = 0x7fffffff; for (;;) { --- 169,181 ---- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; ! private int jjMoveNfa_4(int startState, int curPos) { ! //int[] nextStates; // not used int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; ! //int j; // not used ! int kind = 0x7fffffff; for (;;) { *************** *** 327,331 **** return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); } ! private final int jjStartNfaWithStates_1(int pos, int kind, int state) { jjmatchedKind = kind; --- 302,306 ---- return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); } ! private int jjStartNfaWithStates_1(int pos, int kind, int state) { jjmatchedKind = kind; *************** *** 335,339 **** return jjMoveNfa_1(state, pos + 1); } ! private final int jjMoveStringLiteralDfa0_1() { switch(curChar) --- 310,314 ---- return jjMoveNfa_1(state, pos + 1); } ! private int jjMoveStringLiteralDfa0_1() { switch(curChar) *************** *** 349,360 **** } } ! private final int jjMoveNfa_1(int startState, int curPos) { ! int[] nextStates; int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; ! int j, kind = 0x7fffffff; for (;;) { --- 324,336 ---- } } ! private int jjMoveNfa_1(int startState, int curPos) { ! //int[] nextStates; // not used int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; ! //int j; // not used ! int kind = 0x7fffffff; for (;;) { *************** *** 469,484 **** } } ! private final int jjMoveStringLiteralDfa0_2() { return jjMoveNfa_2(0, 0); } ! private final int jjMoveNfa_2(int startState, int curPos) { ! int[] nextStates; int startsAt = 0; jjnewStateCnt = 1; int i = 1; jjstateSet[0] = startState; ! int j, kind = 0x7fffffff; for (;;) { --- 445,461 ---- } } ! private int jjMoveStringLiteralDfa0_2() { return jjMoveNfa_2(0, 0); } ! private int jjMoveNfa_2(int startState, int curPos) { ! //int[] nextStates; // not used int startsAt = 0; jjnewStateCnt = 1; int i = 1; jjstateSet[0] = startState; ! //int j; // not used ! int kind = 0x7fffffff; for (;;) { *************** *** 637,641 **** return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); } ! private final int jjStartNfaWithStates_3(int pos, int kind, int state) { jjmatchedKind = kind; --- 614,618 ---- return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); } ! private int jjStartNfaWithStates_3(int pos, int kind, int state) { jjmatchedKind = kind; *************** *** 645,649 **** return jjMoveNfa_3(state, pos + 1); } ! private final int jjMoveStringLiteralDfa0_3() { switch(curChar) --- 622,626 ---- return jjMoveNfa_3(state, pos + 1); } ! private int jjMoveStringLiteralDfa0_3() { switch(curChar) *************** *** 707,711 **** } } ! private final int jjMoveStringLiteralDfa1_3(long active0) { try { curChar = input_stream.readChar(); } --- 684,688 ---- } } ! private int jjMoveStringLiteralDfa1_3(long active0) { try { curChar = input_stream.readChar(); } *************** *** 739,743 **** return jjStartNfa_3(0, active0); } ! private final int jjMoveStringLiteralDfa2_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 716,720 ---- return jjStartNfa_3(0, active0); } ! private int jjMoveStringLiteralDfa2_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 763,767 **** return jjStartNfa_3(1, active0); } ! private final int jjMoveStringLiteralDfa3_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 740,744 ---- return jjStartNfa_3(1, active0); } ! private int jjMoveStringLiteralDfa3_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 791,795 **** return jjStartNfa_3(2, active0); } ! private final int jjMoveStringLiteralDfa4_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 768,772 ---- return jjStartNfa_3(2, active0); } ! private int jjMoveStringLiteralDfa4_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 815,819 **** return jjStartNfa_3(3, active0); } ! private final int jjMoveStringLiteralDfa5_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 792,796 ---- return jjStartNfa_3(3, active0); } ! private int jjMoveStringLiteralDfa5_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 837,841 **** return jjStartNfa_3(4, active0); } ! private final int jjMoveStringLiteralDfa6_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 814,818 ---- return jjStartNfa_3(4, active0); } ! private int jjMoveStringLiteralDfa6_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 855,859 **** return jjStartNfa_3(5, active0); } ! private final int jjMoveStringLiteralDfa7_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 832,836 ---- return jjStartNfa_3(5, active0); } ! private int jjMoveStringLiteralDfa7_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 873,877 **** return jjStartNfa_3(6, active0); } ! private final int jjMoveStringLiteralDfa8_3(long old0, long active0) { if (((active0 &= old0)) == 0L) --- 850,854 ---- return jjStartNfa_3(6, active0); } ! private int jjMoveStringLiteralDfa8_3(long old0, long active0) { if (((active0 &= old0)) == 0L) *************** *** 893,904 **** return jjStartNfa_3(7, active0); } ! private final int jjMoveNfa_3(int startState, int curPos) { ! int[] nextStates; int startsAt = 0; jjnewStateCnt = 31; int i = 1; jjstateSet[0] = startState; ! int j, kind = 0x7fffffff; for (;;) { --- 870,882 ---- return jjStartNfa_3(7, active0); } ! private int jjMoveNfa_3(int startState, int curPos) { ! //int[] nextStates; // not used int startsAt = 0; jjnewStateCnt = 31; int i = 1; jjstateSet[0] = startState; ! //int j; // not used ! int kind = 0x7fffffff; for (;;) { *************** *** 1189,1193 **** return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } ! private final int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; --- 1167,1171 ---- return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } ! private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; *************** *** 1197,1201 **** return jjMoveNfa_0(state, pos + 1); } ! private final int jjMoveStringLiteralDfa0_0() { switch(curChar) --- 1175,1179 ---- return jjMoveNfa_0(state, pos + 1); } ! private int jjMoveStringLiteralDfa0_0() { switch(curChar) *************** *** 1211,1222 **** } } ! private final int jjMoveNfa_0(int startState, int curPos) { ! int[] nextStates; int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; ! int j, kind = 0x7fffffff; for (;;) { --- 1189,1201 ---- } } ! private int jjMoveNfa_0(int startState, int curPos) { ! //int[] nextStates; // not used int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; ! //int j; // not used ! int kind = 0x7fffffff; for (;;) { *************** *** 1346,1349 **** --- 1325,1330 ---- } } + + /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, null, null, null, "\175", *************** *** 1353,1356 **** --- 1334,1339 ---- "\135", "\72", "\56", "\74", "\74\75", "\76", "\76\75", "\75\75", "\75", null, "\53", "\55", "\52", "\57", null, null, null, "\54", "\73", null, null, null, null, null, }; + + /** Lexer state names. */ public static final String[] lexStateNames = { "SQS", *************** *** 1360,1363 **** --- 1343,1348 ---- "DEFAULT", }; + + /** Lex State array. */ public static final int[] jjnewLexState = { -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, *************** *** 1381,1393 **** int lengthOfMatch; protected char curChar; ! public WMParser_implTokenManager(CharStream stream) ! { input_stream = stream; } ! public WMParser_implTokenManager(CharStream stream, int lexState) ! { this(stream); SwitchTo(lexState); } public void ReInit(CharStream stream) { --- 1366,1381 ---- int lengthOfMatch; protected char curChar; ! /** Constructor. */ ! public WMParser_implTokenManager(CharStream stream){ input_stream = stream; } ! ! /** Constructor. */ ! public WMParser_implTokenManager(CharStream stream, int lexState){ this(stream); SwitchTo(lexState); } + + /** Reinitialise parser. */ public void ReInit(CharStream stream) { *************** *** 1397,1401 **** ReInitRounds(); } ! private final void ReInitRounds() { int i; --- 1385,1389 ---- ReInitRounds(); } ! private void ReInitRounds() { int i; *************** *** 1404,1407 **** --- 1392,1397 ---- jjrounds[i] = 0x80000000; } + + /** Reinitialise parser. */ public void ReInit(CharStream stream, int lexState) { *************** *** 1409,1412 **** --- 1399,1404 ---- SwitchTo(lexState); } + + /** Switch to specified lex state. */ public void SwitchTo(int lexState) { *************** *** 1419,1442 **** protected Token jjFillToken() { ! Token t = Token.newToken(jjmatchedKind); ! t.kind = jjmatchedKind; if (jjmatchedPos < 0) { if (image == null) ! t.image = ""; else ! t.image = image.toString(); ! t.beginLine = t.endLine = input_stream.getBeginLine(); ! t.beginColumn = t.endColumn = input_stream.getBeginColumn(); } else { String im = jjstrLiteralImages[jjmatchedKind]; ! t.image = (im == null) ? input_stream.GetImage() : im; ! t.beginLine = input_stream.getBeginLine(); ! t.beginColumn = input_stream.getBeginColumn(); ! t.endLine = input_stream.getEndLine(); ! t.endColumn = input_stream.getEndColumn(); } return t; } --- 1411,1445 ---- protected Token jjFillToken() { ! final Token t; ! final String tokenImage; ! final int beginLine; ! final int endLine; ! final int beginColumn; ! final int endColumn; if (jjmatchedPos < 0) { if (image == null) ! tokenImage = ""; else ! tokenImage = image.toString(); ! beginLine = endLine = input_stream.getBeginLine(); ! beginColumn = endColumn = input_stream.getBeginColumn(); } else { String im = jjstrLiteralImages[jjmatchedKind]; ! tokenImage = (im == null) ? input_stream.GetImage() : im; ! beginLine = input_stream.getBeginLine(); ! beginColumn = input_stream.getBeginColumn(); ! endLine = input_stream.getEndLine(); ! endColumn = input_stream.getEndColumn(); } + t = Token.newToken(jjmatchedKind); + t.image = tokenImage; + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + return t; } *************** *** 1449,1455 **** int jjmatchedKind; public Token getNextToken() { ! int kind; Token specialToken = null; Token matchedToken; --- 1452,1459 ---- int jjmatchedKind; + /** Get the next Token. */ public Token getNextToken() { ! //int kind; Token specialToken = null; Token matchedToken; *************** *** 1573,1575 **** --- 1577,1606 ---- } } + private void jjCheckNAdd(int state) + { + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } + } + private void jjAddStates(int start, int end) + { + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); + } + private void jjCheckNAddTwoStates(int state1, int state2) + { + jjCheckNAdd(state1); + jjCheckNAdd(state2); + } + + private void jjCheckNAddStates(int start, int end) + { + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); + } + } |