Class: EBNFLL1Parser::ProdResult
- Inherits:
-
Object
- Object
- EBNFLL1Parser::ProdResult
- Defined in:
- examples/ebnf-ll1-parser/parser.rb
Overview
An internal class used for capturing the values of a production.
Instance Attribute Summary collapse
-
#prod ⇒ Object
Returns the value of attribute prod.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(prod, *values) ⇒ ProdResult
constructor
A new instance of ProdResult.
- #inspect ⇒ Object
- #to_ary ⇒ Object
Constructor Details
#initialize(prod, *values) ⇒ ProdResult
Returns a new instance of ProdResult.
21 22 23 |
# File 'examples/ebnf-ll1-parser/parser.rb', line 21 def initialize(prod, *values) @prod, @values = prod, values end |
Instance Attribute Details
#prod ⇒ Object
Returns the value of attribute prod.
18 19 20 |
# File 'examples/ebnf-ll1-parser/parser.rb', line 18 def prod @prod end |
#values ⇒ Object
Returns the value of attribute values.
19 20 21 |
# File 'examples/ebnf-ll1-parser/parser.rb', line 19 def values @values end |
Instance Method Details
#inspect ⇒ Object
29 30 31 |
# File 'examples/ebnf-ll1-parser/parser.rb', line 29 def inspect "(#{prod} #{values.map(&:inspect).join(' ')})" end |
#to_ary ⇒ Object
25 26 27 |
# File 'examples/ebnf-ll1-parser/parser.rb', line 25 def to_ary values.map {|v| v.respond_to?(:to_ary) ? v.to_ary : v}.unshift(@prod) end |