Skip to main content

The VHDLOutlineParser Class Reference

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

Declaration

class VHDLOutlineParser { ... }

Included Headers

#include <src/vhdljjparser.h>

Base class

classOutlineParserInterface

Abstract interface for outline parsers. More...

Public Constructors Index

VHDLOutlineParser ()

Public Destructor Index

~VHDLOutlineParser () override

Public Member Functions Index

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

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

voidparsePrototype (const QCString &text) override

Callback function called by the comment block scanner. More...

voidsetLineParsed (int tok)
intgetLine (int tok)
intgetLine ()
voidlineCount (const QCString &)
voidlineCount ()
voidaddProto (const QCString &s1, const QCString &s2, const QCString &s3, const QCString &s4, const QCString &s5, const QCString &s6)
voidcreateFunction (const QCString &impure, VhdlSpecifier spec, const QCString &fname)
voidaddVhdlType (const QCString &n, int startLine, EntryType section, VhdlSpecifier spec, const QCString &args, const QCString &type, Protection prot)
voidaddCompInst (const QCString &n, const QCString &instName, const QCString &comp, int iLine)
voidhandleCommentBlock (const QCString &doc, bool brief)
voidhandleFlowComment (const QCString &)
voidinitEntry (Entry *e)
voidnewEntry ()
boolisFuncProcProced ()
voidpushLabel (QCString &, QCString &)
QCStringpopLabel (QCString &q)
booladdLibUseClause (const QCString &type)
voidmapLibPackage (Entry *root)
voidcreateFlow ()
voiderror_skipto (int kind)
voidoneLineComment (QCString qcs)
voidsetMultCommentLine ()
boolcheckMultiComment (QCString &qcs, int line)
voidinsertEntryAtLine (std::shared_ptr< Entry > ce, int line)
QCStringgetNameID ()

returns a unique id for each record member. More...

intcheckInlineCode (QCString &doc)

Private Member Attributes Index

std::unique_ptr< Private >p

Description

VHDL parser using state-based lexical scanning.

This is the VHDL language parser for doxygen.

Definition at line 27 of file vhdljjparser.h.

Public Constructors

VHDLOutlineParser()

VHDLOutlineParser::VHDLOutlineParser ()

Declaration at line 30 of file vhdljjparser.h, definition at line 124 of file vhdljjparser.cpp.

125{
126}

Reference p.

Public Destructor

~VHDLOutlineParser()

VHDLOutlineParser::~VHDLOutlineParser ()

Declaration at line 31 of file vhdljjparser.h, definition at line 128 of file vhdljjparser.cpp.

Public Member Functions

addCompInst()

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

Declaration at line 52 of file vhdljjparser.h, definition at line 479 of file vhdljjparser.cpp.

479void VHDLOutlineParser::addCompInst(const QCString &n, const QCString &instName, const QCString &comp,int iLine)
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}

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)

Declaration at line 60 of file vhdljjparser.h, 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}

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)

Declaration at line 49 of file vhdljjparser.h, definition at line 634 of file vhdljjparser.cpp.

634void VHDLOutlineParser::addProto(const QCString &s1,const QCString &s2,const QCString &s3,
635 const QCString &s4,const QCString &s5,const QCString &s6)
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}

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)

Declaration at line 51 of file vhdljjparser.h, definition at line 521 of file vhdljjparser.cpp.

521void VHDLOutlineParser::addVhdlType(const QCString &n,int startLine,EntryType section,
522 VhdlSpecifier spec,const QCString &args,const QCString &type,Protection prot)
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}

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)

Declaration at line 69 of file vhdljjparser.h, 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}

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 and Entry::vhdlSpec.

Referenced by handleCommentBlock.

checkMultiComment()

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

Declaration at line 66 of file vhdljjparser.h, 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}

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

Referenced by handleCommentBlock and oneLineComment.

createFlow()

void VHDLOutlineParser::createFlow ()

Declaration at line 62 of file vhdljjparser.h, 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 }
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 }
782 {
783 ret="end procedure";
784 }
785 else
786 {
787 ret="end process ";
788 }
789
791 // FlowChart::printFlowList();
794}

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)

