mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Fix rules not being parsed entirely
This commit is contained in:
parent
edb52a989e
commit
f68849c65f
@ -112,32 +112,28 @@ def main() -> None:
|
||||
log.error(str(e))
|
||||
exit(1)
|
||||
|
||||
error = False
|
||||
try:
|
||||
asyncio.run(pferd.run())
|
||||
except ConfigOptionError as e:
|
||||
log.unlock()
|
||||
log.error(str(e))
|
||||
error = True
|
||||
exit(1)
|
||||
except RuleParseError as e:
|
||||
log.unlock()
|
||||
e.pretty_print()
|
||||
error = True
|
||||
exit(1)
|
||||
except KeyboardInterrupt:
|
||||
log.unlock()
|
||||
log.explain_topic("Interrupted, exiting immediately")
|
||||
log.explain("Open files and connections are left for the OS to clean up")
|
||||
log.explain("Temporary files are not cleaned up")
|
||||
pferd.print_report()
|
||||
# TODO Clean up tmp files
|
||||
# And when those files *do* actually get cleaned up properly,
|
||||
# reconsider if this should be an error
|
||||
error = True
|
||||
# reconsider if this should really exit with 1
|
||||
exit(1)
|
||||
except Exception:
|
||||
log.unlock()
|
||||
log.unexpected_exception()
|
||||
error = True
|
||||
|
||||
pferd.print_report()
|
||||
|
||||
if error:
|
||||
pferd.print_report()
|
||||
exit(1)
|
||||
|
@ -119,7 +119,9 @@ class Pferd:
|
||||
|
||||
def print_report(self) -> None:
|
||||
for name in self._crawlers_to_run:
|
||||
crawler = self._crawlers[name]
|
||||
crawler = self._crawlers.get(name)
|
||||
if crawler is None:
|
||||
continue # Crawler failed to load
|
||||
|
||||
log.report("")
|
||||
log.report(f"[bold bright_cyan]Report[/] for {escape(name)}")
|
||||
|
@ -266,6 +266,11 @@ def parse_whitespace(line: Line) -> None:
|
||||
line.advance()
|
||||
|
||||
|
||||
def parse_eol(line: Line) -> None:
|
||||
if line.get() is not None:
|
||||
raise RuleParseError(line, "Expected end of line")
|
||||
|
||||
|
||||
def parse_rule(line: Line) -> Rule:
|
||||
# Parse left side
|
||||
leftindex = line.index
|
||||
@ -291,6 +296,8 @@ def parse_rule(line: Line) -> Rule:
|
||||
else:
|
||||
rightpath = PurePath(right)
|
||||
|
||||
parse_eol(line)
|
||||
|
||||
# Dispatch
|
||||
if arrowname == "":
|
||||
return NormalRule(PurePath(left), rightpath)
|
||||
|
Loading…
Reference in New Issue
Block a user