org.inxar.syntacs.analyzer.lexical
Interface LexerInterpreter

All Superinterfaces:
LRTranslationComponent
All Known Subinterfaces:
LRTranslatorInterpreter

public interface LexerInterpreter
extends LRTranslationComponent

The LexerInterpreter is responsible for handling "lexer events". A lexer "event" is defined when then Lexer has found a new character sequence that matches some Token type. The Lexer passes the Token type and character sequence offset and length to the LexerInterpreter.


Method Summary
 int error(int offset, int length)
          Notify an error starting at the given offset having the given length.
 Parser getParser()
          Gets the Parser object which this LexerInterpreter may relay Symbol events to.
 void match(int type, int offset, int length)
          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.
 void setParser(Parser parser)
          Sets the Parser object to which this LexerInterpreter may relay Symbol events to.
 void stop()
          Notify that the end of the Input has been reached.
 
Methods inherited from interface org.inxar.syntacs.translator.lr.LRTranslationComponent
getAuditor, getInput, getLRTranslatorGrammar, getProperties, initialize, reset, setAuditor, setInput, setLRTranslatorGrammar, setProperties
 

Method Detail

match

public void match(int type,
                  int offset,
                  int length)
           throws TranslationException
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.

error

public int error(int offset,
                 int length)
          throws TranslationException
Notify an error starting at the given offset having the given length. The return value is a code which instructs the lexer how to recover. Since there is currently no lexical error recovery implemented, the return value is meaningless.

stop

public void stop()
          throws TranslationException
Notify that the end of the Input has been reached.

setParser

public void setParser(Parser parser)
Sets the Parser object to which this LexerInterpreter may relay Symbol events to.

getParser

public Parser getParser()
Gets the Parser object which this LexerInterpreter may relay Symbol events to.