Skip to content

Allow generic preprocessor directives #215

@mlange05

Description

@mlange05

In addition to include statements which are recognised as Include_Stmt AST nodes, it would be very useful to allow generic pre-processor directives (eg. #define or #idfef) to be internalised under some generic Directive AST node to prevent parser failures on source files that have not been pre-processed yet. This would allow source-to-source translator tools to deal with non-conformant directives downstream and thus become less intrusive to existing code.

If this is a problem for other use cases, it might also be possible to specialise this behaviour with a flag, something like

reader = FortranStringReader(fcode, ignore_comments=False, allow_directives=True)

I'm happy to provide a PR - just looking for some confirmation that this is ok and possibly some pointers where to start.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions