struct CLTK::Token
- CLTK::Token
- Struct
- Value
- Object
Defined in:
cltk/token.crConstructors
-
.new(type : String | Symbol, value : TokenValue = nil, position : StreamPosition | Nil = nil)
Instantiates a new Token object with the values specified.
Instance Method Summary
-
#==(other)
Compares one token to another.
-
#position : CLTK::StreamPosition?
@return [StreamPosition] StreamPosition object associated with this token.
-
#to_s
@return [String] String representing the tokens type and value.
-
#type : String | Symbol
@return [Symbol]
-
#value : Array(String) | Float64 | Int32 | String | Nil
@return [Symbol]
Instance methods inherited from class Object
in?(collection : Array | Set)
in?
Constructor Detail
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.
Instance Method Detail
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]
@return [StreamPosition] StreamPosition object associated with this token.