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

VHDL parser using state-based lexical scanning. More...

#include <src/vhdljjparser.h>

+ Inheritance diagram for VHDLOutlineParser:
+ Collaboration diagram for VHDLOutlineParser:

Classes

struct  Private
 

Public Member Functions

 VHDLOutlineParser ()
 
 ~VHDLOutlineParser () override
 
void parseInput (const QCString &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 QCString &) 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 QCString &text) override
 Callback function called by the comment block scanner.
 
void setLineParsed (int tok)
 
int getLine (int tok)
 
int getLine ()
 
void lineCount (const QCString &)
 
void lineCount ()
 
void addProto (const QCString &s1, const QCString &s2, const QCString &s3, const QCString &s4, const QCString &s5, const QCString &s6)
 
void createFunction (const QCString &impure, VhdlSpecifier spec, const QCString &fname)
 
void addVhdlType (const QCString &n, int startLine, EntryType section, VhdlSpecifier spec, const QCString &args, const QCString &type, Protection prot)
 
void addCompInst (const QCString &n, const QCString &instName, const QCString &comp, int iLine)
 
void handleCommentBlock (const QCString &doc, bool brief)
 
void handleFlowComment (const QCString &)
 
void initEntry (Entry *e)
 
void newEntry ()
 
bool isFuncProcProced ()
 
void pushLabel (QCString &, QCString &)
 
QCString popLabel (QCString &q)
 
bool addLibUseClause (const QCString &type)
 
void mapLibPackage (Entry *root)
 
void createFlow ()
 
void error_skipto (int kind)
 
void oneLineComment (QCString qcs)
 
void setMultCommentLine ()
 
bool checkMultiComment (QCString &qcs, int line)
 
void insertEntryAtLine (std::shared_ptr< Entry > ce, int line)
 
QCString getNameID ()
 returns a unique id for each record member.
 
int checkInlineCode (QCString &doc)
 
- Public Member Functions inherited from OutlineParserInterface

Private Attributes

std::unique_ptr< Privatep
 

Detailed Description

VHDL parser using state-based lexical scanning.

This is the VHDL language parser for doxygen.

Definition at line 27 of file vhdljjparser.h.

Constructor & Destructor Documentation

◆ VHDLOutlineParser()

VHDLOutlineParser::VHDLOutlineParser ( )

Definition at line 124 of file vhdljjparser.cpp.

124 : p(std::make_unique<Private>())
125{
126}
std::unique_ptr< Private > p

References p.

◆ ~VHDLOutlineParser()

VHDLOutlineParser::~VHDLOutlineParser ( )
override

Definition at line 128 of file vhdljjparser.cpp.

129{
130}

Member Function Documentation

◆ addCompInst()

void VHDLOutlineParser::addCompInst ( const QCString & n,
const QCString & instName,
const QCString & comp,
int iLine )

Definition at line 479 of file vhdljjparser.cpp.

480{
481 VhdlParser::SharedState *s = &p->shared;
483 s->current->section=EntryType::makeVariable();
484 s->current->startLine=iLine;
485 s->current->bodyLine=iLine;
486 s->current->type=instName; // foo:instname e.g proto or work. proto(ttt)
487 s->current->exception=s->genLabels.lower(); // |arch|label1:label2...
488 s->current->name=n; // foo
489 if (s->lastCompound)
490 {
491 s->current->args=s->lastCompound->name; // architecture name
492 }
493 s->current->includeName=comp; // component/entity/configuration
494 int u=s->genLabels.find("|",1);
495 if (u>0)
496 {
497 s->current->write=s->genLabels.right(s->genLabels.length()-u);
498 s->current->read=s->genLabels.left(u);
499 }
500 //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine);
501
502 if (s->lastCompound)
503 {
504 s->current->args=s->lastCompound->name;
505 if (true) // !findInstant(current->type))
506 {
507 initEntry(s->current.get());
508 // TODO: protect with mutex
509 g_instFiles.emplace_back(std::make_shared<Entry>(*s->current));
510 // TODO: end protect with mutex
511 }
512
513 s->current=std::make_shared<Entry>();
514 }
515 else
516 {
517 newEntry();
518 }
519}
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString lower() const
Definition qcstring.h:234
QCString right(size_t len) const
Definition qcstring.h:219
QCString left(size_t len) const
Definition qcstring.h:214
void initEntry(Entry *e)
std::shared_ptr< Entry > lastCompound
std::shared_ptr< Entry > current
@ INSTANTIATION
Definition types.h:569
static EntryList g_instFiles

