View Javadoc

    1   package org.codehaus.groovy.syntax.lexer;
    2
    3   import org.codehaus.groovy.syntax.AbstractTokenStream;
    4   import org.codehaus.groovy.syntax.SyntaxException;
    5   import org.codehaus.groovy.syntax.ReadException;
    6   import org.codehaus.groovy.syntax.Token;
    7
    8
    9   /***
    10   *  Implements a <code>TokenStream</code> on a <code>Lexer</code>.
    11   */
    12
    13  public class LexerTokenStream
    14      extends AbstractTokenStream
    15  {
    16      private Lexer lexer;
    17
    18     /***
    19      *  Initializes the <code>LexerTokenStream</code>.
    20      */
    21
    22      public LexerTokenStream(Lexer lexer)
    23      {
    24          this.lexer = lexer;
    25      }
    26
    27
    28     /***
    29      *  Returns the underlying <code>Lexer</code>.
    30      */
    31
    32      public Lexer getLexer()
    33      {
    34          return this.lexer;
    35      }
    36
    37
    38     /***
    39      *  Returns the next token from the <code>Lexer</code>.
    40      */
    41
    42      public Token nextToken() throws ReadException, SyntaxException
    43      {
    44          return getLexer().nextToken();
    45      }
    46  }