to.etc.lexer
Class TextReaderBase

java.lang.Object
  extended by to.etc.lexer.TextReaderBase
Direct Known Subclasses:
ReaderScannerBase

public class TextReaderBase
extends java.lang.Object

A reader which helps with lexical scanning. This contains a variable lookahead text thingy.

Author:
Frits Jalvingh Created on Oct 28, 2009

Constructor Summary
TextReaderBase(java.lang.Object source, java.io.Reader r)
           
 
Method Summary
 void accept()
          Called to advance the character, WITHOUT copying it.
 void accept(int ct)
          Accept ct characters by skipping over them, they are NOT copied.
protected  void append(char c)
           
 void append(int c)
           
protected  void clearCopy()
           
 void copy()
           
 void copy(int count)
           
 java.lang.String getCopied()
           
protected  int getCurrentColumn()
           
protected  int getCurrentLine()
           
 java.lang.Object getSource()
           
 int LA()
          Returns the "current" character in the queue.
 int LA(int ix)
          Returns the ixth character for lookahead.
protected  java.lang.StringBuilder sb()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextReaderBase

public TextReaderBase(java.lang.Object source,
                      java.io.Reader r)
Method Detail

sb

protected java.lang.StringBuilder sb()

getCopied

public java.lang.String getCopied()

clearCopy

protected void clearCopy()

append

protected void append(char c)

append

public void append(int c)

getSource

public java.lang.Object getSource()

getCurrentLine

protected int getCurrentLine()

getCurrentColumn

protected int getCurrentColumn()

LA

public final int LA()
             throws java.io.IOException
Returns the "current" character in the queue.

Returns:
Throws:
java.io.IOException

LA

public final int LA(int ix)
             throws java.io.IOException
Returns the ixth character for lookahead. ix cannot exceed the max queue length.

Parameters:
ix -
Returns:
Throws:
java.io.IOException

accept

public void accept()
Called to advance the character, WITHOUT copying it. Consumes the current character, causing the next one to become the current one. Accept increments line numbers and column numbers.

Throws:
java.io.IOException

accept

public void accept(int ct)
Accept ct characters by skipping over them, they are NOT copied.

Parameters:
ct -

copy

public void copy()
          throws java.io.IOException
Throws:
java.io.IOException

copy

public void copy(int count)
          throws java.io.IOException
Throws:
java.io.IOException