Class: Calyx::Rule
- Inherits:
-
Object
- Object
- Calyx::Rule
- Defined in:
- lib/calyx/rule.rb
Overview
Represents a named rule connected to a tree of productions that can be evaluated and a trace which represents where the rule was declared.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#productions ⇒ Object
readonly
Returns the value of attribute productions.
-
#trace ⇒ Object
readonly
Returns the value of attribute trace.
Instance Method Summary collapse
- #evaluate(options) ⇒ Object
-
#initialize(name, productions, trace) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(name, productions, trace) ⇒ Rule
Returns a new instance of Rule.
7 8 9 10 11 |
# File 'lib/calyx/rule.rb', line 7 def initialize(name, productions, trace) @name = name.to_sym @productions = productions @trace = trace end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/calyx/rule.rb', line 5 def name @name end |
#productions ⇒ Object (readonly)
Returns the value of attribute productions.
5 6 7 |
# File 'lib/calyx/rule.rb', line 5 def productions @productions end |
#trace ⇒ Object (readonly)
Returns the value of attribute trace.
5 6 7 |
# File 'lib/calyx/rule.rb', line 5 def trace @trace end |
Instance Method Details
#evaluate(options) ⇒ Object
13 14 15 |
# File 'lib/calyx/rule.rb', line 13 def evaluate() productions.evaluate() end |