com.inxar.syntacs.analyzer.lexical
Class StandardLexer
java.lang.Object
|
+--com.inxar.syntacs.translator.lr.AbstractLRTranslationComponent
|
+--com.inxar.syntacs.analyzer.lexical.StandardLexer
- All Implemented Interfaces:
- Lexer, LRTranslationComponent
- public class StandardLexer
- extends AbstractLRTranslationComponent
- implements Lexer
Concrete Lexer
implementation which uses a
DFA
for the recognition engine.
Constructor Summary |
StandardLexer()
Constructs the StandardLexer . |
Method Summary |
LexerInterpreter |
getLexerInterpreter()
Gets the Listener to be notified of token
Symbol events. |
void |
initialize(Object arg)
The argument must be a DFA or a DFA[]
array. |
void |
reset()
Resets the internal state of the
TranslationComponent in preparation for another
translation. |
void |
resume()
Continues the lexing process from the current
Input position. |
void |
setLexerInterpreter(LexerInterpreter interpreter)
Sets the Listener to be notified of token
Symbol events. |
void |
start()
Resets the internal state of the Lexer and
triggers the search for the next lexeme from the input. |
void |
stop()
Pauses the lexing process. |
StandardLexer
public StandardLexer()
- Constructs the
StandardLexer
.
initialize
public void initialize(Object arg)
- The argument must be a
DFA
or a DFA[]
array.
- Specified by:
initialize
in interface LRTranslationComponent
- Overrides:
initialize
in class AbstractLRTranslationComponent
start
public void start()
throws TranslationException
- Description copied from interface:
Lexer
- Resets the internal state of the
Lexer
and
triggers the search for the next lexeme from the input.
Notification will take place through the
LexerInterpreter
. This method will run until the
input buffer has been exhausted or stop()
is
called.
- Specified by:
start
in interface Lexer
resume
public void resume()
throws TranslationException
- Description copied from interface:
Lexer
- Continues the lexing process from the current
Input
position.
- Specified by:
resume
in interface Lexer
reset
public void reset()
- Description copied from interface:
LRTranslationComponent
- Resets the internal state of the
TranslationComponent
in preparation for another
translation.
- Specified by:
reset
in interface LRTranslationComponent
- Overrides:
reset
in class AbstractLRTranslationComponent
stop
public void stop()
- Description copied from interface:
Lexer
- Pauses the lexing process. Lexing can be restarted via calling
resume()
. The lexer should check before the start
of each token search to see whether stop has been called.
Therefore, the granularity of stop is limited to the moment
between token searches.
- Specified by:
stop
in interface Lexer
getLexerInterpreter
public LexerInterpreter getLexerInterpreter()
- Description copied from interface:
Lexer
- Gets the
Listener
to be notified of token
Symbol
events.
- Specified by:
getLexerInterpreter
in interface Lexer
setLexerInterpreter
public void setLexerInterpreter(LexerInterpreter interpreter)
- Description copied from interface:
Lexer
- Sets the
Listener
to be notified of token
Symbol
events.
- Specified by:
setLexerInterpreter
in interface Lexer