Class ReparseSource

java.lang.Object
com.maroontress.clione.impl.ReparseSource
All Implemented Interfaces:
Source

public final class ReparseSource extends Object implements Source
The source that is created from the given character sequence.
  • Constructor Details

    • ReparseSource

      public ReparseSource(Collection<SourceChar> chars, String filename)
      Creates a new instance of ReparseSource.
      Parameters:
      chars - The character sequence.
      filename - The filename.
  • Method Details

    • close

      public void close()
      Closes this source and its upstream Source or Reader.
      Specified by:
      close in interface Source
    • getLocation

      public SourceLocation getLocation()
      Returns the current location of this source.
      Specified by:
      getLocation in interface Source
      Returns:
      The current location.
    • getChar

      public SourceChar getChar()
      Returns a new SourceChar object at the current location of this source or EOF.

      This method does not change the current location either if the return value represents EOF or is the object that has been pushed back. Otherwise, the current location proceeds the next one.

      This method may read two or more characters from the upstream Source or Reader. It may also replace one or more SourceChar objects with another SourceChar object and return it.

      Specified by:
      getChar in interface Source
      Returns:
      The new SourceChar object.
      See Also:
    • ungetChar

      public void ungetChar(SourceChar c)
      Pushes back the specified SourceChar object.

      The SourceChar object to push back must not represent EOF.

      This method does not change the current location.

      Specified by:
      ungetChar in interface Source
      Parameters:
      c - The SourceChar object to push back.
    • getFilename

      public String getFilename()
      Description copied from interface: Source
      Returns the filename.
      Specified by:
      getFilename in interface Source
      Returns:
      The filename. Or null if no filename is specified.