Doxygen
VHDLOutlineParser类 参考

VHDL parser using state-based lexical scanning. 更多...

#include <vhdljjparser.h>

+ 类 VHDLOutlineParser 继承关系图:
+ VHDLOutlineParser 的协作图:

struct  Private
 

Public 成员函数

 VHDLOutlineParser ()
 
virtual ~VHDLOutlineParser ()
 
void parseInput (const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser)
 Parses a single input file with the goal to build an Entry tree. 更多...
 
bool needsPreprocessing (const QCString &) const
 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)
 Callback function called by the comment block scanner. 更多...
 
void setLineParsed (int tok)
 
int getLine (int tok)
 
int getLine ()
 
void lineCount (const char *)
 
void lineCount ()
 
void addProto (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6)
 
void createFunction (const char *impure, uint64 spec, const char *fname)
 
void addVhdlType (const char *n, int startLine, int section, uint64 spec, const char *args, const char *type, Protection prot)
 
void addCompInst (const char *n, const char *instName, const char *comp, int iLine)
 
void handleCommentBlock (const QCString &doc, bool brief)
 
void handleFlowComment (const char *)
 
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 成员函数 继承自 OutlineParserInterface
virtual ~OutlineParserInterface ()
 

Private 属性

std::unique_ptr< Privatep
 

详细描述

VHDL parser using state-based lexical scanning.

This is the VHDL language parser for doxygen.

在文件 vhdljjparser.h27 行定义.

构造及析构函数说明

◆ VHDLOutlineParser()

VHDLOutlineParser::VHDLOutlineParser ( )

在文件 vhdljjparser.cpp124 行定义.

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

◆ ~VHDLOutlineParser()

VHDLOutlineParser::~VHDLOutlineParser ( )
virtual

在文件 vhdljjparser.cpp128 行定义.

129 {
130 }

成员函数说明

◆ addCompInst()

void VHDLOutlineParser::addCompInst ( const char *  n,
const char *  instName,
const char *  comp,
int  iLine 
)

在文件 vhdljjparser.cpp471 行定义.

472 {
473  VhdlParser::SharedState *s = &p->shared;
475  s->current->section=Entry::VARIABLE_SEC;
476  s->current->startLine=iLine;
477  s->current->bodyLine=iLine;
478  s->current->type=instName; // foo:instname e.g proto or work. proto(ttt)
479  s->current->exception=s->genLabels.lower(); // |arch|label1:label2...
480  s->current->name=n; // foo
481  if (s->lastCompound)
482  {
483  s->current->args=s->lastCompound->name; // architecture name
484  }
485  s->current->includeName=comp; // component/entity/configuration
486  int u=s->genLabels.find("|",1);
487  if (u>0)
488  {
489  s->current->write=s->genLabels.right(s->genLabels.length()-u);
490  s->current->read=s->genLabels.left(u);
491  }
492  //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine);
493 
494  if (s->lastCompound)
495  {
496  s->current->args=s->lastCompound->name;
497  if (true) // !findInstant(current->type))
498  {
499  initEntry(s->current.get());
500  // TODO: protect with mutex
501  g_instFiles.emplace_back(std::make_shared<Entry>(*s->current));
502  // TODO: end protect with mutex
503  }
504 
505  s->current=std::make_shared<Entry>();
506  }
507  else
508  {
509  newEntry();
510  }
511 }

引用了 vhdl::parser::VhdlParser::SharedState::current, QCString::find(), g_instFiles, vhdl::parser::VhdlParser::SharedState::genLabels, initEntry(), VhdlDocGen::INSTANTIATION, vhdl::parser::VhdlParser::SharedState::lastCompound, QCString::left(), QCString::length(), QCString::lower(), newEntry(), p, QCString::right() , 以及 Entry::VARIABLE_SEC.

◆ addLibUseClause()

bool VHDLOutlineParser::addLibUseClause ( const QCString type)

在文件 vhdljjparser.cpp708 行定义.

709 {
710  static bool showIEEESTD=Config_getBool(FORCE_LOCAL_INCLUDES);
711 
712  if (showIEEESTD) // all standard packages and libraries will not be shown
713  {
714  if (type.lower().stripPrefix("ieee")) return FALSE;
715  if (type.lower().stripPrefix("std")) return FALSE;
716  }
717  return TRUE;
718 }

引用了 Config_getBool, FALSE, QCString::lower(), QCString::stripPrefix() , 以及 TRUE.

被这些函数引用 mapLibPackage().

◆ addProto()

void VHDLOutlineParser::addProto ( const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5,
const char *  s6 
)

