Added path iteration and chained directories

All path iteration all goes through the lfs_dir_find function,
which manages the syntax of paths and updates the path pointer
to just the name stored in the dir entry.

Also added directory chaining, which allows more than one block
per directory. This is a simple linked list.
This commit is contained in:
Christopher Haster
2017-04-01 10:09:17 -05:00
parent 390ca3303f
commit ca01b72a35
4 changed files with 270 additions and 63 deletions

View File

@@ -10,9 +10,8 @@ def generate(test):
template = file.read()
lines = []
for line in re.split('(?<=[;{}])\n', test.read()):
match = re.match('( *)(.*)=>(.*);', line, re.MULTILINE)
match = re.match('(?: *\n)*( *)(.*)=>(.*);', line, re.MULTILINE)
if match:
tab, test, expect = match.groups()
lines.append(tab+'res = {test};'.format(test=test.strip()))
@@ -33,13 +32,17 @@ def execute():
subprocess.check_call(["./lfs"])
def main(test=None):
if test:
if test and not test.startswith('-'):
with open(test) as file:
generate(file)
else:
generate(sys.stdin)
compile()
if test == '-s':
sys.exit(1)
execute()
if __name__ == "__main__":