fr.umlv.tatoo.runtime.lexer
Interface SimpleLexer

All Known Implementing Classes:
Lexer, Lexer.LexerImpl

public interface SimpleLexer

A simple interface that can be used to manipulate a lexer after its creation. To use the lexer in pull mode, one will use the method run(), in that case the underlying buffer used must implements the optional operation LexerBuffer.read(). To use the lexer in push mode, on will use step() to proceed all available characters of the buffer and close() when the whole text has been read.

Author:
Remi
See Also:
Lexer

Method Summary
 void close()
          Closes the lexing process.
 void run()
          Does all the lexing in one shot.
 void step()
          Proceed all available characters from the underlying buffer.
 

Method Detail

step

void step()
Proceed all available characters from the underlying buffer. In order to end the lexing, after several calls to step() the developer must call close(). During the execution of this method, changing the buffer has no effect on the current execution. A next call to this method will used the newly set buffer.

See Also:
close(), LexerBuffer.hasRemaining()

run

void run()
Does all the lexing in one shot.

Throws:
UnsupportedOperationException - if the optional operation LexerBuffer.read() is not supported by the underlying buffer.
See Also:
step()

close

void close()
Closes the lexing process. This method must be called after some calls to step(). Note that this method is likely to recognize some supplementary tokens and thus to call LexerListener.ruleVerified(Object, int, Object). during the lexing process, by example, if the lexer states doesn't accept the end of file. During the execution of this method, changing the buffer has no effect on the current execution. A next call to this method will used the newly set buffer.

See Also:
step(), run()