def parse_compound_count(s):
m = re.match(r'<STR_LIT>', s)<EOL>if m:<EOL><INDENT>s = m.group(<NUM_LIT:1>)<EOL><DEDENT>for count_type in (int, Decimal, affine.Expression):<EOL><INDENT>try:<EOL><INDENT>return count_type(s)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>raise ValueError('<STR_LIT>'.format(s))<EOL>
Parse a compound count (number of compounds).