All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.officefloor.web.template.parse.WebTemplateParserTokenManager Maven / Gradle / Ivy

There is a newer version: 3.40.0
Show newest version
/* Generated By:JavaCC: Do not edit this line. WebTemplateParserTokenManager.java */
package net.officefloor.web.template.parse;
import java.util.List;
import java.util.LinkedList;
import java.io.IOException;
import java.io.Reader;

/** Token Manager. */
public class WebTemplateParserTokenManager implements WebTemplateParserConstants
{

  /** Debug output. */
  public  java.io.PrintStream debugStream = System.out;
  /** Set debug output. */
  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private int jjMoveStringLiteralDfa0_0()
{
   return jjMoveNfa_0(11, 0);
}
private int jjMoveNfa_0(int startState, int curPos)
{
   int startsAt = 0;
   jjnewStateCnt = 70;
   int i = 1;
   jjstateSet[0] = startState;
   int kind = 0x7fffffff;
   for (;;)
   {
      if (++jjround == 0x7fffffff)
         ReInitRounds();
      if (curChar < 64)
      {
         long l = 1L << curChar;
         do
         {
            switch(jjstateSet[--i])
            {
               case 11:
                  if ((0x100002600L & l) != 0L)
                     jjstateSet[jjnewStateCnt++] = 14;
                  else if (curChar == 60)
                     jjAddStates(0, 2);
                  else if (curChar == 36)
                     jjCheckNAddStates(3, 5);
                  else if (curChar == 35)
                     jjstateSet[jjnewStateCnt++] = 0;
                  break;
               case 3:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddStates(6, 9);
                  break;
               case 4:
                  if (curChar == 44)
                     jjstateSet[jjnewStateCnt++] = 5;
                  break;
               case 6:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddStates(10, 12);
                  break;
               case 7:
                  if (curChar == 58)
                     jjstateSet[jjnewStateCnt++] = 8;
                  break;
               case 9:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjAddStates(13, 14);
                  break;
               case 12:
                  if ((0x100002600L & l) != 0L)
                     jjstateSet[jjnewStateCnt++] = 14;
                  break;
               case 14:
                  if (curChar == 36)
                     jjCheckNAdd(13);
                  break;
               case 15:
                  if (curChar == 36)
                     jjCheckNAddStates(3, 5);
                  break;
               case 18:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddStates(15, 17);
                  break;
               case 19:
                  if (curChar == 46)
                     jjstateSet[jjnewStateCnt++] = 20;
                  break;
               case 21:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddStates(18, 20);
                  break;
               case 25:
                  if ((0x3ff000000000000L & l) == 0L)
                     break;
                  if (kind > 6)
                     kind = 6;
                  jjCheckNAddStates(21, 23);
                  break;
               case 26:
                  if (curChar == 46)
                     jjstateSet[jjnewStateCnt++] = 27;
                  break;
               case 28:
                  if ((0x3ff000000000000L & l) == 0L)
                     break;
                  if (kind > 6)
                     kind = 6;
                  jjCheckNAddStates(24, 26);
                  break;
               case 29:
                  if ((0x100002600L & l) != 0L && kind > 6)
                     kind = 6;
                  break;
               case 30:
                  if (curChar == 60)
                     jjAddStates(0, 2);
                  break;
               case 31:
                  if (curChar == 45)
                     jjCheckNAddTwoStates(32, 33);
                  break;
               case 32:
                  if ((0x100002600L & l) != 0L)
                     jjCheckNAddTwoStates(32, 33);
                  break;
               case 34:
                  if (curChar == 58)
                     jjstateSet[jjnewStateCnt++] = 35;
                  break;
               case 36:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddTwoStates(36, 37);
                  break;
               case 38:
                  if ((0x100002600L & l) != 0L)
                     jjAddStates(27, 28);
                  break;
               case 39:
                  if (curChar == 62 && kind > 3)
                     kind = 3;
                  break;
               case 40:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 39;
                  break;
               case 41:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 40;
                  break;
               case 42:
                  if (curChar == 33)
                     jjCheckNAdd(37);
                  break;
               case 43:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 31;
                  break;
               case 44:
                  if (curChar == 33)
                     jjstateSet[jjnewStateCnt++] = 43;
                  break;
               case 45:
                  if (curChar == 45)
                     jjCheckNAddTwoStates(46, 57);
                  break;
               case 46:
                  if ((0x100002600L & l) != 0L)
                     jjCheckNAddTwoStates(46, 57);
                  break;
               case 49:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddStates(29, 32);
                  break;
               case 50:
                  if (curChar == 46)
                     jjstateSet[jjnewStateCnt++] = 51;
                  break;
               case 52:
                  if ((0x3ff000000000000L & l) != 0L)
                     jjCheckNAddStates(33, 36);
                  break;
               case 53:
                  if (curChar == 62 && kind > 4)
                     kind = 4;
                  break;
               case 54:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 53;
                  break;
               case 55:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 54;
                  break;
               case 56:
                  if ((0x100002600L & l) != 0L)
                     jjCheckNAddTwoStates(56, 55);
                  break;
               case 57:
                  if (curChar == 36)
                     jjstateSet[jjnewStateCnt++] = 47;
                  break;
               case 58:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 45;
                  break;
               case 59:
                  if (curChar == 33)
                     jjstateSet[jjnewStateCnt++] = 58;
                  break;
               case 60:
                  if (curChar == 45)
                     jjCheckNAddTwoStates(66, 67);
                  break;
               case 62:
                  if ((0x100002600L & l) != 0L)
                     jjAddStates(37, 38);
                  break;
               case 63:
                  if (curChar == 62 && kind > 5)
                     kind = 5;
                  break;
               case 64:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 63;
                  break;
               case 65:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 64;
                  break;
               case 66:
                  if (curChar == 36)
                     jjstateSet[jjnewStateCnt++] = 61;
                  break;
               case 67:
                  if ((0x100002600L & l) != 0L)
                     jjCheckNAddTwoStates(66, 67);
                  break;
               case 68:
                  if (curChar == 45)
                     jjstateSet[jjnewStateCnt++] = 60;
                  break;
               case 69:
                  if (curChar == 33)
                     jjstateSet[jjnewStateCnt++] = 68;
                  break;
               default : break;
            }
         } while(i != startsAt);
      }
      else if (curChar < 128)
      {
         long l = 1L << (curChar & 077);
         do
         {
            switch(jjstateSet[--i])
            {
               case 0:
                  if (curChar == 123)
                     jjstateSet[jjnewStateCnt++] = 1;
                  break;
               case 1:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(39, 44);
                  break;
               case 2:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(6, 9);
                  break;
               case 3:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddStates(6, 9);
                  break;
               case 5:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(10, 12);
                  break;
               case 6:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddStates(10, 12);
                  break;
               case 8:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddTwoStates(9, 10);
                  break;
               case 9:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddTwoStates(9, 10);
                  break;
               case 10:
                  if (curChar == 125 && kind > 1)
                     kind = 1;
                  break;
               case 13:
                  if (curChar == 125 && kind > 7)
                     kind = 7;
                  break;
               case 16:
                  if (curChar == 123)
                     jjstateSet[jjnewStateCnt++] = 17;
                  break;
               case 17:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(15, 17);
                  break;
               case 18:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddStates(15, 17);
                  break;
               case 20:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(18, 20);
                  break;
               case 21:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddStates(18, 20);
                  break;
               case 22:
                  if (curChar == 125 && kind > 2)
                     kind = 2;
                  break;
               case 23:
                  if (curChar == 123)
                     jjstateSet[jjnewStateCnt++] = 24;
                  break;
               case 24:
                  if ((0x7fffffe07fffffeL & l) == 0L)
                     break;
                  if (kind > 6)
                     kind = 6;
                  jjCheckNAddStates(21, 23);
                  break;
               case 25:
                  if ((0x7fffffe87fffffeL & l) == 0L)
                     break;
                  if (kind > 6)
                     kind = 6;
                  jjCheckNAddStates(21, 23);
                  break;
               case 27:
                  if ((0x7fffffe07fffffeL & l) == 0L)
                     break;
                  if (kind > 6)
                     kind = 6;
                  jjCheckNAddStates(24, 26);
                  break;
               case 28:
                  if ((0x7fffffe87fffffeL & l) == 0L)
                     break;
                  if (kind > 6)
                     kind = 6;
                  jjCheckNAddStates(24, 26);
                  break;
               case 33:
                  if (curChar == 123)
                     jjAddStates(45, 47);
                  break;
               case 35:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddTwoStates(36, 37);
                  break;
               case 36:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddTwoStates(36, 37);
                  break;
               case 37:
                  if (curChar == 125)
                     jjAddStates(27, 28);
                  break;
               case 47:
                  if (curChar == 123)
                     jjstateSet[jjnewStateCnt++] = 48;
                  break;
               case 48:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(29, 32);
                  break;
               case 49:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddStates(29, 32);
                  break;
               case 51:
                  if ((0x7fffffe07fffffeL & l) != 0L)
                     jjCheckNAddStates(33, 36);
                  break;
               case 52:
                  if ((0x7fffffe87fffffeL & l) != 0L)
                     jjCheckNAddStates(33, 36);
                  break;
               case 61:
                  if (curChar == 125)
                     jjAddStates(37, 38);
                  break;
               default : break;
            }
         } while(i != startsAt);
      }
      else
      {
         int i2 = (curChar & 0xff) >> 6;
         long l2 = 1L << (curChar & 077);
         do
         {
            switch(jjstateSet[--i])
            {
               default : break;
            }
         } while(i != startsAt);
      }
      if (kind != 0x7fffffff)
      {
         jjmatchedKind = kind;
         jjmatchedPos = curPos;
         kind = 0x7fffffff;
      }
      ++curPos;
      if ((i = jjnewStateCnt) == (startsAt = 70 - (jjnewStateCnt = startsAt)))
         return curPos;
      try { curChar = input_stream.readChar(); }
      catch(java.io.IOException e) { return curPos; }
   }
}
static final int[] jjnextStates = {
   44, 59, 69, 16, 23, 13, 2, 3, 4, 7, 4, 6, 7, 9, 10, 18, 
   19, 22, 19, 21, 22, 25, 26, 29, 26, 28, 29, 38, 41, 49, 50, 55, 
   56, 50, 52, 55, 56, 62, 65, 2, 3, 4, 7, 9, 10, 34, 35, 42, 
};

/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null, };

