Changeset c101fe1 for waflib/Tools/c_preproc.py
- Timestamp:
- Nov 13, 2013, 1:00:56 PM (10 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- d3066e2
- Parents:
- 54e74f0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waflib/Tools/c_preproc.py
r54e74f0 rc101fe1 22 22 re_pragma_once=re.compile('^\s*once\s*',re.IGNORECASE) 23 23 re_nl=re.compile('\\\\\r*\n',re.MULTILINE) 24 re_cpp=re.compile(r """(/\*[^*]*\*+([^/*][^*]*\*+)*/)|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)""",re.MULTILINE)24 re_cpp=re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',re.DOTALL|re.MULTILINE) 25 25 trig_def=[('??'+a,b)for a,b in zip("=-/!'()<>",r'#~\|^[]{}')] 26 26 chr_esc={'0':0,'a':7,'b':8,'t':9,'n':10,'f':11,'v':12,'r':13,'\\':92,"'":39} … … 38 38 skipped='s' 39 39 def repl(m): 40 s=m.group( 1)41 if s :40 s=m.group(0) 41 if s.startswith('/'): 42 42 return' ' 43 return m.group(3)or''43 return s 44 44 def filter_comments(filename): 45 45 code=Utils.readf(filename) … … 476 476 break 477 477 found=self.cached_find_resource(n,filename) 478 if found :478 if found and not found in self.ban_includes: 479 479 self.nodes.append(found) 480 480 if filename[-4:]!='.moc': … … 519 519 bld.parse_cache={} 520 520 self.parse_cache=bld.parse_cache 521 self.current_file=node 521 522 self.addlines(node) 522 523 if env['DEFINES']: … … 558 559 elif token=='include'or token=='import': 559 560 (kind,inc)=extract_include(line,self.defs) 560 if inc in self.ban_includes:561 continue562 if token=='import':self.ban_includes.add(inc)563 561 if ve:debug('preproc: include found %s (%s) ',inc,kind) 564 562 if kind=='"'or not strict_quotes: 565 self.tryfind(inc) 563 self.current_file=self.tryfind(inc) 564 if token=='import': 565 self.ban_includes.add(self.current_file) 566 566 elif token=='elif': 567 567 if state[-1]==accepted: … … 584 584 elif token=='pragma': 585 585 if re_pragma_once.match(line.lower()): 586 self.ban_includes.add(self.cur file)586 self.ban_includes.add(self.current_file) 587 587 except Exception ,e: 588 588 if Logs.verbose:
Note: See TracChangeset
for help on using the changeset viewer.