在文件 vhdljjparser.cpp628 行定义.

630 {
631  VhdlParser::SharedState *s = &p->shared;
632  (void)s5; // avoid unused warning
633  QCString name=s2;
634  StringVector ql=split(name.str(),",");
635 
636  for (const auto &n : ql)
637  {
638  Argument arg;
639  arg.name=n;
640  if (s3)
641  {
642  arg.type=s3;
643  }
644  arg.type+=" ";
645  arg.type+=s4;
646  if (s6)
647  {
648  arg.type+=s6;
649  }
650  if (s->parse_sec==GEN_SEC && s->param_sec==0)
651  {
652  arg.defval="gen!";
653  }
654 
655  if (s->parse_sec==PARAM_SEC)
656  {
657  // assert(false);
658  }
659 
660  arg.defval+=s1;
661  arg.attrib="";//s6;
662 
663  s->current->argList.push_back(arg);
664  s->current->args+=s2;
665  s->current->args+=",";
666  }
667 }

引用了 Argument::attrib, vhdl::parser::VhdlParser::SharedState::current, Argument::defval, GEN_SEC, Argument::name, p, PARAM_SEC, vhdl::parser::VhdlParser::SharedState::param_sec, vhdl::parser::VhdlParser::SharedState::parse_sec, split(), QCString::str() , 以及 Argument::type.

◆ addVhdlType()

void VHDLOutlineParser::addVhdlType ( const char *  n,
int  startLine,
int  section,
uint64  spec,
const char *  args,
const char *  type,
Protection  prot 
)

在文件 vhdljjparser.cpp513 行定义.

515 {
516  VhdlParser::SharedState *s = &p->shared;
517  QCString name(n);
518  if (isFuncProcProced() || VhdlDocGen::getFlowMember()) return;
519 
520  if (s->parse_sec==GEN_SEC)
521  {
522  spec= VhdlDocGen::GENERIC;
523  }
524 
525  StringVector ql=split(name.str(),",");
526 
527  for (size_t u=0;u<ql.size();u++)
528  {
529  s->current->name=ql[u];
530  s->current->startLine=startLine;
531  s->current->bodyLine=startLine;
532  s->current->section=section;
533  s->current->spec=spec;
534  s->current->fileName=p->yyFileName;
535  if (s->current->args.isEmpty())
536  {
537  s->current->args=args;
538  }
539  s->current->type=type;
540  s->current->protection=prot;
541 
542  if (!s->lastCompound && (section==Entry::VARIABLE_SEC) && (spec == VhdlDocGen::USE || spec == VhdlDocGen::LIBRARY) )
543  {
544  p->libUse.emplace_back(std::make_shared<Entry>(*s->current));
545  s->current->reset();
546  }
547  newEntry();
548  }
549 }

引用了 vhdl::parser::VhdlParser::SharedState::current, GEN_SEC, VhdlDocGen::GENERIC, VhdlDocGen::getFlowMember(), isFuncProcProced(), vhdl::parser::VhdlParser::SharedState::lastCompound, VhdlDocGen::LIBRARY, newEntry(), p, vhdl::parser::VhdlParser::SharedState::parse_sec, split(), QCString::str(), VhdlDocGen::USE , 以及 Entry::VARIABLE_SEC.

◆ checkInlineCode()

int VHDLOutlineParser::checkInlineCode ( QCString doc)

在文件 vhdljjparser.cpp273 行定义.

