pcpp icon indicating copy to clipboard operation
pcpp copied to clipboard

LL suffix not parsed correctly

Open Melsius opened this issue 2 years ago • 1 comments

When trying to parse an integer suffixed with "LL", parsing fails. E.g. in

#define very_long_one (1LL)

To reproduce I boiled it down to:

import pcpp
proc = pcpp.Preprocessor()
tokens = proc.tokenize("1LL")
proc.evalexpr(tokens)

Yields: :3 error: Could not evaluate expression due to SyntaxError("around token 'L' type CPP_ID") (passed to evaluator: '1LL')

This can be easily fixed by changing the CPP_INTEGER regex in pcpp.parser to allow one more optional 'L' at the end, however I'm kind of puzzled why nobody else has ran into this issue. Am I missing something?

Melsius avatar Jul 19 '23 13:07 Melsius

We ought to do a better job in pcpp parsing U, L, LL, ULL etc.

Thanks for the BR.

ned14 avatar Jul 19 '23 14:07 ned14