code: Rule KeyDef() {
  		return FirstOf(
  			//found some abc files with only global accidental
  			//assuming it's K:C global accidentals
  			OneOrMoreS(SequenceS(
  				Optional(WSPS()).suppressNode(),
  				GlobalAccidental()
  			)),
  			SequenceS(AnyOf("CDEFGAB").label(BaseNote),
  				OptionalS(KeyNoteAccidental()),
  				Optional(WSPS()).suppressNode(),
  				OptionalS(Mode()),
  				ZeroOrMoreS(SequenceS(
  						Optional(WSPS()).suppressNode(),
  						GlobalAccidental()
  				)),
  				OptionalS(SequenceS(WSPS(), Parameter(Octave)))
  			)
  		).label(KeyDef);
  	}
docs: key-def ::= base-note [key-note-accidental] [mode] *(1*WSP global-accidental)