Class: Antlr4::Runtime::TokenTagToken

Inherits:
CommonToken show all
Defined in:
lib/antlr4/runtime/token_tag_token.rb

Instance Attribute Summary collapse

Attributes inherited from CommonToken

#_text, #channel, #char_position_in_line, #index, #line, #source, #start, #stop, #type

Instance Method Summary collapse

Methods inherited from CommonToken

create1, create2, #create3, #input_stream, #to_s_old, #to_s_recog

Constructor Details

#initialize(token_name, type, label = nil) ⇒ TokenTagToken


6
7
8
9
10
# File 'lib/antlr4/runtime/token_tag_token.rb', line 6

def initialize(token_name, type, label = nil)
  super(type)
  @token_name = token_name
  @label = label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label


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

def label
  @label
end

#token_nameObject (readonly)

Returns the value of attribute token_name


3
4
5
# File 'lib/antlr4/runtime/token_tag_token.rb', line 3

def token_name
  @token_name
end

Instance Method Details

#textObject


12
13
14
15
16
# File 'lib/antlr4/runtime/token_tag_token.rb', line 12

def text
  return '<' + @label + ':' + @token_name + '>' unless @label.nil?

  '<' + @token_name + '>'
end

#to_sObject


18
19
20
# File 'lib/antlr4/runtime/token_tag_token.rb', line 18

def to_s
  @token_name + ':' + @type
end