Class: Packcr::Node::CaptureNode

Inherits:
Packcr::Node show all
Defined in:
lib/packcr/node/capture_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exprObject

Returns the value of attribute expr.



4
5
6
# File 'lib/packcr/node/capture_node.rb', line 4

def expr
  @expr
end

#indexObject

Returns the value of attribute index.



4
5
6
# File 'lib/packcr/node/capture_node.rb', line 4

def index
  @index
end

Instance Method Details

#debug_dump(indent = 0) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/packcr/node/capture_node.rb', line 6

def debug_dump(indent = 0)
  $stdout.print "#{" " * indent}Capture(index:"
  Packcr.dump_integer_value(index)
  $stdout.print ") {\n"
  expr.debug_dump(indent + 2)
  $stdout.print "#{" " * indent}}\n"
end

#generate_code(gen, onfail, indent, bare) ⇒ Object



14
15
16
17
18
# File 'lib/packcr/node/capture_node.rb', line 14

def generate_code(gen, onfail, indent, bare)
  r = nil
  gen.write Packcr.template("node/capture.#{gen.lang}.erb", binding, indent: indent)
  return r
end


29
30
31
# File 'lib/packcr/node/capture_node.rb', line 29

def link_references(ctx)
  expr.link_references(ctx)
end

#verify_captures(ctx, capts) ⇒ Object



24
25
26
27
# File 'lib/packcr/node/capture_node.rb', line 24

def verify_captures(ctx, capts)
  expr.verify_captures(ctx, capts)
  capts.push(self)
end

#verify_variables(vars) ⇒ Object



20
21
22
# File 'lib/packcr/node/capture_node.rb', line 20

def verify_variables(vars)
  expr.verify_variables(vars)
end