fparser Reference Guide
0.0.14
|
Public Member Functions | |
def | __init__ (self) |
def | __str__ (self) |
def | enable_checks (self, value) |
def | clear (self) |
def | add (self, name) |
def | lookup (self, name) |
def | scoping_unit_classes (self) |
def | scoping_unit_classes (self, value) |
def | current_scope (self) |
def | enter_scope (self, name) |
def | exit_scope (self) |
def | remove (self, name) |
Class encapsulating functionality for the global symbol-tables object. This is a container for all symbol tables constructed while parsing code. All names are converted to lower case (since Fortran is not case sensitive).
Definition at line 48 of file symbol_table.py.
def fparser.two.symbol_table.SymbolTables.add | ( | self, | |
name | |||
) |
Add a new symbol table with the supplied name. The name will be converted to lower case if necessary. :param str name: the name for the new table. :returns: the new symbol table. :rtype: :py:class:`fparser.two.symbol_table.SymbolTable` :raises SymbolTableError: if there is already an entry with the \ supplied name.
Definition at line 93 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._enable_checks, and fparser.two.symbol_table.SymbolTables._symbol_tables.
def fparser.two.symbol_table.SymbolTables.clear | ( | self | ) |
Deletes any stored SymbolTables but retains the stored list of classes that define scoping units.
Definition at line 84 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._current_scope, and fparser.two.symbol_table.SymbolTables._symbol_tables.
def fparser.two.symbol_table.SymbolTables.current_scope | ( | self | ) |
:returns: the symbol table for the current scoping unit or None. :rtype: :py:class:`fparser.two.symbol_table.SymbolTable` or NoneType
Definition at line 160 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._current_scope.
def fparser.two.symbol_table.SymbolTables.enable_checks | ( | self, | |
value | |||
) |
Sets whether or not to enable consistency checks in every symbol table that is created during a parse. :param bool value: whether or not checks are enabled.
Definition at line 74 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._enable_checks.
def fparser.two.symbol_table.SymbolTables.enter_scope | ( | self, | |
name | |||
) |
Called when the parser enters a new scoping region (i.e. when it encounters one of the classes listed in `_scoping_unit_classes`). Sets the 'current scope' to be the symbol table with the supplied name. If we are not currently within a tree of scoping regions then a new entry is created in the internal dict of symbol tables. If there is an existing tree then a new table is created and added to the bottom. :param str name: name of the scoping region.
Definition at line 167 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._current_scope, fparser.two.symbol_table.SymbolTables._enable_checks, fparser.two.symbol_table.SymbolTables.add(), and fparser.two.symbol_table.SymbolTables.lookup().
def fparser.two.symbol_table.SymbolTables.exit_scope | ( | self | ) |
Marks the end of the processing of the current scoping unit. Since we are exiting the current scoping region, the new 'current scoping region' will be its parent. :raises SymbolTableError: if there is no current scope from which to \ exit.
Definition at line 200 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._current_scope.
def fparser.two.symbol_table.SymbolTables.lookup | ( | self, | |
name | |||
) |
Find the named symbol table and return it. :param str name: the name of the required symbol table (not case \ sensitive). :returns: the named symbol table. :rtype: :py:class:`fparser.two.symbol_table.SymbolTable`
Definition at line 116 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._symbol_tables.
def fparser.two.symbol_table.SymbolTables.remove | ( | self, | |
name | |||
) |
Removes the named symbol table and any descendants it may have. When searching for the named table, the current scope takes priority followed by the list of top-level symbol tables. :param str name: the name of the symbol table to remove (not case \ sensitive). :raises SymbolTableError: if the named symbol table is not in the \ current scope or in the list of top-level symbol tables.
Definition at line 213 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._current_scope, and fparser.two.symbol_table.SymbolTables._symbol_tables.
def fparser.two.symbol_table.SymbolTables.scoping_unit_classes | ( | self | ) |
:returns: the fparser2 classes that are taken to mark the start of \ a new scoping region. :rtype: list of types
Definition at line 130 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._scoping_unit_classes.
def fparser.two.symbol_table.SymbolTables.scoping_unit_classes | ( | self, | |
value | |||
) |
Set the list of fparser2 classes that are taken to mark the start of \ a new scoping region. :param value: the list of fparser2 classes. :type value: list of types :raises TypeError: if the supplied value is not a list of types.
Definition at line 140 of file symbol_table.py.
References fparser.two.symbol_table.SymbolTables._scoping_unit_classes, and fparser.two.symbol_table.SymbolTables.scoping_unit_classes().