class Antlr4::Runtime::LexerCustomAction

Attributes

action_index[R]
rule_index[R]

Public Class Methods

new(rule_index, action_index) click to toggle source
# File lib/antlr4/runtime/lexer_custom_action.rb, line 7
def initialize(rule_index, action_index)
  @rule_index = rule_index
  @action_index = action_index
end

Public Instance Methods

action_type() click to toggle source
# File lib/antlr4/runtime/lexer_custom_action.rb, line 12
def action_type
  LexerActionType::CUSTOM
end
eql?(other) click to toggle source
# File lib/antlr4/runtime/lexer_custom_action.rb, line 40
def eql?(other)
  if other == self
    return true
  else
    return false unless other.is_a? LexerCustomAction
  end

  @rule_index == other.rule_index && @action_index == other.action_index
end
execute(lexer) click to toggle source
# File lib/antlr4/runtime/lexer_custom_action.rb, line 20
def execute(lexer)
  lexer.action(nil, @rule_index, @action_index)
end
hash() click to toggle source
# File lib/antlr4/runtime/lexer_custom_action.rb, line 24
def hash
  return @_hash unless @_hash.nil?

  hash_code = RumourHash.calculate([action_type, rule_index, action_index])

  unless @_hash.nil?
    if hash_code == @_hash
      puts 'Same hash_code for LexerCustomAction'
    else
      puts 'Different hash_code for LexerCustomAction'
    end
  end

  @_hash = hash_code
end
position_dependent?() click to toggle source
# File lib/antlr4/runtime/lexer_custom_action.rb, line 16
def position_dependent?
  true
end