274 {
275  static const reg::Ex csRe(R"([\\@]code)");
276  static const reg::Ex cendRe(R"(\s*[\\@]endcode)");
277  static const reg::Ex cbriefRe(R"([\\@]brief)");
278 
279  // helper to simulate behavior of QString.find(const QRegExp &re,int pos)
280  auto findRe = [](const QCString &str,const reg::Ex &re,int pos=0) -> int
281  {
282  if ((int)str.length()<pos) return -1;
284  const std::string s = str.str();
285  if (reg::search(s,match,re,pos)) // match found
286  {
287  return (int)match.position();
288  }
289  else // not found
290  {
291  return -1;
292  }
293  };
294  auto replaceRe = [](const QCString &str,const reg::Ex &re,const QCString &replacement) -> QCString
295  {
296  return reg::replace(str.str(), re, replacement.str());
297  };
298 
299  int index = findRe(doc,csRe);
300 
301  if (findRe(doc,cendRe)!=-1)
302  return 1;
303 
304  if (index < 0)
305  return index;
306 
307  VhdlParser::SharedState *s = &p->shared;
308  p->strComment += doc;
309  p->code = findRe(p->inputString,csRe, p->code + 1);
310  int com = p->inputString.find(p->strComment.data());
311  int ref = findRe(p->inputString,cendRe, p->code + 1);
312  int len = p->strComment.size();
313 
314  int ll = com + len;
315  int diff = ref - ll - 3;
316  QCString code = p->inputString.mid(ll, diff);
317  int iLine = 0;
318  code = stripLeadingAndTrailingEmptyLines(code, iLine);
319  int val = code.contains('\n');
320  VhdlDocGen::prepareComment(p->strComment);
321  StringVector ql = split(p->strComment.str(),"\n");
322 
323  QCString co;
324  QCString na;
325  for (const auto &qcs_ : ql)
326  {
327  QCString qcs(qcs_);
328  qcs = qcs.simplifyWhiteSpace();
329  if (findRe(qcs,csRe)!=-1)
330  {
331  int i = qcs.find('{');
332  int j = qcs.find('}');
333  if (i > 0 && j > 0 && j > i)
334  {
335  na = qcs.mid(i + 1, (j - i - 1));
336  }
337  continue;
338  }
339  qcs = replaceRe(qcs,cbriefRe, "");
340  co += qcs;
341  co += '\n';
342  }
343 
345 
346  Entry gBlock;
347  if (!na.isEmpty())
348  gBlock.name = na;
349  else
350  gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
351  gBlock.startLine = p->yyLineNr+iLine-1;
352  gBlock.bodyLine = p->yyLineNr+iLine-1 ;
353  gBlock.doc = code;
354  gBlock.inbodyDocs = code;
355  gBlock.brief = co;
356  gBlock.section = Entry::VARIABLE_SEC;
358  gBlock.fileName = p->yyFileName;
359  gBlock.endBodyLine = p->yyLineNr + val +iLine;
360  gBlock.lang = SrcLangExt_VHDL;
361  std::shared_ptr<Entry> compound;
362 
363  if (s->lastEntity)
364  compound = s->lastEntity;
365  else if (s->lastCompound)
366  compound = s->lastCompound;
367  else
368  compound = 0;
369 
370  if (compound)
371  {
372  compound->copyToSubEntry(&gBlock);
373  }
374  else
375  {
376  gBlock.type = "misc"; // global code like library ieee...
377  s->current_root->copyToSubEntry(&gBlock);
378  }
379  p->strComment.resize(0);
380  return 1;
381 }

引用了 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(), reg::match(), QCString::mid(), VhdlDocGen::MISCELLANEOUS, Entry::name, p, VhdlDocGen::prepareComment(), reg::replace(), reg::search(), Entry::section, QCString::simplifyWhiteSpace(), Entry::spec, split(), SrcLangExt_VHDL, Entry::startLine, QCString::str(), stripLeadingAndTrailingEmptyLines(), Entry::type , 以及 Entry::VARIABLE_SEC.

被这些函数引用 handleCommentBlock().

◆ checkMultiComment()

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

在文件 vhdljjparser.cpp806 行定义.

807 {
808  VhdlParser::SharedState *s = &p->shared;
810 
811  if (p->lineEntry.empty()) return false;
812 
814  while (!p->lineEntry.empty())
815  {
816  std::shared_ptr<Entry> e=p->lineEntry.back();
817  e->briefLine=line;
818  e->brief+=qcs;
819 
820  p->lineEntry.pop_back();
821  }
822  return true;
823 }

引用了 vhdl::parser::VhdlParser::SharedState::current_root, insertEntryAtLine(), p , 以及 VhdlDocGen::prepareComment().

被这些函数引用 handleCommentBlock() , 以及 oneLineComment().

◆ createFlow()

void VHDLOutlineParser::createFlow ( )

在文件 vhdljjparser.cpp740 行定义.

741 {
742  VhdlParser::SharedState *s = &p->shared;
744  {
745  return;
746  }
747  QCString q,ret;
748 
749  if (s->currP==VhdlDocGen::FUNCTION)
750  {
751  q=":function( ";
752  FlowChart::alignFuncProc(q,s->tempEntry->argList,true);
753  q+=")";
754  }
755  else if (s->currP==VhdlDocGen::PROCEDURE)
756  {
757  q=":procedure (";
758  FlowChart::alignFuncProc(q,s->tempEntry->argList,false);
759  q+=")";
760  }
761  else
762  {
763  q=":process( "+s->tempEntry->args;
764  q+=")";
765  }
766 
767  q.prepend(VhdlDocGen::getFlowMember()->name());
768 
770 
771  if (s->currP==VhdlDocGen::FUNCTION)
772  {
773  ret="end function ";
774  }
775  else if (s->currP==VhdlDocGen::PROCEDURE)
776  {
777  ret="end procedure";
778  }
779  else
780  {
781  ret="end process ";
782  }
783 
785  // FlowChart::printFlowList();
787  s->currP=0;
788 }

