Skip to main content

The VHDLCodeParser Class Reference

Declaration

class VHDLCodeParser { ... }

Included Headers

#include <src/vhdlcode.h>

Base class

classCodeParserInterface

Abstract interface for code parsers. More...

Public Constructors Index

VHDLCodeParser ()

Public Destructor Index

~VHDLCodeParser () override

Public Member Functions Index

voidparseCode (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. More...

voidresetCodeParserState () override

Resets the state of the code parser. More...

Private Member Attributes Index

std::unique_ptr< Private >p

Definition at line 25 of file vhdlcode.h.

Public Constructors

VHDLCodeParser()

VHDLCodeParser::VHDLCodeParser ()

Declaration at line 28 of file vhdlcode.h, definition at line 1632 of file vhdlcode.l.

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}

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

Public Destructor

~VHDLCodeParser()

VHDLCodeParser::~VHDLCodeParser ()

Declaration at line 29 of file vhdlcode.h, definition at line 1641 of file vhdlcode.l.

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

Reference p.

Public Member Functions

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)
virtual

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

Parameters
[in] codeOutList

interface for writing the result.

[in] scopeName

Name of scope to which the code belongs.

[in] input

Actual code in the form of a string

[in] lang

The programming language of the code fragment.

[in] stripCodeComments

signals whether or not for the code block the doxygen comments should be stripped.

[in] isExampleBlock

TRUE iff the code is part of an example.

[in] exampleName

Name of the example.

[in] fileDef

File definition to which the code is associated.

[in] startLine

Starting line in case of a code fragment.

[in] endLine

Ending line of the code fragment.

[in] inlineFragment

Code fragment that is to be shown inline as part of the documentation.

[in] memberDef

Member definition to which the code is associated (non null in case of an inline fragment for a member).

[in] showLineNumbers

if set to TRUE and also fileDef is not 0, line numbers will be added to the source fragment

[in] searchCtx

context under which search data has to be stored.

[in] collectXRefs

collect cross-reference relations.

Declaration at line 32 of file vhdlcode.h, definition at line 1651 of file vhdlcode.l.

1652 const QCString &/* className */,
1653 const QCString &s,
1655 bool stripCodeComments,
1656 bool exBlock,
1657 const QCString &exName,
1658 const FileDef *fd,
1659 int startLine,
1660 int endLine,
1661 bool inlineFragment,
1662 const MemberDef *memberDef,
1663 bool,
1664 const Definition *searchCtx,
1665 bool /* collectXRefs */)
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}

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 ()
virtual

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()

Declaration at line 48 of file vhdlcode.h, definition at line 1646 of file vhdlcode.l.

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

Reference p.

Referenced by parseCode and VHDLCodeParser.

Private Member Attributes

p

std::unique_ptr<Private> VHDLCodeParser::p

Definition at line 51 of file vhdlcode.h.

51 std::unique_ptr<Private> p;

Referenced by parseCode, resetCodeParserState, VHDLCodeParser and ~VHDLCodeParser.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.