Top Description Fields Methods
org.antlr.runtime

public Interface CharStream

extends IntStream
Known Direct Implementers
org.antlr.runtime.ANTLRStringStream

A source of characters for an ANTLR lexer

Field Summary

Modifier and TypeField and Description
public static final int

Method Summary

Modifier and TypeMethod and Description
public int
getCharPositionInLine()

The index of the character relative to the beginning of the line 0..n-1

public int
getLine()

ANTLR tracks the line information automatically

public int
LT(int i)

Get the ith character of lookahead.

public void
public void
setLine(int line)

Because this stream can rewind, we need to be able to reset the line

public String
substring(int start, int stop)

For infinite streams, you don't need this; primarily I'm providing a useful interface for action code.

Inherited from org.antlr.runtime.IntStream:
consumegetSourceNameindexLAmarkreleaserewindrewindseeksize

Field Detail

EOFback to summary
public static final int EOF

Method Detail

getCharPositionInLineback to summary
public int getCharPositionInLine()

The index of the character relative to the beginning of the line 0..n-1

getLineback to summary
public int getLine()

ANTLR tracks the line information automatically

LTback to summary
public 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.

setCharPositionInLineback to summary
public void setCharPositionInLine(int pos)
setLineback to summary
public void setLine(int line)

Because this stream can rewind, we need to be able to reset the line

substringback to summary
public 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.