|
PyForTool
Python-fortran-tool
|
Classes | |
| class | PYFTError |
Functions | |
| debugDecor (func) | |
| noParallel (func) | |
| setVerbosity (level) | |
| printInfos () | |
| fortran2xml (fortranSource, parserOptions=None, wrapH=False) | |
| tostring (doc) | |
| tofortran (doc) | |
| isint (string) | |
| Other. | |
| isfloat (string) | |
| tag (elem) | |
| Helper functions acting on the xml. | |
| n2name (nodeN) | |
| alltext (doc) | |
| nonCode (elem) | |
| isExecutable (elem) | |
| isConstruct (elem) | |
| isStmt (elem) | |
Variables | |
| dict | debugStats = {} |
| Verbosity, decorators and Exception. | |
| SHARED_TREE | |
Utility functions and classes for XML manipulation and debugging. Provides helper functions for parsing, converting, and manipulating FORTRAN source code represented as XML.
| pyfortool.util.alltext | ( | doc | ) |
| pyfortool.util.debugDecor | ( | func | ) |
| pyfortool.util.fortran2xml | ( | fortranSource, | |
parserOptions = None, |
|||
wrapH = False |
|||
| ) |
Convert FORTRAN source code to XML using fxtran parser.
Parameters
----------
fortranSource : str
FORTRAN source code string or path to a file.
parserOptions : list, optional
Options passed to fxtran parser.
wrapH : bool, optional
If True, wrap .h file content in a MODULE for free-form parsing.
Returns
-------
tuple
(includesRemoved, xml) where:
- includesRemoved (bool): True if include statements were processed.
- xml (Element): XML document tree.
Examples
--------
>>> includesRemoved, xml = fortran2xml("REAL :: X\nX = 1.0")
| pyfortool.util.isConstruct | ( | elem | ) |
| pyfortool.util.isExecutable | ( | elem | ) |
Check if element is an executable statement.
Parameters
----------
elem : Element
XML element.
Returns
-------
bool
True if element is a statement or construct (excluding declarations).
Examples
--------
>>> isExecutable(stmt_element)
True
Definition at line 449 of file util.py.

| pyfortool.util.isfloat | ( | string | ) |
| pyfortool.util.isint | ( | string | ) |
| pyfortool.util.isStmt | ( | elem | ) |
| pyfortool.util.n2name | ( | nodeN | ) |
Extract entity name from N-tagged XML element.
Parameters
----------
nodeN : Element
XML element with N tag containing 'n' child elements.
Returns
-------
str
Concatenated name from all 'n' child elements.
Examples
--------
>>> n2name(element) # <N><n>X</n><n>Y</n></N> -> 'XY'
| pyfortool.util.nonCode | ( | elem | ) |
| pyfortool.util.noParallel | ( | func | ) |
| pyfortool.util.printInfos | ( | ) |
| pyfortool.util.setVerbosity | ( | level | ) |
| pyfortool.util.tag | ( | elem | ) |
Helper functions acting on the xml.
Get XML tag name without namespace.
Parameters
----------
elem : Element
XML Element.
Returns
-------
str
Tag name without namespace prefix.
Examples
--------
>>> tag(xml_element) # '{http://fxtran.net}subroutine-stmt' -> 'subroutine-stmt'
| pyfortool.util.tofortran | ( | doc | ) |
| pyfortool.util.tostring | ( | doc | ) |
| dict pyfortool.util.debugStats = {} |