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// own header
14#include "vhdljjparser.h"
15
16// standard includes
17#include <string>
18#include <memory>
19#include <exception>
20
21// other includes
24#include "arguments.h"
25#include "commentscan.h"
26#include "config.h"
27#include "containers.h"
28#include "definition.h"
29#include "doxygen.h"
30#include "dstring.h"
31#include "language.h"
32#include "markdown.h"
33#include "message.h"
34#include "outputlist.h"
35#include "regex.h"
36#include "stringutil.h"
37#include "types.h"
38#include "util.h"
39#include "vhdldocgen.h"
40
41using namespace vhdl::parser;
42
44{
46 bool brief;
47 bool pending = false;
48 int iDocLine = 1;
49};
50
51
52static bool isConstraintFile(const DString &fileName,const DString &ext)
53{
54 return fileName.right(ext.length())==ext;
55}
56
57
58//-------------------------------------
59
61
63{
64 void parseVhdlfile(const DString &fileName,const DString &inputBuffer,bool inLine);
65
69
71 int yyLineNr = 1;
73 int iDocLine = -1;
75 Entry* gBlock = nullptr;
76 Entry* previous = nullptr;
77//-------------------------------------------------------
78
79 Entry* oldEntry = nullptr;
80 bool varr = false;
89 size_t code = 0;
90
91};
92
94 const DString &inputBuffer,bool inLine)
95{
96 CharStream *stream = new CharStream(reinterpret_cast<const JJChar*>(inputBuffer.data()), (int)inputBuffer.size(), 1, 1);
97 VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
99 vhdlParser=new VhdlParser(tokenManager);
102 tokenManager->setLexParser(vhdlParser);
103 tokenManager->ReInit(stream,0);
104 tokenManager->setErrorHandler(tokErrHandler);
105 VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName.data());
106 vhdlParser->setErrorHandler(parserErrHandler);
107 try
108 {
109 if(inLine)
110 {
112 }
113 else
114 {
115 // vhdlParser->interface_variable_declaration(); //interface_declaration() ;
117 }
118 }
119 catch( std::exception &){ /* fprintf(stderr,"\n[%s]",e.what()); */ }
120 // fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
121 // fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
122 //
123 delete vhdlParser;
124 delete tokenManager;
125 delete stream;
126}
127
129{
130}
131
135
136void VHDLOutlineParser::parseInput(const DString &fileName,const char *fileBuf,
137 const std::shared_ptr<Entry> &root, ClangTUParser *)
138{
139 VhdlParser::SharedState *s = &p->shared;
140 p->thisParser=this;
141 p->inputString=fileBuf;
142
143 // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);
144
145 bool inLine = fileName.empty();
146
147 if (!inLine) msg("Parsing file {}...\n",fileName);
148
149 p->yyFileName=fileName;
150
151 bool xilinx_ucf=isConstraintFile(p->yyFileName,".ucf");
152 bool altera_qsf=isConstraintFile(p->yyFileName,".qsf");
153
154 // support XILINX(ucf) and ALTERA (qsf) file
155
156 if (xilinx_ucf)
157 {
158 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,false);
159 return;
160 }
161 if (altera_qsf)
162 {
163 VhdlDocGen::parseUCF(fileBuf,root.get(),p->yyFileName,true);
164 return;
165 }
166 p->yyLineNr=1;
167 s->current_root=root;
168 s->lastCompound=nullptr;
169 s->lastEntity=nullptr;
170 p->oldEntry = nullptr;
171 s->current=std::make_shared<Entry>();
172 initEntry(s->current.get());
173 p->commentScanner.enterFile(fileName,p->yyLineNr);
174 p->lineParse.reserve(200);
175 p->parseVhdlfile(fileName,fileBuf,inLine);
176 p->commentScanner.leaveFile(fileName,p->yyLineNr);
177
178 s->current.reset();
179
180 if (!inLine)
181 mapLibPackage(root.get());
182
183 p->yyFileName.clear();
184 p->libUse.clear();
185}
186
188{
189 p->yyLineNr++;
190}
191
193{
194 if (!text.empty())
195 {
196 for (const char* c=text.data() ; *c ; ++c )
197 {
198 if (*c == '\n') p->yyLineNr++;
199 }
200 }
201}
202
204{
205 e->fileName = p->yyFileName;
206 e->lang = SrcLangExt::VHDL;
207 if (p->str_doc.pending)
208 {
209 p->str_doc.pending=false;
210 p->oldEntry=nullptr; // prevents endless recursion
211 p->iDocLine=p->str_doc.iDocLine;
212 handleCommentBlock(p->str_doc.doc,p->str_doc.brief);
213 p->iDocLine=-1;
214 }
215 p->commentScanner.initGroupInfo(e);
216}
217
219{
220 VhdlParser::SharedState *s = &p->shared;
221 p->previous = s->current.get();
222 if (s->current->vhdlSpec==VhdlSpecifier::ENTITY ||
223 s->current->vhdlSpec==VhdlSpecifier::PACKAGE ||
224 s->current->vhdlSpec==VhdlSpecifier::ARCHITECTURE ||
226 {
227 s->current_root->moveToSubEntryAndRefresh(s->current);
228 }
229 else
230 {
231 if (s->lastCompound)
232 {
233 s->lastCompound->moveToSubEntryAndRefresh(s->current);
234 }
235 else
236 {
237 if (s->lastEntity)
238 {
239 s->lastEntity->moveToSubEntryAndRefresh(s->current);
240 }
241 else
242 {
243 s->current_root->moveToSubEntryAndRefresh(s->current);
244 }
245 }
246 }
247 initEntry(s->current.get());
248}
249
250static int idCounter;
251
252/** returns a unique id for each record member.
253*
254* type first_rec is record
255* RE: data_type;
256* end;
257*
258* type second_rec is record
259* RE: data_type;
260* end;
261*/
262
267
269{
270 lineCount(doc);
271
273 {
274 DString qcs(doc);
275 qcs=qcs.stripWhiteSpace();
276 qcs.stripPrefix("--#");
278 }
279}
280
282{
283 static const reg::Ex csRe(R"([\\@]code)");
284 static const reg::Ex cendRe(R"(\s*[\\@]endcode)");
285 static const reg::Ex cbriefRe(R"([\\@]brief)");
286
287 // helper to simulate behavior of QString.find(const QRegExp &re,int pos)
288 auto findRe = [](const DString &str,const reg::Ex &re,size_t pos=0) -> size_t
289 {
290 if (str.length()<pos) return DString::npos;
291 reg::Match match;
292 if (reg::search(str.str(),match,re,pos)) // match found
293 {
294 return match.position();
295 }
296 else // not found
297 {
298 return DString::npos;
299 }
300 };
301 auto replaceRe = [](const DString &str,const reg::Ex &re,const DString &replacement) -> DString
302 {
303 return reg::replace(str.str(), re, replacement.str());
304 };
305
306 size_t index = findRe(doc,csRe);
307
308 if (findRe(doc,cendRe)!=DString::npos)
309 return 1;
310
311 if (index==DString::npos)
312 return index;
313
314 VhdlParser::SharedState *s = &p->shared;
315 p->strComment += doc;
316 p->code = findRe(p->inputString,csRe, p->code + 1);
317 size_t com = p->inputString.find(p->strComment);
318 size_t ref = findRe(p->inputString,cendRe, p->code + 1);
319 size_t len = p->strComment.size();
320
321 size_t ll = com + len;
322 int diff = static_cast<int>(ref) - static_cast<int>(ll) - 3;
323 DString code = p->inputString.mid(ll, diff);
324 int iLine = 0;
325 code = stripLeadingAndTrailingEmptyLines(code, iLine);
326 int val = code.contains('\n');
327 VhdlDocGen::prepareComment(p->strComment);
328 StringVector ql = split(p->strComment.str(),"\n");
329
330 DString co;
331 DString na;
332 for (const auto &qcs_ : ql)
333 {
334 DString qcs(qcs_);
335 qcs = qcs.simplifyWhiteSpace();
336 if (findRe(qcs,csRe)!=DString::npos)
337 {
338 size_t i = qcs.find('{');
339 size_t j = qcs.find('}');
340 if (i!=DString::npos && j!=DString::npos && i>0 && j > i)
341 {
342 na = qcs.mid(i+1, j-i-1);
343 }
344 continue;
345 }
346 qcs = replaceRe(qcs,cbriefRe, "");
347 co += qcs;
348 co += '\n';
349 }
350
352
353 Entry gBlock;
354 if (!na.empty())
355 gBlock.name = na;
356 else
357 gBlock.name = "misc" + VhdlDocGen::getRecordNumber();
358 gBlock.startLine = p->yyLineNr+iLine-1;
359 gBlock.bodyLine = p->yyLineNr+iLine-1 ;
360 gBlock.doc = code;
361 gBlock.inbodyDocs = code;
362 gBlock.brief = co;
363 gBlock.section = EntryType::makeVariable();
365 gBlock.fileName = p->yyFileName;
366 gBlock.endBodyLine = p->yyLineNr + val +iLine;
367 gBlock.lang = SrcLangExt::VHDL;
368 std::shared_ptr<Entry> compound;
369
370 if (s->lastEntity)
371 compound = s->lastEntity;
372 else if (s->lastCompound)
373 compound = s->lastCompound;
374 else
375 compound = nullptr;
376
377 if (compound)
378 {
379 compound->copyToSubEntry(&gBlock);
380 }
381 else
382 {
383 gBlock.type = "misc"; // global code like library ieee...
384 s->current_root->copyToSubEntry(&gBlock);
385 }
386 p->strComment.clear();
387 return 1;
388}
389
391{
392 int position = 0;
393 bool needsEntry = false;
394 VhdlParser::SharedState *s = &p->shared;
395 DString doc = doc1;
396
397 if (doc.empty())
398 return;
399
400 if (checkMultiComment(doc, p->yyLineNr))
401 {
402 p->strComment.clear();
403 return;
404 }
405
406 if (checkInlineCode(doc) != DString::npos)
407 {
408 return;
409 }
410
411 Protection protection = Protection::Public;
413 if (doc.empty()) return;
414
415 if (p->oldEntry == s->current.get())
416 {
417 p->str_doc.doc = doc;
418 p->str_doc.iDocLine = p->iDocLine;
419 p->str_doc.brief = brief;
420 p->str_doc.pending = true;
421 return;
422 }
423
424 p->oldEntry = s->current.get();
425
426 if (brief)
427 {
428 s->current->briefLine = p->yyLineNr;
429 }
430 else
431 {
432 s->current->docLine = p->yyLineNr;
433 }
434
435
436
437 Markdown markdown(p->yyFileName,p->iDocLine);
438 int lineNr = p->iDocLine;
439 GuardedSectionStack guards;
440 DString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
441
442 while (p->commentScanner.parseCommentBlock(
443 p->thisParser,
444 s->current.get(),
445 processedDoc, // text
446 p->yyFileName, // file
447 lineNr, // line of block start
448 brief,
449 0,
450 false,
451 protection,
452 position,
453 needsEntry,
454 Config_getBool(MARKDOWN_SUPPORT),
455 &guards
456 ))
457 {
458 if (needsEntry)
459 newEntry();
460 }
461 if (needsEntry)
462 {
463 if (p->varr)
464 {
465 p->varr = false;
466 s->current->name = p->varName;
467 s->current->section = EntryType::makeVariableDoc();
468 p->varName = "";
469 }
470 newEntry();
471 }
472 p->iDocLine = -1;
473 p->strComment.clear();
474}
475
477{
478 p->varName=text;
479 p->varr=true;
480}
481
482void VHDLOutlineParser::addCompInst(const DString &n, const DString &instName, const DString &comp,int iLine)
483{
484 VhdlParser::SharedState *s = &p->shared;
486 s->current->section=EntryType::makeVariable();
487 s->current->startLine=iLine;
488 s->current->bodyLine=iLine;
489 s->current->type=instName; // foo:instname e.g proto or work. proto(ttt)
490 s->current->exception=s->genLabels.lower(); // |arch|label1:label2...
491 s->current->name=n; // foo
492 if (s->lastCompound)
493 {
494 s->current->args=s->lastCompound->name; // architecture name
495 }
496 s->current->includeName=comp; // component/entity/configuration
497 size_t u=s->genLabels.find('|',1);
498 if (u!=DString::npos && u>0)
499 {
500 s->current->write=s->genLabels.mid(u);
501 s->current->read=s->genLabels.left(u);
502 }
503 //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine);
504
505 if (s->lastCompound)
506 {
507 s->current->args=s->lastCompound->name;
508 if (true) // !findInstant(current->type))
509 {
510 initEntry(s->current.get());
511 // TODO: protect with mutex
512 g_instFiles.emplace_back(std::make_shared<Entry>(*s->current));
513 // TODO: end protect with mutex
514 }
515
516 s->current=std::make_shared<Entry>();
517 }
518 else
519 {
520 newEntry();
521 }
522}
523
524void VHDLOutlineParser::addVhdlType(const DString &n,int startLine,EntryType section,
525 VhdlSpecifier spec,const DString &args,const DString &type,Protection prot)
526{
527 VhdlParser::SharedState *s = &p->shared;
529
531 {
533 }
534
535 StringVector ql=split(n.str(),",");
536
537 for (size_t u=0;u<ql.size();u++)
538 {
539 s->current->name=ql[u];
540 s->current->startLine=startLine;
541 s->current->bodyLine=startLine;
542 s->current->section=section;
543 s->current->vhdlSpec=spec;
544 s->current->fileName=p->yyFileName;
545 if (s->current->args.empty())
546 {
547 s->current->args=args;
548 }
549 s->current->type=type;
550 s->current->protection=prot;
551
552 if (!s->lastCompound && section.isVariable() && (spec == VhdlSpecifier::USE || spec == VhdlSpecifier::LIBRARY) )
553 {
554 p->libUse.emplace_back(std::make_shared<Entry>(*s->current));
555 s->current->reset();
556 }
557 newEntry();
558 }
559}
560
562{
563 VhdlParser::SharedState *s = &p->shared;
564 s->current->vhdlSpec=spec;
565 s->current->section=EntryType::makeFunction();
566
567 if (impure=="impure" || impure=="pure")
568 {
569 s->current->exception=impure;
570 }
571
573 {
574 s->current->vhdlSpec=VhdlSpecifier::GENERIC;
575 s->current->section=EntryType::makeFunction();
576 }
577
579 {
580 s->current->name=impure;
581 s->current->exception="";
582 }
583 else
584 {
585 s->current->name=fname;
586 }
587
588 if (spec==VhdlSpecifier::PROCESS)
589 {
590 s->current->args=fname;
591 s->current->name=impure;
593 if (!fname.empty())
594 {
595 StringVector q1=split(fname.str(),",");
596 for (const auto &name : q1)
597 {
598 Argument arg;
599 arg.name=name;
600 s->current->argList.push_back(arg);
601 }
602 }
603 }
604}
605
606
608{
609 VhdlParser::SharedState *s = &p->shared;
613 )
614 {
615 return true;
616 }
617 return false;
618}
619
621{
622 label+="|";
623 label+=val;
624}
625
627{
628 size_t i=q.rfind('|');
629 if (i==DString::npos) return DString();
630 q = q.left(i);
631 return q;
632}
633
634
635
636void VHDLOutlineParser::addProto(const DString &s1,const DString &s2,const DString &s3,
637 const DString &s4,const DString &/*s5*/,const DString &s6)
638{
639 VhdlParser::SharedState *s = &p->shared;
640 StringVector ql=split(s2.str(),",");
641
642 for (const auto &n : ql)
643 {
644 Argument arg;
645 arg.name=n;
646 if (!s3.empty())
647 {
648 arg.type=s3;
649 }
650 arg.type+=" ";
651 arg.type+=s4;
652 if (!s6.empty())
653 {
654 arg.type+=s6;
655 }
657 {
658 arg.defval="generic";
659 }
660
662 {
663 // ASSERT(false);
664 }
665
666 arg.defval+=s1;
667 arg.attrib="";//s6;
668
669 s->current->argList.push_back(arg);
670 s->current->args+=s2;
671 s->current->args+=",";
672 }
673}
674
675
676/*
677 * adds the library|use statements to the next class (entity|package|architecture|package body
678 * library ieee
679 * entity xxx
680 * .....
681 * library
682 * package
683 * entity zzz
684 * .....
685 * and so on..
686 */
688{
689 for (const auto &rt : p->libUse)
690 {
691 if (addLibUseClause(rt->name))
692 {
693 bool bFound=false;
694 for (const auto &current : root->children())
695 {
696 if (VhdlDocGen::isVhdlClass(current.get()))
697 {
698 if (current->startLine > rt->startLine)
699 {
700 bFound=true;
701 current->copyToSubEntry(rt);
702 break;
703 }
704 }
705 }//for
706 if (!bFound)
707 {
708 root->copyToSubEntry(rt);
709 }
710 } //if
711 }// for
712}//MapLib
713
715{
716 bool showIEEESTD=Config_getBool(FORCE_LOCAL_INCLUDES);
717
718 if (showIEEESTD) // all standard packages and libraries will not be shown
719 {
720 if (type.lower().stripPrefix("ieee")) return false;
721 if (type.lower().stripPrefix("std")) return false;
722 }
723 return true;
724}
725
727{
728 return p->yyLineNr;
729}
730
732{
733 if ((int)p->lineParse.size()<=tok) p->lineParse.resize(tok+1);
734 p->lineParse[tok]=p->yyLineNr;
735}
736
738{
739 int val=p->lineParse[tok];
740 if (val<0) val=0;
741 //ASSERT(val>=0 && val<=yyLineNr);
742 return val;
743}
744
745
747{
748 VhdlParser::SharedState *s = &p->shared;
750 {
751 return;
752 }
753 DString q,ret;
754
756 {
757 q=":function( ";
758 FlowChart::alignFuncProc(q,s->tempEntry->argList,true);
759 q+=")";
760 }
761 else if (s->currP==VhdlSpecifier::PROCEDURE)
762 {
763 q=":procedure (";
764 FlowChart::alignFuncProc(q,s->tempEntry->argList,false);
765 q+=")";
766 }
767 else
768 {
769 q=":process( "+s->tempEntry->args;
770 q+=")";
771 }
772
774
776
778 {
779 ret="end function ";
780 }
781 else if (s->currP==VhdlSpecifier::PROCEDURE)
782 {
783 ret="end procedure";
784 }
785 else
786 {
787 ret="end process ";
788 }
789
791 // FlowChart::printFlowList();
794}
795
797{
798 p->iDocLine=p->yyLineNr;
799}
800
802{
803 if (size_t j=qcs.find("--!"); j!=DString::npos) qcs=qcs.mid(j+3);
804 if (!checkMultiComment(qcs,p->iDocLine))
805 {
806 handleCommentBlock(qcs,true);
807 }
808}
809
810
812{
813 VhdlParser::SharedState *s = &p->shared;
815
816 if (p->lineEntry.empty()) return false;
817
819 while (!p->lineEntry.empty())
820 {
821 std::shared_ptr<Entry> e=p->lineEntry.back();
822 e->briefLine=line;
823 e->brief+=qcs;
824
825 p->lineEntry.pop_back();
826 }
827 return true;
828}
829
830// returns the vhdl parsed types at line xxx
831void VHDLOutlineParser::insertEntryAtLine(std::shared_ptr<Entry> ce,int line)
832{
833 for (const auto &rt : ce->children())
834 {
835 if (rt->bodyLine==line)
836 {
837 p->lineEntry.push_back(rt);
838 }
839
840 insertEntryAtLine(rt,line);
841 }
842}
843
845{
846 return g_instFiles;
847}
848
850{
851 Token *op;
852 do
853 {
854 p->vhdlParser->getNextToken(); // step to next token
855 op=p->vhdlParser->getToken(1); // get first token
856 if (op==nullptr) break;
857 //fprintf(stderr,"\n %s",qPrint(t->image));
858 } while (op->kind != kind);
859 p->vhdlParser->clearError();
860 // The above loop consumes tokens all the way up to a token of
861 // "kind". We use a do-while loop rather than a while because the
862 // current token is the one immediately before the erroneous token
863 // (in our case the token immediately before what should have been
864 // "if"/"while".
865}
866
868{
869 if (s.length()<4) return s;
870 DString result;
871 result.reserve(s.length());
872 const char *p=s.data()+3; // skip /*!
873 char c='\0';
874 while (*p == ' ' || *p == '\t') p++;
875 while ((c=*p++))
876 {
877 result+=c;
878 if (c == '\n')
879 {
880 // special handling of space followed by * at beginning of line
881 while (*p == ' ' || *p == '\t') p++;
882 while (*p == '*') p++;
883 // special attention in case character at end is /
884 if (*p == '/') p++;
885 }
886 }
887 // special attention in case */ at end of last line
888 size_t len = result.length();
889 if (len>=2 && result[len-1]=='/' && result[len-2]=='*')
890 {
891 len -= 2;
892 while (len>0 && result[len-1] == '*') len--;
893 while (len>0 && ((c = result[len-1]) == ' ' || c == '\t')) len--;
894 result.resize(len);
895 }
896 return result;
897}
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:84
DString & setNum(short n)
Definition dstring.h:552
void resize(size_t newlen)
Definition dstring.h:209
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
DString lower() const
Definition dstring.h:326
DString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple internal white...
Definition dstring.cpp:127
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
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:178
DString right(size_t len) const
Definition dstring.h:311
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:154
DString & prepend(const char *s)
Definition dstring.h:515
int contains(char c, bool cs=true) const
Definition dstring.cpp:85
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
Definition dstring.h:217
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
DString left(size_t len) const
Definition dstring.h:306
const std::string & str() const
Definition dstring.h:645
bool stripPrefix(const DString &prefix)
Definition dstring.h:290
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:157
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
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:33
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 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
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)
void setErrorHandler(ErrorHandler *eh)
void ReInit(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:850
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:872
Definition dstring.h:913
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:3987
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)