引用了 FlowChart::addFlowChart(), FlowChart::alignFuncProc(), vhdl::parser::VhdlParser::SharedState::currP, FlowChart::END_NO, VhdlDocGen::FUNCTION, VhdlDocGen::getFlowMember(), p, QCString::prepend(), VhdlDocGen::PROCEDURE, FlowChart::START_NO, vhdl::parser::VhdlParser::SharedState::tempEntry , 以及 FlowChart::writeFlowChart().

◆ createFunction()

void VHDLOutlineParser::createFunction ( const char *  impure,
uint64  spec,
const char *  fname 
)

在文件 vhdljjparser.cpp551 行定义.

552 {
553  VhdlParser::SharedState *s = &p->shared;
554  QCString impure(imp);
555  QCString fname(fn);
556  s->current->spec=spec;
557  s->current->section=Entry::FUNCTION_SEC;
558 
559  if (impure=="impure" || impure=="pure")
560  {
561  s->current->exception=impure;
562  }
563 
564  if (s->parse_sec==GEN_SEC)
565  {
566  s->current->spec= VhdlDocGen::GENERIC;
567  s->current->section=Entry::FUNCTION_SEC;
568  }
569 
571  {
572  s->current->name=impure;
573  s->current->exception="";
574  }
575  else
576  {
577  s->current->name=fname;
578  }
579 
580  if (spec==VhdlDocGen::PROCESS)
581  {
582  s->current->args=fname;
583  s->current->name=impure;
584  VhdlDocGen::deleteAllChars(s->current->args,' ');
585  if (!fname.isEmpty())
586  {
587  StringVector q1=split(fname.str(),",");
588  for (const auto &name : q1)
589  {
590  Argument arg;
591  arg.name=name;
592  s->current->argList.push_back(arg);
593  }
594  }
595  }
596 }

引用了 vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::currP, VhdlDocGen::deleteAllChars(), Entry::FUNCTION_SEC, GEN_SEC, VhdlDocGen::GENERIC, QCString::isEmpty(), Argument::name, p, vhdl::parser::VhdlParser::SharedState::parse_sec, VhdlDocGen::PROCEDURE, VhdlDocGen::PROCESS, split() , 以及 QCString::str().

◆ error_skipto()

void VHDLOutlineParser::error_skipto ( int  kind)

在文件 vhdljjparser.cpp844 行定义.

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

引用了 vhdl::parser::Token::kind , 以及 p.

◆ getLine() [1/2]

int VHDLOutlineParser::getLine ( )

在文件 vhdljjparser.cpp720 行定义.

721 {
722  return p->yyLineNr;
723 }

引用了 p.

◆ getLine() [2/2]

int VHDLOutlineParser::getLine ( int  tok)

在文件 vhdljjparser.cpp731 行定义.

732 {
733  int val=p->lineParse[tok];
734  if (val<0) val=0;
735  //assert(val>=0 && val<=yyLineNr);
736  return val;
737 }

引用了 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;

在文件 vhdljjparser.cpp255 行定义.

256 {
257  return QCString().setNum(idCounter++);
258 }

引用了 idCounter , 以及 QCString::setNum().

◆ handleCommentBlock()

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

在文件 vhdljjparser.cpp383 行定义.

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

引用了 checkInlineCode(), checkMultiComment(), Config_getBool, vhdl::parser::VhdlParser::SharedState::current, FALSE, QCString::isEmpty(), newEntry(), p, VhdlDocGen::prepareComment(), Markdown::process(), Public, TRUE , 以及 Entry::VARIABLEDOC_SEC.

被这些函数引用 initEntry() , 以及 oneLineComment().

◆ handleFlowComment()

void VHDLOutlineParser::handleFlowComment ( const char *  doc)

在文件 vhdljjparser.cpp260 行定义.

261 {
262  lineCount(doc);
263 
265  {
266  QCString qcs(doc);
267  qcs=qcs.stripWhiteSpace();
268  qcs.stripPrefix("--#");
270  }
271 }

引用了 FlowChart::addFlowChart(), FlowChart::COMMENT_NO, VhdlDocGen::getFlowMember(), lineCount(), QCString::stripPrefix() , 以及 QCString::stripWhiteSpace().

◆ initEntry()

void VHDLOutlineParser::initEntry ( Entry e)

在文件 vhdljjparser.cpp195 行定义.

