Class: Rly::Production
- Inherits:
-
Object
- Object
- Rly::Production
- Defined in:
- lib/rly/parse/production.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#lr0_added ⇒ Object
Returns the value of attribute lr0_added.
-
#lr_items ⇒ Object
Returns the value of attribute lr_items.
-
#lr_next ⇒ Object
Returns the value of attribute lr_next.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#precedence ⇒ Object
readonly
Returns the value of attribute precedence.
-
#prod ⇒ Object
readonly
Returns the value of attribute prod.
-
#reduced ⇒ Object
Returns the value of attribute reduced.
-
#usyms ⇒ Object
readonly
Returns the value of attribute usyms.
Instance Method Summary collapse
-
#initialize(index, name, prod, precedence = [:right, 0], block = nil) ⇒ Production
constructor
FIXME line!!!.
- #inspect ⇒ Object
- #length ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(index, name, prod, precedence = [:right, 0], block = nil) ⇒ Production
FIXME line!!!
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rly/parse/production.rb', line 7 def initialize(index, name, prod, precedence=[:right, 0], block=nil) @index = index @name = name @prod = prod @precedence = precedence @block = block @usyms = [] prod.each { |sym| @usyms << sym unless @usyms.include?(sym) } end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def block @block end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def index @index end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def line @line end |
#lr0_added ⇒ Object
Returns the value of attribute lr0_added.
4 5 6 |
# File 'lib/rly/parse/production.rb', line 4 def lr0_added @lr0_added end |
#lr_items ⇒ Object
Returns the value of attribute lr_items.
4 5 6 |
# File 'lib/rly/parse/production.rb', line 4 def lr_items @lr_items end |
#lr_next ⇒ Object
Returns the value of attribute lr_next.
4 5 6 |
# File 'lib/rly/parse/production.rb', line 4 def lr_next @lr_next end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def name @name end |
#precedence ⇒ Object (readonly)
Returns the value of attribute precedence.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def precedence @precedence end |
#prod ⇒ Object (readonly)
Returns the value of attribute prod.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def prod @prod end |
#reduced ⇒ Object
Returns the value of attribute reduced.
4 5 6 |
# File 'lib/rly/parse/production.rb', line 4 def reduced @reduced end |
#usyms ⇒ Object (readonly)
Returns the value of attribute usyms.
3 4 5 |
# File 'lib/rly/parse/production.rb', line 3 def usyms @usyms end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'lib/rly/parse/production.rb', line 22 def inspect "#<Production #{to_s}>" end |
#length ⇒ Object
26 27 28 |
# File 'lib/rly/parse/production.rb', line 26 def length @prod.length end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/rly/parse/production.rb', line 18 def to_s "#{name} -> #{@prod.map { |s| s.to_s }.join(' ')}" end |