Class: Packcr::Node::ExpandNode
- Inherits:
-
Packcr::Node
- Object
- Packcr::Node
- Packcr::Node::ExpandNode
- Defined in:
- lib/packcr/node/expand_node.rb
Instance Attribute Summary collapse
-
#col ⇒ Object
Returns the value of attribute col.
-
#index ⇒ Object
Returns the value of attribute index.
-
#line ⇒ Object
Returns the value of attribute line.
Instance Method Summary collapse
- #debug_dump(indent = 0) ⇒ Object
- #generate_code(gen, onfail, indent, bare) ⇒ Object
- #link_references(ctx) ⇒ Object
- #verify_captures(ctx, capts) ⇒ Object
- #verify_variables(vars) ⇒ Object
Instance Attribute Details
#col ⇒ Object
Returns the value of attribute col.
4 5 6 |
# File 'lib/packcr/node/expand_node.rb', line 4 def col @col end |
#index ⇒ Object
Returns the value of attribute index.
4 5 6 |
# File 'lib/packcr/node/expand_node.rb', line 4 def index @index end |
#line ⇒ Object
Returns the value of attribute line.
4 5 6 |
# File 'lib/packcr/node/expand_node.rb', line 4 def line @line end |
Instance Method Details
#debug_dump(indent = 0) ⇒ Object
6 7 8 9 10 |
# File 'lib/packcr/node/expand_node.rb', line 6 def debug_dump(indent = 0) $stdout.print "#{" " * indent}Expand(index:" Packcr.dump_integer_value(index) $stdout.print ")\n" end |
#generate_code(gen, onfail, indent, bare) ⇒ Object
12 13 14 15 |
# File 'lib/packcr/node/expand_node.rb', line 12 def generate_code(gen, onfail, indent, ) gen.write Packcr.template("node/expand.#{gen.lang}.erb", binding, indent: indent, unwrap: ) return Packcr::CODE_REACH__BOTH end |
#link_references(ctx) ⇒ Object
32 33 |
# File 'lib/packcr/node/expand_node.rb', line 32 def link_references(ctx) end |
#verify_captures(ctx, capts) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/packcr/node/expand_node.rb', line 20 def verify_captures(ctx, capts) found = capts.any? do |capt| unless capt.is_a?(Packcr::Node::CaptureNode) raise "unexpected capture: #{capt.class}" end index == capt.index end if !found && index != nil ctx.error line + 1, col + 1, "Capture #{index + 1} not available at this position" end end |
#verify_variables(vars) ⇒ Object
17 18 |
# File 'lib/packcr/node/expand_node.rb', line 17 def verify_variables(vars) end |