Class OneCharacter

java.lang.Object
com.scriptbasic.lexer.elements.AbstractElementAnalyzer
com.scriptbasic.lexer.elements.OneCharacter
All Implemented Interfaces:
LexicalElementAnalyzer

public class OneCharacter
extends AbstractElementAnalyzer
  • Constructor Summary

    Constructors 
    Constructor Description
    OneCharacter​(SourceReader reader)  
  • Method Summary

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

    Methods inherited from class com.scriptbasic.lexer.elements.AbstractElementAnalyzer

    getReader

    Methods inherited from class java.lang.Object

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

  • Method Details

    • read

      public LexicalElement read()
      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
      Specified by:
      read in class AbstractElementAnalyzer
      Returns:
      the created lexeme or null