fparser.two.parser ================== .. py:module:: fparser.two.parser .. autoapi-nested-parse:: This file provides utilities to create a Fortran parser suitable for a particular standard. Classes ------- .. autoapisummary:: fparser.two.parser.ParserFactory Functions --------- .. autoapisummary:: fparser.two.parser.get_module_classes Module Contents --------------- .. py:function:: get_module_classes(input_module) Return all classes local to a module. :param module input_module: the module containing the classes. :returns: list of class names and types. :rtype: List[Tuple[str, type]] .. py:class:: ParserFactory Creates a parser suitable for the specified Fortran standard. .. py:method:: create(std=None) Creates a class hierarchy suitable for the specified Fortran standard. Also sets-up the list of classes that define scoping regions in the global SymbolTables object and clears any existing symbol table information. :param str std: the Fortran standard. Choices are 'f2003' or 'f2008'. 'f2003' is the default. :return: a Program class (not object) for use with the Fortran reader :rtype: :py:class:`fparser.two.Fortran2003.Program` :raises ValueError: if the supplied value for the std parameter is invalid For example: >>> from fparser.two.parser import ParserFactory >>> f2003_parser = ParserFactory().create() >>> f2003_parser = ParserFactory().create(std='f2003') >>> f2008_parser = ParserFactory().create(std='f2008') >>> # Assuming that a reader has already been created ... >>> ast = f2008_parser(reader) >>> print(ast) .. py:method:: _setup(input_classes) Perform some Python magic to create the connections between classes and populate the baseclass with this information. This has been lifted from the original implementation and no attempt has been made to tidy up the code, other than making it conformant to the coding rules. :param list input_classes: a list of tuples each containing a class name and a class.