private Particle parseGroup() throws PrologSyntaxException {
    Particle g = new Particle(Particle.GROUP);
    g.particles = new Vector();
    new AtomParser(db, as, pp, g).parseParticles();
    int n = g.particles.size();
    int flags = 0;
    for (int i = 0; i < n; i++) {
      switch (((Particle)g.particles.elementAt(i)).type) {
      case Particle.GROUP:
	flags |= Entity.GROUP_CONTAINS_GROUP;
	break;
      case Particle.CONNECT_OR:
	flags |= Entity.GROUP_CONTAINS_OR;
	break;
      case Particle.CONNECT_SEQ:
	flags |= Entity.GROUP_CONTAINS_SEQ;
	break;
      case Particle.PCDATA:
	flags |= Entity.GROUP_CONTAINS_PCDATA;
	break;
      case Particle.ELEMENT_NAME:
	flags |= Entity.GROUP_CONTAINS_ELEMENT_NAME;
	break;
      case Particle.NMTOKEN:
	flags |= Entity.GROUP_CONTAINS_NMTOKEN;
	break;
      }
    }
    for (int i = 0; i < n; i++) {
      Particle p = (Particle)g.particles.elementAt(i);
      if (p.type == Particle.REFERENCE)
	p.entity.groupFlags |= flags;
    }
    return g;
  }