References vhdl::parser::VhdlParser::SharedState::current, QCString::find(), g_instFiles, vhdl::parser::VhdlParser::SharedState::genLabels, initEntry(), INSTANTIATION, vhdl::parser::VhdlParser::SharedState::lastCompound, QCString::left(), QCString::length(), QCString::lower(), newEntry(), p, and QCString::right().

◆ addLibUseClause()

bool VHDLOutlineParser::addLibUseClause ( const QCString & type)

Definition at line 714 of file vhdljjparser.cpp.

715{
716 bool showIEEESTD=Config_getBool(FORCE_LOCAL_INCLUDES);
717
718 if (showIEEESTD) // all standard packages and libraries will not be shown
719 {
720 if (type.lower().stripPrefix("ieee")) return FALSE;
721 if (type.lower().stripPrefix("std")) return FALSE;
722 }
723 return TRUE;
724}
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:198
#define Config_getBool(name)
Definition config.h:33
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References Config_getBool, FALSE, QCString::lower(), QCString::stripPrefix(), and TRUE.

Referenced by mapLibPackage().

◆ addProto()

void VHDLOutlineParser::addProto ( const QCString & s1,
const QCString & s2,
const QCString & s3,
const QCString & s4,
const QCString & s5,
const QCString & s6 )

Definition at line 634 of file vhdljjparser.cpp.

636{
637 VhdlParser::SharedState *s = &p->shared;
638 (void)s5; // avoid unused warning
639 QCString name=s2;
640 StringVector ql=split(name.str(),",");
641
642 for (const auto &n : ql)
643 {
644 Argument arg;
645 arg.name=n;
646 if (!s3.isEmpty())
647 {
648 arg.type=s3;
649 }
650 arg.type+=" ";
651 arg.type+=s4;
652 if (!s6.isEmpty())
653 {
654 arg.type+=s6;
655 }
657 {
658 arg.defval="generic";
659 }
660
662 {
663 // assert(false);
664 }
665
666 arg.defval+=s1;
667 arg.attrib="";//s6;
668
669 s->current->argList.push_back(arg);
670 s->current->args+=s2;
671 s->current->args+=",";
672 }
673}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
const std::string & str() const
Definition qcstring.h:537
std::vector< std::string > StringVector
Definition containers.h:33
QCString type
Definition arguments.h:37
QCString name
Definition arguments.h:39
QCString defval
Definition arguments.h:41
QCString attrib
Definition arguments.h:36
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
Definition util.cpp:6946

References Argument::attrib, vhdl::parser::VhdlParser::SharedState::current, Argument::defval, GEN_SEC, QCString::isEmpty(), Argument::name, p, PARAM_SEC, vhdl::parser::VhdlParser::SharedState::param_sec, vhdl::parser::VhdlParser::SharedState::parse_sec, split(), QCString::str(), Argument::type, and UNKNOWN.

◆ addVhdlType()

void VHDLOutlineParser::addVhdlType ( const QCString & n,
int startLine,
EntryType section,
VhdlSpecifier spec,
const QCString & args,
const QCString & type,
Protection prot )

Definition at line 521 of file vhdljjparser.cpp.

523{
524 VhdlParser::SharedState *s = &p->shared;
525 QCString name(n);
527
529 {
531 }
532
533 StringVector ql=split(name.str(),",");
534
535 for (size_t u=0;u<ql.size();u++)
536 {
537 s->current->name=ql[u];
538 s->current->startLine=startLine;
539 s->current->bodyLine=startLine;
540 s->current->section=section;
541 s->current->vhdlSpec=spec;
542 s->current->fileName=p->yyFileName;
543 if (s->current->args.isEmpty())
544 {
545 s->current->args=args;
546 }
547 s->current->type=type;
548 s->current->protection=prot;
549
550 if (!s->lastCompound && section.isVariable() && (spec == VhdlSpecifier::USE || spec == VhdlSpecifier::LIBRARY) )
551 {
552 p->libUse.emplace_back(std::make_shared<Entry>(*s->current));
553 s->current->reset();
554 }
555 newEntry();
556 }
557}
static const MemberDef * getFlowMember()

