예제 #1
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();
   jj_ntk = -1;
   jj_gen = 0;
   for (int i = 0; i < 5; i++) jj_la1[i] = -1;
 }
예제 #2
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();
   jj_ntk = -1;
   jj_gen = 0;
   for (int i = 0; i < 5; i++) jj_la1[i] = -1;
 }
예제 #3
0
  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;
  }
예제 #4
0
  /** 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;
      }

      try {
        input_stream.backup(0);
        while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
          curChar = input_stream.BeginToken();
      } catch (java.io.IOException e1) {
        continue EOFLoop;
      }
      jjmatchedKind = 0x7fffffff;
      jjmatchedPos = 0;
      curPos = jjMoveStringLiteralDfa0_0();
      if (jjmatchedKind != 0x7fffffff) {
        if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1);
        if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
          matchedToken = jjFillToken();
          return matchedToken;
        } else {
          continue EOFLoop;
        }
      }
      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);
    }
  }
  /** Get the next Token. */
  public Token getNextToken() {
    Token specialToken = null;
    Token matchedToken;
    int curPos = 0;

    EOFLoop:
    for (; ; ) {
      try {
        curChar = input_stream.BeginToken();
      } catch (java.io.IOException e) {
        jjmatchedKind = 0;
        matchedToken = jjFillToken();
        matchedToken.specialToken = specialToken;
        return matchedToken;
      }
      image = jjimage;
      image.setLength(0);
      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 > 10) {
              jjmatchedKind = 10;
            }
            break;
          case 2:
            jjmatchedKind = 0x7fffffff;
            jjmatchedPos = 0;
            curPos = jjMoveStringLiteralDfa0_2();
            if (jjmatchedPos == 0 && jjmatchedKind > 10) {
              jjmatchedKind = 10;
            }
            break;
        }
        if (jjmatchedKind != 0x7fffffff) {
          if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1);
          if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
            matchedToken = jjFillToken();
            matchedToken.specialToken = specialToken;
            if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind];
            return matchedToken;
          } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
            if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) {
              matchedToken = jjFillToken();
              if (specialToken == null) specialToken = matchedToken;
              else {
                matchedToken.specialToken = specialToken;
                specialToken = (specialToken.next = matchedToken);
              }
              SkipLexicalActions(matchedToken);
            } else SkipLexicalActions(null);
            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);
      }
    }
  }