Class PhaseOneSource

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

public final class PhaseOneSource extends Object implements Source
This source reads characters from upstream source, replacing trigraph sequences with the character that they represent.
  • Constructor Details

    • PhaseOneSource

      public PhaseOneSource(Source source)
      Creates a source replacing trigraph sequences.
      Parameters:
      source - The reader from which characters will be read.
  • Method Details

    • close

      public void close() throws IOException
      Closes this source and its upstream Source or Reader.
      Specified by:
      close in interface Source
      Throws:
      IOException - If an I/O error occurs.
    • getFilename

      public String getFilename()
      Returns the filename.
      Specified by:
      getFilename in interface Source
      Returns:
      The filename. Or null if no filename is specified.
    • 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() throws IOException
      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.
      Throws:
      IOException - If an I/O error occurs.
      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.