struct CLTK::Token

Defined in:

cltk/token.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

in?(collection : Array | Set) in?

Constructor Detail

def self.new(type : String | Symbol, value : TokenValue = nil, position : StreamPosition | Nil = nil) #

Instantiates a new Token object with the values specified.

@param [Symbol] type A symbol representing the type of this Token. @param [Object, nil] value A value associated with this token. @param [StreamPosition, nil] position The position of the token in a stream.


[View source]

Instance Method Detail

def ==(other) #

Compares one token to another. This only tests the token's type and value and not the location of the token in its source.

@param [Token] other Another Token to compare to.

@return [Boolean]


[View source]
def position : CLTK::StreamPosition? #

@return [StreamPosition] StreamPosition object associated with this token.


[View source]
def to_s #

@return [String] String representing the tokens type and value.


[View source]
def type : String | Symbol #

@return [Symbol]


[View source]
def value : Array(String) | Float64 | Int32 | String | Nil #

@return [Symbol]


[View source]