Sha256: 71f115ce33c130bf4be6c9abe64f157d90e04f216762f7d8952dab51b030b079

Contents?: true

Size: 885 Bytes

Versions: 5

Compression:

Stored size: 885 Bytes

Contents

module Antlr4::Runtime

  class LexerTypeAction < LexerAction
    attr_reader :type

    def initialize(type)
      @type = type
    end

    def action_type
      LexerActionType::TYPE
    end

    def position_dependent?
      false
    end

    def execute(lexer)
      lexer._type = @type
    end

    def hash
      return @_hash unless @_hash.nil?

      hash_code = RumourHash.calculate([action_type, @type])

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

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

      @type == other.type
    end

    def to_s
      'type(' << @type << ')'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
antlr4-runtime-0.2.8 lib/antlr4/runtime/lexer_type_action.rb
antlr4-runtime-0.2.7 lib/antlr4/runtime/lexer_type_action.rb
antlr4-runtime-0.2.6 lib/antlr4/runtime/lexer_type_action.rb
antlr4-runtime-0.2.5 lib/antlr4/runtime/lexer_type_action.rb
antlr4-runtime-0.2.4 lib/antlr4/runtime/lexer_type_action.rb