git @ Cat's Eye Technologies SixtyPical / 023a415
Don't search for filenames given on cmdline in the include path. Chris Pressey 3 years ago
2 changed file(s) with 8 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
3030 programs = []
3131
3232 for filename in options.filenames:
33 program = load_program(filename, symtab, include_path)
33 program = load_program(filename, symtab, include_path, include_file=False)
3434 if options.debug:
3535 print(symtab)
3636 programs.append(program)
100100 while self.scanner.consume('include'):
101101 filename = self.scanner.token
102102 self.scanner.scan()
103 program = load_program(filename, self.symtab, self.include_path)
103 program = load_program(filename, self.symtab, self.include_path, include_file=True)
104104 includes.append(program)
105105 while self.scanner.on('typedef', 'const'):
106106 if self.scanner.on('typedef'):
479479 # - - - -
480480
481481
482 def load_program(filename, symtab, include_path):
482 def load_program(filename, symtab, include_path, include_file=False):
483483 import os
484 for include_dir in include_path:
485 if os.path.exists(os.path.join(include_dir, filename)):
486 filename = os.path.join(include_dir, filename)
487 break
484 if include_file:
485 for include_dir in include_path:
486 if os.path.exists(os.path.join(include_dir, filename)):
487 filename = os.path.join(include_dir, filename)
488 break
488489 text = open(filename).read()
489490 parser = Parser(symtab, text, filename, include_path)
490491 program = parser.program()