Exemplo n.º 1
0
 /** Consumes a token without returning the value. */
 public void advance() {
   if (nextToken != null) {
     try {
       nextToken = scanner.yylex();
     } catch (IOException e) {
       nextToken = null;
     } catch (ScannerException e) {
       nextToken = null;
     }
   }
 }
Exemplo n.º 2
0
  /**
   * Creates the scanner and reads the first lookahead token.
   *
   * @param istream the input stream to tokenize.
   */
  public Scanner(DataInputStream istream) {
    super();

    scanner = new Lexer(istream);

    try {
      nextToken = scanner.yylex();
    } catch (IOException e) {
      nextToken = null;
    } catch (ScannerException e) {
      nextToken = null;
    }
  }