diff --git a/trlc/lexer.py b/trlc/lexer.py index b1e590e7..711237ec 100644 --- a/trlc/lexer.py +++ b/trlc/lexer.py @@ -315,7 +315,7 @@ def __init__(self, mh, file_name, file_content=None): try: super().__init__(mh, fd.read()) except UnicodeDecodeError as err: - mh.error(Location(file_name), str(err)) + mh.lex_error(Location(file_name), str(err)) def current_location(self): # lobster-exclude: Utility function diff --git a/trlc/trlc.py b/trlc/trlc.py index 0ccb441d..eea3329c 100644 --- a/trlc/trlc.py +++ b/trlc/trlc.py @@ -170,19 +170,20 @@ def register_file(self, file_name, file_content=None): # lobster-trace: LRM.Layout ok = True - if file_name.endswith(".rsl"): - try: + try: + if file_name.endswith(".rsl"): self.register_rsl_file(file_name, file_content) - except TRLC_Error: + elif file_name.endswith(".check"): + self.register_check_file(file_name, file_content) + elif file_name.endswith(".trlc"): + self.register_trlc_file(file_name, file_content) + else: ok = False - elif file_name.endswith(".check"): - self.register_check_file(file_name, file_content) - elif file_name.endswith(".trlc"): - self.register_trlc_file(file_name, file_content) - else: + self.mh.error(Location(os.path.basename(file_name)), + "is not a rsl, check, or trlc file", + fatal = False) + except TRLC_Error: ok = False - self.mh.error(Location(os.path.basename(file_name)), - "is not a rsl, check, or trlc file") return ok