Interface LexicalElement

All Superinterfaces:
SourceLocationBound
All Known Implementing Classes:
AbstractLexicalElement, BasicLexicalElement

public interface LexicalElement
extends SourceLocationBound
A single lexical element that was created by the LexicalAnalyer
Author:
Peter Verhas
  • Field Details

  • Method Details

    • getLexeme

      java.lang.String getLexeme()
      Get the original representation of the lexical element the way it was specified in the source code.
      Returns:
      the lexical element as string
    • getType

      int getType()
      Get the type of the lexical element.
      Returns:
      return value
    • stringValue

      java.lang.String stringValue()
      Get the string value of the lexical element. This method should be called only when the lexical element is a string literal. Otherwise the implementation will throw IllegalArgumentException();
      Returns:
      return value
    • longValue

      java.lang.Long longValue()
      Get the long value of the element. This method should only be called when the type of the symbol is long. Otherwise the implementation will throw IllegalArgumentException();
      Returns:
      return value
      Throws:
      java.lang.IllegalArgumentException - in case of exception
    • doubleValue

      java.lang.Double doubleValue()
    • booleanValue

      java.lang.Boolean booleanValue()
    • isString

      java.lang.Boolean isString()
    • isDouble

      java.lang.Boolean isDouble()
    • isLong

      java.lang.Boolean isLong()
    • isBoolean

      java.lang.Boolean isBoolean()
    • isNumeric

      java.lang.Boolean isNumeric()
    • isLiteralConstant

      java.lang.Boolean isLiteralConstant()
    • isIdentifier

      java.lang.Boolean isIdentifier()
    • isSymbol

      java.lang.Boolean isSymbol()
    • isSymbol

      java.lang.Boolean isSymbol​(java.lang.String lexeme)
      Return true if the lexical element is a symbol and the lexeme matches the the actual symbol.
      Parameters:
      lexeme - to match by the lexical element. The parameter must not ne null.
      Returns:
      true if the lexical element is a symbol and the lexeme matches the parameter lexeme.
    • isStatementSeparator

      java.lang.Boolean isStatementSeparator()
      Returns:
      true if the lexical element is colon
    • isLineTerminator

      java.lang.Boolean isLineTerminator()