Skip to content

Commit

Permalink
#1247 Update changelog and some docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
sergisiso committed Dec 30, 2024
1 parent f268ddf commit 1e94f0a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 4 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
frontend to chase down some (or all) module imports when constructing
the PSyIR for existing code.

4) PR #2821 for #1247. Adds support for parsing comments from the fparser2
AST tree. There are two new FortranReader arguments to select the behaviour
for comments and directives (by default they are not parsed).

release 3.0.0 6th of December 2024

1) PR #2477 for #2463. Add support for Fortran Namelist statements.
Expand Down
23 changes: 9 additions & 14 deletions src/psyclone/psyir/frontend/fparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,25 +852,20 @@ class Fparser2Reader():
Class to encapsulate the functionality for processing the fparser2 AST and
convert the nodes to PSyIR.
:param ignore_directives: If directives should be ignored or not
(default True). Only has an effect
if comments were not ignored.
:param last_comments_as_codeblocks: If the last comments in the
a given block (e.g. subroutine,
do, if-then body, etc.) should
be kept as code blocks or lost
(default False).
Only has an effect if comments were
not ignored.
:param ignore_directives: Whether directives should be ignored or not
(default True). Only has an effect if comments were not ignored when
creating the fparser2 AST.
:param last_comments_as_codeblocks: Whether the last comments in the a
given block (e.g. subroutine, do, if-then body, etc.) should be kept as
CodeBlocks or lost (default False). Only has an effect if comments
were not ignored when creating the fparser2 AST.
:param resolve_modules: Whether to resolve modules while parsing a file,
for more precise control it also accepts a list of module names.
Defaults to False.
:raises TypeError: if the constructor argument is not of the expected type.
'''

unary_operators = OrderedDict([
('+', UnaryOperation.Operator.PLUS),
('-', UnaryOperation.Operator.MINUS),
Expand Down Expand Up @@ -955,7 +950,7 @@ class SelectTypeInfo:

def __init__(self, ignore_directives: bool = True,
last_comments_as_codeblocks: bool = False,
resolve_modules=False):
resolve_modules: bool = False):
if isinstance(resolve_modules, bool):
self._resolve_all_modules = resolve_modules
self._modules_to_resolve = []
Expand Down Expand Up @@ -1015,7 +1010,7 @@ def __init__(self, ignore_directives: bool = True,
self._last_psyir_parsed_and_span = None
# Whether to ignore directives when processing the fparser2 AST
self._ignore_directives = ignore_directives
# Whether to keep the last comments in a given block as code blocks
# Whether to keep the last comments in a given block as CodeBlocks
self._last_comments_as_codeblocks = last_comments_as_codeblocks

@staticmethod
Expand Down

0 comments on commit 1e94f0a

Please sign in to comment.