Class: Antlr4::Runtime::TokenTagToken
- Inherits:
-
CommonToken
- Object
- Token
- WritableToken
- CommonToken
- Antlr4::Runtime::TokenTagToken
- 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
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#token_name ⇒ Object
readonly
Returns the value of attribute token_name.
Attributes inherited from CommonToken
#_text, #channel, #char_position_in_line, #line, #source, #start, #stop, #token_index, #type
Instance Method Summary collapse
-
#initialize(token_name, type, label = nil) ⇒ TokenTagToken
constructor
A new instance of TokenTagToken.
- #text ⇒ Object
- #to_s ⇒ Object
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
#label ⇒ Object (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_name ⇒ Object (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
#text ⇒ Object
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_s ⇒ Object
18 19 20 |
# File 'lib/antlr4/runtime/token_tag_token.rb', line 18 def to_s @token_name + ':' + @type end |