Class: Antlr4::Runtime::TagChunk

Inherits:
Chunk
  • Object
show all
Defined in:
lib/antlr4/runtime/tag_chunk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, tag) ⇒ TagChunk

Returns a new instance of TagChunk



7
8
9
10
11
12
13
14
# File 'lib/antlr4/runtime/tag_chunk.rb', line 7

def initialize(label, tag)
  if tag.nil? || tag.empty?
    raise IllegalArgumentException, 'tag cannot be nil or empty'
  end

  @label = label
  @tag = tag
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label



5
6
7
# File 'lib/antlr4/runtime/tag_chunk.rb', line 5

def label
  @label
end

#tagObject (readonly)

Returns the value of attribute tag



4
5
6
# File 'lib/antlr4/runtime/tag_chunk.rb', line 4

def tag
  @tag
end

Instance Method Details

#to_sObject



16
17
18
19
20
# File 'lib/antlr4/runtime/tag_chunk.rb', line 16

def to_s
  return @label + ':' + @tag unless @label.nil?

  @tag
end