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

#include <src/vhdlcode.h>

+ Inheritance diagram for VHDLCodeParser:
+ Collaboration diagram for VHDLCodeParser:

Classes

struct  Private
 

Public Member Functions

 VHDLCodeParser ()
 
 ~VHDLCodeParser () override
 
void parseCode (OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE) override
 Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
 
void resetCodeParserState () override
 Resets the state of the code parser.
 
- Public Member Functions inherited from CodeParserInterface

Private Attributes

std::unique_ptr< Privatep
 

Detailed Description

Definition at line 25 of file vhdlcode.h.

Constructor & Destructor Documentation

◆ VHDLCodeParser()

VHDLCodeParser::VHDLCodeParser ( )

Definition at line 1632 of file vhdlcode.l.

1632 : p(std::make_unique<Private>())
1633{
1634 vhdlcodeYYlex_init_extra(&p->state,&p->yyscanner);
1635#ifdef FLEX_DEBUG
1636 vhdlcodeYYset_debug(Debug::isFlagSet(Debug::Lex_vhdlcode)?1:0,p->yyscanner);
1637#endif
1639}
@ Lex_vhdlcode
Definition debug.h:68
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:135
void resetCodeParserState() override
Resets the state of the code parser.
Definition vhdlcode.l:1646
std::unique_ptr< Private > p
Definition vhdlcode.h:51

References Debug::isFlagSet(), Debug::Lex_vhdlcode, p, and resetCodeParserState().

◆ ~VHDLCodeParser()

VHDLCodeParser::~VHDLCodeParser ( )
override

Definition at line 1641 of file vhdlcode.l.

1642{
1643 vhdlcodeYYlex_destroy(p->yyscanner);
1644}

References p.

Member Function Documentation

◆ parseCode()

void VHDLCodeParser::parseCode ( OutputCodeList & codeOutList,
const QCString & scopeName,
const QCString & input,
SrcLangExt lang,
bool stripCodeComments,
bool isExampleBlock,
const QCString & exampleName = QCString(),
const FileDef * fileDef = nullptr,
int startLine = -1,
int endLine = -1,
bool inlineFragment = FALSE,
const MemberDef * memberDef = nullptr,
bool showLineNumbers = TRUE,
const Definition * searchCtx = nullptr,
bool collectXRefs = TRUE )
overridevirtual

Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.

Parameters
[in]codeOutListinterface for writing the result.
[in]scopeNameName of scope to which the code belongs.
[in]inputActual code in the form of a string
[in]langThe programming language of the code fragment.
[in]stripCodeCommentssignals whether or not for the code block the doxygen comments should be stripped.
[in]isExampleBlockTRUE iff the code is part of an example.
[in]exampleNameName of the example.
[in]fileDefFile definition to which the code is associated.
[in]startLineStarting line in case of a code fragment.
[in]endLineEnding line of the code fragment.
[in]inlineFragmentCode fragment that is to be shown inline as part of the documentation.
[in]memberDefMember definition to which the code is associated (non null in case of an inline fragment for a member).
[in]showLineNumbersif set to TRUE and also fileDef is not 0, line numbers will be added to the source fragment
[in]searchCtxcontext under which search data has to be stored.
[in]collectXRefscollect cross-reference relations.

Implements CodeParserInterface.

Definition at line 1651 of file vhdlcode.l.

