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 2485 of file pyscanner.l.

2485 : p(std::make_unique<PythonOutlineParser::Private>())
2486{
2487 pyscannerYYlex_init_extra(&p->state,&p->yyscanner);
2488#ifdef FLEX_DEBUG
2489 pyscannerYYset_debug(Debug::isFlagSet(Debug::Lex_pyscanner)?1:0,p->yyscanner);
2490#endif
2491}
@ Lex_pyscanner
Definition debug.h:68
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
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 2493 of file pyscanner.l.

2494{
2495 pyscannerYYlex_destroy(p->yyscanner);
2496}

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 2513 of file pyscanner.l.

2514{
2515 return false;
2516}

◆ 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 2499 of file pyscanner.l.

2503{
2504 struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
2505 yyextra->thisParser = this;
2506 DebugLex debugLex(Debug::Lex_pyscanner, __FILE__, qPrint(fileName));
2507 ::parseMain(p->yyscanner, fileName,fileBuf,root);
2508
2509 // May print the AST for debugging purposes
2510 // printAST(global_root);
2511}
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)
Definition pyscanner.l:2347

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 2518 of file pyscanner.l.

2519{
2520 ::parsePrototype(p->yyscanner,text);
2521}
void parsePrototype(const DString &text) override
Callback function called by the comment block scanner.
Definition pyscanner.l:2518

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: