summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfimov Vasily <real@ispras.ru>2016-02-09 20:35:42 +0300
committerEfimov Vasily <real@ispras.ru>2017-10-30 19:58:20 +0300
commit12f4bd55dd789d95218367ec8a3978f6fff5e00e (patch)
treefee953402c5f695b523224332082266fcbfca187
parent40bec356f44293671ce7af0c4f1742ad040cbe82 (diff)
downloadply-12f4bd55dd789d95218367ec8a3978f6fff5e00e.tar.gz
cpp: avoid infinite attempts to expand a word same as a parameterized macro
Signed-off-by: Efimov Vasily <real@ispras.ru>
-rw-r--r--ply/cpp.py6
1 files changed, 6 insertions, 0 deletions
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__':