196 {
197  e->fileName = p->yyFileName;
198  e->lang = SrcLangExt_VHDL;
199  if (p->str_doc.pending)
200  {
201  p->str_doc.pending=FALSE;
202  p->oldEntry=0; // prevents endless recursion
203  p->iDocLine=p->str_doc.iDocLine;
204  handleCommentBlock(p->str_doc.doc,p->str_doc.brief);
205  p->iDocLine=-1;
206  }
207  p->commentScanner.initGroupInfo(e);
208 }

引用了 FALSE, Entry::fileName, handleCommentBlock(), Entry::lang, p , 以及 SrcLangExt_VHDL.

被这些函数引用 addCompInst(), newEntry() , 以及 parseInput().

◆ insertEntryAtLine()

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

在文件 vhdljjparser.cpp826 行定义.

827 {
828  for (const auto &rt : ce->children())
829  {
830  if (rt->bodyLine==line)
831  {
832  p->lineEntry.push_back(rt);
833  }
834 
835  insertEntryAtLine(rt,line);
836  }
837 }

引用了 p.

被这些函数引用 checkMultiComment().

◆ isFuncProcProced()

bool VHDLOutlineParser::isFuncProcProced ( )

在文件 vhdljjparser.cpp599 行定义.

600 {
601  VhdlParser::SharedState *s = &p->shared;
602  if (s->currP==VhdlDocGen::FUNCTION ||
605  )
606  {
607  return TRUE;
608  }
609  return FALSE;
610 }

引用了 vhdl::parser::VhdlParser::SharedState::currP, FALSE, VhdlDocGen::FUNCTION, p, VhdlDocGen::PROCEDURE, VhdlDocGen::PROCESS , 以及 TRUE.

被这些函数引用 addVhdlType().

◆ lineCount() [1/2]

void VHDLOutlineParser::lineCount ( )

在文件 vhdljjparser.cpp182 行定义.

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

引用了 p.

被这些函数引用 handleFlowComment().

◆ lineCount() [2/2]

void VHDLOutlineParser::lineCount ( const char *  text)

在文件 vhdljjparser.cpp187 行定义.

188 {
189  for (const char* c=text ; *c ; ++c )
190  {
191  if (*c == '\n') p->yyLineNr++;
192  }
193 }

引用了 p.

◆ mapLibPackage()

void VHDLOutlineParser::mapLibPackage ( Entry root)

在文件 vhdljjparser.cpp681 行定义.

682 {
683  for (const auto &rt : p->libUse)
684  {
685  if (addLibUseClause(rt->name))
686  {
687  bool bFound=FALSE;
688  for (const auto &current : root->children())
689  {
690  if (VhdlDocGen::isVhdlClass(current.get()))
691  {
692  if (current->startLine > rt->startLine)
693  {
694  bFound=TRUE;
695  current->copyToSubEntry(rt);
696  break;
697  }
698  }
699  }//for
700  if (!bFound)
701  {
702  root->copyToSubEntry(rt);
703  }
704  } //if
705  }// for
706 }//MapLib

引用了 addLibUseClause(), Entry::children(), Entry::copyToSubEntry(), FALSE, VhdlDocGen::isVhdlClass(), p , 以及 TRUE.

被这些函数引用 parseInput().

◆ needsPreprocessing()

bool VHDLOutlineParser::needsPreprocessing ( const QCString extension) const
inlinevirtual

Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.

参见
parseInput()

实现了 OutlineParserInterface.

在文件 vhdljjparser.h37 行定义.

37 { return TRUE; }

引用了 TRUE.

◆ newEntry()

void VHDLOutlineParser::newEntry ( )

在文件 vhdljjparser.cpp210 行定义.

