Class: Packcr::Node::ActionNode
- Inherits:
-
Packcr::Node
- Object
- Packcr::Node
- Packcr::Node::ActionNode
- Defined in:
- lib/packcr/node/action_node.rb
Instance Attribute Summary collapse
-
#capts ⇒ Object
Returns the value of attribute capts.
-
#code ⇒ Object
Returns the value of attribute code.
-
#index ⇒ Object
Returns the value of attribute index.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
- #debug_dump(indent = 0) ⇒ Object
- #generate_code(gen, onfail, indent, bare) ⇒ Object
-
#initialize ⇒ ActionNode
constructor
A new instance of ActionNode.
- #link_references(ctx) ⇒ Object
- #verify_captures(ctx, capts) ⇒ Object
- #verify_variables(vars) ⇒ Object
Constructor Details
#initialize ⇒ ActionNode
Returns a new instance of ActionNode.
6 7 8 9 10 |
# File 'lib/packcr/node/action_node.rb', line 6 def initialize super self.vars = [] self.capts = [] end |
Instance Attribute Details
#capts ⇒ Object
Returns the value of attribute capts.
4 5 6 |
# File 'lib/packcr/node/action_node.rb', line 4 def capts @capts end |
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/packcr/node/action_node.rb', line 4 def code @code end |
#index ⇒ Object
Returns the value of attribute index.
4 5 6 |
# File 'lib/packcr/node/action_node.rb', line 4 def index @index end |
#vars ⇒ Object
Returns the value of attribute vars.
4 5 6 |
# File 'lib/packcr/node/action_node.rb', line 4 def vars @vars end |
Instance Method Details
#debug_dump(indent = 0) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/packcr/node/action_node.rb', line 12 def debug_dump(indent = 0) $stdout.print "#{" " * indent}Action(index:" Packcr.dump_integer_value(index) $stdout.print ", code:{" Packcr.dump_escaped_string(code.text) $stdout.print "}, vars:" vars = self.vars capts = self.capts if vars.length + capts.length > 0 $stdout.print "\n" vars.each do |ref| $stdout.print "#{" " * (indent + 2)}'#{ref.var}'\n" end capts.each do |capt| $stdout.print "#{" " * (indent + 2)}$#{capt.index + 1}\n" end $stdout.print "#{" " * indent})\n" else $stdout.print "none)\n" end end |
#generate_code(gen, onfail, indent, bare) ⇒ Object
35 36 37 38 |
# File 'lib/packcr/node/action_node.rb', line 35 def generate_code(gen, onfail, indent, ) gen.write Packcr.template("node/action.#{gen.lang}.erb", binding, indent: indent, unwrap: ) return Packcr::CODE_REACH__ALWAYS_SUCCEED end |
#link_references(ctx) ⇒ Object
48 49 |
# File 'lib/packcr/node/action_node.rb', line 48 def link_references(ctx) end |
#verify_captures(ctx, capts) ⇒ Object
44 45 46 |
# File 'lib/packcr/node/action_node.rb', line 44 def verify_captures(ctx, capts) @capts = capts end |
#verify_variables(vars) ⇒ Object
40 41 42 |
# File 'lib/packcr/node/action_node.rb', line 40 def verify_variables(vars) @vars = vars end |