Class ANTLRInputStream

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected char[] data
      Deprecated.
      The data being scanned
      static int INITIAL_BUFFER_SIZE
      Deprecated.
       
      protected int n
      Deprecated.
      How many characters are actually in the buffer
      String name
      Deprecated.
      What is name or source of this char stream?
      protected int p
      Deprecated.
      0..n-1 index into string of next char
      static int READ_BUFFER_SIZE
      Deprecated.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void consume()
      Deprecated.
      Consumes the current symbol in the stream.
      String getSourceName()
      Deprecated.
      Gets the name of the underlying symbol source.
      String getText​(Interval interval)
      Deprecated.
      This method returns the text for a range of characters within this input stream.
      int index()
      Deprecated.
      Return the current input symbol index 0..n where n indicates the last symbol has been read.
      int LA​(int i)
      Deprecated.
      Gets the value of the symbol at offset i from the current position.
      void load​(Reader r, int size, int readChunkSize)
      Deprecated.
       
      int LT​(int i)
      Deprecated.
       
      int mark()
      Deprecated.
      mark/release do nothing; we have entire buffer
      void release​(int marker)
      Deprecated.
      This method releases a marked range created by a call to mark().
      void reset()
      Deprecated.
      Reset the stream so that it's in the same state it was when the object was created *except* the data array is not touched.
      void seek​(int index)
      Deprecated.
      consume() ahead until p==index; can't just set p=index as we must update line and charPositionInLine.
      int size()
      Deprecated.
      Returns the total number of symbols in the stream, including a single EOF symbol.
      String toString()
      Deprecated.
       
    • Field Detail

      • INITIAL_BUFFER_SIZE

        public static final int INITIAL_BUFFER_SIZE
        Deprecated.
        See Also:
        Constant Field Values
      • data

        protected char[] data
        Deprecated.
        The data being scanned
      • n

        protected int n
        Deprecated.
        How many characters are actually in the buffer
      • p

        protected int p
        Deprecated.
        0..n-1 index into string of next char
      • name

        public String name
        Deprecated.
        What is name or source of this char stream?
    • Constructor Detail

      • ANTLRInputStream

        public ANTLRInputStream()
        Deprecated.
      • ANTLRInputStream

        public ANTLRInputStream​(String input)
        Deprecated.
        Copy data in string to a local char array
      • ANTLRInputStream

        public ANTLRInputStream​(char[] data,
                                int numberOfActualCharsInArray)
        Deprecated.
        This is the preferred constructor for strings as no data is copied
      • ANTLRInputStream

        public ANTLRInputStream​(Reader r,
                                int initialSize,
                                int readChunkSize)
                         throws IOException
        Deprecated.
        Throws:
        IOException
    • Method Detail

      • reset

        public void reset()
        Deprecated.
        Reset the stream so that it's in the same state it was when the object was created *except* the data array is not touched.
      • consume

        public void consume()
        Deprecated.
        Description copied from interface: IntStream
        Consumes the current symbol in the stream. This method has the following effects:
        • Forward movement: The value of index() before calling this method is less than the value of index() after calling this method.
        • Ordered lookahead: The value of LA(1) before calling this method becomes the value of LA(-1) after calling this method.
        Note that calling this method does not guarantee that index() is incremented by exactly 1, as that would preclude the ability to implement filtering streams (e.g. CommonTokenStream which distinguishes between "on-channel" and "off-channel" tokens).
        Specified by:
        consume in interface IntStream
      • LA

        public int LA​(int i)
        Deprecated.
        Description copied from interface: IntStream
        Gets the value of the symbol at offset i from the current position. When i==1, this method returns the value of the current symbol in the stream (which is the next symbol to be consumed). When i==-1, this method returns the value of the previously read symbol in the stream. It is not valid to call this method with i==0, but the specific behavior is unspecified because this method is frequently called from performance-critical code.

        This method is guaranteed to succeed if any of the following are true:

        • i>0
        • i==-1 and index() returns a value greater than the value of index() after the stream was constructed and LA(1) was called in that order. Specifying the current index() relative to the index after the stream was created allows for filtering implementations that do not return every symbol from the underlying source. Specifying the call to LA(1) allows for lazily initialized streams.
        • LA(i) refers to a symbol consumed within a marked region that has not yet been released.

        If i represents a position at or beyond the end of the stream, this method returns IntStream.EOF.

        The return value is unspecified if i<0 and fewer than -i calls to consume() have occurred from the beginning of the stream before calling this method.

        Specified by:
        LA in interface IntStream
      • LT

        public int LT​(int i)
        Deprecated.
      • index

        public int index()
        Deprecated.
        Return the current input symbol index 0..n where n indicates the last symbol has been read. The index is the index of char to be returned from LA(1).
        Specified by:
        index in interface IntStream
      • size

        public int size()
        Deprecated.
        Description copied from interface: IntStream
        Returns the total number of symbols in the stream, including a single EOF symbol.
        Specified by:
        size in interface IntStream
      • mark

        public int mark()
        Deprecated.
        mark/release do nothing; we have entire buffer
        Specified by:
        mark in interface IntStream
        Returns:
        An opaque marker which should be passed to release() when the marked range is no longer required.
      • release

        public void release​(int marker)
        Deprecated.
        Description copied from interface: IntStream
        This method releases a marked range created by a call to mark(). Calls to release() must appear in the reverse order of the corresponding calls to mark(). If a mark is released twice, or if marks are not released in reverse order of the corresponding calls to mark(), the behavior is unspecified.

        For more information and an example, see IntStream.mark().

        Specified by:
        release in interface IntStream
        Parameters:
        marker - A marker returned by a call to mark().
        See Also:
        IntStream.mark()
      • seek

        public void seek​(int index)
        Deprecated.
        consume() ahead until p==index; can't just set p=index as we must update line and charPositionInLine. If we seek backwards, just set p
        Specified by:
        seek in interface IntStream
        Parameters:
        index - The absolute index to seek to.
      • getText

        public String getText​(Interval interval)
        Deprecated.
        Description copied from interface: CharStream
        This method returns the text for a range of characters within this input stream. This method is guaranteed to not throw an exception if the specified interval lies entirely within a marked range. For more information about marked ranges, see IntStream.mark().
        Specified by:
        getText in interface CharStream
        Parameters:
        interval - an interval within the stream
        Returns:
        the text of the specified interval
      • getSourceName

        public String getSourceName()
        Deprecated.
        Description copied from interface: IntStream
        Gets the name of the underlying symbol source. This method returns a non-null, non-empty string. If such a name is not known, this method returns IntStream.UNKNOWN_SOURCE_NAME.
        Specified by:
        getSourceName in interface IntStream