CharStream

interface CharStream(source)

This interface describes a character stream that maintains line and column number positions of the characters. It also has the capability to backup the stream to some extent. An implementation of this interface is used in the TokenManager implementation generated by JavaCCParser. All the methods except backup can be implemented in any fashion. backup needs to be implemented correctly for the correct operation of the lexer. Rest of the methods are all used to get information like line number, column number and the String that constitutes a token and are not used by the lexer. Hence their implementation won't affect the generated lexer's operation.

Inheritors

Functions

Link copied to clipboard
abstract fun backup(amount: Int)
Backs up the input stream by amount steps.
Link copied to clipboard
abstract fun beginToken(): Char
Start matching a new token here.
Link copied to clipboard
abstract fun done()
The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class.
Link copied to clipboard
abstract fun getBeginColumn(): Int
Where the token being matched starts.
Link copied to clipboard
abstract fun getBeginLine(): Int
Where the token being matched starts.
Link copied to clipboard
abstract fun getEndColumn(): Int
Where the token being matched ends.
Link copied to clipboard
abstract fun getEndLine(): Int
Where the token being matched ends.
Link copied to clipboard
abstract fun getImage(): String
The text of the token being matched.
Link copied to clipboard
abstract fun getSuffix(len: Int): Array<Char>
The tail of the token being matched, for MORE productions.
Link copied to clipboard
abstract fun getTabSize(): Int
How wide a tab is taken to be when counting columns.
Link copied to clipboard
abstract fun isTrackLineColumn(): Boolean
Whether positions are being maintained at all.
Link copied to clipboard
abstract fun readChar(): Char
Get the next character from the selected input.
Link copied to clipboard
abstract fun setTabSize(i: Int)
Set the tab size to use.
Link copied to clipboard
abstract fun setTrackLineColumn(trackLineColumn: Boolean)
Enable or disable line number and column number tracking.