Sha256: e2295db71d787b4fe72f3d3059f19f98278899574e2ca263bff14509b6e88390

Contents?: true

Size: 816 Bytes

Versions: 7

Compression:

Stored size: 816 Bytes

Contents

module Treetop
  module Runtime
    class TerminalParseFailure < ParseFailure
      attr_reader :expected_string

      def initialize(input, index, expected_string)
        super(input, index)
        @expected_string = expected_string      
      end

      def nested_failures
        [self]
      end
      
      def to_s
        "String matching #{expected_string} expected at line #{line}, column #{column} (index #{index})."
      end
    
      def ==(other_failure)
        eql?(other_failure)
      end
    
      def eql?(other_failure)
        return false unless other_failure.instance_of?(TerminalParseFailure)
        expected_string.eql?(other_failure.expected_string) && index.eql?(other_failure.index)
      end
    
      def hash
        [index, expected_string].hash
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
treetop-1.0.1 lib/treetop/runtime/terminal_parse_failure.rb
treetop-1.1.1 lib/treetop/runtime/terminal_parse_failure.rb
treetop-1.0.2 lib/treetop/runtime/terminal_parse_failure.rb
treetop-1.0.0 lib/treetop/runtime/terminal_parse_failure.rb
treetop-1.1.0 lib/treetop/runtime/terminal_parse_failure.rb
treetop-1.1.2 lib/treetop/runtime/terminal_parse_failure.rb
treetop-1.1.4 lib/treetop/runtime/terminal_parse_failure.rb