References vhdl::parser::VhdlParser::SharedState::current, GEN_SEC, GENERIC, VhdlDocGen::getFlowMember(), isFuncProcProced(), vhdl::parser::VhdlParser::SharedState::lastCompound, LIBRARY, newEntry(), p, vhdl::parser::VhdlParser::SharedState::parse_sec, split(), QCString::str(), and USE.

◆ checkInlineCode()

int VHDLOutlineParser::checkInlineCode ( QCString & doc)

Definition at line 277 of file vhdljjparser.cpp.

278{
279 static const reg::Ex csRe(R"([\\@]code)");
280 static const reg::Ex cendRe(R"(\s*[\\@]endcode)");
281 static const reg::Ex cbriefRe(R"([\\@]brief)");
282
283 // helper to simulate behavior of QString.find(const QRegExp &re,int pos)
284 auto findRe = [](const QCString &str,const reg::Ex &re,int pos=0) -> int
285 {
286 if ((int)str.length()<pos) return -1;
287 reg::Match match;
288 const std::string s = str.str();
289 if (reg::search(s,match,re,pos)) // match found
290 {
291 return (int)match.position();
292 }
293 else // not found
294 {
295 return -1;
296 }
297 };
298 auto replaceRe = [](const QCString &str,const reg::Ex &re,const QCString &replacement) -> QCString
299 {
300 return reg::replace(str.str(), re, replacement.str());
301 };
302
303 int index = findRe(doc,csRe);
304
305 if (findRe(doc,cendRe)!=-1)
306 return 1;
307
308 if (index < 0)
309 return index;
310
311 VhdlParser::SharedState *s = &p->shared;
312 p->strComment += doc;
313 p->code = findRe(p->inputString,csRe, p->code + 1);
314 int com = p->inputString.find(p->strComment.data());
315 int ref = findRe(p->inputString,cendRe, p->code + 1);
316 int len = static_cast<int>(p->strComment.size());
317
318 int ll = com + len;
319 int diff = ref - ll - 3;
320 QCString code = p->inputString.mid(ll, diff);
321 int iLine = 0;
322 code = stripLeadingAndTrailingEmptyLines(code, iLine);
323 int val = code.contains('\n');
324 VhdlDocGen::prepareComment(p->strComment);
325 StringVector ql = split(p->strComment.str(),"\n");
326
327 QCString co;
328 QCString na;
329 for (const auto &qcs_ : ql)
330 {
331 QCString qcs(qcs_);
332 qcs = qcs.simplifyWhiteSpace();
333 if (findRe(qcs,csRe)!=-1)
334 {
335 int i = qcs.find('{');
336 int j = qcs.find('}');
337 if (i > 0 && j > 0 && j > i)
338 {
339 na = qcs.mid(i + 1, (j - i - 1));
340 }
341 continue;
342 }
343 qcs = replaceRe(qcs,cbriefRe, "");
344 co += qcs;
345 co += '\n';
346 }
347
349
350 Entry gBlock;
351 if (!na.isEmpty())
352 gBlock.name = na;
353 else
354 gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
355 gBlock.startLine = p->yyLineNr+iLine-1;
356 gBlock.bodyLine = p->yyLineNr+iLine-1 ;
357 gBlock.doc = code;
358 gBlock.inbodyDocs = code;
359 gBlock.brief = co;
360 gBlock.section = EntryType::makeVariable();
362 gBlock.fileName = p->yyFileName;
363 gBlock.endBodyLine = p->yyLineNr + val +iLine;
364 gBlock.lang = SrcLangExt::VHDL;
365 std::shared_ptr<Entry> compound;
366
367 if (s->lastEntity)
368 compound = s->lastEntity;
369 else if (s->lastCompound)
370 compound = s->lastCompound;
371 else
372 compound = nullptr;
373
374 if (compound)
375 {
376 compound->copyToSubEntry(&gBlock);
377 }
378 else
379 {
380 gBlock.type = "misc"; // global code like library ieee...
381 s->current_root->copyToSubEntry(&gBlock);
382 }
383 p->strComment.clear();
384 return 1;
385}
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:183
int endBodyLine
line number where the definition ends
Definition entry.h:218
SrcLangExt lang
programming language in which this entry was found
Definition entry.h:227
QCString inbodyDocs
documentation inside the body of a function
Definition entry.h:206
QCString fileName
file this entry was extracted from
Definition entry.h:223
QCString type
member type
Definition entry.h:173
int startLine
start line of entry in the source
Definition entry.h:224
QCString name
member name
Definition entry.h:174
EntryType section
entry type (see Sections);
Definition entry.h:172
int bodyLine
line number of the body in the source
Definition entry.h:216
QCString doc
documentation block (partly parsed)
Definition entry.h:200
QCString brief
brief description (doc block)
Definition entry.h:203
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
int contains(char c, bool cs=TRUE) const
Definition qcstring.cpp:143
static QCString getRecordNumber()
static void prepareComment(QCString &)
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:748
std::string replace(std::string_view str, const Ex &re, std::string_view replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
Definition regex.cpp:770
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:759
std::shared_ptr< Entry > lastEntity
std::shared_ptr< Entry > current_root
@ MISCELLANEOUS
Definition types.h:575
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
Definition util.cpp:5368

References Entry::bodyLine, Entry::brief, QCString::contains(), vhdl::parser::VhdlParser::SharedState::current_root, Entry::doc, Entry::endBodyLine, Entry::fileName, QCString::find(), VhdlDocGen::getRecordNumber(), Entry::inbodyDocs, QCString::isEmpty(), Entry::lang, vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, QCString::length(), QCString::mid(), MISCELLANEOUS, Entry::name, p, VhdlDocGen::prepareComment(), reg::replace(), reg::search(), Entry::section, QCString::simplifyWhiteSpace(), split(), Entry::startLine, QCString::str(), stripLeadingAndTrailingEmptyLines(), Entry::type, VHDL, and Entry::vhdlSpec.

Referenced by handleCommentBlock().

◆ checkMultiComment()

bool VHDLOutlineParser::checkMultiComment ( QCString & qcs,
int line )

Definition at line 812 of file vhdljjparser.cpp.

813{
814 VhdlParser::SharedState *s = &p->shared;
816
817 if (p->lineEntry.empty()) return false;
818
820 while (!p->lineEntry.empty())
821 {
822 std::shared_ptr<Entry> e=p->lineEntry.back();
823 e->briefLine=line;
824 e->brief+=qcs;
825
826 p->lineEntry.pop_back();
827 }
828 return true;
829}
void insertEntryAtLine(std::shared_ptr< Entry > ce, int line)

References vhdl::parser::VhdlParser::SharedState::current_root, insertEntryAtLine(), p, and VhdlDocGen::prepareComment().

Referenced by handleCommentBlock(), and oneLineComment().

◆ createFlow()

void VHDLOutlineParser::createFlow ( )

Definition at line 746 of file vhdljjparser.cpp.

747{
748 VhdlParser::SharedState *s = &p->shared;
750 {
751 return;
752 }
753 QCString q,ret;
754
756 {
757 q=":function( ";
758 FlowChart::alignFuncProc(q,s->tempEntry->argList,true);
759 q+=")";
760 }
761 else if (s->currP==VhdlSpecifier::PROCEDURE)
762 {
763 q=":procedure (";
764 FlowChart::alignFuncProc(q,s->tempEntry->argList,false);
765 q+=")";
766 }
767 else
768 {
769 q=":process( "+s->tempEntry->args;
770 q+=")";
771 }
772
774
776
778 {
779 ret="end function ";
780 }
781 else if (s->currP==VhdlSpecifier::PROCEDURE)
782 {
783 ret="end procedure";
784 }
785 else
786 {
787 ret="end process ";
788 }
789
791 // FlowChart::printFlowList();
794}
static void alignFuncProc(QCString &q, const ArgumentList &al, bool isFunc)
static void addFlowChart(int type, const QCString &text, const QCString &exp, const QCString &label=QCString())
static void writeFlowChart()
QCString & prepend(const char *s)
Definition qcstring.h:407
std::shared_ptr< Entry > tempEntry

References FlowChart::addFlowChart(), FlowChart::alignFuncProc(), vhdl::parser::VhdlParser::SharedState::currP, FlowChart::END_NO, FUNCTION, VhdlDocGen::getFlowMember(), p, QCString::prepend(), PROCEDURE, FlowChart::START_NO, vhdl::parser::VhdlParser::SharedState::tempEntry, UNKNOWN, and FlowChart::writeFlowChart().

◆ createFunction()

void VHDLOutlineParser::createFunction ( const QCString & impure,
VhdlSpecifier spec,
const QCString & fname )

Definition at line 559 of file vhdljjparser.cpp.

560{
561 VhdlParser::SharedState *s = &p->shared;
562 s->current->vhdlSpec=spec;
563 s->current->section=EntryType::makeFunction();
564
565 if (impure=="impure" || impure=="pure")
566 {
567 s->current->exception=impure;
568 }
569
571 {
572 s->current->vhdlSpec=VhdlSpecifier::GENERIC;
573 s->current->section=EntryType::makeFunction();
574 }
575
577 {
578 s->current->name=impure;
579 s->current->exception="";
580 }
581 else
582 {
583 s->current->name=fname;
584 }
585
586 if (spec==VhdlSpecifier::PROCESS)
587 {
588 s->current->args=fname;
589 s->current->name=impure;
591 if (!fname.isEmpty())
592 {
593 StringVector q1=split(fname.str(),",");
594 for (const auto &name : q1)
595 {
596 Argument arg;
597 arg.name=name;
598 s->current->argList.push_back(arg);
599 }
600 }
601 }
602}
static void deleteAllChars(QCString &s, char c)

References vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::currP, VhdlDocGen::deleteAllChars(), GEN_SEC, GENERIC, QCString::isEmpty(), Argument::name, p, vhdl::parser::VhdlParser::SharedState::parse_sec, PROCEDURE, PROCESS, split(), and QCString::str().

◆ error_skipto()

void VHDLOutlineParser::error_skipto ( int kind)

Definition at line 850 of file vhdljjparser.cpp.

851{
852 Token *op;
853 do
854 {
855 p->vhdlParser->getNextToken(); // step to next token
856 op=p->vhdlParser->getToken(1); // get first token
857 if (op==nullptr) break;
858 //fprintf(stderr,"\n %s",qPrint(t->image));
859 } while (op->kind != kind);
860 p->vhdlParser->clearError();
861 // The above loop consumes tokens all the way up to a token of
862 // "kind". We use a do-while loop rather than a while because the
863 // current token is the one immediately before the erroneous token
864 // (in our case the token immediately before what should have been
865 // "if"/"while".
866}

References vhdl::parser::Token::kind, and p.

◆ getLine() [1/2]

int VHDLOutlineParser::getLine ( )

Definition at line 726 of file vhdljjparser.cpp.

727{
728 return p->yyLineNr;
729}

References p.

◆ getLine() [2/2]

int VHDLOutlineParser::getLine ( int tok)

Definition at line 737 of file vhdljjparser.cpp.

738{
739 int val=p->lineParse[tok];
740 if (val<0) val=0;
741 //assert(val>=0 && val<=yyLineNr);
742 return val;
743}

References p.

◆ getNameID()

QCString VHDLOutlineParser::getNameID ( )

returns a unique id for each record member.

type first_rec is record RE: data_type; end;

type second_rec is record RE: data_type; end;

Definition at line 259 of file vhdljjparser.cpp.

260{
261 return QCString().setNum(idCounter++);
262}
static int idCounter

References idCounter, and QCString::setNum().

◆ handleCommentBlock()

void VHDLOutlineParser::handleCommentBlock ( const QCString & doc,
bool brief )

Definition at line 387 of file vhdljjparser.cpp.

388{
389 int position = 0;
390 bool needsEntry = FALSE;
391 VhdlParser::SharedState *s = &p->shared;
392 QCString doc = doc1;
393
394 if (doc.isEmpty())
395 return;
396
397 if (checkMultiComment(doc, p->yyLineNr))
398 {
399 p->strComment.clear();
400 return;
401 }
402
403 if (checkInlineCode(doc) > 0)
404 {
405 return;
406 }
407
408 Protection protection = Protection::Public;
410 if (doc.isEmpty()) return;
411
412 if (p->oldEntry == s->current.get())
413 {
414 p->str_doc.doc = doc;
415 p->str_doc.iDocLine = p->iDocLine;
416 p->str_doc.brief = brief;
417 p->str_doc.pending = TRUE;
418 return;
419 }
420
421 p->oldEntry = s->current.get();
422
423 if (brief)
424 {
425 s->current->briefLine = p->yyLineNr;
426 }
427 else
428 {
429 s->current->docLine = p->yyLineNr;
430 }
431
432
433
434 Markdown markdown(p->yyFileName,p->iDocLine);
435 int lineNr = p->iDocLine;
436 GuardedSectionStack guards;
437 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
438
439 while (p->commentScanner.parseCommentBlock(
440 p->thisParser,
441 s->current.get(),
442 processedDoc, // text
443 p->yyFileName, // file
444 lineNr, // line of block start
445 brief,
446 0,
447 FALSE,
448 protection,
449 position,
450 needsEntry,
451 Config_getBool(MARKDOWN_SUPPORT),
452 &guards
453 ))
454 {
455 if (needsEntry)
456 newEntry();
457 }
458 if (needsEntry)
459 {
460 if (p->varr)
461 {
462 p->varr = FALSE;
463 s->current->name = p->varName;
464 s->current->section = EntryType::makeVariableDoc();
465 p->varName = "";
466 }
467 newEntry();
468 }
469 p->iDocLine = -1;
470 p->strComment.clear();
471}
int checkInlineCode(QCString &doc)
bool checkMultiComment(QCString &qcs, int line)
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
Protection
Protection level of members.
Definition types.h:26
@ Public
Definition types.h:26
@ Markdown
Definition types.h:57

References checkInlineCode(), checkMultiComment(), Config_getBool, vhdl::parser::VhdlParser::SharedState::current, FALSE, QCString::isEmpty(), newEntry(), p, VhdlDocGen::prepareComment(), Markdown::process(), Public, and TRUE.

Referenced by initEntry(), and oneLineComment().

◆ handleFlowComment()

void VHDLOutlineParser::handleFlowComment ( const QCString & doc)

Definition at line 264 of file vhdljjparser.cpp.

265{
266 lineCount(doc);
267
269 {
270 QCString qcs(doc);
271 qcs=qcs.stripWhiteSpace();
272 qcs.stripPrefix("--#");
273 FlowChart::addFlowChart(FlowChart::COMMENT_NO,QCString(),QCString(),qcs);
274 }
275}

References FlowChart::addFlowChart(), FlowChart::COMMENT_NO, VhdlDocGen::getFlowMember(), lineCount(), QCString::stripPrefix(), and QCString::stripWhiteSpace().

◆ initEntry()

void VHDLOutlineParser::initEntry ( Entry * e)

Definition at line 199 of file vhdljjparser.cpp.

200{
201 e->fileName = p->yyFileName;
203 if (p->str_doc.pending)
204 {
205 p->str_doc.pending=FALSE;
206 p->oldEntry=nullptr; // prevents endless recursion
207 p->iDocLine=p->str_doc.iDocLine;
208 handleCommentBlock(p->str_doc.doc,p->str_doc.brief);
209 p->iDocLine=-1;
210 }
211 p->commentScanner.initGroupInfo(e);
212}
void handleCommentBlock(const QCString &doc, bool brief)

References FALSE, Entry::fileName, handleCommentBlock(), Entry::lang, p, and VHDL.

Referenced by addCompInst(), newEntry(), and parseInput().

◆ insertEntryAtLine()

void VHDLOutlineParser::insertEntryAtLine ( std::shared_ptr< Entry > ce,
int line )

Definition at line 832 of file vhdljjparser.cpp.

833{
834 for (const auto &rt : ce->children())
835 {
836 if (rt->bodyLine==line)
837 {
838 p->lineEntry.push_back(rt);
839 }
840
841 insertEntryAtLine(rt,line);
842 }
843}

References insertEntryAtLine(), and p.

Referenced by checkMultiComment(), and insertEntryAtLine().

◆ isFuncProcProced()

bool VHDLOutlineParser::isFuncProcProced ( )

Definition at line 605 of file vhdljjparser.cpp.

606{
607 VhdlParser::SharedState *s = &p->shared;
611 )
612 {
613 return TRUE;
614 }
615 return FALSE;
616}

