def parse(input)
      @input = input.clone

      @current_pos = 0
      @reported_pos = 0
      @cached_pos = 0
      @cached_pos_details = { line: 1, column: 1, seenCR: false }
      @max_fail_pos = 0
      @max_fail_expected = []
      @silent_fails = 0

      @result = parse_root

      if success? && @current_pos == @input.size
        return @result
      else
        fail(type: "end", description: "end of input") if failed? && @current_pos < input.size
        raise ParseError
      end
    end
def parse(input)
      @input = input.clone

      @current_pos = 0
      @reported_pos = 0
      @cached_pos = 0
      @cached_pos_details = { line: 1, column: 1, seenCR: false }
      @max_fail_pos = 0
      @max_fail_expected = []
      @silent_fails = 0

      @result = parse_root

      if success? && @current_pos == @input.size
        return @result
      else
        fail(type: "end", description: "end of input") if failed? && @current_pos < input.size
        raise ParseError
      end
    end
start parse

 @param [String] input

 @return [Hash] JKF