Class: Antlr4::Runtime::RuleTagToken

Inherits:
Token
  • Object
show all
Defined in:
lib/antlr4/runtime/rule_tag_token.rb

Constant Summary

Constants inherited from Token

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule_name, bypass_token_type, label = nil) ⇒ RuleTagToken

Returns a new instance of RuleTagToken.



8
9
10
11
12
13
14
15
16
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 8

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

  @rule_name = rule_name
  @bypass_token_type = bypass_token_type
  @label = label
end

Instance Attribute Details

#bypass_token_typeObject (readonly)

Returns the value of attribute bypass_token_type.



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

def bypass_token_type
  @bypass_token_type
end

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 6

def label
  @label
end

#rule_nameObject (readonly)

Returns the value of attribute rule_name.



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

def rule_name
  @rule_name
end

Instance Method Details

#channelObject



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

def channel
  DEFAULT_CHANNEL
end

#char_position_in_lineObject



36
37
38
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 36

def char_position_in_line
  -1
end

#input_streamObject



56
57
58
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 56

def input_stream
  nil
end

#lineObject



32
33
34
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 32

def line
  0
end

#start_indexObject



44
45
46
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 44

def start_index
  -1
end

#stop_indexObject



48
49
50
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 48

def stop_index
  -1
end

#textObject



22
23
24
25
26
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 22

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

  '<' + @rule_name + '>'
end

#to_sObject



60
61
62
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 60

def to_s
  @rule_name + ':' + @bypass_token_type
end

#token_indexObject



40
41
42
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 40

def token_index
  -1
end

#token_sourceObject



52
53
54
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 52

def token_source
  nil
end

#typeObject



28
29
30
# File 'lib/antlr4/runtime/rule_tag_token.rb', line 28

def type
  @bypass_token_type
end