211 {
212  VhdlParser::SharedState *s = &p->shared;
213  p->previous = s->current.get();
214  if (s->current->spec==VhdlDocGen::ENTITY ||
215  s->current->spec==VhdlDocGen::PACKAGE ||
216  s->current->spec==VhdlDocGen::ARCHITECTURE ||
218  {
219  s->current_root->moveToSubEntryAndRefresh(s->current);
220  }
221  else
222  {
223  if (s->lastCompound)
224  {
225  s->lastCompound->moveToSubEntryAndRefresh(s->current);
226  }
227  else
228  {
229  if (s->lastEntity)
230  {
231  s->lastEntity->moveToSubEntryAndRefresh(s->current);
232  }
233  else
234  {
235  s->current_root->moveToSubEntryAndRefresh(s->current);
236  }
237  }
238  }
239  initEntry(s->current.get());
240 }

引用了 VhdlDocGen::ARCHITECTURE, vhdl::parser::VhdlParser::SharedState::current, vhdl::parser::VhdlParser::SharedState::current_root, VhdlDocGen::ENTITY, initEntry(), vhdl::parser::VhdlParser::SharedState::lastCompound, vhdl::parser::VhdlParser::SharedState::lastEntity, p, VhdlDocGen::PACKAGE , 以及 VhdlDocGen::PACKAGE_BODY.

被这些函数引用 addCompInst(), addVhdlType() , 以及 handleCommentBlock().

◆ oneLineComment()

void VHDLOutlineParser::oneLineComment ( QCString  qcs)

在文件 vhdljjparser.cpp795 行定义.

796 {
797  int j=qcs.find("--!");
798  qcs=qcs.right(qcs.length()-3-j);
799  if (!checkMultiComment(qcs,p->iDocLine))
800  {
802  }
803 }

引用了 checkMultiComment(), QCString::find(), handleCommentBlock(), QCString::length(), p, QCString::right() , 以及 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.

参数
[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.

实现了 OutlineParserInterface.

在文件 vhdljjparser.cpp132 行定义.

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  p->yyFileName=fileName;
144 
145  bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
146  bool altera_qsf=isConstraintFile(p->yyFileName,".qsf");
147 
148  // support XILINX(ucf) and ALTERA (qsf) file
149 
150  if (xilinx_ucf)
151  {
152  VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,FALSE);
153  return;
154  }
155  if (altera_qsf)
156  {
157  VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,TRUE);
158  return;
159  }
160  p->yyLineNr=1;
161  s->current_root=root;
162  s->lastCompound=0;
163  s->lastEntity=0;
164  s->lastEntity=0;
165  p->oldEntry = 0;
166  s->current=std::make_shared<Entry>();
167  initEntry(s->current.get());
168  p->commentScanner.enterFile(fileName,p->yyLineNr);
169  p->lineParse.reserve(200);
170  p->parseVhdlfile(fileName,fileBuf,inLine);
171  p->commentScanner.leaveFile(fileName,p->yyLineNr);
172 
173  s->current.reset();
174 
175  if (!inLine)
176  mapLibPackage(root.get());
177 
178  p->yyFileName.resize(0);
179  p->libUse.clear();
180 }

引用了 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(), p, VhdlDocGen::parseUCF() , 以及 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.

实现了 OutlineParserInterface.

在文件 vhdljjparser.cpp465 行定义.

466 {
467  p->varName=text;
468  p->varr=TRUE;
469 }

引用了 p , 以及 TRUE.

◆ popLabel()

QCString VHDLOutlineParser::popLabel ( QCString q)

在文件 vhdljjparser.cpp618 行定义.

619 {
620  int i=q.findRev("|");
621  if (i<0) return QCString();
622  q = q.left(i);
623  return q;
624 }

引用了 QCString::findRev() , 以及 QCString::left().

◆ pushLabel()

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

在文件 vhdljjparser.cpp612 行定义.

613 {
614  label+="|";
615  label+=val;
616 }

◆ setLineParsed()

void VHDLOutlineParser::setLineParsed ( int  tok)

在文件 vhdljjparser.cpp725 行定义.

726 {
727  if ((int)p->lineParse.size()<=tok) p->lineParse.resize(tok+1);
728  p->lineParse[tok]=p->yyLineNr;
729 }

引用了 p.

◆ setMultCommentLine()

void VHDLOutlineParser::setMultCommentLine ( )

在文件 vhdljjparser.cpp790 行定义.

791 {
792  p->iDocLine=p->yyLineNr;
793 }

引用了 p.

类成员变量说明

◆ p


