diff --git a/fortls/parsers/internal/parser.py b/fortls/parsers/internal/parser.py index 60f42f97..ae84ce64 100644 --- a/fortls/parsers/internal/parser.py +++ b/fortls/parsers/internal/parser.py @@ -2075,11 +2075,10 @@ def replace_vars(line: str): if defs is None: defs = {} try: - line_res = eval(replace_ops(replace_vars(replace_defined(text)))) - except: - return False - else: - return line_res + return eval(replace_ops(replace_vars(replace_defined(text)))) + except Exception as exc: + log.error("Error evaluating preprocessor IF statement: %s", exc) + raise ParserError(exc) from exc def expand_func_macro(def_name: str, def_value: tuple[str, str]): def_args, sub = def_value