Class: TagChunk

Inherits:
Chunk show all
Defined in:
lib/antlr4/tree/Chunk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, label = nil) ⇒ TagChunk

Returns a new instance of TagChunk.



7
8
9
10
# File 'lib/antlr4/tree/Chunk.rb', line 7

def initialize(tag, label=nil)
    self.tag = tag
    self.label = label
end

Instance Attribute Details

#labelObject

Returns the value of attribute label.



6
7
8
# File 'lib/antlr4/tree/Chunk.rb', line 6

def label
  @label
end

#tagObject

Returns the value of attribute tag.



6
7
8
# File 'lib/antlr4/tree/Chunk.rb', line 6

def tag
  @tag
end

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
# File 'lib/antlr4/tree/Chunk.rb', line 12

def to_s
    if self.label.nil?
        self.tag
    else
        "#{self.label}:#{self.tag}"
    end
end