Class: Grammar::NT
- Inherits:
-
Object
- Object
- Grammar::NT
- Defined in:
- lib/zipf/grammar.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#span ⇒ Object
Returns the value of attribute span.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
Instance Method Summary collapse
-
#initialize(symbol, index = 0) ⇒ NT
constructor
A new instance of NT.
- #to_s ⇒ Object
Constructor Details
#initialize(symbol, index = 0) ⇒ NT
Returns a new instance of NT.
19 20 21 22 23 |
# File 'lib/zipf/grammar.rb', line 19 def initialize symbol, index=0 @symbol = symbol @index = index @span = Span.new end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
17 18 19 |
# File 'lib/zipf/grammar.rb', line 17 def index @index end |
#span ⇒ Object
Returns the value of attribute span.
17 18 19 |
# File 'lib/zipf/grammar.rb', line 17 def span @span end |
#symbol ⇒ Object
Returns the value of attribute symbol.
17 18 19 |
# File 'lib/zipf/grammar.rb', line 17 def symbol @symbol end |
Instance Method Details
#to_s ⇒ Object
25 26 27 |
# File 'lib/zipf/grammar.rb', line 25 def to_s "NT(#{@span.left},#{@span.right})<#{@symbol},#{@index}>" end |