|
Doxygen
|
#include <stdint.h>#include <map>#include <vector>#include <stack>#include <algorithm>#include <stdio.h>#include <stdlib.h>#include <assert.h>#include <ctype.h>#include "fortranscanner.h"#include "entry.h"#include "message.h"#include "config.h"#include "doxygen.h"#include "util.h"#include "defargs.h"#include "language.h"#include "commentscan.h"#include "pre.h"#include "arguments.h"#include "debug.h"#include "markdown.h"#include "doxygen_lex.h"#include "fortranscanner.l.h"Go to the source code of this file.
Classes | |
| struct | BlockState |
| struct | SymbolModifiers |
| Holds yyextra->modifiers (ie attributes) for one symbol (variable, function, etc). More... | |
| struct | CommentInPrepass |
| struct | fortranscannerYY_state |
| struct | FortranOutlineParser::Private |
Macros | |
| #define | YY_TYPEDEF_YY_SCANNER_T |
| #define | DBG_CTX(x) |
| #define | YY_NO_INPUT 1 |
| #define | YY_NO_UNISTD_H 1 |
| #define | YY_INPUT(buf, result, max_size) |
| #define | YY_USER_ACTION yyextra->colNr+=(int)yyleng; |
| #define | INVALID_ENTRY ((Entry*)0x8) |
Typedefs | |
| typedef yyguts_t * | yyscan_t |
Enumerations | |
| enum | ScanVar { V_IGNORE , V_VARIABLE , V_PARAMETER , V_RESULT } |
| enum | InterfaceType { IF_NONE , IF_SPECIFIC , IF_GENERIC , IF_ABSTRACT } |
Functions | |
| static int | getAmpersandAtTheStart (const char *buf, int length) |
| static int | getAmpOrExclAtTheEnd (const char *buf, int length, char ch) |
| static DString | extractFromParens (const DString &name) |
| static DString | extractBind (const DString &name) |
| static int | yyread (yyscan_t yyscanner, char *buf, int max_size) |
| static void | startCommentBlock (yyscan_t yyscanner, bool) |
| static void | handleCommentBlock (yyscan_t yyscanner, const DString &doc, bool brief) |
| static void | subrHandleCommentBlock (yyscan_t yyscanner, const DString &doc, bool brief) |
| Handle parameter description as defined after the declaration of the parameter. | |
| static void | subrHandleCommentBlockResult (yyscan_t yyscanner, const DString &doc, bool brief) |
| Handle result description as defined after the declaration of the parameter. | |
| static void | addCurrentEntry (yyscan_t yyscanner, bool case_insens) |
| adds yyextra->current entry to yyextra->current_root and creates new yyextra->current | |
| static void | addModule (yyscan_t yyscanner, const DString &name=DString(), bool isModule=false) |
| static void | addSubprogram (yyscan_t yyscanner, const DString &text) |
| static void | addInterface (yyscan_t yyscanner, DString name, InterfaceType type) |
| static Argument * | getParameter (yyscan_t yyscanner, const DString &name) |
| static void | scanner_abort (yyscan_t yyscanner) |
| static void | pop_state (yyscan_t yyscanner) |
| static void | pushBlockState (yyscan_t yyscanner, const DString &text) |
| static void | popBlockState (yyscan_t yyscanner) |
| static void | startScope (yyscan_t yyscanner, Entry *scope) |
| static bool | endScope (yyscan_t yyscanner, Entry *scope, bool isGlobalRoot=false) |
| static void | copyEntry (std::shared_ptr< Entry > dest, const std::shared_ptr< Entry > &src) |
| used to copy entry to an interface module procedure | |
| static void | resolveModuleProcedures (yyscan_t yyscanner, Entry *current_root) |
| fill empty interface module procedures with info from corresponding module subprogs | |
| static void | resolveTypeBoundProcedures (Entry *scope) |
| static void | truncatePrepass (yyscan_t yyscanner, int index) |
| static void | pushBuffer (yyscan_t yyscanner, const DString &buffer) |
| static void | popBuffer (yyscan_t yyscanner) |
| static const CommentInPrepass * | locatePrepassComment (yyscan_t yyscanner, int from, int to) |
| static void | updateVariablePrepassComment (yyscan_t yyscanner, int from, int to) |
| static void | newLine (yyscan_t yyscanner) |
| static void | initEntry (yyscan_t yyscanner) |
| static const char * | stateToString (int state) |
| static int | computeIndent (const char *s) |
| static const char * | getLexerFILE () |
| int | yylex (yyscan_t yyscanner) |
| fortran parsing states | |
| static void | insertCharacter (char *contents, int length, int pos, char c) |
| const char * | prepassFixedForm (const char *contents, int *hasContLine, int fixedCommentAfter) |
| static bool | keyWordsFortranC (const char *contents) |
| bool | recognizeFixedForm (const DString &contents, FortranFormat format) |
| FortranFormat | convertFileNameFortranParserCode (const DString &fn) |
| static Argument * | findArgument (Entry *subprog, DString name, bool byTypeName=false) |
| static DString | applyModifiers (DString typeName, const SymbolModifiers &mdfs) |
| static void | applyModifiers (Argument *arg, const SymbolModifiers &mdfs) |
| static void | applyModifiers (Entry *ent, const SymbolModifiers &mdfs) |
| static void | initParser (yyscan_t yyscanner) |
| static void | parseMain (yyscan_t yyscanner, const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt, FortranFormat format) |
Variables | |
| static const char * | directionStrs [] |
| static const char * | directionParam [] |
| #define DBG_CTX | ( | x | ) |
Definition at line 82 of file fortranscanner.l.
| #define INVALID_ENTRY ((Entry*)0x8) |
Definition at line 274 of file fortranscanner.l.
Referenced by endScope(), and parseMain().
| #define YY_INPUT | ( | buf, | |
| result, | |||
| max_size ) |
Definition at line 268 of file fortranscanner.l.
| #define YY_NO_INPUT 1 |
Definition at line 84 of file fortranscanner.l.
| #define YY_NO_UNISTD_H 1 |
Definition at line 85 of file fortranscanner.l.
| #define YY_TYPEDEF_YY_SCANNER_T |
Definition at line 48 of file fortranscanner.l.
| #define YY_USER_ACTION yyextra->colNr+=(int)yyleng; |
Definition at line 273 of file fortranscanner.l.
| typedef yyguts_t* yyscan_t |
Definition at line 50 of file fortranscanner.l.
| enum InterfaceType |
| Enumerator | |
|---|---|
| IF_NONE | |
| IF_SPECIFIC | |
| IF_GENERIC | |
| IF_ABSTRACT | |
Definition at line 88 of file fortranscanner.l.
| enum ScanVar |
| Enumerator | |
|---|---|
| V_IGNORE | |
| V_VARIABLE | |
| V_PARAMETER | |
| V_RESULT | |
Definition at line 87 of file fortranscanner.l.
|
static |
adds yyextra->current entry to yyextra->current_root and creates new yyextra->current
Definition at line 2985 of file fortranscanner.l.
References addCurrentEntry(), and initEntry().
Referenced by addCurrentEntry(), addInterface(), addModule(), and handleCommentBlock().
|
static |
Adds interface to the root entry.
Definition at line 3059 of file fortranscanner.l.
References addCurrentEntry(), addInterface(), addModule(), DString::DString(), IF_ABSTRACT, IF_GENERIC, IF_NONE, IF_SPECIFIC, pushBlockState(), and TypeSpecifier::TypeSpecifier().
Referenced by addInterface().
|
static |
Definition at line 2995 of file fortranscanner.l.
References addCurrentEntry(), addModule(), DString::append(), DBG_CTX, DString::DString(), DString::empty(), DString::mid(), DString::npos, DString::prepend(), qPrint(), DString::rfind(), DString::setNum(), startScope(), and substitute().
Referenced by addInterface(), and addModule().
Definition at line 3032 of file fortranscanner.l.
References addSubprogram(), DString::clear(), DBG_CTX, DString::find(), IF_ABSTRACT, DString::lower(), DString::npos, pushBlockState(), qPrint(), and DString::stripWhiteSpace().
Referenced by addSubprogram().
|
static |
Apply yyextra->modifiers stored in mdfs to the arg argument.
Definition at line 2621 of file fortranscanner.l.
References applyModifiers(), and Argument::type.
|
static |
Apply yyextra->modifiers stored in mdfs to the typeName string.
Definition at line 2504 of file fortranscanner.l.
References SymbolModifiers::allocatable, applyModifiers(), SymbolModifiers::bindVar, DString::contains(), SymbolModifiers::contiguous, SymbolModifiers::deferred, SymbolModifiers::dimension, SymbolModifiers::direction, directionStrs, DString::empty(), SymbolModifiers::external, SymbolModifiers::intrinsic, SymbolModifiers::NONE_D, SymbolModifiers::nonoverridable, SymbolModifiers::nopass, SymbolModifiers::optional, SymbolModifiers::parameter, SymbolModifiers::pass, SymbolModifiers::passVar, SymbolModifiers::pointer, SymbolModifiers::PRIVATE, SymbolModifiers::protect, SymbolModifiers::protection, SymbolModifiers::PUBLIC, SymbolModifiers::save, SymbolModifiers::target, SymbolModifiers::value, and SymbolModifiers::volat.
Referenced by applyModifiers(), applyModifiers(), applyModifiers(), and endScope().
|
static |
Apply yyextra->modifiers stored in mdfs to the ent entry.
Definition at line 2627 of file fortranscanner.l.
References applyModifiers(), SymbolModifiers::deferred, Entry::isStatic, SymbolModifiers::nonoverridable, SymbolModifiers::nopass, SymbolModifiers::PRIVATE, Entry::protection, SymbolModifiers::protection, SymbolModifiers::PUBLIC, Entry::spec, Entry::type, and Entry::virt.
|
inlinestatic |
Definition at line 1718 of file fortranscanner.l.
References computeIndent(), and Config_getInt.
| FortranFormat convertFileNameFortranParserCode | ( | const DString & | fn | ) |
Definition at line 2207 of file fortranscanner.l.
References convertFileNameFortranParserCode(), Fixed, Free, getFileNameExtension(), ParserManager::getParserName(), Doxygen::parserManager, and Unknown.
Referenced by convertCppComments(), convertFileNameFortranParserCode(), and setFileName().
used to copy entry to an interface module procedure
Definition at line 2245 of file fortranscanner.l.
References copyEntry().
Referenced by copyEntry(), and resolveModuleProcedures().
Ends scope in fortran program: may update subprogram arguments or module variable attributes.
Definition at line 2664 of file fortranscanner.l.
References applyModifiers(), Entry::children(), end(), endScope(), findArgument(), initEntry(), INVALID_ENTRY, DString::lower(), Argument::name, Entry::name, DString::npos, Entry::parent(), DString::remove(), Entry::removeSubEntry(), resolveTypeBoundProcedures(), DString::rfind(), scanner_abort(), Entry::section, Entry::spec, DString::str(), Argument::type, and Entry::type.
Referenced by endScope(), and parseMain().
remove useless spaces from bind statement
Definition at line 2322 of file fortranscanner.l.
References extractBind(), extractFromParens(), DString::length(), DString::mid(), and DString::stripWhiteSpace().
Referenced by extractBind(), and SymbolModifiers::operator|=().
Extracts string which resides within parentheses of provided string.
Definition at line 2304 of file fortranscanner.l.
References end(), extractFromParens(), DString::find(), DString::length(), DString::npos, DString::remove(), DString::rfind(), and DString::stripWhiteSpace().
Referenced by extractBind(), extractFromParens(), and SymbolModifiers::operator|=().
For debugging purposes.
Find argument with given name in subprog entry.
Definition at line 2487 of file fortranscanner.l.
References Entry::argList, findArgument(), DString::lower(), Argument::name, and Argument::type.
Referenced by endScope(), and findArgument().
|
static |
Definition at line 1765 of file fortranscanner.l.
References getAmpersandAtTheStart().
Referenced by getAmpersandAtTheStart().
|
static |
Definition at line 1784 of file fortranscanner.l.
References getAmpOrExclAtTheEnd().
Referenced by getAmpOrExclAtTheEnd(), and prepassFixedForm().
|
inlinestatic |
Get the argument name.
Definition at line 3108 of file fortranscanner.l.
References getParameter(), DString::lower(), and Argument::name.
Referenced by getParameter(), and updateVariablePrepassComment().
Definition at line 3143 of file fortranscanner.l.
References addCurrentEntry(), Config_getBool, DString::data(), DBG_CTX, handleCommentBlock(), Markdown::process(), qPrint(), and stripIndentation().
Referenced by handleCommentBlock(), subrHandleCommentBlock(), and subrHandleCommentBlockResult().
|
static |
Definition at line 2956 of file fortranscanner.l.
References initEntry().
Referenced by addCurrentEntry(), endScope(), initEntry(), and startScope().
|
static |
Definition at line 2950 of file fortranscanner.l.
References initParser().
Referenced by initParser(), and parseMain().
|
static |
Definition at line 1864 of file fortranscanner.l.
References insertCharacter().
Referenced by insertCharacter(), and prepassFixedForm().
|
static |
Definition at line 2135 of file fortranscanner.l.
References keyWordsFortranC(), DString::lower(), and DString::str().
Referenced by keyWordsFortranC(), and recognizeFixedForm().
|
static |
Definition at line 1733 of file fortranscanner.l.
References CommentInPrepass::column, and locatePrepassComment().
Referenced by locatePrepassComment(), and updateVariablePrepassComment().
|
static |
Definition at line 1709 of file fortranscanner.l.
References newLine().
Referenced by newLine().
|
static |
Definition at line 3320 of file fortranscanner.l.
References Config_getInt, endScope(), Debug::FortranFixed2Free, initParser(), INVALID_ENTRY, msg, parseMain(), prepassFixedForm(), Debug::print(), recognizeFixedForm(), and startScope().
Referenced by FortranOutlineParser::parseInput(), and parseMain().
|
inlinestatic |
Definition at line 3509 of file fortranscanner.l.
References pop_state(), and warn.
Referenced by pop_state().
|
static |
Definition at line 3526 of file fortranscanner.l.
References popBlockState(), and warn.
Referenced by popBlockState().
|
static |
Definition at line 2235 of file fortranscanner.l.
References DBG_CTX, and popBuffer().
Referenced by FortranOutlineParser::parsePrototype(), and popBuffer().
| const char * prepassFixedForm | ( | const char * | contents, |
| int * | hasContLine, | ||
| int | fixedCommentAfter ) |
Definition at line 1875 of file fortranscanner.l.
References getAmpOrExclAtTheEnd(), insertCharacter(), and prepassFixedForm().
Referenced by checkContLines(), parseMain(), and prepassFixedForm().
Definition at line 3518 of file fortranscanner.l.
References pushBlockState().
Referenced by addInterface(), addSubprogram(), and pushBlockState().
Definition at line 2221 of file fortranscanner.l.
References DString::data(), DBG_CTX, pushBuffer(), and qPrint().
Referenced by FortranOutlineParser::parsePrototype(), and pushBuffer().
| bool recognizeFixedForm | ( | const DString & | contents, |
| FortranFormat | format ) |
Definition at line 2154 of file fortranscanner.l.
References DString::at(), Config_getInt, DString::data(), Fixed, Free, keyWordsFortranC(), DString::length(), and recognizeFixedForm().
Referenced by convertCppComments(), FortranCodeParser::parseCode(), parseMain(), recognizeFixedForm(), and setFileName().
fill empty interface module procedures with info from corresponding module subprogs
TODO: handle procedures in used modules
Definition at line 2267 of file fortranscanner.l.
References Entry::children(), copyEntry(), end(), DString::npos, DString::remove(), resolveModuleProcedures(), DString::rfind(), and DString::str().
Referenced by resolveModuleProcedures().
|
static |
search for types with type bound procedures (e.g. methods) and try to resolve their arguments
Definition at line 2791 of file fortranscanner.l.
References Entry::children(), resolveTypeBoundProcedures(), and DString::str().
Referenced by endScope(), and resolveTypeBoundProcedures().
|
static |
Definition at line 3475 of file fortranscanner.l.
References qPrint(), scanner_abort(), and stateToString().
Referenced by endScope(), and scanner_abort().
|
static |
Definition at line 3126 of file fortranscanner.l.
References startCommentBlock().
Referenced by startCommentBlock().
Starts the new scope in fortran program. Consider using this function when starting module, interface, function or other program block.
Definition at line 2648 of file fortranscanner.l.
References initEntry(), and startScope().
Referenced by addModule(), parseMain(), and startScope().
|
static |
References computeIndent(), and stateToString().
Handle parameter description as defined after the declaration of the parameter.
Definition at line 3187 of file fortranscanner.l.
References DString::back(), directionParam, DString::DString(), DString::empty(), DString::find(), handleCommentBlock(), SymbolModifiers::IN, SymbolModifiers::INOUT, DString::lower(), DString::mid(), SymbolModifiers::NONE_D, SymbolModifiers::OUT, DString::stripPrefix(), DString::stripWhiteSpace(), subrHandleCommentBlock(), and warn.
Referenced by subrHandleCommentBlock().
Handle result description as defined after the declaration of the parameter.
Definition at line 3290 of file fortranscanner.l.
References DString::back(), DString::DString(), DString::empty(), handleCommentBlock(), DString::lower(), DString::stripPrefix(), DString::stripWhiteSpace(), and subrHandleCommentBlockResult().
Referenced by subrHandleCommentBlockResult().
|
static |
Definition at line 1851 of file fortranscanner.l.
References truncatePrepass().
Referenced by truncatePrepass().
|
static |
Definition at line 1750 of file fortranscanner.l.
References Argument::docs, getParameter(), locatePrepassComment(), CommentInPrepass::str, updateVariablePrepassComment(), V_PARAMETER, and V_VARIABLE.
Referenced by updateVariablePrepassComment().
| int yylex | ( | yyscan_t | yyscanner | ) |
fortran parsing states
comment parsing states prototype parsing
Definition at line 379 of file fortranscanner.l.
|
static |
Definition at line 2938 of file fortranscanner.l.
References yyread().
|
static |
Definition at line 144 of file fortranscanner.l.
Referenced by subrHandleCommentBlock().
|
static |
Definition at line 140 of file fortranscanner.l.
Referenced by applyModifiers().