Class GenericSourceReader

    • Constructor Summary

      Constructors 
      Constructor Description
      GenericSourceReader​(java.io.Reader reader, SourceProvider sourceProvider, java.lang.String sourceFileName)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Integer get()
      Get the next character from the input stream.
      java.lang.String getFileName()
      Get the name of the file to which the object is bound to.
      int getLineNumber()
      Get the line number to which the object is bound to.
      int getPosition()
      Get the position on the line to which the object is bound to.
      SourceProvider getSourceProvider()
      Get the source provider that provided this reader.
      void unget​(java.lang.Integer ch)
      Readers should support lexical analyzers offering the possibility to push some characters back to the input stream, when a lexical analyzer can not decide its selection only consuming extra characters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenericSourceReader

        public GenericSourceReader​(java.io.Reader reader,
                                   SourceProvider sourceProvider,
                                   java.lang.String sourceFileName)
    • Method Detail

      • getFileName

        public java.lang.String getFileName()
        Description copied from interface: SourceLocationBound
        Get the name of the file to which the object is bound to.
        Specified by:
        getFileName in interface SourceLocationBound
        Returns:
        the name of the file
      • getPosition

        public int getPosition()
        Description copied from interface: SourceLocationBound
        Get the position on the line to which the object is bound to.
        Specified by:
        getPosition in interface SourceLocationBound
        Returns:
        the position within the line
      • unget

        public void unget​(java.lang.Integer ch)
        Readers should support lexical analyzers offering the possibility to push some characters back to the input stream, when a lexical analyzer can not decide its selection only consuming extra characters.

        Some of the readers may limit the operation of this push back functionality not supporting tracking line numbers, position and file name when this method is used.

        Lexical analyzers should push back the characters that were read from the reader the backward order as they were read. (Read last pushed back first.)

        Implementation should ignore null parameter.

        This implementation will not track the position properly when a new line character is pushed back. Such a push back does not happen when using Basic lexical analysis.

        Specified by:
        unget in interface SourceReader
        Parameters:
        ch - the character to push back
      • get

        public java.lang.Integer get()
        Get the next character from the input stream.
        Specified by:
        get in interface SourceReader
        Returns:
        return value