X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomrogue%2Fparser.py;h=a1b56b571b650431d297badf3f0e4573da731359;hb=acdf162669be2293919fe536275b28703489881f;hp=5782d695fe1f026d4dc2b00f422cda389fae9988;hpb=540aec0e9bf55d0452cffda4b34e1995d3724abf;p=plomrogue2 diff --git a/plomrogue/parser.py b/plomrogue/parser.py index 5782d69..a1b56b5 100644 --- a/plomrogue/parser.py +++ b/plomrogue/parser.py @@ -106,6 +106,16 @@ class Parser: if not arg.isdigit(): raise ArgError('Argument must be non-negative integer.') args += [int(arg)] + elif tmpl == 'int:pos': + if not arg.isdigit() or int(arg) < 1: + raise ArgError('Argument must be positive integer.') + args += [int(arg)] + elif tmpl == 'char': + try: + ord(arg) + except TypeError: + raise ArgError('Argument must be single character.') + args += [arg] elif tmpl == 'yx_tuple:nonneg': args += [self.parse_yx_tuple(arg, 'nonneg')] elif tmpl == 'yx_tuple:pos':