Sha256: 019567173f1910e3275cb84b520c6e2d4f0cfed47c8b41834b44657e9264abfc

Contents?: true

Size: 912 Bytes

Versions: 5

Compression:

Stored size: 912 Bytes

Contents

module Antlr4::Runtime

  class LexerPushModeAction < LexerAction
    attr_reader :mode

    def initialize(mode)
      @mode = mode
    end

    def action_type
      LexerActionType::PUSH_MODE
    end

    def position_dependent?
      false
    end

    def execute(lexer)
      lexer.push_mode(@mode)
    end

    def hash
      return @_hash unless @_hash.nil?

      hash_code = MurmurHash.hash_int_int(action_type, mode)

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

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

      @mode == other.mode
    end

    def to_s
      'pushMode(' << @mode << ')'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
antlr4-runtime-0.2.3 lib/antlr4/runtime/lexer_push_mode_action.rb
antlr4-runtime-0.2.2 lib/antlr4/runtime/lexer_push_mode_action.rb
antlr4-runtime-0.2.1 lib/antlr4/runtime/lexer_push_mode_action.rb
antlr4-runtime-0.2.0 lib/antlr4/runtime/lexer_push_mode_action.rb
antlr4-runtime-0.1.0 lib/antlr4/runtime/lexer_push_mode_action.rb