PyForTool
Python-fortran-tool
Loading...
Searching...
No Matches
Functions
pyfortool.expressions Namespace Reference

Functions

 createElem (tagName, text=None, tail=None)
 
 _cachedCreateExprPart (value)
 
 createExprPart (value)
 
 _cachedCreateExpr (value)
 
 createExpr (value)
 
 simplifyExpr (expr, add=None, sub=None)
 
 createArrayBounds (lowerBoundstr, upperBoundstr, context)
 

Detailed Description

This module includes functions to deal with expressions
These functions are independent of the PYFT and PYFTscope objects

Function Documentation

◆ _cachedCreateExpr()

pyfortool.expressions._cachedCreateExpr (   value)
protected
:param value: statements to convert into xml
:return: the xml fragment corresponding to value (list of nodes)

Definition at line 99 of file expressions.py.

Here is the caller graph for this function:

◆ _cachedCreateExprPart()

pyfortool.expressions._cachedCreateExprPart (   value)
protected
:param value: expression part to put in a *-E node

If value is:
  - a FORTRAN string (python sting containing a ' or a "), returns
    <f:string-E><f:S>...
  - a FORTRAN value (python string convertible in real or int, or .FALSE./.TRUE.), returns
    <f:literal-E><f:l>...
  - a FORTRAN variable name (pyhon string with only alphanumerical characters and _), returns
    <named-E/><N><n>...
  - a FORTRAN operation (other python string), returns the right part of
    the X affectation statement of the code:
    "SUBROUTINE T; X=" + value + "; END". The xml is obtained by calling fxtran.

Definition at line 30 of file expressions.py.

Here is the caller graph for this function:

◆ createArrayBounds()

pyfortool.expressions.createArrayBounds (   lowerBoundstr,
  upperBoundstr,
  context 
)
Return a lower-bound and upper-bound node
:param lowerBoundstr: string for the fortran lower bound of an array
:param upperBoundstr: string for the fortran upper bound of an array
:param context: 'DO' for DO loops
                'DOCONCURRENT' for DO CONCURRENT loops
                'ARRAY' for arrays

Definition at line 184 of file expressions.py.

◆ createElem()

pyfortool.expressions.createElem (   tagName,
  text = None,
  tail = None 
)
:param tagName: tag of the element to create
:param text: None or text of the element
:param tail: None or tail of the element

Definition at line 15 of file expressions.py.

◆ createExpr()

pyfortool.expressions.createExpr (   value)
:param value: statements to convert into xml
:return: the xml fragment corresponding to value (list of nodes)

Definition at line 108 of file expressions.py.

Here is the call graph for this function:

◆ createExprPart()

pyfortool.expressions.createExprPart (   value)
:param value: expression part to put in a *-E node

If value is:
  - a FORTRAN string (python sting containing a ' or a "), returns
    <f:string-E><f:S>...
  - a FORTRAN value (python string convertible in real or int, or .FALSE./.TRUE.), returns
    <f:literal-E><f:l>...
  - a FORTRAN variable name (pyhon string with only alphanumerical characters and _), returns
    <named-E/><N><n>...
  - a FORTRAN operation (other python string), returns the right part of
    the X affectation statement of the code:
    "SUBROUTINE T; X=" + value + "; END". The xml is obtained by calling fxtran.

Definition at line 80 of file expressions.py.

Here is the call graph for this function:

◆ simplifyExpr()

pyfortool.expressions.simplifyExpr (   expr,
  add = None,
  sub = None 
)
:param expr: string containing an expression to simplify
:param add: string containing an expression to add
:param sub: string containing an expression to substract
:return: simplified expression
E.g. simplifyExpr('1+1+I+JI-I') => '2+JI'
Note: only additions and substractions are considered
      addition and subtraction within parentheses are forbidden

Definition at line 117 of file expressions.py.