Interface LexicalAnalyzer

All Known Subinterfaces:
LineOrientedLexicalAnalyzer
All Known Implementing Classes:
BasicLexicalAnalyzer, ScriptBasicLexicalAnalyzer

public interface LexicalAnalyzer
A generic lexical analyzer that reads the characters from a reader and returns the LexicalElements one after the other.

The actual implementation specifies what lexical elements that identifies and returns.

Author:
Peter Verhas
  • Method Details

    • get

      Get the next lexical element from the input stream. If there are no more lexical elements then return null
      Returns:
      return the next lexical element
      Throws:
      AnalysisException - in case there is an exception
    • peek

      Peek at the next lexical element and do not remove it from the input stream. Consecutive calls to peek() without calling get() will return the same lexical element. Calling get() will return the same lexical element as the last call to peek().

      Just as get() this method may also return null if there are no more elements.

      Returns:
      the next lexical element
      Throws:
      AnalysisException - in case of exception
    • registerElementAnalyzer

      void registerElementAnalyzer(LexicalElementAnalyzer lea)
      Register a lexical element analyzer. The lexical element analyzers are consulted in the order they are registered to match a lexeme.
      Parameters:
      lea - parameter