Declaration at line 50 of file vhdljjparser.h, 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 {
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}

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)

Declaration at line 63 of file vhdljjparser.h, 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()

int VHDLOutlineParser::getLine (int tok)

Declaration at line 45 of file vhdljjparser.h, 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}

Reference p.

getLine()

int VHDLOutlineParser::getLine ()

Declaration at line 46 of file vhdljjparser.h, definition at line 726 of file vhdljjparser.cpp.

727{
728 return p->yyLineNr;
729}

Reference 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;

Declaration at line 68 of file vhdljjparser.h, definition at line 259 of file vhdljjparser.cpp.

References idCounter and QCString::setNum.

handleCommentBlock()

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

Declaration at line 53 of file vhdljjparser.h, 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;
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}

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

Referenced by initEntry and oneLineComment.

handleFlowComment()

void VHDLOutlineParser::handleFlowComment (const QCString & doc)

Declaration at line 54 of file vhdljjparser.h, 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("--#");
274 }
275}

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

initEntry()

void VHDLOutlineParser::initEntry (Entry * e)

Declaration at line 55 of file vhdljjparser.h, definition at line 199 of file vhdljjparser.cpp.

200{
201 e->fileName = p->yyFileName;
202 e->lang = SrcLangExt::VHDL;
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}

References FALSE, Entry::fileName, handleCommentBlock, Entry::lang and p.

Referenced by addCompInst, newEntry and parseInput.

insertEntryAtLine()

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

Declaration at line 67 of file vhdljjparser.h, definition at line 832 of file vhdljjparser.cpp.

832void VHDLOutlineParser::insertEntryAtLine(std::shared_ptr<Entry> ce,int line)
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 ()

Declaration at line 57 of file vhdljjparser.h, 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()

void VHDLOutlineParser::lineCount (const QCString & text)

Declaration at line 47 of file vhdljjparser.h, 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}

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

lineCount()

void VHDLOutlineParser::lineCount ()

Declaration at line 48 of file vhdljjparser.h, definition at line 183 of file vhdljjparser.cpp.

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

Reference p.

Referenced by handleFlowComment.

mapLibPackage()

void VHDLOutlineParser::mapLibPackage (Entry * root)

Declaration at line 61 of file vhdljjparser.h, 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

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

Referenced by parseInput.

needsPreprocessing()

bool VHDLOutlineParser::needsPreprocessing (const QCString & extension)
inline virtual

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

Definition at line 38 of file vhdljjparser.h.

38 bool needsPreprocessing(const QCString &) const override { return TRUE; }

Reference TRUE.

newEntry()

void VHDLOutlineParser::newEntry ()

Declaration at line 56 of file vhdljjparser.h, 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 ||
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)

Declaration at line 64 of file vhdljjparser.h, 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)
virtual

Parses a single input file with the goal to build an Entry tree.

Parameters
[in] fileName

The full name of the file.

[in] fileBuf

The contents of the file (zero terminated).

[inout] root

The root of the tree of Entry *nodes representing the information extracted from the file.

[in] clangParser

The clang translation unit parser object or nullptr if disabled.

Declaration at line 33 of file vhdljjparser.h, definition at line 132 of file vhdljjparser.cpp.

132void VHDLOutlineParser::parseInput(const QCString &fileName,const char *fileBuf,
133 const std::shared_ptr<Entry> &root, ClangTUParser *)
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 {}...\n",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}

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 and TRUE.

parsePrototype()

void VHDLOutlineParser::parsePrototype (const QCString & text)
virtual

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.

Declaration at line 39 of file vhdljjparser.h, 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)

Declaration at line 59 of file vhdljjparser.h, 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}

References QCString::findRev and QCString::left.

pushLabel()

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

Declaration at line 58 of file vhdljjparser.h, definition at line 618 of file vhdljjparser.cpp.

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

setLineParsed()

void VHDLOutlineParser::setLineParsed (int tok)

Declaration at line 44 of file vhdljjparser.h, 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}

Reference p.

setMultCommentLine()

void VHDLOutlineParser::setMultCommentLine ()

Declaration at line 65 of file vhdljjparser.h, definition at line 796 of file vhdljjparser.cpp.

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

Reference p.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.