! This is a small include file for Inform stories to check for "Missing Comma Syndrome" (MCS).
! Because the Inform compiler recognises property names as values, it does not generate
! errors if a comma is missed between property definitions. This can result in objects
! being unreferrable by the player, or in nonsense nouns referring to unexpected objects, as
! well as all kinds of other hangs and unexpected behaviour.
! To use, simply include the file, and then with debug mode on, type the debug verb ("debugmcs")
! It's not foolproof, and may generate some false positives with Library objects,
! but is intended as a useful additional check. If the verb gives a blank response, you're probably fine.
! Cedric Knight Apr 2001
#ifdef DEBUG;
[ CheckRoutines o p i g;
if (o==selfobj or thedark) rfalse; ! funny cases in parserm
if (o provides p) {
g=0;
for (i=0: i*2<o.#p: i++) {
if (metaclass(o.&p-->i)~=Routine && o.&p-->i~=NULL) g=1;
}
if (g) {print "Likely problem with "; @print_obj o; print ".",(property) p,"^";}
}
];
[ CheckSR o p;
if (o provides p) {
if (o.#p>2 || metaclass(o.&p-->0)~=String) CheckRoutines(o, p);
}
];
f=0;
objectloop(o) {
if (~~(o provides name or parse_name || (metaclass(o)==Class) ||
o==compass or out_obj or in_obj or TheDark or LibraryMessages or InformParser or InformLibrary))
{ if (~~f) print "^No names for: "; else print ", "; f++;
@print_obj o; print "(",o,")";}
}
if (f) print ".^";
];
Verb meta "debugmcs" * ->DebugMCS;
#endif;