Interface CharStream

All Superinterfaces:
IntStream
All Known Implementing Classes:
ANTLRFileStream, ANTLRInputStream, ANTLRReaderStream, ANTLRStringStream

public interface CharStream extends IntStream
A source of characters for an ANTLR lexer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The index of the character relative to the beginning of the line 0..n-1
    int
    ANTLR tracks the line information automatically
    int
    LT(int i)
    Get the ith character of lookahead.
    void
     
    void
    setLine(int line)
    Because this stream can rewind, we need to be able to reset the line
    substring(int start, int stop)
    For infinite streams, you don't need this; primarily I'm providing a useful interface for action code.

    Methods inherited from interface org.antlr.runtime.IntStream

    consume, getSourceName, index, LA, mark, release, rewind, rewind, seek, size
  • Field Details

  • Method Details

    • substring

      String substring(int start, int stop)
      For infinite streams, you don't need this; primarily I'm providing a useful interface for action code. Just make sure actions don't use this on streams that don't support it.
    • LT

      int LT(int i)
      Get the ith character of lookahead. This is the same usually as LA(i). This will be used for labels in the generated lexer code. I'd prefer to return a char here type-wise, but it's probably better to be 32-bit clean and be consistent with LA.
    • getLine

      int getLine()
      ANTLR tracks the line information automatically
    • setLine

      void setLine(int line)
      Because this stream can rewind, we need to be able to reset the line
    • setCharPositionInLine

      void setCharPositionInLine(int pos)
    • getCharPositionInLine

      int getCharPositionInLine()
      The index of the character relative to the beginning of the line 0..n-1