Class AbstractElementAnalyzer

java.lang.Object
com.scriptbasic.lexer.elements.AbstractElementAnalyzer
All Implemented Interfaces:
LexicalElementAnalyzer
Direct Known Subclasses:
BasicString, Decimal, Identifier, MultiCharacter, OneCharacter

public abstract class AbstractElementAnalyzer
extends java.lang.Object
implements LexicalElementAnalyzer
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected AbstractElementAnalyzer​(SourceReader reader)  
  • Method Summary

    Modifier and Type Method Description
    SourceReader getReader()  
    abstract LexicalElement read()
    Reads a lexeme and returns the created lexical element.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getReader

      public SourceReader getReader()
    • read

      public abstract LexicalElement read() throws LexicalException
      Description copied from interface: LexicalElementAnalyzer
      Reads a lexeme and returns the created lexical element.

      If the characters read from the reader show that the lexeme is not the type that the class implementing this interface can handle then the characters are pushed back to he reader and null is returned.

      If the characters read from the reader show that the lexeme is the type that the class implementing this interface can handle, but is erroneous, then the method throws the exception.

      Specified by:
      read in interface LexicalElementAnalyzer
      Returns:
      the created lexeme or null
      Throws:
      LexicalException