Doxygen
Loading...
Searching...
No Matches
PythonOutlineParser Class Referencefinal

Python Language parser using state-based lexical scanning. More...

#include <src/pyscanner.h>

Inheritance diagram for PythonOutlineParser:
Collaboration diagram for PythonOutlineParser:

Classes

struct  Private

Public Member Functions

 PythonOutlineParser ()
 ~PythonOutlineParser () 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< Privatep

Detailed Description

Python Language parser using state-based lexical scanning.

This is the Python language parser for doxygen.

Definition at line 32 of file pyscanner.h.

Constructor & Destructor Documentation

◆ PythonOutlineParser()

PythonOutlineParser::PythonOutlineParser ( )

Definition at line 2459 of file pyscanner.l.

2459 : p(std::make_unique<PythonOutlineParser::Private>())
2460{
2461 pyscannerYYlex_init_extra(&p->state,&p->yyscanner);
2462#ifdef FLEX_DEBUG
2463 pyscannerYYset_debug(Debug::isFlagSet(Debug::Lex_pyscanner)?1:0,p->yyscanner);
2464#endif
2465}
@ Lex_pyscanner
Definition debug.h:68
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:133
std::unique_ptr< Private > p
Definition pyscanner.h:46

References Debug::isFlagSet(), Debug::Lex_pyscanner, p, and PythonOutlineParser().

Referenced by PythonOutlineParser().

◆ ~PythonOutlineParser()

PythonOutlineParser::~PythonOutlineParser ( )
override

Definition at line 2467 of file pyscanner.l.

2468{
2469 pyscannerYYlex_destroy(p->yyscanner);
2470}

References p.

Member Function Documentation

◆ needsPreprocessing()

bool PythonOutlineParser::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 2487 of file pyscanner.l.

2488{
2489 return false;
2490}

◆ parseInput()

void PythonOutlineParser::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 2473 of file pyscanner.l.

2477{
2478 struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
2479 yyextra->thisParser = this;
2480 DebugLex debugLex(Debug::Lex_pyscanner, __FILE__, qPrint(fileName));
2481 ::parseMain(p->yyscanner, fileName,fileBuf,root);
2482
2483 // May print the AST for debugging purposes
2484 // printAST(global_root);
2485}
const char * qPrint(const char *s)
Definition dstring.h:787
static void parseMain(yyscan_t yyscanner, const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt)
Definition pyscanner.l:2321

References Debug::Lex_pyscanner, p, parseMain(), and qPrint().

◆ parsePrototype()

void PythonOutlineParser::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 2492 of file pyscanner.l.

2493{
2494 ::parsePrototype(p->yyscanner,text);
2495}
void parsePrototype(const DString &text) override
Callback function called by the comment block scanner.
Definition pyscanner.l:2492

References p, and parsePrototype().

Referenced by parsePrototype().

Member Data Documentation

◆ p

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

Definition at line 46 of file pyscanner.h.

Referenced by parseInput(), parsePrototype(), PythonOutlineParser(), and ~PythonOutlineParser().


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