loki.frontend.regex
The implementation of a regex parser frontend
This is intended to allow for fast, partial extraction of IR objects from Fortran source files without the need to generate a complete parse tree.
Module Attributes
Indicate that the regex frontend is available.  | 
|
  | 
A global registry of all available patterns  | 
Functions
  | 
Generate a reduced Loki IR from regex parsing of the given Fortran source  | 
Classes
  | 
Pattern to match   | 
  | 
Pattern to match generic bindings  | 
  | 
Pattern to match   | 
  | 
Pattern to match   | 
  | 
Pattern to match   | 
  | 
Base class for patterns used in the   | 
  | 
Pattern to match procedure bindings  | 
  | 
Pattern to match procedure statements in interfaces  | 
  | 
Classes to configure active patterns in the   | 
  | 
Pattern to match   | 
  | 
Pattern to match   | 
  | 
Pattern to match   | 
- class RegexParserClass(value)
 Bases:
FlagClasses to configure active patterns in the
REGEXfrontendEvery
Patternin the frontend is categorized as one of these classes. By specifying some (or all of them) asparser_classestoparse_regex_source, pattern matching can be switched on and off for some pattern classes, and thus the overall parse time reduced.- EmptyClass = 0
 
- ProgramUnitClass = 1
 
- InterfaceClass = 2
 
- ImportClass = 4
 
- TypeDefClass = 8
 
- DeclarationClass = 16
 
- CallClass = 32
 
- AllClasses = 63
 
- parse_regex_source(source, parser_classes=None, scope=None)
 Generate a reduced Loki IR from regex parsing of the given Fortran source
The IR nodes that should be matched can be configured via
parser_classes. Any non-matched source code snippets are retained asRawSourceobjects.- Parameters:
 source (str or
Source) – The raw source stringparser_classes (RegexParserClass) – Active parser classes for matching
scope (
Scope, optional) – The enclosing parent scope
- HAVE_REGEX = True
 Indicate that the regex frontend is available.