Commits

Anonymous committed 8642020

Define pragma_pattern again, allow for cpp_ignore==None.

Comments (0)

Files changed (1)

pycparser/c_lexer.py

         #
         self.line_pattern = re.compile('([ \t]*line\W)|([ \t]*\d+)')
 
+        self.pragma_pattern = re.compile('[ \t]*pragma\W')
+
 	# There are further things coming through, which we ignore
-	# for now.
+	# for now. It can also be set to None.
 	self.cpp_ignore = re.compile(r'[ \t]*(pragma|ident)[^\n]*\n')
+	self.cpp_ignore = None
 
     @property
     def filename(self):
         else:
 	    # Look for CPP patterns to ignore
 	    #~ print t.lexer.lexdata[t.lexer.lexpos:t.lexer.lexpos+90]
-	    m = self.cpp_ignore.match(
+	    if self.cpp_ignore != None:
+		m = self.cpp_ignore.match(
 	    			t.lexer.lexdata, pos=t.lexer.lexpos)
-	    if m:
-	    	s, e = m.span()
-	    	t.lexer.lexpos += e - s
-	    	return
+		if m:
+		    s, e = m.span()
+		    t.lexer.lexpos += e - s
+		    return
 
 	    lpos = t.lexer.lexpos
 	    print "Unknown CPP:", t.lexer.lexdata[lpos:lpos+20]