References vhdl::parser::VhdlParser::SharedState::currP, FALSE, FUNCTION, p, PROCEDURE, PROCESS, and TRUE.

Referenced by addVhdlType().

◆ lineCount() [1/2]

void VHDLOutlineParser::lineCount ( )

Definition at line 183 of file vhdljjparser.cpp.

184{
185 p->yyLineNr++;
186}

References p.

Referenced by handleFlowComment().

◆ lineCount() [2/2]

void VHDLOutlineParser::lineCount ( const QCString & text)

Definition at line 188 of file vhdljjparser.cpp.

189{
190 if (!text.isEmpty())
191 {
192 for (const char* c=text.data() ; *c ; ++c )
193 {
194 if (*c == '\n') p->yyLineNr++;
195 }
196 }
197}
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159

References QCString::data(), QCString::isEmpty(), and p.

◆ mapLibPackage()

void VHDLOutlineParser::mapLibPackage ( Entry * root)

Definition at line 687 of file vhdljjparser.cpp.

688{
689 for (const auto &rt : p->libUse)
690 {
691 if (addLibUseClause(rt->name))
692 {
693 bool bFound=FALSE;
694 for (const auto &current : root->children())
695 {
696 if (VhdlDocGen::isVhdlClass(current.get()))
697 {
698 if (current->startLine > rt->startLine)
699 {
700 bFound=TRUE;
701 current->copyToSubEntry(rt);
702 break;
703 }
704 }
705 }//for
706 if (!bFound)
707 {
708 root->copyToSubEntry(rt);
709 }
710 } //if
711 }// for
712}//MapLib
const std::vector< std::shared_ptr< Entry > > & children() const
Definition entry.h:139
void copyToSubEntry(Entry *e)
Definition entry.cpp:156
bool addLibUseClause(const QCString &type)
static bool isVhdlClass(const Entry *cu)
Definition vhdldocgen.h:212

