protected Token jjFillToken() {
   Token t = Token.newToken(jjmatchedKind);
   t.kind = jjmatchedKind;
   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;
 }
Beispiel #2
0
 /** Reinitialise. */
 public void ReInit(java.io.Reader stream) {
   jj_input_stream.ReInit(stream, 1, 1);
   token_source.ReInit(jj_input_stream);
   token = new Token();
   token.next = jj_nt = token_source.getNextToken();
   jj_gen = 0;
   for (int i = 0; i < 3; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
Beispiel #3
0
 public void ReInit(java.io.Reader stream) {
   jj_input_stream.ReInit(stream, 1, 1);
   token_source.ReInit(jj_input_stream);
   token = new Token();
   jj_ntk = -1;
   jjtree.reset();
   jj_gen = 0;
   for (int i = 0; i < 26; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
Beispiel #4
0
 /** Reinitialise. */
 public void ReInit(java.io.InputStream stream, String encoding) {
   try {
     jj_input_stream.ReInit(stream, encoding, 1, 1);
   } catch (java.io.UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
   token_source.ReInit(jj_input_stream);
   token = new Token();
   token.next = jj_nt = token_source.getNextToken();
   jj_gen = 0;
   for (int i = 0; i < 3; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
 void TokenLexicalActions(Token matchedToken) {
   switch (jjmatchedKind) {
     case 6:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = COMMENT;
       CommonTokenAction(matchedToken);
       break;
     case 8:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = COMMENT;
       CommonTokenAction(matchedToken);
       break;
     case 10:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = CONSTANT;
       break;
     case 11:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = CONSTANT;
       break;
     case 12:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = CONSTANT;
       break;
     case 13:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = CONSTANT;
       break;
     case 15:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = CONSTANT;
       break;
     case 16:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = CONSTANT;
       break;
     case 18:
       if (image == null) image = new StringBuffer();
       image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
       matchedToken.style = IDENTIFIERS;
       break;
     case 30:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[30]);
       matchedToken.style = OPERATORS;
       break;
     case 37:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[37]);
       matchedToken.style = OPERATORS;
       break;
     case 38:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[38]);
       matchedToken.style = OPERATORS;
       break;
     case 39:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[39]);
       matchedToken.style = OPERATORS;
       break;
     case 40:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[40]);
       matchedToken.style = OPERATORS;
       break;
     case 41:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[41]);
       matchedToken.style = OPERATORS;
       break;
     case 42:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[42]);
       matchedToken.style = OPERATORS;
       break;
     case 56:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[56]);
       matchedToken.style = OPERATORS;
       break;
     case 57:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[57]);
       matchedToken.style = OPERATORS;
       break;
     case 58:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[58]);
       matchedToken.style = OPERATORS;
       break;
     case 59:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[59]);
       matchedToken.style = OPERATORS;
       break;
     case 60:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[60]);
       matchedToken.style = OPERATORS;
       break;
     case 61:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[61]);
       matchedToken.style = OPERATORS;
       break;
     case 62:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[62]);
       matchedToken.style = OPERATORS;
       break;
     case 63:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[63]);
       matchedToken.style = OPERATORS;
       break;
     case 64:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[64]);
       matchedToken.style = OPERATORS;
       break;
     case 65:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[65]);
       matchedToken.style = OPERATORS;
       break;
     case 66:
       if (image == null) image = new StringBuffer();
       image.append(jjstrLiteralImages[66]);
       matchedToken.style = OPERATORS;
       break;
     default:
       break;
   }
 }
  public Token getNextToken() {
    int kind;
    Token specialToken = null;
    Token matchedToken;
    int curPos = 0;

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

      for (; ; ) {
        switch (curLexState) {
          case 0:
            try {
              input_stream.backup(0);
              while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
                curChar = input_stream.BeginToken();
            } catch (java.io.IOException e1) {
              continue EOFLoop;
            }
            jjmatchedKind = 0x7fffffff;
            jjmatchedPos = 0;
            curPos = jjMoveStringLiteralDfa0_0();
            break;
          case 1:
            jjmatchedKind = 0x7fffffff;
            jjmatchedPos = 0;
            curPos = jjMoveStringLiteralDfa0_1();
            if (jjmatchedPos == 0 && jjmatchedKind > 9) {
              jjmatchedKind = 9;
            }
            break;
        }
        if (jjmatchedKind != 0x7fffffff) {
          if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1);
          if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
            matchedToken = jjFillToken();
            TokenLexicalActions(matchedToken);
            if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind];
            CommonTokenAction(matchedToken);
            return matchedToken;
          } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
            if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind];
            continue EOFLoop;
          }
          jjimageLen += jjmatchedPos + 1;
          if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind];
          curPos = 0;
          jjmatchedKind = 0x7fffffff;
          try {
            curChar = input_stream.readChar();
            continue;
          } catch (java.io.IOException e1) {
          }
        }
        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);
      }
    }
  }