Doxygen
vhdljjparser.cpp
浏览该文件的文档.
1 /******************************************************************************
2  *
3  * Copyright (C) 2014 by M. Kreis
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  */
12 
13 #include <string>
14 
15 #include "qcstring.h"
16 #include "containers.h"
17 #include "vhdljjparser.h"
18 #include "vhdldocgen.h"
19 #include "message.h"
20 #include "config.h"
21 #include "doxygen.h"
22 #include "util.h"
23 #include "language.h"
24 #include "commentscan.h"
25 #include "index.h"
26 #include "definition.h"
27 #include "searchindex.h"
28 #include "outputlist.h"
29 #include "arguments.h"
30 #include "types.h"
31 #include "growbuf.h"
32 #include "markdown.h"
33 #include "VhdlParserTokenManager.h"
35 #include "regex.h"
36 
37 using namespace vhdl::parser;
38 
40 {
42  bool brief;
43  bool pending = false;
44  int iDocLine = 1;
45 };
46 
47 
48 static bool isConstraintFile(const QCString &fileName,const QCString &ext)
49 {
50  return fileName.right(ext.length())==ext;
51 }
52 
53 
54 //-------------------------------------
55 
57 
59 {
60  void parseVhdlfile(const QCString &fileName,const char* inputBuffer,bool inLine);
61 
62  VHDLOutlineParser *thisParser = 0;
63  VhdlParser *vhdlParser = 0;
65 
67  int yyLineNr = 1;
69  int iDocLine = -1;
71  Entry* gBlock = 0;
72  Entry* previous = 0;
73 //-------------------------------------------------------
74 
75  Entry* oldEntry = 0;
76  bool varr = FALSE;
81  int iCodeLen;
85  int code = 0;
86 
87 };
88 
90  const char* inputBuffer,bool inLine)
91 {
92  JAVACC_STRING_TYPE s =inputBuffer;
93  CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1);
94  VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
95  VhdlTokenManagerErrorHandler *tokErrHandler=new VhdlTokenManagerErrorHandler(fileName.data());
96  vhdlParser=new VhdlParser(tokenManager);
97  vhdlParser->setOutlineParser(thisParser);
98  vhdlParser->setSharedState(&shared);
99  tokenManager->setLexParser(vhdlParser);
100  tokenManager->ReInit(stream,0);
101  tokenManager->setErrorHandler(tokErrHandler);
102  VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName.data());
103  vhdlParser->setErrorHandler(parserErrHandler);
104  try
105  {
106  if(inLine)
107  {
108  vhdlParser->parseInline();
109  }
110  else
111  {
112  vhdlParser->design_file();
113  }
114  }
115  catch( std::exception &){ /* fprintf(stderr,"\n[%s]",e.what()); */ }
116  // fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
117  // fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
118  //
119  delete vhdlParser;
120  delete tokenManager;
121  delete stream;
122 }
123 
125 {
126 }
127 
129 {
130 }
131 
132 void 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  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 }
181 
183 {
184  p->yyLineNr++;
185 }
186 
187 void VHDLOutlineParser::lineCount(const char* text)
188 {
189  for (const char* c=text ; *c ; ++c )
190  {
191  if (*c == '\n') p->yyLineNr++;
192  }
193 }
194 
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 }
209 
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 }
241 
242 static int idCounter;
243 
244 /** returns a unique id for each record member.
245 *
246 * type first_rec is record
247 * RE: data_type;
248 * end;
249 *
250 * type second_rec is record
251 * RE: data_type;
252 * end;
253 */
254 
256 {
257  return QCString().setNum(idCounter++);
258 }
259 
261 {
262  lineCount(doc);
263 
265  {
266  QCString qcs(doc);
267  qcs=qcs.stripWhiteSpace();
268  qcs.stripPrefix("--#");
270  }
271 }
272 
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 }
382 
383 void VHDLOutlineParser::handleCommentBlock(const QCString &doc1, bool brief)
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 }
464 
466 {
467  p->varName=text;
468  p->varr=TRUE;
469 }
470 
471 void VHDLOutlineParser::addCompInst(const char *n, const char* instName, const char* comp,int iLine)
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 }
512 
513 void VHDLOutlineParser::addVhdlType(const char *n,int startLine,int section,
514  uint64 spec,const char* args,const char* type,Protection prot)
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 }
550 
551 void VHDLOutlineParser::createFunction(const char *imp,uint64 spec,const char *fn)
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 }
597 
598 
600 {
601  VhdlParser::SharedState *s = &p->shared;
602  if (s->currP==VhdlDocGen::FUNCTION ||
605  )
606  {
607  return TRUE;
608  }
609  return FALSE;
610 }
611 
613 {
614  label+="|";
615  label+=val;
616 }
617 
619 {
620  int i=q.findRev("|");
621  if (i<0) return QCString();
622  q = q.left(i);
623  return q;
624 }
625 
626 
627 
628 void VHDLOutlineParser::addProto(const char *s1,const char *s2,const char *s3,
629  const char *s4,const char *s5,const char *s6)
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 }
668 
669 
670 /*
671  * adds the library|use statements to the next class (entity|package|architecture|package body
672  * library ieee
673  * entity xxx
674  * .....
675  * library
676  * package
677  * entity zzz
678  * .....
679  * and so on..
680  */
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
707 
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 }
719 
721 {
722  return p->yyLineNr;
723 }
724 
726 {
727  if ((int)p->lineParse.size()<=tok) p->lineParse.resize(tok+1);
728  p->lineParse[tok]=p->yyLineNr;
729 }
730 
732 {
733  int val=p->lineParse[tok];
734  if (val<0) val=0;
735  //assert(val>=0 && val<=yyLineNr);
736  return val;
737 }
738 
739 
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 }
789 
791 {
792  p->iDocLine=p->yyLineNr;
793 }
794 
796 {
797  int j=qcs.find("--!");
798  qcs=qcs.right(qcs.length()-3-j);
799  if (!checkMultiComment(qcs,p->iDocLine))
800  {
802  }
803 }
804 
805 
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 }
824 
825 // returns the vhdl parsed types at line xxx
826 void VHDLOutlineParser::insertEntryAtLine(std::shared_ptr<Entry> ce,int line)
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 }
838 
840 {
841  return g_instFiles;
842 }
843 
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 }
861 
863 {
864  GrowBuf growBuf;
865  const char *p=s+3; // skip /*!
866  char c='\0';
867  while (*p == ' ' || *p == '\t') p++;
868  while ((c=*p++))
869  {
870  growBuf.addChar(c);
871  if (c == '\n')
872  {
873  // special handling of space followed by * at beginning of line
874  while (*p == ' ' || *p == '\t') p++;
875  while (*p == '*') p++;
876  // special attention in case character at end is /
877  if (*p == '/') p++;
878  }
879  }
880  // special attention in case */ at end of last line
881  int len = growBuf.getPos();
882  if (growBuf.at(len-1) == '/' && growBuf.at(len-2) == '*')
883  {
884  len -= 2;
885  while (growBuf.at(len-1) == '*') len--;
886  c = growBuf.at(len-1);
887  while ((c = growBuf.at(len-1)) == ' ' || c == '\t') len--;
888  growBuf.setPos(len);
889  }
890  growBuf.addChar(0);
891  return growBuf.get();
892 }
VhdlDocGen::getFlowMember
static const MemberDef * getFlowMember()
Definition: vhdldocgen.cpp:92
StringVector
std::vector< std::string > StringVector
Definition: containers.h:32
VHDLOutlineParser::getLine
int getLine()
Definition: vhdljjparser.cpp:720
FlowChart::writeFlowChart
static void writeFlowChart()
Definition: vhdldocgen.cpp:3420
VHDLOutlineParser::addVhdlType
void addVhdlType(const char *n, int startLine, int section, uint64 spec, const char *args, const char *type, Protection prot)
Definition: vhdljjparser.cpp:513
VhdlDocGen::PROCEDURE
@ PROCEDURE
Definition: vhdldocgen.h:95
outputlist.h
VHDLOutlineParser::handleCommentBlock
void handleCommentBlock(const QCString &doc, bool brief)
Definition: vhdljjparser.cpp:383
VhdlParserErrorHandler.hpp
vhdl::parser::VhdlTokenManagerErrorHandler
Definition: VhdlParserErrorHandler.hpp:46
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
VHDLOutlineParser::Private::libUse
EntryList libUse
Definition: vhdljjparser.cpp:78
Protection
Protection
Protection level of members
Definition: types.h:26
VHDLOutlineParser::setMultCommentLine
void setMultCommentLine()
Definition: vhdljjparser.cpp:790
Entry::startLine
int startLine
start line of entry in the source
Definition: entry.h:291
Markdown::process
QCString process(const QCString &input, int &startNewlines, bool fromParseInput=false)
Definition: markdown.cpp:3002
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
VHDLOutlineParser::getNameID
QCString getNameID()
returns a unique id for each record member.
Definition: vhdljjparser.cpp:255
types.h
This file contains a number of basic enums and types.
GrowBuf::setPos
void setPos(uint newPos)
Definition: growbuf.h:97
FlowChart::alignFuncProc
static void alignFuncProc(QCString &q, const ArgumentList &al, bool isFunc)
Definition: vhdldocgen.cpp:3614
VHDLOutlineParser::VHDLOutlineParser
VHDLOutlineParser()
Definition: vhdljjparser.cpp:124
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
GrowBuf::get
char * get()
Definition: growbuf.h:94
VHDLOutlineParser::lineCount
void lineCount()
Definition: vhdljjparser.cpp:182
VhdlDocGen::ENTITY
@ ENTITY
Definition: vhdldocgen.h:83
vhdl::parser::TokenParser::setLexParser
void setLexParser(VhdlParser *p)
Definition: vhdlstring.h:20
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
VHDLOutlineParser::handleFlowComment
void handleFlowComment(const char *)
Definition: vhdljjparser.cpp:260
VhdlDocGen::GENERIC
@ GENERIC
Definition: vhdldocgen.h:100
index.h
commentscan.h
Interface for the comment block scanner
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
vhdl::parser::VhdlParser
Definition: VhdlParser.h:21
growbuf.h
VHDLOutlineParser::Private::strComment
QCString strComment
Definition: vhdljjparser.cpp:80
VHDLOutlineParser::insertEntryAtLine
void insertEntryAtLine(std::shared_ptr< Entry > ce, int line)
Definition: vhdljjparser.cpp:826
markdown.h
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::VhdlParserTokenManager
Token Manager.
Definition: VhdlParserTokenManager.h:18
VHDLOutlineParser::Private::str_doc
VHDLDocInfo str_doc
Definition: vhdljjparser.cpp:82
IntVector
std::vector< int > IntVector
Definition: containers.h:36
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
GrowBuf::at
char at(uint i) const
Definition: growbuf.h:98
VHDLOutlineParser::checkInlineCode
int checkInlineCode(QCString &doc)
Definition: vhdljjparser.cpp:273
qcstring.h
VHDLOutlineParser::checkMultiComment
bool checkMultiComment(QCString &qcs, int line)
Definition: vhdljjparser.cpp:806
VHDLOutlineParser::parseInput
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.
Definition: vhdljjparser.cpp:132
VHDLDocInfo::doc
QCString doc
Definition: vhdljjparser.cpp:41
filter2008VhdlComment
QCString filter2008VhdlComment(const char *s)
Definition: vhdljjparser.cpp:862
Entry::doc
QCString doc
documentation block (partly parsed)
Definition: entry.h:267
GrowBuf::addChar
void addChar(char c)
Definition: growbuf.h:54
GrowBuf
Class representing a string buffer optimised for growing.
Definition: growbuf.h:12
vhdl::parser::VhdlParserTokenManager::setErrorHandler
void setErrorHandler(TokenManagerErrorHandler *eh)
Definition: VhdlParserTokenManager.h:111
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
getVhdlInstList
const EntryList & getVhdlInstList()
Definition: vhdljjparser.cpp:839
QCString::stripWhiteSpace
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition: qcstring.h:243
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
message.h
VHDLOutlineParser::addLibUseClause
bool addLibUseClause(const QCString &type)
Definition: vhdljjparser.cpp:708
VHDLOutlineParser::Private::varName
QCString varName
Definition: vhdljjparser.cpp:77
GrowBuf::getPos
uint getPos() const
Definition: growbuf.h:96
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
VHDLOutlineParser::Private::shared
VhdlParser::SharedState shared
Definition: vhdljjparser.cpp:83
VhdlDocGen::parseUCF
static void parseUCF(const char *input, Entry *entity, const QCString &f, bool vendor)
Definition: vhdldocgen.cpp:2266
VhdlParserTokenManager.h
VHDLOutlineParser::error_skipto
void error_skipto(int kind)
Definition: vhdljjparser.cpp:844
QCString::simplifyWhiteSpace
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
Definition: qcstring.cpp:180
Entry::section
int section
entry type (see Sections);
Definition: entry.h:238
arguments.h
CommentScanner
Definition: commentscan.h:28
VHDLOutlineParser::addProto
void addProto(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6)
Definition: vhdljjparser.cpp:628
vhdl::parser::VhdlParserTokenManager::ReInit
void ReInit(JAVACC_CHARSTREAM *stream, int lexState=0)
doxygen.h
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
language.h
QCString::lower
QCString lower() const
Definition: qcstring.h:232
VHDLOutlineParser::~VHDLOutlineParser
virtual ~VHDLOutlineParser()
Definition: vhdljjparser.cpp:128
VhdlDocGen::PACKAGE_BODY
@ PACKAGE_BODY
Definition: vhdldocgen.h:84
VHDLOutlineParser::Private::lineEntry
EntryList lineEntry
Definition: vhdljjparser.cpp:79
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
vhdl::parser::VhdlErrorHandler
Definition: VhdlParserErrorHandler.hpp:16
Entry::FUNCTION_SEC
@ FUNCTION_SEC
Definition: entry.h:97
regex.h
Argument::attrib
QCString attrib
Definition: arguments.h:49
VHDLOutlineParser::addCompInst
void addCompInst(const char *n, const char *instName, const char *comp, int iLine)
Definition: vhdljjparser.cpp:471
vhdl::parser
Definition: CharStream.h:13
VHDLOutlineParser::Private::forL
QCString forL
Definition: vhdljjparser.cpp:84
PARAM_SEC
@ PARAM_SEC
Definition: vhdljjparser.h:20
VHDLOutlineParser::pushLabel
void pushLabel(QCString &, QCString &)
Definition: vhdljjparser.cpp:612
VHDLOutlineParser::parsePrototype
void parsePrototype(const QCString &text)
Callback function called by the comment block scanner.
Definition: vhdljjparser.cpp:465
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
VHDLOutlineParser::Private::commentScanner
CommentScanner commentScanner
Definition: vhdljjparser.cpp:64
QCString::setNum
QCString & setNum(short n)
Definition: qcstring.h:372
EntryList
std::vector< std::shared_ptr< Entry > > EntryList
Definition: entry.h:336
Entry::fileName
QCString fileName
file this entry was extracted from
Definition: entry.h:290
FlowChart::END_NO
@ END_NO
Definition: vhdldocgen.h:272
containers.h
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
VHDLOutlineParser::setLineParsed
void setLineParsed(int tok)
Definition: vhdljjparser.cpp:725
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
definition.h
VHDLOutlineParser
VHDL parser using state-based lexical scanning.
Definition: vhdljjparser.h:27
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
VHDLOutlineParser::Private::lineParse
IntVector lineParse
Definition: vhdljjparser.cpp:68
VHDLDocInfo::brief
bool brief
Definition: vhdljjparser.cpp:42
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
VHDLOutlineParser::createFunction
void createFunction(const char *impure, uint64 spec, const char *fname)
Definition: vhdljjparser.cpp:551
JAVACC_STRING_TYPE
#define JAVACC_STRING_TYPE
Definition: JavaCC.h:16
vhdl::parser::VhdlParser::SharedState::lastEntity
std::shared_ptr< Entry > lastEntity
Definition: VhdlParser.h:8589
VHDLOutlineParser::Private::inputString
QCString inputString
Definition: vhdljjparser.cpp:70
Argument::name
QCString name
Definition: arguments.h:52
config.h
VHDLOutlineParser::Private::yyFileName
QCString yyFileName
Definition: vhdljjparser.cpp:66
QCString::data
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:153
ClangTUParser
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition: clangparser.h:21
FlowChart::START_NO
@ START_NO
Definition: vhdldocgen.h:274
VHDLOutlineParser::Private::iCodeLen
int iCodeLen
Definition: vhdljjparser.cpp:81
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
VHDLOutlineParser::popLabel
QCString popLabel(QCString &q)
Definition: vhdljjparser.cpp:618
VHDLDocInfo
Definition: vhdljjparser.cpp:39
VhdlDocGen::USE
@ USE
Definition: vhdldocgen.h:96
searchindex.h
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
vhdl::parser::CharStream
This class describes a character stream that maintains line and column number positions of the charac...
Definition: CharStream.h:31
util.h
A bunch of utility functions.
VHDLOutlineParser::createFlow
void createFlow()
Definition: vhdljjparser.cpp:740
VHDLOutlineParser::Private
Definition: vhdljjparser.cpp:58
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
uint64
uint64_t uint64
Definition: qcstring.h:43
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
VHDLOutlineParser::Private::parseVhdlfile
void parseVhdlfile(const QCString &fileName, const char *inputBuffer, bool inLine)
Definition: vhdljjparser.cpp:89
vhdljjparser.h
vhdldocgen.h
FlowChart::COMMENT_NO
@ COMMENT_NO
Definition: vhdldocgen.h:285
VhdlDocGen::MISCELLANEOUS
@ MISCELLANEOUS
Definition: vhdldocgen.h:107
VHDLOutlineParser::oneLineComment
void oneLineComment(QCString qcs)
Definition: vhdljjparser.cpp:795
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108