1666{
1667 yyscan_t yyscanner = p->yyscanner;
1668 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1669 //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd);
1670 if (s.isEmpty()) return;
1671 DebugLex debugLex(Debug::Lex_vhdlcode, __FILE__, fd ? qPrint(fd->fileName()): nullptr);
1672 yyextra->fileName = fd ? fd->fileName():"";
1673 if (memberDef)
1674 {
1675 const ClassDef *dd=memberDef->getClassDef();
1676 if (dd) yyextra->currClass=dd->name();
1677 }
1678 od.stripCodeComments(stripCodeComments);
1680 yyextra->code = &od;
1681 yyextra->inputString = s.data();
1682 yyextra->inputPosition = 0;
1683 yyextra->currentFontClass = nullptr;
1684 yyextra->insideCodeLine = false;
1685 yyextra->searchCtx = searchCtx;
1686 yyextra->foldStack.clear();
1687 yyextra->insideSpecialComment = false;
1688
1689 if (startLine!=-1)
1690 yyextra->yyLineNr = startLine;
1691 else
1692 yyextra->yyLineNr = 1;
1693
1694 if (endLine!=-1)
1695 yyextra->inputLines = endLine+1;
1696 else
1697 yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1;
1698
1699
1700 // yyextra->theCallContext.clear();
1701 yyextra->exampleBlock = exBlock;
1702 yyextra->exampleName = exName;
1703 yyextra->sourceFileDef = fd;
1704 if (exBlock && fd==nullptr)
1705 {
1706 // create a dummy filedef for the example
1707 yyextra->exampleFileDef = createFileDef("",exName);
1708 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1709 }
1710 if (yyextra->sourceFileDef)
1711 {
1712 setCurrentDoc(yyscanner,"l00001");
1713 }
1714 yyextra->currentDefinition = nullptr;
1715 yyextra->currentMemberDef = nullptr;
1716 yyextra->vhdlMember = nullptr;
1717 if (!yyextra->exampleName.isEmpty())
1718 {
1719 yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example");
1720 }
1721 yyextra->includeCodeFragment = inlineFragment;
1722 startCodeLine(yyscanner);
1723 if (!yyextra->lexInit)
1724 {
1726 yyextra->lexInit=true;
1727 }
1728 vhdlcodeYYrestart( nullptr, yyscanner );
1729 BEGIN( Bases );
1730 vhdlcodeYYlex(yyscanner);
1731 if (yyextra->insideCodeLine)
1732 {
1733 endCodeLine(yyscanner);
1734 }
1735 if (Config_getBool(HTML_CODE_FOLDING))
1736 {
1737 while (!yyextra->foldStack.empty())
1738 {
1739 yyextra->code->endFold();
1740 yyextra->foldStack.pop_back();
1741 }
1742 }
1743 if (yyextra->exampleFileDef)
1744 {
1745 // delete the temporary file definition used for this example
1746 yyextra->exampleFileDef.reset();
1747 yyextra->sourceFileDef = nullptr;
1748 }
1749
1750 // write the tooltips
1751 yyextra->tooltipManager.writeTooltips(od);
1752}
virtual const QCString & name() const =0
virtual const ClassDef * getClassDef() const =0
static void init()
static void endCodeLine(yyscan_t yyscanner)
Definition code.l:2481
static void startCodeLine(yyscan_t yyscanner)
Definition code.l:2412
static int countLines(yyscan_t yyscanner)
Definition code.l:3465
yyguts_t * yyscan_t
Definition code.l:24
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
Definition code.l:2274
#define Config_getBool(name)
Definition config.h:33
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
Definition filedef.cpp:265
const char * qPrint(const char *s)
Definition qcstring.h:661
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:3858

References Config_getBool, convertNameToFile(), countLines(), createFileDef(), QCString::data(), endCodeLine(), FileDef::fileName(), MemberDef::getClassDef(), VhdlDocGen::init(), QCString::isEmpty(), Debug::Lex_vhdlcode, Definition::name(), p, qPrint(), resetCodeParserState(), setCurrentDoc(), startCodeLine(), and OutputCodeList::stripCodeComments().

◆ resetCodeParserState()

void VHDLCodeParser::resetCodeParserState ( )
overridevirtual

Resets the state of the code parser.

Since multiple code fragments can together form a single example, an explicit function is used to reset the code parser state.

See also
parseCode()

Implements CodeParserInterface.

Definition at line 1646 of file vhdlcode.l.

1647{
1648 p->state.vhdlKeyDict.clear();
1649}

References p.

Referenced by parseCode(), and VHDLCodeParser().

Member Data Documentation

◆ p

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

Definition at line 51 of file vhdlcode.h.

Referenced by parseCode(), resetCodeParserState(), VHDLCodeParser(), and ~VHDLCodeParser().


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