com.finalist.jag.template.parser
Class InputBuffer

java.lang.Object
  extended bycom.finalist.jag.template.parser.InputBuffer
Direct Known Subclasses:
CharBuffer

public abstract class InputBuffer
extends java.lang.Object

Class InputBuffer

Version:
%I%, %G%
Author:

Field Summary
protected  int markerOffset
          Field markerOffset
protected  int nMarkers
          Field nMarkers
protected  int numToConsume
          Field numToConsume
protected  CharQueue queue
          Field queue
 
Constructor Summary
InputBuffer()
          Create an input buffer
 
Method Summary
 void commit()
          This method updates the state of the input buffer so that the text matched since the most recent mark() is no longer held by the buffer.
 void consume()
          Mark another character for deferred consumption
abstract  void fill(int amount)
          Ensure that the input buffer is sufficiently full
 java.lang.String getCharsFromMark(int mark)
          Method getCharsFromMark
 java.lang.String getLAChars()
          Method getLAChars
 java.lang.String getMarkedChars()
          Method getMarkedChars
 boolean isMarked()
          Method isMarked
 char LA(int i)
          Get a lookahead character
 java.lang.String LAChars(int n)
          Method LAChars
 int mark()
          Return an integer marker that can be used to rewind the buffer to its current state.
 void rewind(int mark)
          Rewind the character buffer to a marker.
protected  void syncConsume()
          Sync up deferred consumption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nMarkers

protected int nMarkers
Field nMarkers


markerOffset

protected int markerOffset
Field markerOffset


numToConsume

protected int numToConsume
Field numToConsume


queue

protected CharQueue queue
Field queue

Constructor Detail

InputBuffer

public InputBuffer()
Create an input buffer

Method Detail

commit

public void commit()
This method updates the state of the input buffer so that the text matched since the most recent mark() is no longer held by the buffer. So, you either do a mark/rewind for failed predicate or mark/commit to keep on parsing without rewinding the input.


consume

public void consume()
Mark another character for deferred consumption


fill

public abstract void fill(int amount)
                   throws CharStreamException
Ensure that the input buffer is sufficiently full

Parameters:
amount -
Throws:
CharStreamException

getLAChars

public java.lang.String getLAChars()
Method getLAChars

Returns:

getCharsFromMark

public java.lang.String getCharsFromMark(int mark)
Method getCharsFromMark

Parameters:
mark -
Returns:

LAChars

public java.lang.String LAChars(int n)
                         throws CharStreamException
Method LAChars

Parameters:
n -
Returns:
Throws:
CharStreamException

getMarkedChars

public java.lang.String getMarkedChars()
Method getMarkedChars

Returns:

isMarked

public boolean isMarked()
Method isMarked

Returns:

LA

public char LA(int i)
        throws CharStreamException
Get a lookahead character

Parameters:
i -
Returns:
Throws:
CharStreamException

mark

public int mark()
Return an integer marker that can be used to rewind the buffer to its current state.

Returns:

rewind

public void rewind(int mark)
Rewind the character buffer to a marker.

Parameters:
mark - Marker returned previously from mark()

syncConsume

protected void syncConsume()
Sync up deferred consumption



Copyright © 2003-2005 SourceForge. All Rights Reserved.