Line continuations and fix macro expansion in #ifdef and #ifndef
Line continuations and fix macro expansion in #ifdef and #ifndef


Index: tools/wraptypes/cparser.py
===================================================================
--- tools/wraptypes/cparser.py	(revision 555)
+++ tools/wraptypes/cparser.py	(working copy)
@@ -215,7 +215,7 @@
     t.lexer.begin('PP')
     if t.value in pp_keywords:
         t.type = 'PP_%s' % t.value.upper()
-        if t.value in ('define', 'undef'):
+        if t.value in ('define', 'undef', 'ifdef', 'ifndef'):
             t.lexer.pp_replace_macro = False
         return t
     else:
@@ -244,8 +244,10 @@
 
 def t_PPBEGIN_newline(t):
     r'\n'
+    t.lexer.lineno += 1
+    if t.lexdata[t.lexpos-2] == '\\':
+        return None
     t.lexer.pop_state()
-    t.lexer.lineno += 1
     t.type = 'PP_NEWLINE'
     return t
 
@@ -329,8 +331,10 @@
 
 def t_PP_newline(t):
     r'\n'
+    t.lexer.lineno += 1
+    if t.lexer.lexdata[t.lexer.lexpos-2] == '\\':
+        return None
     t.lexer.pop_state()
-    t.lexer.lineno += 1
     t.lexer.pp_replace_macro = True
     t.type = 'PP_NEWLINE'
     return t



git-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@556 14d46d22-621c-0410-bb3d-6f67920f7d95

regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations