Class TransformationCatalogTextScanner


  • public class TransformationCatalogTextScanner
    extends java.lang.Object
    Implements the scanner for reserved words and other tokens that are generated from the input stream for the Transformation Catalog.
    Author:
    Jens Vöckler, Karan Vahi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.LineNumberReader mInputReader
      Stores the stream from which we are currently scanning.
      private int mLookAhead
      Captures the look-ahead character.
      private Token mPreviousToken
      Captures the previous token.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLineNumber()
      Obtains the current line number in the input stream from the outside.
      boolean hasMoreTokens()
      Checks for the availability of more input.
      Token nextToken()
      Obtains the next token from the input stream.
      private void skipWhitespace()
      Skips any white space and comments in the input.
      • Methods inherited from class java.lang.Object

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

      • mInputReader

        private java.io.LineNumberReader mInputReader
        Stores the stream from which we are currently scanning.
      • mLookAhead

        private int mLookAhead
        Captures the look-ahead character.
      • mPreviousToken

        private Token mPreviousToken
        Captures the previous token. Required to parse transformation value correctly.
    • Constructor Detail

      • TransformationCatalogTextScanner

        public TransformationCatalogTextScanner​(java.io.Reader reader)
                                         throws java.io.IOException
        Starts to scan the given stream.
        Parameters:
        reader - the reader stream from which we are reading the site catalog.
        Throws:
        java.io.IOException
    • Method Detail

      • getLineNumber

        public int getLineNumber()
        Obtains the current line number in the input stream from the outside.
        Returns:
        the current line number.
      • skipWhitespace

        private void skipWhitespace()
                             throws java.io.IOException
        Skips any white space and comments in the input. This method stops either at the end of file, or at any non-whitespace input character.
        Throws:
        java.io.IOException
      • hasMoreTokens

        public boolean hasMoreTokens()
                              throws java.io.IOException
        Checks for the availability of more input.
        Returns:
        true, if there is more to read, false for EOF.
        Throws:
        java.io.IOException
      • nextToken

        public Token nextToken()
                        throws java.io.IOException,
                               ScannerException
        Obtains the next token from the input stream.
        Returns:
        an instance conforming to the token interface, or null for eof.
        Throws:
        java.io.IOException - if something went wrong while reading
        java.lang.Exception - if a lexical error was encountered.
        ScannerException