Class: Packcr::Node::RuleNode
- Inherits:
-
Packcr::Node
- Object
- Packcr::Node
- Packcr::Node::RuleNode
- Defined in:
- lib/packcr/node/rule_node.rb
Instance Attribute Summary collapse
-
#capts ⇒ Object
Returns the value of attribute capts.
-
#codes ⇒ Object
Returns the value of attribute codes.
-
#col ⇒ Object
Returns the value of attribute col.
-
#expr ⇒ Object
Returns the value of attribute expr.
-
#line ⇒ Object
Returns the value of attribute line.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
- #add_ref ⇒ Object
- #debug_dump(indent = 0) ⇒ Object
-
#initialize ⇒ RuleNode
constructor
A new instance of RuleNode.
- #verify(ctx) ⇒ Object
Constructor Details
#initialize ⇒ RuleNode
Returns a new instance of RuleNode.
6 7 8 9 10 11 12 |
# File 'lib/packcr/node/rule_node.rb', line 6 def initialize super self.ref = 0 self.vars = [] self.capts = [] self.codes = [] end |
Instance Attribute Details
#capts ⇒ Object
Returns the value of attribute capts.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def capts @capts end |
#codes ⇒ Object
Returns the value of attribute codes.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def codes @codes end |
#col ⇒ Object
Returns the value of attribute col.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def col @col end |
#expr ⇒ Object
Returns the value of attribute expr.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def expr @expr end |
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def line @line end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def name @name end |
#ref ⇒ Object
Returns the value of attribute ref.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def ref @ref end |
#vars ⇒ Object
Returns the value of attribute vars.
4 5 6 |
# File 'lib/packcr/node/rule_node.rb', line 4 def vars @vars end |
Instance Method Details
#add_ref ⇒ Object
25 26 27 |
# File 'lib/packcr/node/rule_node.rb', line 25 def add_ref @ref += 1 end |
#debug_dump(indent = 0) ⇒ Object
14 15 16 17 18 |
# File 'lib/packcr/node/rule_node.rb', line 14 def debug_dump(indent = 0) $stdout.print "#{" " * indent}Rule(name:'#{name}', ref:#{ref}, vars.len:#{vars.length}, capts.len:#{capts.length}, codes.len:#{codes.length}) {\n" expr.debug_dump(indent + 2) $stdout.print "#{" " * indent}}\n" end |
#verify(ctx) ⇒ Object
20 21 22 23 |
# File 'lib/packcr/node/rule_node.rb', line 20 def verify(ctx) expr.verify_variables([]) expr.verify_captures(ctx, []) end |