Class: Antlr4::Runtime::LexerIndexedCustomAction

Inherits:
LexerAction
  • Object
show all
Defined in:
lib/antlr4/runtime/lexer_indexed_custom_action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(offset, action) ⇒ LexerIndexedCustomAction


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

def initialize(offset, action)
  @offset = offset
  @action = action
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action


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

def action
  @action
end

#offsetObject (readonly)

Returns the value of attribute offset


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

def offset
  @offset
end

Instance Method Details

#action_typeObject


12
13
14
# File 'lib/antlr4/runtime/lexer_indexed_custom_action.rb', line 12

def action_type
  @action.action_type
end

#eql?(other) ⇒ Boolean


39
40
41
42
43
44
45
46
47
# File 'lib/antlr4/runtime/lexer_indexed_custom_action.rb', line 39

def eql?(other)
  if other == self
    return true
  else
    return false unless other.is_a? LexerIndexedCustomAction
  end

  @offset == other.offset && @action == other.action
end

#execute(lexer) ⇒ Object

assume the input stream position was properly set by the calling code


20
21
22
# File 'lib/antlr4/runtime/lexer_indexed_custom_action.rb', line 20

def execute(lexer) # assume the input stream position was properly set by the calling code
  @action.execute(lexer)
end

#hashObject


24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/antlr4/runtime/lexer_indexed_custom_action.rb', line 24

def hash
  return @_hash unless @_hash.nil?

  hash_code = MurmurHash.hash_int_obj(offset, action)

  if !@_hash.nil?
    if hash_code == @_hash
      puts 'Same hash_code for LexerIndexedCustomAction'
    else
      puts 'Different hash_code for LexerIndexedCustomAction'
    end
  end
  @_hash = hash_code
end

#position_dependent?Boolean


16
17
18
# File 'lib/antlr4/runtime/lexer_indexed_custom_action.rb', line 16

def position_dependent?
  true
end