mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-06-07 22:29:27 +00:00
Don't search for filenames given on cmdline in the include path.
This commit is contained in:
parent
a9917d3ea8
commit
023a415a14
|
@ -31,7 +31,7 @@ def process_input_files(filenames, options):
|
||||||
programs = []
|
programs = []
|
||||||
|
|
||||||
for filename in options.filenames:
|
for filename in options.filenames:
|
||||||
program = load_program(filename, symtab, include_path)
|
program = load_program(filename, symtab, include_path, include_file=False)
|
||||||
if options.debug:
|
if options.debug:
|
||||||
print(symtab)
|
print(symtab)
|
||||||
programs.append(program)
|
programs.append(program)
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Parser(object):
|
||||||
while self.scanner.consume('include'):
|
while self.scanner.consume('include'):
|
||||||
filename = self.scanner.token
|
filename = self.scanner.token
|
||||||
self.scanner.scan()
|
self.scanner.scan()
|
||||||
program = load_program(filename, self.symtab, self.include_path)
|
program = load_program(filename, self.symtab, self.include_path, include_file=True)
|
||||||
includes.append(program)
|
includes.append(program)
|
||||||
while self.scanner.on('typedef', 'const'):
|
while self.scanner.on('typedef', 'const'):
|
||||||
if self.scanner.on('typedef'):
|
if self.scanner.on('typedef'):
|
||||||
|
@ -480,12 +480,13 @@ class Parser(object):
|
||||||
# - - - -
|
# - - - -
|
||||||
|
|
||||||
|
|
||||||
def load_program(filename, symtab, include_path):
|
def load_program(filename, symtab, include_path, include_file=False):
|
||||||
import os
|
import os
|
||||||
for include_dir in include_path:
|
if include_file:
|
||||||
if os.path.exists(os.path.join(include_dir, filename)):
|
for include_dir in include_path:
|
||||||
filename = os.path.join(include_dir, filename)
|
if os.path.exists(os.path.join(include_dir, filename)):
|
||||||
break
|
filename = os.path.join(include_dir, filename)
|
||||||
|
break
|
||||||
text = open(filename).read()
|
text = open(filename).read()
|
||||||
parser = Parser(symtab, text, filename, include_path)
|
parser = Parser(symtab, text, filename, include_path)
|
||||||
program = parser.program()
|
program = parser.program()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user