Doxygen
Loading...
Searching...
No Matches
FortranOutlineParser Class Reference

Fortran language parser using state-based lexical scanning. More...

#include <src/fortranscanner.h>

Inheritance diagram for FortranOutlineParser:
Collaboration diagram for FortranOutlineParser:

Classes

struct  Private

Public Member Functions

 FortranOutlineParser (FortranFormat format=FortranFormat::Unknown)
 ~FortranOutlineParser () override
void parseInput (const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser) override
 Parses a single input file with the goal to build an Entry tree.
bool needsPreprocessing (const DString &extension) const override
 Returns true if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.
void parsePrototype (const DString &text) override
 Callback function called by the comment block scanner.

Private Attributes

std::unique_ptr< Private > p

Detailed Description

Fortran language parser using state-based lexical scanning.

This is the Fortran language parser for doxygen.

Definition at line 25 of file fortranscanner.h.

Constructor & Destructor Documentation

◆ FortranOutlineParser()

FortranOutlineParser::FortranOutlineParser ( FortranFormat format = FortranFormat::Unknown)

Definition at line 3429 of file fortranscanner.l.

3430 : p(std::make_unique<Private>(format))
3431{
3432}
std::unique_ptr< Private > p

References p.

Referenced by ~FortranOutlineParser().

◆ ~FortranOutlineParser()

FortranOutlineParser::~FortranOutlineParser ( )
overridedefault

Member Function Documentation

◆ needsPreprocessing()

bool FortranOutlineParser::needsPreprocessing ( const DString & extension) const
overridevirtual

Returns true if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.

See also
parseInput()

Implements OutlineParserInterface.

Definition at line 3449 of file fortranscanner.l.

3450{
3451 return extension!=extension.lower(); // use preprocessor only for upper case extensions
3452}
DString lower() const
Definition dstring.h:326

References DString::lower().

◆ parseInput()

void FortranOutlineParser::parseInput ( const DString & fileName,
const char * fileBuf,
const std::shared_ptr< Entry > & root,
ClangTUParser * clangParser )
overridevirtual

Parses a single input file with the goal to build an Entry tree.

Parameters
[in]fileNameThe full name of the file.
[in]fileBufThe contents of the file (zero terminated).
[in,out]rootThe root of the tree of Entry *nodes representing the information extracted from the file.
[in]clangParserThe clang translation unit parser object or nullptr if disabled.

Implements OutlineParserInterface.

Definition at line 3436 of file fortranscanner.l.

3440{
3441 struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
3442 yyextra->thisParser = this;
3443
3444 DebugLex debugLex(Debug::Lex_fortranscanner, __FILE__, qPrint(fileName));
3445
3446 ::parseMain(p->yyscanner,fileName,fileBuf,root,p->format);
3447}
@ Lex_fortranscanner
Definition debug.h:63
#define yyguts_t
Definition code.l:23
const char * qPrint(const char *s)
Definition dstring.h:783
static void parseMain(yyscan_t yyscanner, const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt, FortranFormat format)

References Debug::Lex_fortranscanner, p, parseMain(), qPrint(), and yyguts_t.

◆ parsePrototype()

void FortranOutlineParser::parsePrototype ( const DString & text)
overridevirtual

Callback function called by the comment block scanner.

It provides a string text containing the prototype of a function or variable. The parser should parse this and store the information in the Entry node that corresponds with the node for which the comment block parser was invoked.

Implements OutlineParserInterface.

Definition at line 3454 of file fortranscanner.l.

3455{
3456 struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
3457 pushBuffer(p->yyscanner,text);
3458 yyextra->parsingPrototype = true;
3459 BEGIN(Prototype);
3460 fortranscannerYYlex(p->yyscanner);
3461 yyextra->parsingPrototype = false;
3462 popBuffer(p->yyscanner);
3463}
static void pushBuffer(yyscan_t yyscanner, const DString &buffer)
static void popBuffer(yyscan_t yyscanner)

References p, popBuffer(), pushBuffer(), and yyguts_t.

Member Data Documentation

◆ p

std::unique_ptr<Private> FortranOutlineParser::p
private

Definition at line 40 of file fortranscanner.h.

Referenced by FortranOutlineParser(), parseInput(), and parsePrototype().


The documentation for this class was generated from the following files: