fparser.two.Fortran2008.loop_control_r818

Module containing Fortran2008 Loop_Control rule R818

Module Contents

Classes

Loop_Control

Fortran 2008 rule R818

class fparser.two.Fortran2008.loop_control_r818.Loop_Control(string, parent_cls=None)[source]

Bases: fparser.two.Fortran2003.Loop_Control

Fortran 2008 rule R818

loop-control is [ , ] do-variable = scalar-int-expr , scalar-int-expr

[ , scalar-int-expr ]

or [ , ] WHILE ( scalar-logical-expr ) or [ , ] CONCURRENT forall-header

Extends the Fortran2003 rule R830 with the additional CONCURRENT clause.

The F2003 Loop_Control class would be better and more extensible if it called 2 classes, one for each of the above expressions. This would then affect the implementation of this class. Something like the suggestion below. However, this would result in a different fparser tree, see issue #416.

F2003: While_Loop_Cntl: scalar-logical-expression, delim F2003: Counter_Loop_Cntl: var, lower, upper, [step], delim F2008: Concurrent_Loop_Cntl: conc_expr, delim F2018: Concurrent_Loop_Cntl: conc_expr, local_x, delim

subclass_names = [][source]
use_names[source]
static match(string)[source]

Attempts to match the supplied text with this rule.

Parameters:

string (str) – Fortran code to check for a match.

Returns:

None if there is no match, a tuple with the first entry providing the result of matching the ‘WHILE’ part of the rule if there is a match, the second entry providing the result of matching the ‘COUNTER’ part of the rule if there is a match, the third entry indicating whether there is an optional preceding ‘,’ and the fourth entry providing the result of matching the ‘CONCURRENT’ part of the rule if there is a match.

Return type:

Optional[Tuple[ Optional[ fparser.two.Fortran2003.Scalar_Logical_Expr], Optional[Tuple[ fparser.two.Fortran2003.Do_Variable, List[str]]], Optional[str], Optional[fparser.two.Fortran2003.Forall_Header]]]

tostr()[source]
Returns:

the Fortran representation of this object.

Return type:

str