Record Class Token

java.lang.Object
java.lang.Record
org.applecommander.bastools.api.model.Token

public record Token(int line, Token.Type type, ApplesoftKeyword keyword, Double number, String text) extends Record
A Token in the classic compiler sense, in that this represents a component of the application.
  • Constructor Details

    • Token

      public Token(int line, Token.Type type, ApplesoftKeyword keyword, Double number, String text)
      Creates an instance of a Token record class.
      Parameters:
      line - the value for the line record component
      type - the value for the type record component
      keyword - the value for the keyword record component
      number - the value for the number record component
      text - the value for the text record component
  • Method Details

    • accept

      public Token accept(Visitor t)
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • asString

      public String asString()
    • eol

      public static Token eol(int line)
    • number

      public static Token number(int line, Double number)
    • number

      public static Token number(int line, Double number, String text)
    • ident

      public static Token ident(int line, String text)
    • comment

      public static Token comment(int line, String text)
    • data

      public static Token data(int line, String data)
    • string

      public static Token string(int line, String text)
    • keyword

      public static Token keyword(int line, ApplesoftKeyword keyword)
    • syntax

      public static Token syntax(int line, int ch)
    • directive

      public static Token directive(int line, String text)
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • line

      public int line()
      Returns the value of the line record component.
      Returns:
      the value of the line record component
    • type

      public Token.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • keyword

      public ApplesoftKeyword keyword()
      Returns the value of the keyword record component.
      Returns:
      the value of the keyword record component
    • number

      public Double number()
      Returns the value of the number record component.
      Returns:
      the value of the number record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component