# File lib/edi4r/edifact.rb, line 955
    def MsgGroup.parse (p, segment_list) # List of segments
      grp = p.new_msggroup(:msg_type => 'DUMMY')

      # We now expect a sequence of segments that comprises one group, 
      # starting with UNG and ending with UNE, and with messages in between.
      # We process the UNG/UNE envelope separately, then work on the content.

      header  = grp.parse_segment(segment_list.shift, 'UNG')
      trailer = grp.parse_segment(segment_list.pop,   'UNE')

      init_seg = Regexp.new('^UNH')
      exit_seg = Regexp.new('^UNT')
      
      while segbuf = segment_list.shift
        case segbuf

        when init_seg
          sub_list = Array.new
          sub_list.push segbuf

        when exit_seg
          sub_list.push segbuf  
          grp.add grp.parse_message(sub_list)

        else
          sub_list.push segbuf  
        end
      end

      grp.header  = header
      grp.trailer = trailer
      grp
    end