Doxygen
Loading...
Searching...
No Matches
vhdljjparser.cpp
Go to the documentation of this file.
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 "dstring.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 "stringutil.h"
24#include "language.h"
25#include "commentscan.h"
26#include "definition.h"
27#include "searchindex.h"
28#include "outputlist.h"
29#include "arguments.h"
30#include "types.h"
31#include "markdown.h"
34#include "regex.h"
35
36using namespace vhdl::parser;
37
39{
41 bool brief;
42 bool pending = false;
43 int iDocLine = 1;
44};
45
46
47static bool isConstraintFile(const DString &fileName,const DString &ext)
48{
49 return fileName.right(ext.length())==ext;
50}
51
52
53//-------------------------------------
54
56
58{
59 void parseVhdlfile(const DString &fileName,const DString &inputBuffer,bool inLine);
60
64
66 int yyLineNr = 1;
68 int iDocLine = -1;
70 Entry* gBlock = nullptr;
71 Entry* previous = nullptr;
72//-------------------------------------------------------
73
74 Entry* oldEntry = nullptr;
75 bool varr = false;
84 size_t code = 0;
85
86};
87
89 const DString &inputBuffer,bool inLine)
90{
91 CharStream *stream = new CharStream(reinterpret_cast<const JJChar*>(inputBuffer.data()), (int)inputBuffer.size(), 1, 1);
92 VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
94 vhdlParser=new VhdlParser(tokenManager);
97 tokenManager->setLexParser(vhdlParser);
98 tokenManager->ReInit(stream,0);
99 tokenManager->setErrorHandler(tokErrHandler);
100 VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName.data());
101 vhdlParser->setErrorHandler(parserErrHandler);
102 try
103 {
104 if(inLine)
105 {
107 }
108 else
109 {
110 // vhdlParser->interface_variable_declaration(); //interface_declaration() ;
112 }
113 }
114 catch( std::exception &){ /* fprintf(stderr,"\n[%s]",e.what()); */ }
115 // fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
116 // fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
117 //
118 delete vhdlParser;
119 delete tokenManager;
120 delete stream;
121}
122
124{
125}
126
130
131void VHDLOutlineParser::parseInput(const DString &fileName,const char *fileBuf,
132 const std::shared_ptr<Entry> &root, ClangTUParser *)
133{
134 VhdlParser::SharedState *s = &p->shared;
135 p->thisParser=this;
136 p->inputString=fileBuf;
137
138 // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);
139
140 bool inLine = fileName.empty();
141
142 if (!inLine) msg("Parsing file {}...\n",fileName);
143
144 p->yyFileName=fileName;
145
146 bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
147 bool altera_qsf=isConstraintFile(p->yyFileName,".qsf");
148
149 // support XILINX(ucf) and ALTERA (qsf) file
150
151 if (xilinx_ucf)
152 {
153 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,false);
154 return;
155 }
156 if (altera_qsf)
157 {
158 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,true);
159 return;
160 }
161 p->yyLineNr=1;
162 s->current_root=root;
163 s->lastCompound=nullptr;
164 s->lastEntity=nullptr;
165 p->oldEntry = nullptr;
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.clear();
179 p->libUse.clear();
180}
181
183{
184 p->yyLineNr++;
185}
186
188{
189 if (!text.empty())
190 {
191 for (const char* c=text.data() ; *c ; ++c )
192 {
193 if (*c == '\n') p->yyLineNr++;
194 }
195 }
196}
197
199{
200 e->fileName = p->yyFileName;
201 e->lang = SrcLangExt::VHDL;
202 if (p->str_doc.pending)
203 {
204 p->str_doc.pending=false;
205 p->oldEntry=nullptr; // prevents endless recursion
206 p->iDocLine=p->str_doc.iDocLine;
207 handleCommentBlock(p->str_doc.doc,p->str_doc.brief);
208 p->iDocLine=-1;
209 }
210 p->commentScanner.initGroupInfo(e);
211}
212
214{
215 VhdlParser::SharedState *s = &p->shared;
216 p->previous = s->current.get();
217 if (s->current->vhdlSpec==VhdlSpecifier::ENTITY ||
218 s->current->vhdlSpec==VhdlSpecifier::PACKAGE ||
219 s->current->vhdlSpec==VhdlSpecifier::ARCHITECTURE ||
221 {
222 s->current_root->moveToSubEntryAndRefresh(s->current);
223 }
224 else
225 {
226 if (s->lastCompound)
227 {
228 s->lastCompound->moveToSubEntryAndRefresh(s->current);
229 }
230 else
231 {
232 if (s->lastEntity)
233 {
234 s->lastEntity->moveToSubEntryAndRefresh(s->current);
235 }
236 else
237 {
238 s->current_root->moveToSubEntryAndRefresh(s->current);
239 }
240 }
241 }
242 initEntry(s->current.get());
243}
244
245static int idCounter;
246
247/** returns a unique id for each record member.
248*
249* type first_rec is record
250* RE: data_type;
251* end;
252*
253* type second_rec is record
254* RE: data_type;
255* end;
256*/
257
262
264{
265 lineCount(doc);
266
268 {
269 DString qcs(doc);
270 qcs=qcs.stripWhiteSpace();
271 qcs.stripPrefix("--#");
273 }
274}
275
277{
278 static const reg::Ex csRe(R"([\\@]code)");
279 static const reg::Ex cendRe(R"(\s*[\\@]endcode)");
280 static const reg::Ex cbriefRe(R"([\\@]brief)");
281
282 // helper to simulate behavior of QString.find(const QRegExp &re,int pos)
283 auto findRe = [](const DString &str,const reg::Ex &re,size_t pos=0) -> size_t
284 {
285 if (str.length()<pos) return DString::npos;
286 reg::Match match;
287 if (reg::search(str.str(),match,re,pos)) // match found
288 {
289 return match.position();
290 }
291 else // not found
292 {
293 return DString::npos;
294 }
295 };
296 auto replaceRe = [](const DString &str,const reg::Ex &re,const DString &replacement) -> DString
297 {
298 return reg::replace(str.str(), re, replacement.str());
299 };
300
301 size_t index = findRe(doc,csRe);
302
303 if (findRe(doc,cendRe)!=DString::npos)
304 return 1;
305
306 if (index==DString::npos)
307 return index;
308
309 VhdlParser::SharedState *s = &p->shared;
310 p->strComment += doc;
311 p->code = findRe(p->inputString,csRe, p->code + 1);
312 size_t com = p->inputString.find(p->strComment);
313 size_t ref = findRe(p->inputString,cendRe, p->code + 1);
314 size_t len = p->strComment.size();
315
316 size_t ll = com + len;
317 int diff = static_cast<int>(ref) - static_cast<int>(ll) - 3;
318 DString code = p->inputString.mid(ll, diff);
319 int iLine = 0;
320 code = stripLeadingAndTrailingEmptyLines(code, iLine);
321 int val = code.contains('\n');
322 VhdlDocGen::prepareComment(p->strComment);
323 StringVector ql = split(p->strComment.str(),"\n");
324
325 DString co;
326 DString na;
327 for (const auto &qcs_ : ql)
328 {
329 DString qcs(qcs_);
330 qcs = qcs.simplifyWhiteSpace();
331 if (findRe(qcs,csRe)!=DString::npos)
332 {
333 size_t i = qcs.find('{');
334 size_t j = qcs.find('}');
335 if (i!=DString::npos && j!=DString::npos && i>0 && j > i)
336 {
337 na = qcs.mid(i+1, j-i-1);
338 }
339 continue;
340 }
341 qcs = replaceRe(qcs,cbriefRe, "");
342 co += qcs;
343 co += '\n';
344 }
345
347
348 Entry gBlock;
349 if (!na.empty())
350 gBlock.name = na;
351 else
352 gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
353 gBlock.startLine = p->yyLineNr+iLine-1;
354 gBlock.bodyLine = p->yyLineNr+iLine-1 ;
355 gBlock.doc = code;
356 gBlock.inbodyDocs = code;
357 gBlock.brief = co;
358 gBlock.section = EntryType::makeVariable();
360 gBlock.fileName = p->yyFileName;
361 gBlock.endBodyLine = p->yyLineNr + val +iLine;
362 gBlock.lang = SrcLangExt::VHDL;
363 std::shared_ptr<Entry> compound;
364
365 if (s->lastEntity)
366 compound = s->lastEntity;
367 else if (s->lastCompound)
368 compound = s->lastCompound;
369 else
370 compound = nullptr;
371
372 if (compound)
373 {
374 compound->copyToSubEntry(&gBlock);
375 }
376 else
377 {
378 gBlock.type = "misc"; // global code like library ieee...
379 s->current_root->copyToSubEntry(&gBlock);
380 }
381 p->strComment.clear();
382 return 1;
383}
384
386{
387 int position = 0;
388 bool needsEntry = false;
389 VhdlParser::SharedState *s = &p->shared;
390 DString doc = doc1;
391
392 if (doc.empty())
393 return;
394
395 if (checkMultiComment(doc, p->yyLineNr))
396 {
397 p->strComment.clear();
398 return;
399 }
400
401 if (checkInlineCode(doc) != DString::npos)
402 {
403 return;
404 }
405
406 Protection protection = Protection::Public;
408 if (doc.empty()) return;
409
410 if (p->oldEntry == s->current.get())
411 {
412 p->str_doc.doc = doc;
413 p->str_doc.iDocLine = p->iDocLine;
414 p->str_doc.brief = brief;
415 p->str_doc.pending = true;
416 return;
417 }
418
419 p->oldEntry = s->current.get();
420
421 if (brief)
422 {
423 s->current->briefLine = p->yyLineNr;
424 }
425 else
426 {
427 s->current->docLine = p->yyLineNr;
428 }
429
430
431
432 Markdown markdown(p->yyFileName,p->iDocLine);
433 int lineNr = p->iDocLine;
434 GuardedSectionStack guards;
435 DString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
436
437 while (p->commentScanner.parseCommentBlock(
438 p->thisParser,
439 s->current.get(),
440 processedDoc, // text
441 p->yyFileName, // file
442 lineNr, // line of block start
443 brief,
444 0,
445 false,
446 protection,
447 position,
448 needsEntry,
449 Config_getBool(MARKDOWN_SUPPORT),
450 &guards
451 ))
452 {
453 if (needsEntry)
454 newEntry();
455 }
456 if (needsEntry)
457 {
458 if (p->varr)
459 {
460 p->varr = false;
461 s->current->name = p->varName;
462 s->current->section = EntryType::makeVariableDoc();
463 p->varName = "";
464 }
465 newEntry();
466 }
467 p->iDocLine = -1;
468 p->strComment.clear();
469}
470
472{
473 p->varName=text;
474 p->varr=true;
475}
476
477void VHDLOutlineParser::addCompInst(const DString &n, const DString &instName, const DString &comp,int iLine)
478{
479 VhdlParser::SharedState *s = &p->shared;
481 s->current->section=EntryType::makeVariable();
482 s->current->startLine=iLine;
483 s->current->bodyLine=iLine;
484 s->current->type=instName; // foo:instname e.g proto or work. proto(ttt)
485 s->current->exception=s->genLabels.lower(); // |arch|label1:label2...
486 s->current->name=n; // foo
487 if (s->lastCompound)
488 {
489 s->current->args=s->lastCompound->name; // architecture name
490 }
491 s->current->includeName=comp; // component/entity/configuration
492 size_t u=s->genLabels.find('|',1);
493 if (u!=DString::npos && u>0)
494 {
495 s->current->write=s->genLabels.mid(u);
496 s->current->read=s->genLabels.left(u);
497 }
498 //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine);
499
500 if (s->lastCompound)
501 {
502 s->current->args=s->lastCompound->name;
503 if (true) // !findInstant(current->type))
504 {
505 initEntry(s->current.get());
506 // TODO: protect with mutex
507 g_instFiles.emplace_back(std::make_shared<Entry>(*s->current));
508 // TODO: end protect with mutex
509 }
510
511 s->current=std::make_shared<Entry>();
512 }
513 else
514 {
515 newEntry();
516 }
517}
518
519void VHDLOutlineParser::addVhdlType(const DString &n,int startLine,EntryType section,
520 VhdlSpecifier spec,const DString &args,const DString &type,Protection prot)
521{
522 VhdlParser::SharedState *s = &p->shared;
524
526 {
528 }
529
530 StringVector ql=split(n.str(),",");
531
532 for (size_t u=0;u<ql.size();u++)
533 {
534 s->current->name=ql[u];
535 s->current->startLine=startLine;
536 s->current->bodyLine=startLine;
537 s->current->section=section;
538 s->current->vhdlSpec=spec;
539 s->current->fileName=p->yyFileName;
540 if (s->current->args.empty())
541 {
542 s->current->args=args;
543 }
544 s->current->type=type;
545 s->current->protection=prot;
546
547 if (!s->lastCompound && section.isVariable() && (spec == VhdlSpecifier::USE || spec == VhdlSpecifier::LIBRARY) )
548 {
549 p->libUse.emplace_back(std::make_shared<Entry>(*s->current));
550 s->current->reset();
551 }
552 newEntry();
553 }
554}
555
557{
558 VhdlParser::SharedState *s = &p->shared;
559 s->current->vhdlSpec=spec;
560 s->current->section=EntryType::makeFunction();
561
562 if (impure=="impure" || impure=="pure")
563 {
564 s->current->exception=impure;
565 }
566
568 {
569 s->current->vhdlSpec=VhdlSpecifier::GENERIC;
570 s->current->section=EntryType::makeFunction();
571 }
572
574 {
575 s->current->name=impure;
576 s->current->exception="";
577 }
578 else
579 {
580 s->current->name=fname;
581 }
582
583 if (spec==VhdlSpecifier::PROCESS)
584 {
585 s->current->args=fname;
586 s->current->name=impure;
588 if (!fname.empty())
589 {
590 StringVector q1=split(fname.str(),",");
591 for (const auto &name : q1)
592 {
593 Argument arg;
594 arg.name=name;
595 s->current->argList.push_back(arg);
596 }
597 }
598 }
599}
600
601
603{
604 VhdlParser::SharedState *s = &p->shared;
608 )
609 {
610 return true;
611 }
612 return false;
613}
614
616{
617 label+="|";
618 label+=val;
619}
620
622{
623 size_t i=q.rfind('|');
624 if (i==DString::npos) return DString();
625 q = q.left(i);
626 return q;
627}
628
629
630
631void VHDLOutlineParser::addProto(const DString &s1,const DString &s2,const DString &s3,
632 const DString &s4,const DString &/*s5*/,const DString &s6)
633{
634 VhdlParser::SharedState *s = &p->shared;
635 StringVector ql=split(s2.str(),",");
636
637 for (const auto &n : ql)
638 {
639 Argument arg;
640 arg.name=n;
641 if (!s3.empty())
642 {
643 arg.type=s3;
644 }
645 arg.type+=" ";
646 arg.type+=s4;
647 if (!s6.empty())
648 {
649 arg.type+=s6;
650 }
652 {
653 arg.defval="generic";
654 }
655
657 {
658 // assert(false);
659 }
660
661 arg.defval+=s1;
662 arg.attrib="";//s6;
663
664 s->current->argList.push_back(arg);
665 s->current->args+=s2;
666 s->current->args+=",";
667 }
668}
669
670
671/*
672 * adds the library|use statements to the next class (entity|package|architecture|package body
673 * library ieee
674 * entity xxx
675 * .....
676 * library
677 * package
678 * entity zzz
679 * .....
680 * and so on..
681 */
683{
684 for (const auto &rt : p->libUse)
685 {
686 if (addLibUseClause(rt->name))
687 {
688 bool bFound=false;
689 for (const auto &current : root->children())
690 {
691 if (VhdlDocGen::isVhdlClass(current.get()))
692 {
693 if (current->startLine > rt->startLine)
694 {
695 bFound=true;
696 current->copyToSubEntry(rt);
697 break;
698 }
699 }
700 }//for
701 if (!bFound)
702 {
703 root->copyToSubEntry(rt);
704 }
705 } //if
706 }// for
707}//MapLib
708
710{
711 bool showIEEESTD=Config_getBool(FORCE_LOCAL_INCLUDES);
712
713 if (showIEEESTD) // all standard packages and libraries will not be shown
714 {
715 if (type.lower().stripPrefix("ieee")) return false;
716 if (type.lower().stripPrefix("std")) return false;
717 }
718 return true;
719}
720
722{
723 return p->yyLineNr;
724}
725
727{
728 if ((int)p->lineParse.size()<=tok) p->lineParse.resize(tok+1);
729 p->lineParse[tok]=p->yyLineNr;
730}
731
733{
734 int val=p->lineParse[tok];
735 if (val<0) val=0;
736 //assert(val>=0 && val<=yyLineNr);
737 return val;
738}
739
740
742{
743 VhdlParser::SharedState *s = &p->shared;
745 {
746 return;
747 }
748 DString q,ret;
749
751 {
752 q=":function( ";
753 FlowChart::alignFuncProc(q,s->tempEntry->argList,true);
754 q+=")";
755 }
756 else if (s->currP==VhdlSpecifier::PROCEDURE)
757 {
758 q=":procedure (";
759 FlowChart::alignFuncProc(q,s->tempEntry->argList,false);
760 q+=")";
761 }
762 else
763 {
764 q=":process( "+s->tempEntry->args;
765 q+=")";
766 }
767
769
771
773 {
774 ret="end function ";
775 }
776 else if (s->currP==VhdlSpecifier::PROCEDURE)
777 {
778 ret="end procedure";
779 }
780 else
781 {
782 ret="end process ";
783 }
784
786 // FlowChart::printFlowList();
789}
790
792{
793 p->iDocLine=p->yyLineNr;
794}
795
797{
798 if (size_t j=qcs.find("--!"); j!=DString::npos) qcs=qcs.mid(j+3);
799 if (!checkMultiComment(qcs,p->iDocLine))
800 {
801 handleCommentBlock(qcs,true);
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
826void 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==nullptr) 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 if (s.length()<4) return s;
865 DString result;
866 result.reserve(s.length());
867 const char *p=s.data()+3; // skip /*!
868 char c='\0';
869 while (*p == ' ' || *p == '\t') p++;
870 while ((c=*p++))
871 {
872 result+=c;
873 if (c == '\n')
874 {
875 // special handling of space followed by * at beginning of line
876 while (*p == ' ' || *p == '\t') p++;
877 while (*p == '*') p++;
878 // special attention in case character at end is /
879 if (*p == '/') p++;
880 }
881 }
882 // special attention in case */ at end of last line
883 size_t len = result.length();
884 if (len>=2 && result[len-1]=='/' && result[len-2]=='*')
885 {
886 len -= 2;
887 while (len>0 && result[len-1] == '*') len--;
888 while (len>0 && ((c = result[len-1]) == ' ' || c == '\t')) len--;
889 result.resize(len);
890 }
891 return result;
892}
JAVACC_CHAR_TYPE JJChar
Definition JavaCC.h:21
This class contains the information about the argument of a function or template.
Definition arguments.h:27
DString attrib
Definition arguments.h:42
DString defval
Definition arguments.h:47
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition clangparser.h:25
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
DString & setNum(short n)
Definition dstring.h:556
void resize(size_t newlen)
Definition dstring.h:213
DString()=default
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:248
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:322
DString lower() const
Definition dstring.h:330
DString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple internal white...
Definition dstring.cpp:123
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:182
DString right(size_t len) const
Definition dstring.h:315
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:158
DString & prepend(const char *s)
Definition dstring.h:519
int contains(char c, bool cs=true) const
Definition dstring.cpp:81
size_t find(char c, size_t pos=0) const
Definition dstring.h:243
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
Definition dstring.h:221
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:341
DString left(size_t len) const
Definition dstring.h:310
const std::string & str() const
Definition dstring.h:649
bool stripPrefix(const DString &prefix)
Definition dstring.h:294
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:161
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:155
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:115
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:182
const std::vector< std::shared_ptr< Entry > > & children() const
Definition entry.h:138
int endBodyLine
line number where the definition ends
Definition entry.h:218
DString fileName
file this entry was extracted from
Definition entry.h:223
SrcLangExt lang
programming language in which this entry was found
Definition entry.h:228
DString doc
documentation block (partly parsed)
Definition entry.h:200
DString brief
brief description (doc block)
Definition entry.h:203
int startLine
start line of entry in the source
Definition entry.h:224
DString type
member type
Definition entry.h:172
EntryType section
entry type (see Sections);
Definition entry.h:171
int bodyLine
line number of the body in the source
Definition entry.h:216
void copyToSubEntry(Entry *e)
Definition entry.cpp:158
DString name
member name
Definition entry.h:173
DString inbodyDocs
documentation inside the body of a function
Definition entry.h:206
Wrapper class for the Entry type.
Definition types.h:856
static void addFlowChart(int type, const DString &text, const DString &exp, const DString &label=DString())
static void writeFlowChart()
static void alignFuncProc(DString &q, const ArgumentList &al, bool isFunc)
Helper class to process markdown formatted text.
Definition markdown.h:32
DString process(const DString &input, int &startNewlines, bool fromParseInput=false)
size_t checkInlineCode(DString &doc)
DString popLabel(DString &q)
void parseInput(const DString &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.
void oneLineComment(DString qcs)
void error_skipto(int kind)
void addProto(const DString &s1, const DString &s2, const DString &s3, const DString &s4, const DString &s5, const DString &s6)
void createFunction(const DString &impure, VhdlSpecifier spec, const DString &fname)
void parsePrototype(const DString &text) override
Callback function called by the comment block scanner.
void setLineParsed(int tok)
void addVhdlType(const DString &n, int startLine, EntryType section, VhdlSpecifier spec, const DString &args, const DString &type, Protection prot)
std::unique_ptr< Private > p
~VHDLOutlineParser() override
void insertEntryAtLine(std::shared_ptr< Entry > ce, int line)
bool addLibUseClause(const DString &type)
DString getNameID()
returns a unique id for each record member.
void initEntry(Entry *e)
void lineCount(const DString &)
void addCompInst(const DString &n, const DString &instName, const DString &comp, int iLine)
void pushLabel(DString &, DString &)
bool checkMultiComment(DString &qcs, int line)
void handleCommentBlock(const DString &doc, bool brief)
void mapLibPackage(Entry *root)
void handleFlowComment(const DString &)
static const MemberDef * getFlowMember()
static void prepareComment(DString &)
static void deleteAllChars(DString &s, char c)
static bool isVhdlClass(const Entry *cu)
Definition vhdldocgen.h:209
static void parseUCF(const DString &input, Entry *entity, const DString &f, bool vendor)
static DString getRecordNumber()
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:154
This class describes a character stream that maintains line and column number positions of the charac...
Definition CharStream.h:31
CharStream(const JJChar *buf, int sz, int startline, int startcolumn, int buffersize)
Definition CharStream.h:166
Describes the input token stream.
Definition Token.h:17
int kind
An integer that describes the kind of this token.
Definition Token.h:25
void setLexParser(VhdlParser *p)
Definition vhdlstring.h:20
void setSharedState(SharedState *s)
void setOutlineParser(VHDLOutlineParser *p)
VhdlParser(TokenManager *tokenManager)
void setErrorHandler(ErrorHandler *eh)
void ReInit(JAVACC_CHARSTREAM *stream, int lexState=0)
VhdlParserTokenManager(JAVACC_CHARSTREAM *stream, int lexState=0)
void setErrorHandler(TokenManagerErrorHandler *eh)
Interface for the comment block scanner.
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
#define Config_getBool(name)
Definition config.h:33
std::vector< int > IntVector
Definition containers.h:38
std::vector< std::string > StringVector
Definition containers.h:33
std::vector< std::shared_ptr< Entry > > EntryList
Definition entry.h:270
#define msg(fmt,...)
Definition message.h:94
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:847
std::string replace(std::string_view str, const Ex &re, std::string_view replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
Definition regex.cpp:869
Definition dstring.h:917
Web server based search engine.
Some helper functions for std::string.
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
Definition stringutil.h:117
VHDLOutlineParser * thisParser
void parseVhdlfile(const DString &fileName, const DString &inputBuffer, bool inLine)
VhdlParser::SharedState shared
std::shared_ptr< Entry > lastEntity
std::shared_ptr< Entry > lastCompound
std::shared_ptr< Entry > current_root
std::shared_ptr< Entry > tempEntry
std::shared_ptr< Entry > current
This file contains a number of basic enums and types.
Protection
Definition types.h:32
VhdlSpecifier
Definition types.h:770
@ INSTANTIATION
Definition types.h:791
@ MISCELLANEOUS
Definition types.h:797
DString stripLeadingAndTrailingEmptyLines(const DString &s, int &docLine)
Special version of DString::stripWhiteSpace() that only strips completely blank lines.
Definition util.cpp:3989
A bunch of utility functions.
const EntryList & getVhdlInstList()
static int idCounter
static EntryList g_instFiles
static bool isConstraintFile(const DString &fileName, const DString &ext)
DString filter2008VhdlComment(const DString &s)