Improve function arguments parsing and checking

* always use "argN" names for unnamed arguments
* honor space symbol between typename and "*", "&" symbols
* fix indent errors
This commit is contained in:
Andrey Kamaev
2012-11-12 14:42:28 +04:00
parent 5f41971305
commit aabbe11e64
3 changed files with 41 additions and 35 deletions

View File

@@ -116,6 +116,8 @@ def compareSignatures(f, s):
sarg = arg[1]
ftype = re.sub(r"\b(cv|std)::", "", (farg[0] or ""))
stype = re.sub(r"\b(cv|std)::", "", (sarg[0] or ""))
ftype = re.sub(r" (&|\*)$", "\\1", ftype)
stype = re.sub(r" (&|\*)$", "\\1", stype)
if ftype != stype:
return False, "type of argument #" + str(idx+1) + " mismatch"
fname = farg[1] or "arg" + str(idx)
@@ -151,6 +153,7 @@ def formatSignature(s):
if idx > 0:
_str += ", "
argtype = re.sub(r"\bcv::", "", arg[0])
argtype = re.sub(r" (&|\*)$", "\\1", argtype)
bidx = argtype.find('[')
if bidx < 0:
_str += argtype + " "