From 12f4bd55dd789d95218367ec8a3978f6fff5e00e Mon Sep 17 00:00:00 2001 From: Efimov Vasily Date: Tue, 9 Feb 2016 20:35:42 +0300 Subject: cpp: avoid infinite attempts to expand a word same as a parameterized macro Signed-off-by: Efimov Vasily --- ply/cpp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ply/cpp.py b/ply/cpp.py index 06acdf3..d00348e 100644 --- a/ply/cpp.py +++ b/ply/cpp.py @@ -536,6 +536,12 @@ class Preprocessor(object): r.lineno = t.lineno tokens[i:j+tokcount] = rep i += len(rep) + else: + # This is not a macro. It is just a word which + # equals to name of the macro. Hence, go to the + # next token. + i += 1 + del expanded[t.value] continue elif t.value == '__LINE__': -- cgit v1.2.1