From 073a7e6dbc9b8a50fb61badb582d6b129103417b Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 9 Jan 2025 08:26:54 +0000 Subject: [PATCH] ProgramUnit: Only apply source sanitisation for FP frontend --- loki/program_unit.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/loki/program_unit.py b/loki/program_unit.py index 9de271ae2..71089d820 100644 --- a/loki/program_unit.py +++ b/loki/program_unit.py @@ -149,11 +149,6 @@ def from_source(cls, source, definitions=None, preprocess=False, includes = omni_includes source = preprocess_cpp(source=source, includes=includes, defines=defines) - # Preprocess using internal frontend-specific PP rules - # to sanitize input and work around known frontend problems. - if frontend != Frontend.OMNI: - source, pp_info = sanitize_input(source=source, frontend=frontend) - if frontend == Frontend.REGEX: return cls.from_regex(raw_source=source, parser_classes=parser_classes, parent=parent) @@ -164,6 +159,10 @@ def from_source(cls, source, definitions=None, preprocess=False, type_map=type_map, parent=parent) if frontend == Frontend.FP: + # Preprocess using internal frontend-specific PP rules + # to sanitize input and work around known frontend problems. + source, pp_info = sanitize_input(source=source, frontend=frontend) + ast = parse_fparser_source(source) return cls.from_fparser(ast=ast, raw_source=source, definitions=definitions, pp_info=pp_info, parent=parent)