/** Lexer state names. */
public static final String[] lexStateNames = {
   "DEFAULT",
};
protected SimpleCharStream input_stream;
private final int[] jjrounds = new int[70];
private final int[] jjstateSet = new int[140];
protected char curChar;
/** Constructor. */
public WebTemplateParserTokenManager(SimpleCharStream stream){
   if (SimpleCharStream.staticFlag)
      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
   input_stream = stream;
}

/** Constructor. */
public WebTemplateParserTokenManager(SimpleCharStream stream, int lexState){
   this(stream);
   SwitchTo(lexState);
}

/** Reinitialise parser. */
public void ReInit(SimpleCharStream stream)
{
   jjmatchedPos = jjnewStateCnt = 0;
   curLexState = defaultLexState;
   input_stream = stream;
   ReInitRounds();
}
private void ReInitRounds()
{
   int i;
   jjround = 0x80000001;
   for (i = 70; i-- > 0;)
      jjrounds[i] = 0x80000000;
}

/** Reinitialise parser. */
public void ReInit(SimpleCharStream stream, int lexState)
{
   ReInit(stream);
   SwitchTo(lexState);
}

/** Switch to specified lex state. */
public void SwitchTo(int lexState)
{
   if (lexState >= 1 || lexState < 0)
      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
   else
      curLexState = lexState;
}

