// class [ assoc class ] private bool ParseClassOrAssociation(ClassDiagram cd) { // class var c = ParseClass(); if (c == null) { // error must have been flagged by class parsing return(false); } cd.AddClass(c); // either there is an association afterwards or not // if there is none, then either this is the end of input // or a comma follows. var sourceClass = c; do { var assoc = ParseAssociation(); if (assoc == null) { break; } // assoc did parse, must be followed by class var c2 = ParseClass(); if (c2 == null) { return(false); } cd.AddClass(c2); cd.Add(new Association(assoc, sourceClass, c2)); sourceClass = c2; } while (true); return(true); }