class CLTK::CFG::Item
Overview
The Item class represents a CFG production with dot in it.
Defined in:
cltk/cfg/item.crcltk/parser/msgpack.cr
Class Method Summary
-
.new(dot : Int32, id : Int32, lhs : String, rhs : Array(String))
Instantiates a new Item object with a dot located before the symbol at index dot of the right-hand side.
- .new(__temp_88 : MessagePack::Unpacker)
Instance Method Summary
-
#==(other : Item)
Compares two items.
-
#advance
Moves the items dot forward by one if the end of the right-hand side hasn't already been reached.
-
#at_end?
Tests to see if the dot is at the end of the right-hand side.
-
#copy
@return [Item] A new copy of this item.
- #dot : Int32
- #dot=(_dot : Int32)
- #id : Int32
- #id=(_id : Int32)
- #lhs : String
- #lhs=(_lhs : String)
-
#next_symbol
Returns the symbol located after the dot.
- #rhs : Array(String)
- #rhs=(_rhs : Array(String))
- #to_msgpack(packer : MessagePack::Packer)
-
#to_s(padding = 0)
Returns a string representation of this item.
Instance methods inherited from class CLTK::CFG::Production
==(other)
==,
copy
copy,
id : Int32
id,
id=(_id : Int32)
id=,
last_terminal
last_terminal,
lhs : String
lhs,
lhs=(_lhs : String)
lhs=,
rhs : Array(String)
rhs,
rhs=(_rhs : Array(String))
rhs=,
to_item
to_item,
to_msgpack(packer : MessagePack::Packer)
to_msgpack,
to_s(padding = 0)
to_s
Class methods inherited from class CLTK::CFG::Production
new(id : Int32, lhs : String, rhs : Array(String))new(__temp_80 : MessagePack::Unpacker) new
Instance methods inherited from class Object
in?(collection : Array | Set)
in?
Class Method Detail
Instantiates a new Item object with a dot located before the symbol at index dot of the right-hand side. The remaining arguments (args) should be as specified by {Production#initialize}.
@param [Integer] dot Location of the dot in this Item. @param [Array<Object>] args (see {Production#initialize})
Instance Method Detail
Compares two items.
@param [Item] other Another item to compare to.
@return [Boolean]
Moves the items dot forward by one if the end of the right-hand side hasn't already been reached.
@return [Integer, nil]
Returns the symbol located after the dot.
@return [Symbol] Symbol located after the dot (at the index indicated by the {#dot} attribute).
Returns a string representation of this item.
@param [Integer] padding The ammount of padding spaces to add to the beginning of the string.
@return [String]