Class: Antlr4::Runtime::TokenTagToken

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

Constant Summary

Constants inherited from Token

Antlr4::Runtime::Token::DEFAULT_CHANNEL, Antlr4::Runtime::Token::EOF, Antlr4::Runtime::Token::EPSILON, Antlr4::Runtime::Token::HIDDEN_CHANNEL, Antlr4::Runtime::Token::INVALID_TYPE, Antlr4::Runtime::Token::MIN_USER_CHANNEL_VALUE, Antlr4::Runtime::Token::MIN_USER_TOKEN_TYPE

Instance Attribute Summary collapse

Attributes inherited from CommonToken

#_text, #channel, #char_position_in_line, #line, #source, #start, #stop, #token_index, #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

Returns a new instance of 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