Class: TPPlus::Nodes::LabelDefinitionNode
- Defined in:
- lib/tp_plus/nodes/label_definition_node.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(identifier) ⇒ LabelDefinitionNode
constructor
A new instance of LabelDefinitionNode.
- #long_identifier_comment(context) ⇒ Object
Methods inherited from BaseNode
Constructor Details
#initialize(identifier) ⇒ LabelDefinitionNode
Returns a new instance of LabelDefinitionNode.
5 6 7 |
# File 'lib/tp_plus/nodes/label_definition_node.rb', line 5 def initialize(identifier) @identifier = identifier end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/tp_plus/nodes/label_definition_node.rb', line 4 def identifier @identifier end |
Instance Method Details
#eval(context) ⇒ Object
15 16 17 18 |
# File 'lib/tp_plus/nodes/label_definition_node.rb', line 15 def eval(context) #context.add_label(@identifier) "LBL[#{context.labels[@identifier.to_sym]}:#{@identifier[0,16]}]#{long_identifier_comment(context)}" end |
#long_identifier_comment(context) ⇒ Object
9 10 11 12 13 |
# File 'lib/tp_plus/nodes/label_definition_node.rb', line 9 def long_identifier_comment(context) return "" unless @identifier.length > 16 " ;\n! #{@identifier}" end |