References addLibUseClause(), Entry::children(), Entry::copyToSubEntry(), FALSE, VhdlDocGen::isVhdlClass(), p, and TRUE.

Referenced by parseInput().

◆ needsPreprocessing()

bool VHDLOutlineParser::needsPreprocessing ( const QCString & extension) const
inlineoverridevirtual

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 38 of file vhdljjparser.h.

38{ return TRUE; }

References TRUE.

◆ newEntry()

void VHDLOutlineParser::newEntry ( )

Definition at line 214 of file vhdljjparser.cpp.

215{
216 VhdlParser::SharedState *s = &p->shared;
217 p->previous = s->current.get();
218 if (s->current->vhdlSpec==VhdlSpecifier::ENTITY ||
219 s->current->vhdlSpec==VhdlSpecifier::PACKAGE ||
220 s->current->vhdlSpec==VhdlSpecifier::ARCHITECTURE ||
222 {
223 s->current_root->moveToSubEntryAndRefresh(s->current);
224 }
225 else
226 {
227 if (s->lastCompound)
228 {
229 s->lastCompound->moveToSubEntryAndRefresh(s->current);
230 }
231 else
232 {
233 if (s->lastEntity)
234 {
235 s->lastEntity->moveToSubEntryAndRefresh(s->current);
236 }
237 else
238 {
239 s->current_root->moveToSubEntryAndRefresh(s->current);
240 }
241 }
242 }
243 initEntry(s->current.get());
244}

References ARCHITECTURE, vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::current_root, ENTITY, initEntry(), vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, p, PACKAGE, and PACKAGE_BODY.

Referenced by addCompInst(), addVhdlType(), and handleCommentBlock().

◆ oneLineComment()

void VHDLOutlineParser::oneLineComment ( QCString qcs)

Definition at line 801 of file vhdljjparser.cpp.

802{
803 int j=qcs.find("--!");
804 qcs=qcs.right(qcs.length()-3-j);
805 if (!checkMultiComment(qcs,p->iDocLine))
806 {
808 }
809}

References checkMultiComment(), QCString::find(), handleCommentBlock(), QCString::length(), p, QCString::right(), and TRUE.

◆ parseInput()

void VHDLOutlineParser::parseInput ( const QCString & 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 132 of file vhdljjparser.cpp.

134{
135 VhdlParser::SharedState *s = &p->shared;
136 p->thisParser=this;
137 p->inputString=fileBuf;
138
139 // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);
140
141 bool inLine = fileName.isEmpty();
142
143 if (!inLine) msg("Parsing file %s...\n",qPrint(fileName));
144
145 p->yyFileName=fileName;
146
147 bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
148 bool altera_qsf=isConstraintFile(p->yyFileName,".qsf");
149
150 // support XILINX(ucf) and ALTERA (qsf) file
151
152 if (xilinx_ucf)
153 {
154 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,FALSE);
155 return;
156 }
157 if (altera_qsf)
158 {
159 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,TRUE);
160 return;
161 }
162 p->yyLineNr=1;
163 s->current_root=root;
164 s->lastCompound=nullptr;
165 s->lastEntity=nullptr;
166 p->oldEntry = nullptr;
167 s->current=std::make_shared<Entry>();
168 initEntry(s->current.get());
169 p->commentScanner.enterFile(fileName,p->yyLineNr);
170 p->lineParse.reserve(200);
171 p->parseVhdlfile(fileName,fileBuf,inLine);
172 p->commentScanner.leaveFile(fileName,p->yyLineNr);
173
174 s->current.reset();
175
176 if (!inLine)
177 mapLibPackage(root.get());
178
179 p->yyFileName.clear();
180 p->libUse.clear();
181}
void mapLibPackage(Entry *root)
static void parseUCF(const QCString &input, Entry *entity, const QCString &f, bool vendor)
void msg(const char *fmt,...)
Definition message.cpp:98
const char * qPrint(const char *s)
Definition qcstring.h:672
static bool isConstraintFile(const QCString &fileName, const QCString &ext)

References vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::current_root, FALSE, initEntry(), isConstraintFile(), QCString::isEmpty(), vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, mapLibPackage(), msg(), p, VhdlDocGen::parseUCF(), qPrint(), and TRUE.

◆ parsePrototype()

void VHDLOutlineParser::parsePrototype ( const QCString & 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 473 of file vhdljjparser.cpp.

474{
475 p->varName=text;
476 p->varr=TRUE;
477}

References p, and TRUE.

◆ popLabel()

QCString VHDLOutlineParser::popLabel ( QCString & q)

Definition at line 624 of file vhdljjparser.cpp.

625{
626 int i=q.findRev("|");
627 if (i<0) return QCString();
628 q = q.left(i);
629 return q;
630}
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91

References QCString::findRev(), and QCString::left().

◆ pushLabel()

void VHDLOutlineParser::pushLabel ( QCString & label,
QCString & val )

Definition at line 618 of file vhdljjparser.cpp.

619{
620 label+="|";
621 label+=val;
622}

◆ setLineParsed()

void VHDLOutlineParser::setLineParsed ( int tok)

Definition at line 731 of file vhdljjparser.cpp.

732{
733 if ((int)p->lineParse.size()<=tok) p->lineParse.resize(tok+1);
734 p->lineParse[tok]=p->yyLineNr;
735}

References p.

◆ setMultCommentLine()

void VHDLOutlineParser::setMultCommentLine ( )

Definition at line 796 of file vhdljjparser.cpp.

797{
798 p->iDocLine=p->yyLineNr;
799}

References p.

Member Data Documentation

◆ p


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