Module Simula

Class Token

java.lang.Object
simula.compiler.utilities.Token
All Implemented Interfaces:
Externalizable, Serializable

public final class Token extends Object implements Externalizable
Utility class Token.

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
See Also:
  • Field Details

    • text

      private String text
      The Token's text attribute
    • keyWord

      private KeyWord keyWord
      The Token's keyWord attribute
    • value

      private Object value
      The Token's value attribute
    • lineNumber

      public int lineNumber
      The Token's line number
    • lineNumberBeforeScanBasic

      public static int lineNumberBeforeScanBasic
      The line number before scan basic.
  • Constructor Details

    • Token

      public Token(String text, KeyWord keyWord, Object value)
      Create a new Token.
      Parameters:
      text - the Token's text attribute
      keyWord - the Token's keyword attribute
      value - the Token's value attribute
    • Token

      public Token(String text, KeyWord keyWord)
      Create a new Token.
      Parameters:
      text - the Token's text attribute
      keyWord - the Token's keyword attribute
    • Token

      public Token(KeyWord keyWord, Object value)
      Create a new Token.
      Parameters:
      keyWord - the Token's keyword attribute
      value - the Token's value attribute
    • Token

      public Token(KeyWord keyWord)
      Create a new Token.
      Parameters:
      keyWord - the Token's keyword attribute
    • Token

      public Token()
      The default constructor used by Externalization.
  • Method Details

    • setText

      public void setText(String text)
      Set this Token's text attribute.
      Parameters:
      text - new text attribute
    • getText

      public String getText()
      Get this Token's text attribute.
      Returns:
      this Token's text attribute
    • getStyleCode

      public Token.StyleCode getStyleCode()
      Returns the style code for this Token's keyword.
      Returns:
      the style code for this Token's keyword
    • getKeyWord

      public KeyWord getKeyWord()
      Get this Token's keyword attribute.
      Returns:
      this Token's keyword attribute
    • getKeyWordCode

      public int getKeyWordCode()
      Get this Token's keyword code.
      Returns:
      this Token's keyword code
    • getValue

      public Object getValue()
      Get this Token's value attribute.
      Returns:
      this Token's value attribute
    • getIdentifier

      public String getIdentifier()
      Get this Token's value string.
      Returns:
      this Token's value string
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeExternal

      public void writeExternal(ObjectOutput oupt) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput inpt) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException