Class: Kanocc::GrammarRule
- Inherits:
-
Object
- Object
- Kanocc::GrammarRule
- Defined in:
- lib/kanocc/grammar_rule.rb
Instance Attribute Summary collapse
-
#derives_right ⇒ Object
Returns the value of attribute derives_right.
-
#lhs ⇒ Object
readonly
Returns the value of attribute lhs.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#precedence ⇒ Object
Returns the value of attribute precedence.
-
#rhs ⇒ Object
readonly
Returns the value of attribute rhs.
Instance Method Summary collapse
-
#initialize(lhs, rhs, method) ⇒ GrammarRule
constructor
A new instance of GrammarRule.
- #inspect ⇒ Object
Constructor Details
#initialize(lhs, rhs, method) ⇒ GrammarRule
Returns a new instance of GrammarRule.
24 25 26 27 28 29 30 |
# File 'lib/kanocc/grammar_rule.rb', line 24 def initialize(lhs, rhs, method) @lhs = lhs @rhs = rhs @method = method @prededence = 0 @logger.debug("#{lhs} --> #{rhs.map {|gs| gs.is_a?(Symbol) ? gs.to_s : gs}.join}, #prec = #{@prec}, method = #{method}") if @logger end |
Instance Attribute Details
#derives_right ⇒ Object
Returns the value of attribute derives_right.
22 23 24 |
# File 'lib/kanocc/grammar_rule.rb', line 22 def derives_right @derives_right end |
#lhs ⇒ Object (readonly)
Returns the value of attribute lhs.
21 22 23 |
# File 'lib/kanocc/grammar_rule.rb', line 21 def lhs @lhs end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
21 22 23 |
# File 'lib/kanocc/grammar_rule.rb', line 21 def method @method end |
#precedence ⇒ Object
Returns the value of attribute precedence.
22 23 24 |
# File 'lib/kanocc/grammar_rule.rb', line 22 def precedence @precedence end |
#rhs ⇒ Object (readonly)
Returns the value of attribute rhs.
21 22 23 |
# File 'lib/kanocc/grammar_rule.rb', line 21 def rhs @rhs end |
Instance Method Details
#inspect ⇒ Object
32 33 34 |
# File 'lib/kanocc/grammar_rule.rb', line 32 def inspect return lhs.inspect + " ::= " + rhs.map{|gs| gs.inspect}.join(" ") end |