该类的文档由以下文件生成:
VhdlDocGen::getFlowMember
static const MemberDef * getFlowMember()
Definition: vhdldocgen.cpp:92
StringVector
std::vector< std::string > StringVector
Definition: containers.h:32
FlowChart::writeFlowChart
static void writeFlowChart()
Definition: vhdldocgen.cpp:3420
VhdlDocGen::PROCEDURE
@ PROCEDURE
Definition: vhdldocgen.h:95
VHDLOutlineParser::handleCommentBlock
void handleCommentBlock(const QCString &doc, bool brief)
Definition: vhdljjparser.cpp:383
reg::replace
std::string replace(const std::string &str, const Ex &re, const std::string &replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
Definition: regex.cpp:740
GEN_SEC
@ GEN_SEC
Definition: vhdljjparser.h:20
Protection
Protection
Protection level of members
Definition: types.h:26
Entry::startLine
int startLine
start line of entry in the source
Definition: entry.h:291
vhdl::parser::VhdlParser::SharedState::current
std::shared_ptr< Entry > current
Definition: VhdlParser.h:8591
vhdl::parser::Token
Describes the input token stream.
Definition: Token.h:16
FlowChart::alignFuncProc
static void alignFuncProc(QCString &q, const ArgumentList &al, bool isFunc)
Definition: vhdldocgen.cpp:3614
VHDLOutlineParser::isFuncProcProced
bool isFuncProcProced()
Definition: vhdljjparser.cpp:599
VHDLOutlineParser::p
std::unique_ptr< Private > p
Definition: vhdljjparser.h:71
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
VHDLOutlineParser::lineCount
void lineCount()
Definition: vhdljjparser.cpp:182
VhdlDocGen::ENTITY
@ ENTITY
Definition: vhdldocgen.h:83
QCString::findRev
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:86
Entry::spec
uint64 spec
class/member specifiers
Definition: entry.h:248
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
reg::match
bool match(const std::string &str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition: regex.cpp:729
VhdlDocGen::GENERIC
@ GENERIC
Definition: vhdldocgen.h:100
VhdlDocGen::PACKAGE
@ PACKAGE
Definition: vhdldocgen.h:86
Entry::name
QCString name
member name
Definition: entry.h:240
split
static std::vector< QCString > split(const QCString &str, const QCString &sep, bool allowEmptyEntries=FALSE, bool cleanup=TRUE)
Definition: template.cpp:47
vhdl::parser::VhdlParser::SharedState::genLabels
QCString genLabels
Definition: VhdlParser.h:8596
VHDLOutlineParser::insertEntryAtLine
void insertEntryAtLine(std::shared_ptr< Entry > ce, int line)
Definition: vhdljjparser.cpp:826
QCString::str
std::string str() const
Definition: qcstring.h:442
Entry::VARIABLEDOC_SEC
@ VARIABLEDOC_SEC
Definition: entry.h:102
Public
@ Public
Definition: types.h:26
VHDLOutlineParser::mapLibPackage
void mapLibPackage(Entry *root)
Definition: vhdljjparser.cpp:681
vhdl::parser::VhdlParser::SharedState::currP
int currP
Definition: VhdlParser.h:8600
QCString::find
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:38
VHDLOutlineParser::checkInlineCode
int checkInlineCode(QCString &doc)
Definition: vhdljjparser.cpp:273
VHDLOutlineParser::checkMultiComment
bool checkMultiComment(QCString &qcs, int line)
Definition: vhdljjparser.cpp:806
Entry::doc
QCString doc
documentation block (partly parsed)
Definition: entry.h:267
QCString::contains
int contains(char c, bool cs=TRUE) const
Definition: qcstring.cpp:138
Argument::type
QCString type
Definition: arguments.h:50
Entry::inbodyDocs
QCString inbodyDocs
documentation inside the body of a function
Definition: entry.h:273
FlowChart::addFlowChart
static void addFlowChart(int type, const QCString &text, const QCString &exp, const QCString &label=QCString())
Definition: vhdldocgen.cpp:3235
g_instFiles
static EntryList g_instFiles
Definition: vhdljjparser.cpp:56
vhdl::parser::VhdlParser::SharedState::lastCompound
std::shared_ptr< Entry > lastCompound
Definition: VhdlParser.h:8590
QCString::left
QCString left(size_t len) const
Definition: qcstring.h:212
VHDLOutlineParser::addLibUseClause
bool addLibUseClause(const QCString &type)
Definition: vhdljjparser.cpp:708
VhdlDocGen::ARCHITECTURE
@ ARCHITECTURE
Definition: vhdldocgen.h:85
VHDLOutlineParser::initEntry
void initEntry(Entry *e)
Definition: vhdljjparser.cpp:195
idCounter
static int idCounter
Definition: vhdljjparser.cpp:242
VhdlDocGen::parseUCF
static void parseUCF(const char *input, Entry *entity, const QCString &f, bool vendor)
Definition: vhdldocgen.cpp:2266
Entry::section
int section
entry type (see Sections);
Definition: entry.h:238
Entry::endBodyLine
int endBodyLine
line number where the definition ends
Definition: entry.h:285
Argument
This class contains the information about the argument of a function or template
Definition: arguments.h:26
vhdl::parser::VhdlParser::SharedState::current_root
std::shared_ptr< Entry > current_root
Definition: VhdlParser.h:8587
QCString::lower
QCString lower() const
Definition: qcstring.h:232
VhdlDocGen::PACKAGE_BODY
@ PACKAGE_BODY
Definition: vhdldocgen.h:84
VhdlDocGen::LIBRARY
@ LIBRARY
Definition: vhdldocgen.h:82
VhdlDocGen::getRecordNumber
static QCString getRecordNumber()
Definition: vhdldocgen.cpp:1103
reg::Match
Object representing the matching results.
Definition: regex.h:163
VhdlDocGen::isVhdlClass
static bool isVhdlClass(const Entry *cu)
Definition: vhdldocgen.h:236
TRUE
#define TRUE
Definition: qcstring.h:36
Entry::FUNCTION_SEC
@ FUNCTION_SEC
Definition: entry.h:97
Argument::attrib
QCString attrib
Definition: arguments.h:49
PARAM_SEC
@ PARAM_SEC
Definition: vhdljjparser.h:20
VHDLOutlineParser::newEntry
void newEntry()
Definition: vhdljjparser.cpp:210
vhdl::parser::VhdlParser::SharedState::parse_sec
int parse_sec
Definition: VhdlParser.h:8599
Entry::copyToSubEntry
void copyToSubEntry(Entry *e)
Definition: entry.cpp:158
VhdlDocGen::deleteAllChars
static void deleteAllChars(QCString &s, char c)
Definition: vhdldocgen.cpp:1085
QCString::setNum
QCString & setNum(short n)
Definition: qcstring.h:372
Entry::fileName
QCString fileName
file this entry was extracted from
Definition: entry.h:290
FlowChart::END_NO
@ END_NO
Definition: vhdldocgen.h:272
vhdl::parser::VhdlParser::SharedState::param_sec
int param_sec
Definition: VhdlParser.h:8598
Entry::lang
SrcLangExt lang
programming language in which this entry was found
Definition: entry.h:294
QCString::mid
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition: qcstring.h:224
Argument::defval
QCString defval
Definition: arguments.h:54
Entry::brief
QCString brief
brief description (doc block)
Definition: entry.h:270
Entry::bodyLine
int bodyLine
line number of the body in the source
Definition: entry.h:283
VhdlDocGen::INSTANTIATION
@ INSTANTIATION
Definition: vhdldocgen.h:101
Entry
Represents an unstructured piece of information, about an entity found in the sources.
Definition: entry.h:61
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
Entry::children
const std::vector< std::shared_ptr< Entry > > & children() const
Definition: entry.h:205
vhdl::parser::VhdlParser::SharedState::tempEntry
std::shared_ptr< Entry > tempEntry
Definition: VhdlParser.h:8588
reg::Ex
Class representing a regular expression.
Definition: regex.h:48
Markdown
Helper class to process markdown formatted text
Definition: markdown.h:32
isConstraintFile
static bool isConstraintFile(const QCString &fileName, const QCString &ext)
Definition: vhdljjparser.cpp:48
VhdlDocGen::PROCESS
@ PROCESS
Definition: vhdldocgen.h:97
stripLeadingAndTrailingEmptyLines
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Special version of QCString::stripWhiteSpace() that only strips completely blank lines.
Definition: util.cpp:5394
vhdl::parser::VhdlParser::SharedState::lastEntity
std::shared_ptr< Entry > lastEntity
Definition: VhdlParser.h:8589
Argument::name
QCString name
Definition: arguments.h:52
FlowChart::START_NO
@ START_NO
Definition: vhdldocgen.h:274
SrcLangExt_VHDL
@ SrcLangExt_VHDL
Definition: types.h:54
Entry::VARIABLE_SEC
@ VARIABLE_SEC
Definition: entry.h:96
vhdl::parser::VhdlParser::SharedState
Definition: VhdlParser.h:8585
Entry::type
QCString type
member type
Definition: entry.h:239
VhdlDocGen::USE
@ USE
Definition: vhdldocgen.h:96
reg::search
bool search(const std::string &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:718
VhdlDocGen::prepareComment
static void prepareComment(QCString &)
Definition: vhdldocgen.cpp:968
VhdlDocGen::FUNCTION
@ FUNCTION
Definition: vhdldocgen.h:93
QCString::stripPrefix
bool stripPrefix(const QCString &prefix)
Definition: qcstring.h:197
vhdl::parser::Token::kind
int kind
An integer that describes the kind of this token.
Definition: Token.h:25
QCString::right
QCString right(size_t len) const
Definition: qcstring.h:217
QCString::prepend
QCString & prepend(const char *s)
Definition: qcstring.h:339
FlowChart::COMMENT_NO
@ COMMENT_NO
Definition: vhdldocgen.h:285
VhdlDocGen::MISCELLANEOUS
@ MISCELLANEOUS
Definition: vhdldocgen.h:107
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108