def parse_root
      s0 = @current_pos
      s1 = []
      s2 = parse_header
      while s2 != :failed
        s1 << s2
        s2 = parse_header
      end
      if s1 != :failed
        s2 = parse_initialboard
        s2 = nil if s2 == :failed
        s3 = []
        s4 = parse_header
        while s4 != :failed
          s3 << s4
          s4 = parse_header
        end
        s4 = parse_moves
        if s4 != :failed
          s5 = []
          s6 = parse_fork
          while s6 != :failed
            s5 << s6
            s6 = parse_fork
          end
          @reported_pos = s0
          s0 = transform_root(s1, s2, s3, s4, s5)
        else
          @current_pos = s0
          s0 = :failed
        end
      else
        @current_pos = s0
        s0 = :failed
      end
      s0
    end
def parse_root
      s0 = @current_pos
      s1 = []
      s2 = parse_header
      while s2 != :failed
        s1 << s2
        s2 = parse_header
      end
      if s1 != :failed
        s2 = parse_initialboard
        s2 = nil if s2 == :failed
        s3 = []
        s4 = parse_header
        while s4 != :failed
          s3 << s4
          s4 = parse_header
        end
        s4 = parse_moves
        if s4 != :failed
          s5 = []
          s6 = parse_fork
          while s6 != :failed
            s5 << s6
            s6 = parse_fork
          end
          @reported_pos = s0
          s0 = transform_root(s1, s2, s3, s4, s5)
        else
          @current_pos = s0
          s0 = :failed
        end
      else
        @current_pos = s0
        s0 = :failed
      end
      s0
    end
kifu : header* initialboard? header* moves fork*