protected Token jjFillToken()
{
   final Token t;
   final String curTokenImage;
   final int beginLine;
   final int endLine;
   final int beginColumn;
   final int endColumn;
   String im = jjstrLiteralImages[jjmatchedKind];
   curTokenImage = (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, curTokenImage);

   t.beginLine = beginLine;
   t.endLine = endLine;
   t.beginColumn = beginColumn;
   t.endColumn = endColumn;

   return t;
}

int curLexState = 0;
int defaultLexState = 0;
int jjnewStateCnt;
int jjround;
int jjmatchedPos;
int jjmatchedKind;

/** Get the next Token. */
public Token getNextToken() 
{
  Token matchedToken;
  int curPos = 0;

  EOFLoop :
  for (;;)
  {
   try
   {
      curChar = input_stream.BeginToken();
   }
   catch(java.io.IOException e)
   {
      jjmatchedKind = 0;
      matchedToken = jjFillToken();
      return matchedToken;
   }

   jjmatchedKind = 0x7fffffff;
   jjmatchedPos = 0;
   curPos = jjMoveStringLiteralDfa0_0();
   if (jjmatchedPos == 0 && jjmatchedKind > 8)
   {
      jjmatchedKind = 8;
   }
   if (jjmatchedKind != 0x7fffffff)
   {
      if (jjmatchedPos + 1 < curPos)
         input_stream.backup(curPos - jjmatchedPos - 1);
         matchedToken = jjFillToken();
         return matchedToken;
   }
   int error_line = input_stream.getEndLine();
   int error_column = input_stream.getEndColumn();
   String error_after = null;
   boolean EOFSeen = false;
   try { input_stream.readChar(); input_stream.backup(1); }
   catch (java.io.IOException e1) {
      EOFSeen = true;
      error_after = curPos <= 1 ? "" : input_stream.GetImage();
      if (curChar == '\n' || curChar == '\r') {
         error_line++;
         error_column = 0;
      }
      else
         error_column++;
   }
   if (!EOFSeen) {
      input_stream.backup(1);
      error_after = curPos <= 1 ? "" : input_stream.GetImage();
   }
   throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
  }
}

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);
}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy