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
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
Link copied to clipboard
abstract fun getBeginLine(): Int
Link copied to clipboard
abstract fun getEndColumn(): Int
Link copied to clipboard
abstract fun getEndLine(): Int
Link copied to clipboard
abstract fun getImage(): String
Link copied to clipboard
abstract fun getSuffix(len: Int): Array<Char>
Link copied to clipboard
abstract fun getTabSize(): Int
Link copied to clipboard
abstract fun isTrackLineColumn(): Boolean
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.