Class LookaheadTokenSourceProxy<D,T,L>

java.lang.Object
eu.bandm.tools.lexic.LookaheadTokenSourceProxy<D,T,L>
All Implemented Interfaces:
LookaheadTokenSource<D,T,L>, Closeable, AutoCloseable, Supplier<Token<D,T>>

public class LookaheadTokenSourceProxy<D,T,L> extends Object implements LookaheadTokenSource<D,T,L>
  • Constructor Details

    • LookaheadTokenSourceProxy

      public LookaheadTokenSourceProxy()
    • LookaheadTokenSourceProxy

      public LookaheadTokenSourceProxy(@Opt @Opt LookaheadTokenSource<D,T,L> source)
  • Method Details

    • setSource

      public void setSource(@Opt @Opt LookaheadTokenSource<D,T,L> source)
    • get

      public Token<D,T> get()
      Specified by:
      get in interface Supplier<D>
    • relinquishLookahead

      public L relinquishLookahead()
      Clear the internal lookahead buffer and return its contents.
      Specified by:
      relinquishLookahead in interface LookaheadTokenSource<D,T,L>
      Returns:
      the former contents of the internal lookahead buffer
    • takeOverLookahead

      public void takeOverLookahead(L lookaheadData)
      Fill the internal lookahead buffer with data.

      The buffer must be empty before this method is invoked. After return, the given data will be consumed from the buffer before the usual input is considered.

      Specified by:
      takeOverLookahead in interface LookaheadTokenSource<D,T,L>
      Parameters:
      lookaheadData - the lookahead data to fill in
    • close

      public void close()
      Closes this source and releases any resources associated with it.

      The default implementation does nothing.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface LookaheadTokenSource<D,T,L>