Bruno Wolff III <[EMAIL PROTECTED]>: > Eric's wmllint has caught a lot of long standing bugs in campaings, and > I think this is something we would want to tout for the release. > The included campaigns should be noticably higher quality (in terms > of glitches) because of this feature.
And last night I implemented argument-count and argument-type checking. This means that, for example, if you write {PLACE_IMAGE 23 17 "foo.png"} wmlscope will throw a warning because it knows that PLACE_IMAGE expects the argument signature (string numeric numeric) and the first argument of PLACE_IMAGE should thus not be a numeric literal. The way this works is that the cross-reference generator looks at the names of the formal arguments of the macro and tries to figure out from those what the formal arguments should look like. Here are some of the rules: Formal argument X or Y expects a numeric or range literal Formal argument TYPE or DESCRIPTION expects a string literal Formal argument SIDE expects a numeric literal The logic knows it can't deduce anything from actual arguments that are macro calls or $ expressions, and treats those as matching any formal. This is all done inside the function argmatch() in data/tools/wesnoth/wmltools.py In a few minutes I'll implement a rule that IMAGE expects a string ending in ".png" or ".jpg". Then I'll run through the macro definitions in mainline looking for places where a formal should be changed to IMAGE. New rules mapping matches of regular expressions to formal-argument expected types and actual-argument types are easy and cheap to write, so I expect I'll be doing this for a while. I'm thinking, for example, about trying to recognize terrain strings and expecting them if the formal is TERRAIN; this would catch (say) cases where you try to mistakenly pass an image in the wrong place. Of course since this is done in wmlscope it has no game overhead at all. -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> _______________________________________________ Wesnoth-dev mailing list Wesnoth-dev@gna.org https://mail.gna.org/listinfo/wesnoth-dev