com.inxar.syntacs.translator.regexp
Class RegexpInterpreter
java.lang.Object
|
+--com.inxar.syntacs.translator.lr.AbstractLRTranslationComponent
|
+--com.inxar.syntacs.translator.lr.StandardLRTranslatorInterpreter
|
+--com.inxar.syntacs.translator.regexp.RegexpInterpreter
- All Implemented Interfaces:
- LexerInterpreter, LRTranslationComponent, LRTranslatorInterpreter, ParserInterpreter
- public class RegexpInterpreter
- extends StandardLRTranslatorInterpreter
Interpreter
used in the translation of regular
expression strings.
Method Summary |
Object |
getResult()
When translation is complete and there were no unrecoverable
errors, the LRTranslatorInterpreter should be able
to produce some Object which was built from the
parse tree. |
void |
match(int type,
int off,
int len)
The match method is used by the Lexer
to inform the interpreter that a new token has been found at the
given offset with the given length. |
Symbol |
reduce(int type,
Sentence s)
ParserInterpreter.reduce(int, Sentence) is called
when a reduction occurs. |
void |
reset()
Resets the internal state of the
TranslationComponent in preparation for another
translation. |
RegexpInterpreter
public RegexpInterpreter()
match
public void match(int type,
int off,
int len)
throws TranslationException
- Description copied from interface:
LexerInterpreter
- The
match
method is used by the Lexer
to inform the interpreter that a new token has been found at the
given offset with the given length.
- Overrides:
match
in class StandardLRTranslatorInterpreter
reduce
public Symbol reduce(int type,
Sentence s)
throws TranslationException
- Description copied from interface:
ParserInterpreter
ParserInterpreter.reduce(int, Sentence)
is called
when a reduction occurs. The type of the reduction (from the
grammar) as well as the top of the parse stack is passed to the
method. The ParserInterpreter
is expected to
construct a Symbol
and return it back to the
Parser
(to be placed at the top of the parse
stack).
- Overrides:
reduce
in class StandardLRTranslatorInterpreter
reset
public void reset()
- Description copied from interface:
LRTranslationComponent
- Resets the internal state of the
TranslationComponent
in preparation for another
translation.
- Overrides:
reset
in class AbstractLRTranslationComponent
getResult
public Object getResult()
- Description copied from interface:
LRTranslatorInterpreter
- When translation is complete and there were no unrecoverable
errors, the
LRTranslatorInterpreter
should be able
to produce some Object
which was built from the
parse tree. This Object
will be returned by the
Translator
if appropriate.
- Overrides:
getResult
in class StandardLRTranslatorInterpreter