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, const CodeParserOptions &options) 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.

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:69
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
void resetCodeParserState() override
Resets the state of the code parser.
Definition vhdlcode.l:1646
std::unique_ptr< Private > p
Definition vhdlcode.h:42

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

◆ ~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,
const CodeParserOptions & options )
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]optionsAdditional options to configure the parser.

Implements CodeParserInterface.

Definition at line 1651 of file vhdlcode.l.

1658{
1659 yyscan_t yyscanner = p->yyscanner;
1660 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1661 //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd);
1662 if (s.isEmpty()) return;
1663 DebugLex debugLex(Debug::Lex_vhdlcode, __FILE__, options.fileDef() ? qPrint(options.fileDef()->fileName()): nullptr);
1664 yyextra->fileName = options.fileDef() ? options.fileDef()->fileName():"";
1665 if (options.memberDef())
1666 {
1667 const ClassDef *dd=options.memberDef()->getClassDef();
1668 if (dd) yyextra->currClass = dd->name();
1669 }
1670 od.stripCodeComments(stripCodeComments);
1672 yyextra->code = &od;
1673 yyextra->inputString = s.data();
1674 yyextra->inputPosition = 0;
1675 yyextra->currentFontClass = nullptr;
1676 yyextra->insideCodeLine = false;
1677 yyextra->searchCtx = options.searchCtx();
1678 yyextra->insideSpecialComment = false;
1679 yyextra->yyLineNr = options.startLine()!=-1 ? options.startLine() : 1;
1680 yyextra->inputLines = options.endLine()!=-1 ? options.endLine()+1 : yyextra->yyLineNr + countLines(yyscanner) - 1;
1681 yyextra->foldStack.clear();
1682
1683 // yyextra->theCallContext.clear();
1684 yyextra->exampleBlock = options.isExample();
1685 yyextra->exampleName = options.exampleName();
1686 yyextra->sourceFileDef = options.fileDef();
1687 if (options.isExample() && options.fileDef()==nullptr)
1688 {
1689 // create a dummy filedef for the example
1690 yyextra->exampleFileDef = createFileDef("",options.exampleName());
1691 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1692 }
1693 if (yyextra->sourceFileDef)
1694 {
1695 setCurrentDoc(yyscanner,"l00001");
1696 }
1697 yyextra->currentDefinition = nullptr;
1698 yyextra->currentMemberDef = nullptr;
1699 yyextra->vhdlMember = nullptr;
1700 if (!yyextra->exampleName.isEmpty())
1701 {
1702 yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example");
1703 }
1704 yyextra->includeCodeFragment = options.inlineFragment();
1705 startCodeLine(yyscanner);
1706 if (!yyextra->lexInit)
1707 {
1709 yyextra->lexInit=true;
1710 }
1711 vhdlcodeYYrestart( nullptr, yyscanner );
1712 BEGIN( Bases );
1713 vhdlcodeYYlex(yyscanner);
1714 if (yyextra->insideCodeLine)
1715 {
1716 endCodeLine(yyscanner);
1717 }
1718 if (Config_getBool(HTML_CODE_FOLDING))
1719 {
1720 while (!yyextra->foldStack.empty())
1721 {
1722 yyextra->code->endFold();
1723 yyextra->foldStack.pop_back();
1724 }
1725 }
1726 if (yyextra->exampleFileDef)
1727 {
1728 // delete the temporary file definition used for this example
1729 yyextra->exampleFileDef.reset();
1730 yyextra->sourceFileDef = nullptr;
1731 }
1732
1733 // write the tooltips
1734 yyextra->tooltipManager.writeTooltips(od);
1735}
virtual const QCString & name() const =0
virtual QCString fileName() const =0
virtual const ClassDef * getClassDef() const =0
static void init()
static void endCodeLine(yyscan_t yyscanner)
Definition code.l:2478
static void startCodeLine(yyscan_t yyscanner)
Definition code.l:2409
static int countLines(yyscan_t yyscanner)
Definition code.l:3462
yyguts_t * yyscan_t
Definition code.l:24
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
Definition code.l:2277
#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:268
const char * qPrint(const char *s)
Definition qcstring.h:687
bool isExample() const
Definition parserintf.h:81
const Definition * searchCtx() const
Definition parserintf.h:89
const FileDef * fileDef() const
Definition parserintf.h:83
int endLine() const
Definition parserintf.h:85
const MemberDef * memberDef() const
Definition parserintf.h:87
bool inlineFragment() const
Definition parserintf.h:86
QCString exampleName() const
Definition parserintf.h:82
int startLine() const
Definition parserintf.h:84
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:3446

References Config_getBool, convertNameToFile(), countLines(), createFileDef(), QCString::data(), endCodeLine(), CodeParserOptions::endLine(), CodeParserOptions::exampleName(), CodeParserOptions::fileDef(), FileDef::fileName(), MemberDef::getClassDef(), VhdlDocGen::init(), CodeParserOptions::inlineFragment(), QCString::isEmpty(), CodeParserOptions::isExample(), Debug::Lex_vhdlcode, CodeParserOptions::memberDef(), Definition::name(), p, qPrint(), resetCodeParserState(), CodeParserOptions::searchCtx(), setCurrentDoc(), startCodeLine(), CodeParserOptions::startLine(), 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().

Member Data Documentation

◆ p

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

Definition at line 42 of file vhdlcode.h.

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


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