More macro argument type checking.

This commit is contained in:
Eric S. Raymond 2010-02-16 03:12:00 +00:00
parent b5259bc23a
commit 40198d42fe
2 changed files with 6 additions and 5 deletions

View file

@ -28,7 +28,7 @@
#enddef
#Macro for Single Hex
#define SHEX TYPE FLAG PROB TILE
#define SHEX TYPE FLAG PROB TILE_NAME
[terrain_graphics]
map="
, *
@ -47,7 +47,7 @@
probability={PROB}
[image]
name={TILE}
name={TILE_NAME}
base=90,146
[/image]
[/terrain_graphics]

View file

@ -159,10 +159,10 @@ def formaltype(f):
ftype = "alignment"
elif f in ("TYPES",):
ftype = "types"
elif f == "TERRAIN":
ftype = "terrain_code"
elif f.startswith("ADJACENT") or f.startswith("TERRAINLIST") or f.endswith("TERRAIN_PATTERN"):
ftype = "terrain_pattern"
elif f.startswith("TERRAIN"):
ftype = "terrain_code"
elif f in ("NAME", "VAR", "IMAGESTEM", "ID", "FLAG") or f.endswith("_NAME") or f.endswith("_ID"):
ftype = "name"
elif f in ("ID_STRING", "NAME_STRING", "DESCRIPTION"):
@ -179,7 +179,8 @@ def formaltype(f):
ftype = "wml"
elif f in ("AFFIX",) or f.endswith("AFFIX"):
ftype = "affix"
elif f.endswith("VALUE"):
# The regexp case avoids complaints about some wacky terrain macros.
elif f.endswith("VALUE") or re.match("[ARS][0-9]", f):
ftype = "any"
else:
ftype = None