Class: Packcr::Node::StringNode
- Inherits:
-
Packcr::Node
- Object
- Packcr::Node
- Packcr::Node::StringNode
- Defined in:
- lib/packcr/node/string_node.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
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
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/packcr/node/string_node.rb', line 4 def value @value end |
Instance Method Details
#debug_dump(indent = 0) ⇒ Object
10 11 12 13 14 |
# File 'lib/packcr/node/string_node.rb', line 10 def debug_dump(indent = 0) $stdout.print "#{" " * indent}String(value:'" Packcr.dump_escaped_string(value) $stdout.print "')\n" end |
#generate_code(gen, onfail, indent, bare) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/packcr/node/string_node.rb', line 16 def generate_code(gen, onfail, indent, ) n = value&.length || 0 if n > 0 if n > 1 gen.write Packcr.template("node/string_many.#{gen.lang}.erb", binding, indent: indent) return Packcr::CODE_REACH__BOTH else gen.write Packcr.template("node/string_one.#{gen.lang}.erb", binding, indent: indent) return Packcr::CODE_REACH__BOTH end else # no code to generate return Packcr::CODE_REACH__ALWAYS_SUCCEED end Packcr::CODE_REACH__BOTH end |
#link_references(ctx) ⇒ Object
39 40 |
# File 'lib/packcr/node/string_node.rb', line 39 def link_references(ctx) end |
#verify_captures(ctx, capts) ⇒ Object
36 37 |
# File 'lib/packcr/node/string_node.rb', line 36 def verify_captures(ctx, capts) end |
#verify_variables(vars) ⇒ Object
33 34 |
# File 'lib/packcr/node/string_node.rb', line 33 def verify_variables(vars) end |