Class Lexer.Token<D>

java.lang.Object
eu.bandm.tools.d2d2.parser2.Lexer.Token<D>
All Implemented Interfaces:
eu.bandm.tools.ramus.runtime2.Parser.Token<D,Lexer.TokenType>
Enclosing class:
Lexer<D>

public static class Lexer.Token<D> extends Object implements eu.bandm.tools.ramus.runtime2.Parser.Token<D,Lexer.TokenType>
Immutable tokens.
  • Method Details

    • getLocation

      public Location<D> getLocation()
      Description copied from interface: eu.bandm.tools.ramus.runtime2.Parser.Token
      Returns the source location of this token.

      The default implementation returns null.

      Specified by:
      getLocation in interface eu.bandm.tools.ramus.runtime2.Parser.Token<D,Lexer.TokenType>
      Returns:
      the source location of this token, or null if not available.
    • getText

      public String getText()
      Description copied from interface: eu.bandm.tools.ramus.runtime2.Parser.Token
      Returns the text content of this token.
      Specified by:
      getText in interface eu.bandm.tools.ramus.runtime2.Parser.Token<D,Lexer.TokenType>
      Returns:
      the text content of this token.
    • getType

      public Lexer.TokenType getType()
      Description copied from interface: eu.bandm.tools.ramus.runtime2.Parser.Token
      Returns the type of this token.
      Specified by:
      getType in interface eu.bandm.tools.ramus.runtime2.Parser.Token<D,Lexer.TokenType>
      Returns:
      the type of this token.
    • withType

      public Lexer.Token<D> withType(Lexer.TokenType type)
      Creates a variant of this token with the given type.
    • withText

      public Lexer.Token<D> withText(String text)
      Creates a variant of this token with the given text.
    • withPrefix

      public Lexer.Token<D> withPrefix(String prefix)
      Creates a variant of this token with the given text prefix.
    • toString

      public String toString()
      Overrides:
      toString in class Object