fr.umlv.tatoo.runtime.buffer.impl
Class CharBufferWrapper

java.lang.Object
  extended by fr.umlv.tatoo.runtime.buffer.impl.CharBufferWrapper
All Implemented Interfaces:
CharacterBuffer, ErrorContextBuffer<LocationErrorContext>, TokenBuffer

public class CharBufferWrapper
extends Object
implements CharacterBuffer, TokenBuffer, ErrorContextBuffer<LocationErrorContext>


Constructor Summary
CharBufferWrapper(CharBuffer buffer)
           
 
Method Summary
 void compact()
           
 void discard()
          Discards all characters already recognized by the lexer.
 void flip()
           
 int getErrorChar()
           
 LocationErrorContext getErrorContext()
          Returns the context of an error that occurred in the lexer.
 boolean hasRemaining()
           
 char next()
          Reads the next character from the buffer.
 boolean previousWasNewLine()
          Determines if the last unwinded character was an end of line.
 void unwind(int l)
          Unwinds l characters from the buffer.
 CharSequence view()
          Provides a view of all available tokens.
 CharSequence viewCharacters(int nb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharBufferWrapper

public CharBufferWrapper(CharBuffer buffer)
Method Detail

unwind

public void unwind(int l)
Description copied from interface: CharacterBuffer
Unwinds l characters from the buffer.

Specified by:
unwind in interface CharacterBuffer
Parameters:
l - the number of characters to unwind

previousWasNewLine

public boolean previousWasNewLine()
Description copied from interface: CharacterBuffer
Determines if the last unwinded character was an end of line.

Specified by:
previousWasNewLine in interface CharacterBuffer
Returns:
true if the last unwinded character was an end of line; false otherwise

hasRemaining

public boolean hasRemaining()

next

public char next()
Description copied from interface: CharacterBuffer
Reads the next character from the buffer. Current position in the buffer is incremented.

Specified by:
next in interface CharacterBuffer
Returns:
the next character in the buffer

compact

public void compact()

flip

public void flip()

discard

public void discard()
Description copied from interface: TokenBuffer
Discards all characters already recognized by the lexer.

Specified by:
discard in interface TokenBuffer

viewCharacters

public CharSequence viewCharacters(int nb)

view

public CharSequence view()
Description copied from interface: TokenBuffer
Provides a view of all available tokens. Tokens are not copied from the buffer and may change during lexer process.

Specified by:
view in interface TokenBuffer
Returns:
a view of all availale tokens

getErrorContext

public LocationErrorContext getErrorContext()
Description copied from interface: ErrorContextBuffer
Returns the context of an error that occurred in the lexer.

Specified by:
getErrorContext in interface ErrorContextBuffer<LocationErrorContext>
Returns:
the error context

getErrorChar

public int getErrorChar()
Specified by:
getErrorChar in interface ErrorContextBuffer<LocationErrorContext>