diff options
author | Eli Bendersky <eliben@gmail.com> | 2019-05-09 07:03:50 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2019-05-09 07:03:50 -0700 |
commit | c64bc6fe4bf075f4478cb60e6e49361f27aa985f (patch) | |
tree | b011d9665d4d239fa36cc38f4e07832e041f9071 | |
parent | f3a7cda31fc663a9ff6d1122e43999771f411df2 (diff) | |
download | pycparser-c64bc6fe4bf075f4478cb60e6e49361f27aa985f.tar.gz |
Followup on #326 - simplify building up type string
-rw-r--r-- | pycparser/c_parser.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py index a32d0cc..ec8b7d7 100644 --- a/pycparser/c_parser.py +++ b/pycparser/c_parser.py @@ -1778,16 +1778,9 @@ class CParser(PLYParser): raise ValueError('Constant cannot have more than one u/U suffix.') elif lCount > 2: raise ValueError('Constant cannot have more than two l/L suffix.') - else: - if uCount: - t += 'unsigned ' - if lCount == 1: - t += 'long ' - elif lCount == 2: - t += 'long long ' - t += 'int' + prefix = 'unsigned ' * uCount + 'long ' * lCount p[0] = c_ast.Constant( - t, p[1], self._token_coord(p, 1)) + prefix + 'int', p[1], self._token_coord(p, 1)) def p_constant_2(self, p): """ constant : FLOAT_CONST |