Skip to content

Commit

Permalink
Merge branch 'master' into 437_type_guard_stmt_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter authored Apr 11, 2024
2 parents 7ea0f86 + 45631e2 commit 2bfe704
Show file tree
Hide file tree
Showing 34 changed files with 1,245 additions and 344 deletions.
38 changes: 30 additions & 8 deletions doc/pip_requirements.txt → .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -----------------------------------------------------------------------------
# BSD 3-Clause License
#
# Copyright (c) 2022-2023, Science and Technology Facilities Council.
# Copyright (c) 2024, Science and Technology Facilities Council.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -32,10 +32,32 @@
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------

# pip requirements file specifying the packages required to build
# the fparser documentation. Used by readthedocs.
sphinx
sphinxcontrib.bibtex
autoapi
sphinx-autoapi
sphinx_rtd_theme
# Read the Docs configuration file for the fparser documentation
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details.

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
apt_packages:
- graphviz

# Build documentation in the doc/source directory with Sphinx
sphinx:
configuration: doc/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs.
python:
install:
- method: pip
path: .
extra_requirements:
- doc
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ Modifications by (in alphabetical order):
* P. Vitt, University of Siegen, Germany
* A. Voysey, UK Met Office

09/04/2024 PR #442 for #440. Adds a new 'split file' example that splits a single source
file into separate units and creates a Makefile for them.

29/01/2024 PR #435 for #426. Add support for the CONVERT extension of the open()
intrinsic.

25/01/2024 PR #418 for #313. Allow intrinsic shadowing and improve fparser symbol table.

11/01/2024 PR #439 for #432. Fix RTD build and clean up setuptools config.

03/10/2023 PR #431 for #430. Fixes bug in WHERE handling in fparser1.

14/09/2023 PR #425 for #411. Splits the monolithic Fortran2008.py file
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# News #

* 31/01/2024 Version 0.1.4 released (resolves issues with WHERE statements and intrinsics).
* 18/09/2023 Version 0.1.3 released (resolves issues with support for DO CONCURRENT).
* 19/06/2023 Version 0.1.2 released (bug fix for handling of INCLUDE files).
* 28/04/2023 Version 0.1.1 released (extends F2008 support with the optional
Expand Down
3 changes: 2 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ help:

# Target that removes all generated files
allclean: clean
@echo "Removing everything under 'source'..."
@echo "Removing everything under 'source/autoapi'..."
@rm -rf ./source/autoapi/*
@echo "Removing everything under 'source/doxygen'..."
@rm -rf ./source/doxygen/*
7 changes: 4 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import subprocess
import fparser

project = 'fparser'
copyright = '2017-2022, Science and Technology Facilities Council'
copyright = '2017-2024, Science and Technology Facilities Council'
author = 'Andrew Porter, Rupert Ford, Balthasar Reuter and Pearu Peterson'

version = '0.0.16'
release = '0.0.16'
version = fparser._get_version()
release = fparser._get_version()

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
1 change: 1 addition & 0 deletions doc/source/developers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ corresponding dictionary entries are instances of the `SymbolTable`
class:

.. autoclass:: fparser.two.symbol_table.SymbolTable
:members:

The entries in these tables are instances of the named tuple,
`SymbolTable.Symbol` which currently has the properties:
Expand Down
15 changes: 14 additions & 1 deletion doc/source/fparser2.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Copyright (c) 2017-2022 Science and Technology Facilities Council.
.. Copyright (c) 2017-2024 Science and Technology Facilities Council.
All rights reserved.
Expand Down Expand Up @@ -353,6 +353,19 @@ extension adds support for the dollar descriptor in fparser.
For more information see
https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-dollar-sign-and-backslash-editing

CONVERT argument to OPEN
++++++++++++++++++++++++

The CONVERT argument may be used to specify how unformatted data being read
from file is to be converted before being stored. For example::

OPEN(unit=23, file="some_data", form='unformatted',access='sequential', &
convert="LITTLE_ENDIAN")

This extension is supported by (at least) the Gnu, Intel and Cray compilers
but is not a part of any Fortran standard. More details can be found at
https://gcc.gnu.org/onlinedocs/gfortran/CONVERT-specifier.html

Classes
-------

Expand Down
11 changes: 8 additions & 3 deletions example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@

.PHONY: test create_dependency fparser2_f2008

test: create_dependency fparser2_f2008
test: create_dependencies split_file fparser2_f2008

create_dependency:
(cd test_files; ../create_dependencies.py *.f90)
create_dependencies:
(cd test_files/create_dependencies; ../../create_dependencies.py *.f90)

split_file:
(cd test_files/split_file; \
rm -f Makefile func.f90 mod1.f90 sub.f90 test_prog.f90; \
../../split_file.py test.f90)

fparser2_f2008:
python ./fparser2_f2008.py
17 changes: 17 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,20 @@ It also supports files in subdirectories, e.g.:
- Provide a list of modules to ignore, and abort the script if a reference
to a module is found that is unknown (i.e. neither provided in a file name
nor in the list of modules to ignore).

## split_file.py
This script splits one Fortran source file into several files, each containing
one top level module, subroutine, function or program. Each file uses the name
of the program unit (module-, subroutine-, function-, program name). The
extension will be ``.F90`` if there are preprocessor directives in the file,
and ``.f90`` otherwise.

Additionally, ``split_file.py`` will create a Makefile to build either the
binary (if a program is found in the file), or all object files. If any of
the environment variables ``F90``, ``F90FLAGS``, and ``LDFLAGS`` are set at
run time of the script, it will use these values as default values in the
makefile. But by setting these environment variables when running ``make``,
these defaults can always be overwritten. The Makefile also has a ``clean``
target, which will remove all ``.mod``, object, and the program file (if
available). It uses the ``create_dependencies.py`` script to add the
required dependencies to the Makefile.
4 changes: 2 additions & 2 deletions example/create_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# -----------------------------------------------------------------------------
# BSD 3-Clause License
#
# Copyright (c) 2020, Science and Technology Facilities Council.
# Copyright (c) 2020-2024, Science and Technology Facilities Council.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -104,6 +104,7 @@ def get_root(file_name):

# Sort the input file names, so that they are output alphabetically
all_files.sort()
parser = ParserFactory().create(std="f2008")
for filename in all_files:
# Parse the current source file:
try:
Expand All @@ -112,7 +113,6 @@ def get_root(file_name):
print(f"Could not open file '{filename}'.", file=sys.stderr)
sys.exit(-1)

parser = ParserFactory().create(std="f2003")
parse_tree = parser(reader)

# Collect all used modules in a list
Expand Down
Loading

0 comments on commit 2bfe704

Please sign in to comment.