parsing all segments described in reference document