Doxygen
Loading...
Searching...
No Matches
vhdlcode.l File Reference
#include <stdint.h>
#include <unordered_set>
#include <string>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include "vhdlcode.h"
#include "entry.h"
#include "doxygen.h"
#include "message.h"
#include "outputlist.h"
#include "util.h"
#include "membername.h"
#include "searchindex.h"
#include "vhdldocgen.h"
#include "arguments.h"
#include "config.h"
#include "classdef.h"
#include "filedef.h"
#include "tooltip.h"
#include "regex.h"
#include "debug.h"
#include "doxygen_lex.h"
#include "vhdlcode.l.h"
+ Include dependency graph for vhdlcode.l:

Go to the source code of this file.

Classes

struct  vhdlcodeYY_state
 
struct  VHDLCodeParser::Private
 

Macros

#define YY_TYPEDEF_YY_SCANNER_T
 
#define YY_NO_INPUT   1
 
#define YY_NO_UNISTD_H   1
 
#define DBG_CTX(x)
 
#define YY_INPUT(buf, result, max_size)
 

Typedefs

typedef yyguts_t * yyscan_t
 

Functions

static void writeFont (yyscan_t yyscanner, const char *s, const QCString &text, bool specialComment=false)
 
static void generateMemLink (yyscan_t yyscanner, OutputCodeList &ol, QCString &clName, QCString &memberName)
 
static bool writeColoredWord (yyscan_t yyscanner, QCString &word)
 
static void generateClassOrGlobalLink (yyscan_t yyscanner, OutputCodeList &ol, const QCString &clName, bool typeOnly=false, const QCString &curr_class=QCString())
 
static void setCurrentDoc (yyscan_t yyscanner, const QCString &anchor)
 
static bool checkVhdlString (yyscan_t yyscanner, QCString &name)
 
static void addToSearchIndex (yyscan_t yyscanner, const QCString &text)
 
static void startCodeLine (yyscan_t yyscanner)
 
static void endCodeLine (yyscan_t yyscanner)
 
static void nextCodeLine (yyscan_t yyscanner)
 
static void writeWord (yyscan_t yyscanner, const QCString &word, const QCString &curr_class=QCString(), bool classLink=false)
 
static void codifyLines (yyscan_t yyscanner, const QCString &text, const QCString &cl=QCString(), bool classlink=false, bool comment=false)
 
static void writeMultiLineCodeLink (yyscan_t yyscanner, OutputCodeList &ol, const Definition *d, const QCString &text)
 
static void generateFuncLink (yyscan_t yyscanner, OutputCodeList &ol, const MemberDef *mdef)
 
static int countLines (yyscan_t yyscanner)
 
static void startFontClass (yyscan_t yyscanner, const char *s, bool specialComment=false)
 
static void endFontClass (yyscan_t yyscanner, bool specialComment=false)
 
static void appStringLower (QCString &qcs, const char *text)
 
static void codifyMapLines (yyscan_t yyscanner, const QCString &text)
 
static void writeFuncProto (yyscan_t yyscanner)
 
static void writeProcessProto (yyscan_t yyscanner)
 
static int yyread (yyscan_t yyscanner, char *buf, int max_size)
 
static const char * stateToString (int state)
 
static const char * getLexerFILE ()
 
int yylex (yyscan_t yyscanner)
 
static void codeFolding (yyscan_t yyscanner, const Definition *d)
 

Macro Definition Documentation

◆ DBG_CTX

#define DBG_CTX ( x)
Value:
do { } while(0)

Definition at line 67 of file vhdlcode.l.

◆ YY_INPUT

#define YY_INPUT ( buf,
result,
max_size )
Value:
result=yyread(yyscanner,buf,max_size);
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
Definition vhdlcode.l:935

Definition at line 150 of file vhdlcode.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 62 of file vhdlcode.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 63 of file vhdlcode.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 28 of file vhdlcode.l.

Typedef Documentation

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 30 of file vhdlcode.l.

Function Documentation

◆ addToSearchIndex()

static void addToSearchIndex ( yyscan_t yyscanner,
const QCString & text )
static

Definition at line 1004 of file vhdlcode.l.

1005{
1006 if (Doxygen::searchIndex.enabled())
1007 {
1008 Doxygen::searchIndex.addWord(text,false);
1009 }
static SearchIndexIntf searchIndex
Definition doxygen.h:124
1010}

References Doxygen::searchIndex.

◆ appStringLower()

static void appStringLower ( QCString & qcs,
const char * text )
static

Definition at line 1500 of file vhdlcode.l.

1501{
1502 qcs.clear();
1503 qcs.append(text);
1504 qcs=qcs.stripWhiteSpace();
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
QCString & append(char c)
Definition qcstring.h:381
void clear()
Definition qcstring.h:169
1505}

References QCString::append(), QCString::clear(), and QCString::stripWhiteSpace().

◆ checkVhdlString()

static bool checkVhdlString ( yyscan_t yyscanner,
QCString & name )
static

Definition at line 966 of file vhdlcode.l.

967{
968 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
969 if (name.isEmpty()) return false;
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
970
971 size_t len=name.length();
972 if (len>2 && name.at(0)=='"' && name.at(len-1)=='"')
973 {
974 std::string inside = name.str().substr(1,len-2);
975 static const reg::Ex regg(R"(\s+)"); // any number of whitespace
976 auto qrl=split(inside,regg);
977 if (VhdlDocGen::isNumber(qrl[0]))
978 {
979 yyextra->code->codify("\"");
980 startFontClass(yyscanner,"vhdllogic");
981 yyextra->code->codify(inside.c_str());
982 endFontClass(yyscanner);
983 yyextra->code->codify("\"");
984 }
985 else
986 {
987 startFontClass(yyscanner,"keyword");
988 yyextra->code->codify(name);
989 endFontClass(yyscanner);
990 }
991 return true;
992 }
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:567
const std::string & str() const
Definition qcstring.h:526
static bool isNumber(const std::string &s)
Class representing a regular expression.
Definition regex.h:39
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
Definition util.cpp:6945
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
Definition vhdlcode.l:1469
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
Definition vhdlcode.l:1452
993
994 if (VhdlDocGen::isNumber(name.str()))
995 {
996 startFontClass(yyscanner,"vhdllogic");
997 yyextra->code->codify(name);
998 endFontClass(yyscanner);
999 return true;
1000 }
1001 return false;
1002}

References QCString::at(), endFontClass(), QCString::isEmpty(), VhdlDocGen::isNumber(), QCString::length(), split(), startFontClass(), and QCString::str().

Referenced by writeWord().

◆ codeFolding()

static void codeFolding ( yyscan_t yyscanner,
const Definition * d )
static

Definition at line 1012 of file vhdlcode.l.

1013{
1014 // TODO: the VHDL parse doesn't seem to record startLine and endBodyLine for many of the constructs, preventing folding from working.
1015 if (Config_getBool(HTML_CODE_FOLDING))
1016 {
1017 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1018 while (!yyextra->foldStack.empty())
1019 {
1020 const Definition *dd = yyextra->foldStack.back();
1021 if (dd->getEndBodyLine()+1==yyextra->yyLineNr) // +1 to close the section after the end of the body
1022 {
1023 yyextra->code->endFold();
1024 //printf("%d: end codeFolding for %s [%d..%d]\n",yyextra->yyLineNr,qPrint(dd->name()),dd->getStartDefLine(),dd->getEndBodyLine());
1025 yyextra->foldStack.pop_back();
1026 }
1027 else
1028 {
1029 break;
1030 }
1031 }
1032 if (d)
1033 {
1034 int startLine = d->getStartDefLine();
1035 int endLine = d->getEndBodyLine();
1036 if (endLine!=-1 && startLine!=endLine && (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
1037 {
1038 //printf("%d: start codeFolding for %s [%d..%d]\n",yyextra->yyLineNr,qPrint(d->name()),d->getStartDefLine(),d->getEndBodyLine());
1039 yyextra->code->startFold(yyextra->yyLineNr,"","");
1040 yyextra->foldStack.push_back(d);
1041 }
1042 }
1043 }
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual int getEndBodyLine() const =0
virtual int getStartDefLine() const =0
#define Config_getBool(name)
Definition config.h:33
1044}

References Config_getBool, Definition::getEndBodyLine(), and Definition::getStartDefLine().

◆ codifyLines()

static void codifyLines ( yyscan_t yyscanner,
const QCString & text,
const QCString & cl,
bool classlink,
bool comment )
static

write a code fragment 'text' that may span multiple lines, inserting line numbers for each line.

Definition at line 1238 of file vhdlcode.l.

1239{
1240 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1241 if (text.isEmpty()) return;
1242 //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text);
1243 const char *p=text.data(),*sp=p;
1244 char c;
1245 bool done=false;
1246 while (!done)
1247 {
1248 sp=p;
1249 while ((c=*p++) && c!='\n') {}
1250 if (c=='\n')
1251 {
1252 yyextra->yyLineNr++;
1253 QCString line = sp;
1254 line = line.left((int)(p-sp)-1);
1255 if (comment)
1256 {
1257 writeFont(yyscanner,"comment",line);
1258 }
1259 else
1260 {
1261 writeWord(yyscanner,line,cl,classlink);
1262 }
1263 nextCodeLine(yyscanner);
1264 }
1265 else
1266 {
1267 if (comment)
1268 {
1269 writeFont(yyscanner,"comment",sp);
1270 }
1271 else
1272 {
1273 writeWord(yyscanner,sp,cl,classlink);
1274 }
1275 done=true;
1276 }
1277 }
This is an alternative implementation of QCString.
Definition qcstring.h:101
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:159
QCString left(size_t len) const
Definition qcstring.h:214
static void nextCodeLine(yyscan_t yyscanner)
Definition vhdlcode.l:1126
static void writeWord(yyscan_t yyscanner, const QCString &word, const QCString &curr_class=QCString(), bool classLink=false)
Definition vhdlcode.l:1146
static void writeFont(yyscan_t yyscanner, const char *s, const QCString &text, bool specialComment=false)
Definition vhdlcode.l:1488
const char * comment
1278}

References comment, QCString::data(), QCString::isEmpty(), QCString::left(), nextCodeLine(), writeFont(), and writeWord().

◆ codifyMapLines()

static void codifyMapLines ( yyscan_t yyscanner,
const QCString & text )
static

Definition at line 1508 of file vhdlcode.l.

1509{
1510 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1511 if (text.isEmpty()) return;
1512 QCString temp;
1513 //bool dot=false;
1514 int wordCounter=0;
1515 QCString ctemp;
1516 //printf("codifyMapLines(%d,\"%s\")\n",yyextra->yyLineNr,qPrint(text));
1517 const char *p=text.data();
1518 char c;
1519 bool done=false;
1520 while (!done)
1521 {
1522 //sp=p;
1523 while ((c=*p++) && c!='\n' && c!=':' && c != ' ' && c != '(' && c!='\0' && c!='\t')
1524 {
1525 if (c!=0x9)
1526 temp+=c;
1527 }
1528 if (c=='\0') return;
1529 if (!temp.isEmpty()) wordCounter++;
1530
1531 if (!temp.isEmpty())
1532 {
1533 // different kinds of component instantiations
1534 // xxx:yyy (generic/port) map(
1535 // xxx:(entity/component/configuration) yyy (generic/port) map(
1536 // xxx: entity yyy(zzz) (generic/port) map(
1537 if (wordCounter==2 || wordCounter==3)
1538 {
1539 QCString q=temp.lower(); // consider (upper/lower) cases
1540 if (q=="entity" || q=="component" || q=="configuration" || q=="port" || q=="generic")
1541 {
1542 generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,temp);
1543 }
1544 else
1545 {
1546 yyextra->PortMapComp=temp;
1547 generateClassOrGlobalLink(yyscanner,*yyextra->code,temp);
1548 }
1549 }
1550 else
1551 {
1552 generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,temp);
1553 }
1554 }
1555 ctemp.fill(c,1);
1556 codifyLines(yyscanner,ctemp);
1557 ctemp.clear();
1558 temp.clear();
1559 }//while
void fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:180
QCString lower() const
Definition qcstring.h:234
static void generateMemLink(yyscan_t yyscanner, OutputCodeList &ol, QCString &clName, QCString &memberName)
Definition vhdlcode.l:1340
static void generateClassOrGlobalLink(yyscan_t yyscanner, OutputCodeList &ol, const QCString &clName, bool typeOnly=false, const QCString &curr_class=QCString())
Definition vhdlcode.l:1377
static void codifyLines(yyscan_t yyscanner, const QCString &text, const QCString &cl=QCString(), bool classlink=false, bool comment=false)
Definition vhdlcode.l:1238
1560}//codifyMapLines

References QCString::clear(), codifyLines(), QCString::data(), QCString::fill(), generateClassOrGlobalLink(), generateMemLink(), QCString::isEmpty(), and QCString::lower().

◆ countLines()

static int countLines ( yyscan_t yyscanner)
static

counts the number of lines in the input

Definition at line 1433 of file vhdlcode.l.

1434{
1435 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1436 const char *p=yyextra->inputString;
1437 char c;
1438 int count=1;
1439 while ((c=*p))
1440 {
1441 p++ ;
1442 if (c=='\n') count++;
1443 }
1444 if (p>yyextra->inputString && *(p-1)!='\n')
1445 { // last line does not end with a \n, so we add an extra
1446 // line and explicitly terminate the line after parsing.
1447 count++;
1448 }
1449 return count;
1450}

◆ endCodeLine()

static void endCodeLine ( yyscan_t yyscanner)
static

Definition at line 1118 of file vhdlcode.l.

1119{
1120 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1121 endFontClass(yyscanner);
1122 yyextra->code->endCodeLine();
1123 yyextra->insideCodeLine=false;
1124}

References endFontClass().

◆ endFontClass()

static void endFontClass ( yyscan_t yyscanner,
bool specialComment = false )
static

Definition at line 1452 of file vhdlcode.l.

1453{
1454 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1455 //printf("endFontClass: specialComment=%d insideSpecialComment=%d\n",
1456 // specialComment,yyextra->insideSpecialComment);
1457 if (yyextra->currentFontClass)
1458 {
1459 yyextra->code->endFontClass();
1460 yyextra->currentFontClass=0;
1461 }
1462 if (specialComment && yyextra->insideSpecialComment)
1463 {
1464 yyextra->code->endSpecialComment();
1465 yyextra->insideSpecialComment=false;
1466 }
1467}

◆ generateClassOrGlobalLink()

static void generateClassOrGlobalLink ( yyscan_t yyscanner,
OutputCodeList & ol,
const QCString & clName,
bool typeOnly = false,
const QCString & curr_class = QCString() )
static

Definition at line 1377 of file vhdlcode.l.

1379{
1380 QCString className=clName;
1381
1382 if (className.isEmpty()) return;
1383
1384 ClassDef *cd=nullptr;
1385 //MemberDef *md=nullptr;
1386 //bool isLocal=false;
1387 className.stripPrefix("_");
1388 cd = getClass(className);
1389 if (!cd && !curr_class.isEmpty())
1390 {
1391 QCString cls = curr_class;
1392 QCString suffix = "::";
1393 suffix+=clName;
1394 if (cls.right(suffix.length())==suffix)
1395 {
1396 cd = getClass(curr_class);
1397 }
1398 }
A abstract class representing of a compound symbol.
Definition classdef.h:104
QCString right(size_t len) const
Definition qcstring.h:219
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:198
ClassDef * getClass(const QCString &n)
1399
1400 while (cd)
1401 {
1402 //className.stripPrefix("_");
1403 QCString temp(clName);
1404 temp.stripPrefix("_");
1405 if (cd && cd->isLinkable()) // is it a linkable class
1406 {
1407 //if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS)
1408 //{
1409 // temp=VhdlDocGen::getClassName(cd);
1410 //}
1411 writeMultiLineCodeLink(yyscanner,ol,cd,temp);
1412 addToSearchIndex(yyscanner,className);
1413 return;
1414 }
1415 Definition *d = cd->getOuterScope();
1417 {
1418 cd = toClassDef(d);
1419 }
1420 else
1421 {
1422 cd = nullptr;
1423 }
1424 }
virtual bool isLinkable() const =0
virtual DefType definitionType() const =0
virtual Definition * getOuterScope() const =0
ClassDef * toClassDef(Definition *d)
static void writeMultiLineCodeLink(yyscan_t yyscanner, OutputCodeList &ol, const Definition *d, const QCString &text)
Definition vhdlcode.l:1284
static void addToSearchIndex(yyscan_t yyscanner, const QCString &text)
Definition vhdlcode.l:1004
1425
1426 // nothing found, just write out the word
1427 codifyLines(yyscanner,clName);
1428 addToSearchIndex(yyscanner,clName);
1429}// generateClasss or global link

References addToSearchIndex(), codifyLines(), Definition::definitionType(), getClass(), Definition::getOuterScope(), QCString::isEmpty(), Definition::isLinkable(), QCString::length(), QCString::right(), QCString::stripPrefix(), toClassDef(), Definition::TypeClass, and writeMultiLineCodeLink().

◆ generateFuncLink()

static void generateFuncLink ( yyscan_t yyscanner,
OutputCodeList & ol,
const MemberDef * mdef )
static

writes a link to a function or procedure

Definition at line 1324 of file vhdlcode.l.

1325{
1326 //printf("generateFuncLink(FuncName=%s)\n",qPrint(mdef->name()));
1327 QCString memberName=mdef->name();
virtual const QCString & name() const =0
1328
1329 if (mdef->isLinkable()) // is it a linkable class
1330 {
1331 writeMultiLineCodeLink(yyscanner,ol,mdef,mdef->name());
1332 addToSearchIndex(yyscanner,memberName);
1333 return;
1334 }
1335 codifyLines(yyscanner,memberName);
1336 addToSearchIndex(yyscanner,memberName);
1337} // generateFuncLink

References addToSearchIndex(), codifyLines(), Definition::isLinkable(), Definition::name(), and writeMultiLineCodeLink().

Referenced by writeFuncProto().

◆ generateMemLink()

static void generateMemLink ( yyscan_t yyscanner,
OutputCodeList & ol,
QCString & clName,
QCString & memberName )
static

Definition at line 1340 of file vhdlcode.l.

1341{
1342 if (memberName.isEmpty()) return;
1343 if (clName.isEmpty())
1344 {
1345 codifyLines(yyscanner,memberName);
1346
1347 return;
1348 }
1349
1350 QCString className=clName;
1351
1352 //MemberDef *comp=nullptr;
1353 //bool isLocal=false;
1354
1355 const MemberDef *md=VhdlDocGen::findMember(className,memberName);
1356 ClassDef *po=VhdlDocGen::getClass(className);
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
static ClassDef * getClass(const QCString &name)
static const MemberDef * findMember(const QCString &className, const QCString &memName)
1357
1358 if (md==nullptr && po && (VhdlDocGen::VhdlClasses)po->protection()==VhdlDocGen::PACKBODYCLASS)
1359 {
1360 QCString temp=className;//.stripPrefix("_");
1361 temp.stripPrefix("_");
1362 md=VhdlDocGen::findMember(temp,memberName);
1363 }
virtual Protection protection() const =0
Return the protection level (Public,Protected,Private) in which this compound was found.
1364
1365 if (md && md->isLinkable()) // is it a linkable class
1366 {
1367 writeMultiLineCodeLink(yyscanner,ol,md,memberName);
1368 addToSearchIndex(yyscanner,memberName);
1369 return;
1370 }
1371 // nothing found, just write out the word
1372 codifyLines(yyscanner,memberName);
1373 addToSearchIndex(yyscanner,memberName);
1374}// generateMemLink

References addToSearchIndex(), codifyLines(), VhdlDocGen::findMember(), VhdlDocGen::getClass(), QCString::isEmpty(), Definition::isLinkable(), VhdlDocGen::PACKBODYCLASS, ClassDef::protection(), QCString::stripPrefix(), and writeMultiLineCodeLink().

Referenced by codifyMapLines(), and writeWord().

◆ getLexerFILE()

static const char * getLexerFILE ( )
inlinestatic

Definition at line 153 of file vhdlcode.l.

153{return __FILE__;}

◆ nextCodeLine()

static void nextCodeLine ( yyscan_t yyscanner)
static

Definition at line 1126 of file vhdlcode.l.

1127{
1128 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1129 if (yyextra->insideCodeLine)
1130 {
1131 endCodeLine(yyscanner); // </div>
1132 }
1133 const char *fc = yyextra->currentFontClass;
1134 if (yyextra->yyLineNr<yyextra->inputLines)
1135 {
1136 yyextra->currentFontClass = fc;
1137 startCodeLine(yyscanner); //<div>
1138 }
static void endCodeLine(yyscan_t yyscanner)
Definition vhdlcode.l:1118
static void startCodeLine(yyscan_t yyscanner)
Definition vhdlcode.l:1050
1139}

References endCodeLine(), and startCodeLine().

◆ setCurrentDoc()

static void setCurrentDoc ( yyscan_t yyscanner,
const QCString & anchor )
static

Definition at line 950 of file vhdlcode.l.

951{
952 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
953 if (Doxygen::searchIndex.enabled())
954 {
955 if (yyextra->searchCtx)
956 {
957 Doxygen::searchIndex.setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),false);
958 }
959 else
960 {
961 Doxygen::searchIndex.setCurrentDoc(yyextra->sourceFileDef,anchor,true);
962 }
963 }
964}

References Doxygen::searchIndex.

◆ startCodeLine()

static void startCodeLine ( yyscan_t yyscanner)
static

start a new line of code, inserting a line number if yyextra->sourceFileDef is true. If a definition starts at the current line, then the line number is linked to the documentation of that definition.

Definition at line 1050 of file vhdlcode.l.

1051{
1052 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1053 //if (yyextra->currentFontClass) { yyextra->code->endFontClass(); }
1054 if (yyextra->sourceFileDef)
1055 {
1056 //QCString lineNumber,lineAnchor;
1057 //lineNumber.sprintf("%05d",yyextra->yyLineNr);
1058 //lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
1059 // if ((yyextra->yyLineNr % 500) == 0)
1060 // fprintf(stderr,"\n starting Line %d:",yyextra->yyLineNr);
1061 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
1062 //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,qPrint(d ? d->name()) : "<null>");
1063 if (!yyextra->includeCodeFragment && d)
1064 {
1065 yyextra->currentDefinition = d;
1066 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
1067 if (!yyextra->tempComp.isEmpty() && yyextra->currentMemberDef )
1068 {
1069 //ClassDef *cf=VhdlDocGen::getClass(yyextra->tempComp);
1070 QCString nn=yyextra->currentMemberDef->name();
1071 const MemberDef* mdeff=VhdlDocGen::findMember(yyextra->tempComp,nn);
1072 if (mdeff)
1073 {
1074 yyextra->currentMemberDef=mdeff;
1075 }
1076 }
1077
1078 QCString lineAnchor;
1079 lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
1080 if (yyextra->currentMemberDef)
1081 {
1082 codeFolding(yyscanner,yyextra->currentMemberDef);
1083 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
1084 yyextra->currentMemberDef->getOutputFileBase(),
1085 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
1086 !yyextra->includeCodeFragment);
1087 setCurrentDoc(yyscanner,lineAnchor);
1088 }
1089 else if (d->isLinkableInProject())
1090 {
1091 codeFolding(yyscanner,yyextra->currentMemberDef);
1092 yyextra->code->writeLineNumber(d->getReference(),
1093 d->getOutputFileBase(),
1094 QCString(),yyextra->yyLineNr,
1095 !yyextra->includeCodeFragment);
1096 setCurrentDoc(yyscanner,lineAnchor);
1097 }
1098 else
1099 {
1100 codeFolding(yyscanner,nullptr);
1101 }
1102 }
1103 else
1104 {
1105 codeFolding(yyscanner,nullptr);
1106 yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr,
1107 !yyextra->includeCodeFragment);
1108 }
1109 }
1110 yyextra->code->startCodeLine(yyextra->yyLineNr);
1111 yyextra->insideCodeLine=true;
1112 if (yyextra->currentFontClass)
1113 {
1114 yyextra->code->startFontClass(yyextra->currentFontClass);
1115 }
virtual bool isLinkableInProject() const =0
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
QCString & sprintf(const char *format,...)
Definition qcstring.cpp:29
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
Definition vhdlcode.l:950
static void codeFolding(yyscan_t yyscanner, const Definition *d)
Definition vhdlcode.l:1012
1116}

References codeFolding(), VhdlDocGen::findMember(), Definition::getOutputFileBase(), Definition::getReference(), Definition::isLinkableInProject(), setCurrentDoc(), and QCString::sprintf().

◆ startFontClass()

static void startFontClass ( yyscan_t yyscanner,
const char * s,
bool specialComment = false )
static

Definition at line 1469 of file vhdlcode.l.

1470{
1471 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1472 if (s==nullptr) return;
1473 //printf("startFontClass(%s): specialComment=%d insideSpecialComment=%d\n",s,
1474 // specialComment,yyextra->insideSpecialComment);
1475 if (specialComment)
1476 {
1477 yyextra->code->startSpecialComment();
1478 yyextra->insideSpecialComment = true;
1479 }
1480 if (qstrcmp(yyextra->currentFontClass,s)!=0)
1481 {
1482 endFontClass(yyscanner);
1483 yyextra->code->startFontClass(s);
1484 yyextra->currentFontClass=s;
1485 }
int qstrcmp(const char *str1, const char *str2)
Definition qcstring.h:69
1486}

References endFontClass(), and qstrcmp().

◆ stateToString()

static const char * stateToString ( int state)
static

◆ writeColoredWord()

static bool writeColoredWord ( yyscan_t yyscanner,
QCString & word )
static

Definition at line 1612 of file vhdlcode.l.

1613{
1614 QCString qcs=word.lower();
1615 const char *ss=VhdlDocGen::findKeyWord(qcs);
1616 if (ss)
1617 {
1618 writeFont(yyscanner,ss,word);
1619 return true;
1620 }
1621 return false;
static const char * findKeyWord(const QCString &word)
std::string_view word
Definition util.cpp:980
1622}

References VhdlDocGen::findKeyWord(), word, and writeFont().

Referenced by writeWord().

◆ writeFont()

static void writeFont ( yyscan_t yyscanner,
const char * s,
const QCString & text,
bool specialComment = false )
static

Definition at line 1488 of file vhdlcode.l.

1489{
1490 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1491 if (s==nullptr || text.isEmpty()) return;
1492 //printf("writeFont(yyscanner,%d,\"%s\")\n",yyextra->yyLineNr,text);
1493 startFontClass(yyscanner,s,specialComment);
1494 yyextra->code->codify(text);
1495 endFontClass(yyscanner,specialComment);
1496}

References endFontClass(), QCString::isEmpty(), and startFontClass().

Referenced by codifyLines(), and writeColoredWord().

◆ writeFuncProto()

static void writeFuncProto ( yyscan_t yyscanner)
static

Definition at line 1566 of file vhdlcode.l.

1567{
1568 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1569 QCString name,ret;
1570 VhdlDocGen::parseFuncProto(yyextra->funcProto,name,ret,false);
static void parseFuncProto(const QCString &text, QCString &name, QCString &ret, bool doc=false)
1571
1572 if (name.isEmpty())
1573 {
1574 codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass);
1575 return;
1576 }
1577 StringVector qlist=split(yyextra->funcProto.str(),name.str());
1578 QCString temp(qlist[0]);
1579 codifyLines(yyscanner,temp,yyextra->currClass);
1580 yyextra->funcProto.stripPrefix(temp);
1581 temp.clear();
1582 temp=yyextra->currClass;
1583 if (yyextra->isPackageBody)
1584 {
1585 temp.stripPrefix("_");// _{package body name}
1586 }
1587 const MemberDef *mdef=VhdlDocGen::findFunction(name,temp);
static const MemberDef * findFunction(const QCString &name, const QCString &package)
std::vector< std::string > StringVector
Definition containers.h:33
1588
1589 if (mdef)
1590 {
1591 generateFuncLink(yyscanner,*yyextra->code,mdef);
1592 yyextra->funcProto.stripPrefix(name);
1593 codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass);
1594 }
1595 else
1596 {
1597 codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass);
1598 }
static void generateFuncLink(yyscan_t yyscanner, OutputCodeList &ol, const MemberDef *mdef)
Definition vhdlcode.l:1324
1599}// writeFuncProto

References QCString::clear(), codifyLines(), VhdlDocGen::findFunction(), generateFuncLink(), QCString::isEmpty(), VhdlDocGen::parseFuncProto(), split(), QCString::str(), and QCString::stripPrefix().

◆ writeMultiLineCodeLink()

static void writeMultiLineCodeLink ( yyscan_t yyscanner,
OutputCodeList & ol,
const Definition * d,
const QCString & text )
static

writes a link to a fragment text that may span multiple lines, inserting line numbers for each line. If text contains newlines, the link will be split into multiple links with the same destination, one for each line.

Definition at line 1284 of file vhdlcode.l.

1287{
1288 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1289 if (text.isEmpty()) return;
1290 bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
1291 yyextra->tooltipManager.addTooltip(d);
1292 QCString ref = d->getReference();
1293 QCString file = d->getOutputFileBase();
1294 QCString anchor = d->anchor();
1295 QCString tooltip;
1296 if (!sourceTooltips) // fall back to simple "title" tooltips
1297 {
1298 tooltip = d->briefDescriptionAsTooltip();
1299 }
1300 bool done=false;
1301 const char *p=text.data();
1302 while (!done)
1303 {
1304 const char *sp=p;
1305 char c;
1306 while ((c=*p++) && c!='\n') {}
1307 if (c=='\n')
1308 {
1309 yyextra->yyLineNr++;
1310 // printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
1311 ol.writeCodeLink(d->codeSymbolType(),ref,file,anchor,QCString(sp,p-sp-1),tooltip);
1312 nextCodeLine(yyscanner);
1313 }
1314 else
1315 {
1316 ol.writeCodeLink(d->codeSymbolType(),ref,file,anchor,sp,tooltip);
1317 done=true;
1318 }
1319 }
virtual QCString anchor() const =0
virtual QCString briefDescriptionAsTooltip() const =0
virtual CodeSymbolType codeSymbolType() const =0
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
Definition outputlist.h:249
1320}

References Definition::anchor(), Definition::briefDescriptionAsTooltip(), Definition::codeSymbolType(), Config_getBool, QCString::data(), Definition::getOutputFileBase(), Definition::getReference(), QCString::isEmpty(), nextCodeLine(), and OutputCodeList::writeCodeLink().

◆ writeProcessProto()

static void writeProcessProto ( yyscan_t yyscanner)
static

Definition at line 1603 of file vhdlcode.l.

1604{
1605 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1606 codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass);
1607 yyextra->vhdlKeyDict.clear();
1608}// writeProcessProto

References codifyLines().

◆ writeWord()

static void writeWord ( yyscan_t yyscanner,
const QCString & word,
const QCString & curr_class,
bool classLink )
static

writes a word to the output. If curr_class is defined, the word belongs to a class and will be linked.

Definition at line 1146 of file vhdlcode.l.

1147{
1148 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1149 bool found=false;
1150 QCString temp;
1151 QCString tclass(curr_class);
1152 QCString ttt(word);
1153 if (ttt.isEmpty()) return;
1154 for (unsigned int j=0;j<ttt.length();j++)
1155 {
1156 char c=ttt.at(j);
1157 if (c==' '|| c==',' || c==';' || c==':' || c=='(' || c==')' || c=='\r' || c=='\t' || c=='.')
1158 {
1159 if (found)
1160 {
1161 if (!writeColoredWord(yyscanner,temp)) // is it a keyword ?
1162 {
1163 //if (VhdlDocGen::findKeyWord(temp))
1164 // writeFont(yyscanner,"vhdlkeyword",temp);
1165 //printf("writeWord: %s\n",qPrint(temp));
1166 if (!tclass.isEmpty())
1167 {
1168 if (!classLink)
1169 {
1170 generateMemLink(yyscanner,*yyextra->code,tclass,temp);
1171 }
1172 else
1173 {
1174 generateClassOrGlobalLink(yyscanner,*yyextra->code,temp,false,curr_class);
1175 }
1176 }
1177 else
1178 {
1179 if (!checkVhdlString(yyscanner,temp))
1180 {
1181 yyextra->code->codify(temp);
1182 }
1183 }
1184 }
1185 temp.clear();
1186 found=false;
1187 }
bool found
Definition util.cpp:984
static bool writeColoredWord(yyscan_t yyscanner, QCString &word)
Definition vhdlcode.l:1612
static bool checkVhdlString(yyscan_t yyscanner, QCString &name)
Definition vhdlcode.l:966
1188
1189 char cc[2];
1190 cc[0]=c;
1191 cc[1]=0;
1192 yyextra->code->codify(cc);
1193 }
1194 else
1195 {
1196 found=true;
1197 temp+=c;
1198 }
1199 } // for
1200
1201 if (!temp.isEmpty())
1202 {
1203 if (!writeColoredWord(yyscanner,temp))
1204 {
1205 if (!tclass.isEmpty())
1206 {
1207 if (!classLink)
1208 {
1209 generateMemLink(yyscanner,*yyextra->code,tclass,temp); // generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,left);
1210 }
1211 else
1212 {
1213 generateClassOrGlobalLink(yyscanner,*yyextra->code,temp,false,curr_class);
1214 }
1215 }
1216 else
1217 {
1218 QCString qc(temp);
1219 if (VhdlDocGen::isNumber(qc.str()))
1220 {
1221 startFontClass(yyscanner,"vhdllogic");
1222 yyextra->code->codify(temp);
1223 endFontClass(yyscanner);
1224 }
1225 else
1226 {
1227 yyextra->code->codify(temp);
1228 }
1229 }
1230 }
1231 }
1232}// writeWord

References QCString::at(), checkVhdlString(), QCString::clear(), endFontClass(), found, generateClassOrGlobalLink(), generateMemLink(), QCString::isEmpty(), VhdlDocGen::isNumber(), QCString::length(), startFontClass(), QCString::str(), word, and writeColoredWord().

Referenced by codifyLines().

◆ yylex()

int yylex ( yyscan_t yyscanner)

Definition at line 218 of file vhdlcode.l.

220 {
221 BEGIN(Bases);
222 }
223
224<Map>{BRACEOPEN} {
225 yyextra->braceCount++;
226 writeFont(yyscanner,"vhdlchar",yytext);
227 BEGIN(Map);
228 }
229
230<Map>[^()\n,--]* { /* write and link a port map lines */
231 QCString tt(yytext);
233 auto ql = split(tt.str(),"=>");
234 if (ql.size()>=2)
235 {
236 unsigned int index=0;
237 QCString t1(ql[0]);
238 char cc=t1.at(index);
239 while (cc==' ' || cc=='\t')
240 {
241 char c2[2];
242 c2[0]=cc;
243 c2[1]=0;
244 yyextra->code->codify(c2);
245 index++;
246 if (index>=t1.size()) break;
247 cc=t1.at(index);
248 }
static void deleteAllChars(QCString &s, char c)
249
250 QCString s1=t1;
251 s1=s1.stripWhiteSpace();
252
253 // if (!yyextra->PortMapComp.isEmpty())
254 generateMemLink(yyscanner,*yyextra->code,yyextra->PortMapComp,s1);
255 while (index++<t1.size())
256 {
257 cc=t1.at(index);
258 if (cc==' ' || cc=='\t')
259 {
260 char c2[2];
261 c2[0]=cc;
262 c2[1]=0;
263 yyextra->code->codify(c2);
264 }
265 }
266 codifyLines(yyscanner,"=>");
267 index=0;
268 QCString s2(ql[1]);
269 t1=s2;
270 cc=t1.at(index);
271 while (cc==' ' || cc=='\t')
272 {
273 char c2[2];
274 c2[0]=cc;
275 c2[1]=0;
276 yyextra->code->codify(c2);
277 index++;
278 if (index>=t1.size()) break;
279 cc=t1.at(index);
280 }
281 s2=s2.stripWhiteSpace();
282 if (!checkVhdlString(yyscanner,s2))
283 {
284 generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,s2);
285 }
286 while (index++<t1.size())
287 {
288 if (t1.at(index)==' ')
289 {
290 yyextra->code->codify(" ");
291 }
292 }
293 }
294 else
295 {
296 codifyLines(yyscanner,yytext,yyextra->currClass);
297 }
298 BEGIN(Map);
299 }
300
301<Map>"\n"|"," {
302 codifyLines(yyscanner,yytext);
303 BEGIN(Map);
304 }
305
306<Map>{BRACECLOSE} {
307 yyextra->braceCount--;
308 writeFont(yyscanner,"vhdlchar",yytext);
309 if (yyextra->braceCount==0)
310 {
311 BEGIN(Bases);
312 }
313 }
314
315<ParseFuncProto>{NAME} {
316 QCString tmp(yytext);
317 tmp=tmp.stripWhiteSpace();
318 appStringLower(yyextra->prevString,yytext);
319 yyextra->vhdlKeyDict.insert(yyextra->prevString.str());
320 if (!writeColoredWord(yyscanner,tmp))
321 {
322 generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,tmp);
323 }
324 BEGIN(Bases);
325 }
static void appStringLower(QCString &qcs, const char *text)
Definition vhdlcode.l:1500
326
327<ParseType>{STRING} {
328 QCString qcs(yytext);
331 if (VhdlDocGen::isNumber(qcs.str()))
332 {
333 writeFont(yyscanner,"vhdllogic",yytext);
334 }
335 else
336 {
337 writeFont(yyscanner,"keyword",yytext);
338 }
339 }
340
341<ParseType>"\n" {
342 yyextra->funcProto.append(yytext);
343 if (yyextra->isProto)
344 {
345 codifyLines(yyscanner,yytext);
346 }
347 BEGIN(ParseType);
348 }
349
350
351<ParseType>{TEXTT} {
352 yyextra->funcProto.append(yytext);
353 if (yyextra->isProto)
354 {
355 writeFont(yyscanner,"keyword",yytext);
356 }
357 BEGIN(ParseType);
358 }
359
360<ParseType>{ENDEFUNC} {
361 QCString tt(yytext);
362 codifyLines(yyscanner,yytext,yyextra->currClass);
363 tt=tt.lower();
365 tt.stripWhiteSpace();
366 static const reg::Ex regg(R"(\s+)"); // any number of whitespace
367 auto ql = split(tt.str(),regg);
368 int index=findIndex(ql,"if")+1;
369 index+=findIndex(ql,"case")+1;
370 index+=findIndex(ql,"loop")+1;
371 index+=findIndex(ql,"generate")+1;
372 if (index==0)
373 {
374 BEGIN(Bases);
375 }
376 else
377 {
378 BEGIN(ParseType);
379 }
380 }
int findIndex(const StringVector &sv, const std::string &s)
find the index of a string in a vector of strings, returns -1 if the string could not be found
Definition util.cpp:6981
381
382<ParseType>{END1} {
383 codifyLines(yyscanner,yytext,yyextra->currClass);
384 yyextra->vhdlKeyDict.clear();
385 }
386
387<ParseType>^{B}*("begin "|"begin") {
388 codifyLines(yyscanner,yytext,yyextra->currClass);
389 yyextra->isFuncProto=false;
390 }
391
392<ParseType>{SPECSIGN} {
393 yyextra->funcProto.append(yytext);
394 if (yyextra->isProto)
395 {
396 codifyLines(yyscanner,yytext,yyextra->currClass);
397 }
398 }
399
400<ParseType>["_a-zA-Z0-9]* {
401 QCString val(yytext);
402 yyextra->funcProto.append(yytext);
403 appStringLower(yyextra->prevString,yytext);
404
405 if (yyextra->isFuncProto && yyextra->braceCount==0)
406 {
407 yyextra->vhdlKeyDict.insert(yyextra->prevString.str());
408 }
409
410 if (yyextra->isProto)
411 {
412 if (!writeColoredWord(yyscanner,val))
413 {
414 if (!yyextra->isFuncProto &&
415 yyextra->vhdlKeyDict.find(yyextra->prevString.str())==yyextra->vhdlKeyDict.end())
416 {
417 val=val.stripWhiteSpace();
418 if (VhdlDocGen::isNumber(val.str()))
419 {
420 startFontClass(yyscanner,"vhdllogic");
421 codifyLines(yyscanner,yytext,yyextra->currClass);
422 endFontClass(yyscanner);
423 }
424 else
425 {
426 generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,val);
427 }
428 }
429 else
430 {
431 codifyLines(yyscanner,yytext,yyextra->currClass);
432 }
433 }
434 }
435 BEGIN(ParseType);
436 }
437
438<ParseType>{BRACEOPEN} {
439 yyextra->braceCount++;
440 yyextra->funcProto+='(';
441 if (yyextra->isProto)
442 {
443 writeFont(yyscanner,"vhdlchar",yytext);
444 }
445 BEGIN(ParseType);
446 }
447
448<ParseType>{BRACECLOSE} {
449 yyextra->braceCount--;
450 yyextra->funcProto+=')';
451 if (yyextra->isProto)
452 {
453 writeFont(yyscanner,"vhdlchar",yytext);
454 }
455 if (yyextra->braceCount==0 && !yyextra->isProto)// && !yyextra->isPackageBody)
456 {
457 yyextra->isProto=true;
458 appStringLower(yyextra->prevString,yytext);
459 writeFuncProto(yyscanner);
460 BEGIN(Bases);
461 }
462 if (yyextra->isPackageBody)
463 {
464 BEGIN(ParseType);
465 }
466 }
static void writeFuncProto(yyscan_t yyscanner)
Definition vhdlcode.l:1566
467
468
469<ClassesName>{FUNCNAME} {
470 appStringLower(yyextra->prevString,yytext);
471 yyextra->currClass.clear();
472 yyextra->currClass.append(yytext);
473 yyextra->currClass=yyextra->currClass.stripWhiteSpace();
474
475 generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
476 BEGIN(Bases);
477 }
478
479
480<ParseComponent>{BRACEOPEN} {
481 yyextra->braceCount++;
482 yyextra->code->codify(yytext);
483 }
484
485
486<ParseComponent>{BRACECLOSE} {
487 yyextra->braceCount--;
488 yyextra->code->codify(yytext);
489 if (yyextra->braceCount==0 && !yyextra->isComponent)
490 {
491 yyextra->tempComp.clear();
492 BEGIN(Bases);
493 }
494 else
495 {
496 BEGIN(ParseComponent);
497 }
498 }
499
500<ParseComponent>{B}*"-" {
501 if (strlen(yytext)>=2) // found text ?
502 {
503 writeFont(yyscanner,"keyword",yytext);
504 }
505 else
506 {
507 writeFont(yyscanner,"vhdlchar",yytext);
508 }
509 }
510
511<ParseComponent>{SPECSIGN} {
512 codifyLines(yyscanner,yytext);
513 }
514
515
516
517<ParseComponent>"\n"|" " {
518 codifyLines(yyscanner,yytext);
519 }
520
521<ParseComponent>{DIGITSS} {
522 startFontClass(yyscanner,"vhdllogic");
523 codifyLines(yyscanner,yytext);
524 endFontClass(yyscanner);
525 }
526
527<ParseComponent>{PORT} {
528 codifyLines(yyscanner,yytext);
529 yyextra->braceCount=1;
530 yyextra->isComponent=false;
531 }
532
533<ParseComponent>{GENERIC} {
534 codifyLines(yyscanner,yytext);
535 yyextra->braceCount=1;
536 }
537
538<ParseComponent>[_a-zA_Z][_a-zA-Z0-9]* {
539 QCString temp(yytext);
540 appStringLower(yyextra->prevString,yytext);
541 if (!checkVhdlString(yyscanner,temp))
542 {
543 if (!writeColoredWord(yyscanner,yyextra->prevString))
544 {
545 generateMemLink(yyscanner,*yyextra->code,yyextra->tempComp,temp);
546 }
547 }
548 }
549
550<ParseComponent>{STRING} {
551 QCString temp(yytext);
552 if (!checkVhdlString(yyscanner,temp))
553 {
554 codifyLines(yyscanner,yytext);
555 }
556 }
557
558
559<ParseProcessProto>[^()]* {
560 yyextra->funcProto.append(yytext);
561 }
562
563
564
565<ParseProcessProto>{BRACEOPEN} {
566 yyextra->funcProto.append(yytext);
567 yyextra->braceCount++;
568 }
569
570<ParseProcessProto>{BRACECLOSE} {
571 yyextra->funcProto.append(yytext);
572 yyextra->braceCount--;
573 if (yyextra->braceCount==0)
574 {
575 writeProcessProto(yyscanner);
576 BEGIN(Bases);
577 }
578 }
static void writeProcessProto(yyscan_t yyscanner)
Definition vhdlcode.l:1603
579
580<ParsePackage>[^:;]* { //found package
581 StringVector strl=split(yytext,".");
582 if (strl.size()>2)
583 {
584 std::string s1=strl[0];
585 std::string s2=strl[1];
586 std::string s3=strl[2];
587 s1.append(".");
588 s3.insert(0,".");
589 codifyLines(yyscanner,s1.c_str(),yyextra->currClass);
590 ClassDef *cd=VhdlDocGen::getPackageName(s2.c_str());
591 if (cd)
592 {
593 generateClassOrGlobalLink(yyscanner,*yyextra->code,s2.c_str());
594 }
595 else
596 {
597 codifyLines(yyscanner,s2.c_str());
598 }
599 codifyLines(yyscanner,s3.c_str());
600 }
601 else
602 {
603 writeFont(yyscanner,"keywordflow",yytext);
604 }
605 BEGIN(Bases);
606 }
QCString & insert(size_t index, const QCString &s)
Definition qcstring.h:317
static ClassDef * getPackageName(const QCString &name)
607
608<Bases>{MAPCOMPONENT1}|{MAPCOMPONENT2}|{MAPCOMPONENT3}|{MAPCOMPONENT4} { // found port or generic map
609 QCString tt(yytext);
610 int j=tt.find('.');
611
612 if (j>0)
613 {
614 QCString left=tt.left(j+1);
615 codifyLines(yyscanner,left);
616 tt=tt.right(tt.length()-j-1);
617 left=VhdlDocGen::getIndexWord(tt,0);
618 if (!left.isEmpty())
619 {
620 j=left.find('(',false);
621 if (j>=0)
622 {
623 QCString name=left.left(j);
624 generateClassOrGlobalLink(yyscanner,*yyextra->code,name);
625 yyextra->PortMapComp=name;
626 name=tt.right(tt.length()-name.length());
627 codifyLines(yyscanner,name);
628 }
629 else
630 {
631 generateClassOrGlobalLink(yyscanner,*yyextra->code,left);
632 tt.stripPrefix(left); //=tt.right(tt.length()-left.length()-1);
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
static QCString getIndexWord(const QCString &, int index)
633
634 yyextra->PortMapComp=left;
635 codifyLines(yyscanner,tt);
636 }
637 }
638 }
639 else
640 {
641 if (tt.contains(':',false))
642 {
643 codifyMapLines(yyscanner,tt);
644 }
645 else
646 {
647 codifyLines(yyscanner,tt);
648 }
649 }
650 yyextra->braceCount=1;
651 BEGIN(Map);
652 }
static void codifyMapLines(yyscan_t yyscanner, const QCString &text)
Definition vhdlcode.l:1508
653
654<Bases>^{B}*("component"){BN}+{FUNCNAME} { // found component
655 appStringLower(yyextra->prevString,yytext);
656 QCString temp=VhdlDocGen::getIndexWord(yytext,1);
657 temp=temp.stripWhiteSpace();
659 yyextra->tempComp=temp;
660 codifyLines(yyscanner,yytext,temp,true);
661 yyextra->braceCount=0;
662 yyextra->isComponent=true;
663 BEGIN(ParseComponent);
664 }
665
666
667
668<Bases>{ARCHITECTURE} { // found architecture
669 yyextra->PortMapComp.clear();
670 QCString temp = VhdlDocGen::getIndexWord(yytext,3);
671 yyextra->currArch = true;
672 temp+="::";
673 temp+=VhdlDocGen::getIndexWord(yytext,1);
674 yyextra->currClass=temp;
676 codifyLines(yyscanner,yytext,temp,true);
677 yyextra->isPackageBody=false;
678 }
679
680
681<Bases>^{B}*("package "){BN}*("body"){BN}*{FUNCNAME} { // found package body
682 QCString ss(yytext);
683 QCString temp=VhdlDocGen::getIndexWord(yytext,2);
684 StringVector ql=split(yytext,temp.str());
685 std::string ll=ql[0];
686 codifyLines(yyscanner,ll.c_str(),yyextra->currClass);
687 temp=temp.stripWhiteSpace();
688 temp.prepend("_");
689 generateClassOrGlobalLink(yyscanner,*yyextra->code,temp);
690 yyextra->currClass.clear();
691 yyextra->currClass=temp;
692 yyextra->isProto=false;
693 yyextra->isPackageBody=true;
694 }
QCString & prepend(const char *s)
Definition qcstring.h:407
695
696<Bases>{PROCESS} { // found process
697 yyextra->isFuncProto=true;
698 yyextra->funcProto.clear();
699 yyextra->funcProto.append(yytext);
700 yyextra->vhdlKeyDict.clear();
701 appStringLower(yyextra->prevString,yytext);
702 if (yyextra->prevString.contains('('))
703 {
704 yyextra->braceCount=1;
705 BEGIN(ParseProcessProto);
706 }
707 else
708 {
709 writeProcessProto(yyscanner);
710 }
711 }
712
713<Bases>("end"){BN}+("process") { // end of process
714 yyextra->isFuncProto=false;
715 codifyLines(yyscanner,yytext);
716 BEGIN(Bases);
717 }
718
719
720<Bases>^{B}*("begin "|"begin") {
721 yyextra->isFuncProto=false;
722 writeFont(yyscanner,"vhdlkeyword",yytext);
723 }
724
725<Bases>^{B}*("use"|"library"){BN}+ { //found package or library
726 writeFont(yyscanner,"vhdlkeyword",yytext);
727 BEGIN(ParsePackage);
728 }
729
730
731<Bases>^{B}*("use"){BN}+("configuration")[^\n]* {
732 codifyLines(yyscanner,yytext);
733 }
734
735<Bases>{FUNC} { // found function|procedure
736 yyextra->vhdlKeyDict.clear();
737 yyextra->funcProto.clear();
738 yyextra->isProto=false;
739 yyextra->funcProto.append(yytext);
740 yyextra->braceCount=1;
741 BEGIN(ParseType);
742 }
743
744<Bases>^{B}*("entity"|"package"){BN}+ {
745 appStringLower(yyextra->prevString,yytext);
746 writeFont(yyscanner,"keywordflow",yytext);
747 yyextra->isPackageBody=false;
748 BEGIN(ClassesName);
749 }
750
751<Bases>"end"{BN}+"architecture"{BN}+{FUNCNAME} {
752 codifyLines(yyscanner,yytext,yyextra->currClass,true);
753 yyextra->currArch = false;
754 }
755<Bases>"end"{BN}+{FUNCNAME} {
756 if (yyextra->currArch)
757 {
758 codifyLines(yyscanner,yytext,yyextra->currClass,true);
759 yyextra->currArch = false;
760 }
761 else
762 {
763 REJECT;
764 }
765 }
766<Bases>"end" {
767 appStringLower(yyextra->prevString,yytext);
768 QCString temp(yytext);
769 temp=temp.stripWhiteSpace();
770
771 writeColoredWord(yyscanner,temp);
772 BEGIN(End);
773 }
774<End>{ID} {
775 appStringLower(yyextra->prevString,yytext);
776 QCString temp(yytext);
777 temp=temp.stripWhiteSpace();
778
779 if (!writeColoredWord(yyscanner,temp))
780 {
781 generateClassOrGlobalLink(yyscanner,*yyextra->code,temp);
782 }
783 }
784<End>";" {
785 codifyLines(yyscanner,yytext);
786 BEGIN(Bases);
787 }
788<Bases>{KEYWORD} { // found keyword
789 QCString qcs(yytext);
790 if (!writeColoredWord(yyscanner,qcs))
791 {
792 startFontClass(yyscanner,"vhdlchar");
793 yyextra->code->codify(yytext);
794 endFontClass(yyscanner);
795 }
796 }
797
798
799<Bases>{ID} {
800 appStringLower(yyextra->prevString,yytext);
801 QCString temp(yytext);
802 temp=temp.stripWhiteSpace();
803
804 if (!writeColoredWord(yyscanner,temp))
805 {
806 startFontClass(yyscanner,"vhdlchar");
807 generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,temp);
808 endFontClass(yyscanner);
809 }
810 }
811
812<Bases,ParseComponent>{DIGITSS} {
813 startFontClass(yyscanner,"vhdllogic");
814 codifyLines(yyscanner,yytext);
815 endFontClass(yyscanner);
816 }
817
818<Bases>^{B}*("use"){BN}+("entity"|"component")[^\n]* {
819 codifyLines(yyscanner,yytext,yyextra->currClass,true);
820 }
821
822
823<Bases>{TYPEKW} {
824 codifyLines(yyscanner,yytext);
825 if (yyextra->isFuncProto)
826 {
827 BEGIN(ParseFuncProto);
828 }
829 else
830 {
831 BEGIN(Bases);
832 }
833 }
834
835<Bases>{OPERATOR} {
836 startFontClass(yyscanner,"vhdlchar");
837 yyextra->code->codify(yytext);
838 endFontClass(yyscanner);
839 }
840
841<Bases>","|"."|":"|"'"|"("|")" {
842 startFontClass(yyscanner,"vhdlchar");
843 yyextra->code->codify(yytext);
844 endFontClass(yyscanner);
845 }
846
847<Bases>{STRING} {
848 QCString qcs(yytext);
851
852 if (VhdlDocGen::isNumber(qcs.str()))
853 {
854 writeFont(yyscanner,"vhdllogic",yytext);
855 }
856 else
857 {
858 writeFont(yyscanner,"keyword",yytext);
859 }
860 }
861
862<Bases>{B}*"#"[^\n]* {
863 writeFont(yyscanner,"keyword",yytext);
864 }
865
866<Bases>^{B}*{XILINX}/[^a-zA-Z0-9_] {
867 writeWord(yyscanner,yytext);
868 //codifyLines(yyscanner,yytext,yyextra->currClass,true);
869 }
870
871<Bases>^{B}*"set_"[^\n]* {
872 writeWord(yyscanner,yytext);
873 }
874
875<*>\n {
876 codifyLines(yyscanner,yytext);
877 BEGIN(Bases);
878 }
879
880<*>[\x80-\xFF]* { // keep utf8 characters together...
881 yyextra->code->codify(yytext);
882 }
883<*>. {
884 yyextra->code->codify(yytext);
885 }
886
887
888<*>\n?"--!"[^\n]*/\n{B}*"--!" { // found special multi-line comment on its own line
889 if (YY_START!=CopyComment)
890 {
891 startFontClass(yyscanner,"comment",true);
892 yyextra->lastCopyCommentContext=YY_START;
893 BEGIN(CopyComment);
894 }
895 codifyLines(yyscanner,yytext,QCString(),false,true);
896 }
897<*>\n{TEXTT} { // found normal or special comment on its own line
898 QCString text(yytext);
899 int i=text.find("--");
900 bool isSpecialComment = i!=-1 && yytext[i+2]=='!';
901 if (isSpecialComment && YY_START!=CopyComment)
902 {
903 startFontClass(yyscanner,"comment",true);
904 }
905 codifyLines(yyscanner,text,QCString(),false,true);
906 if (isSpecialComment)
907 {
908 endFontClass(yyscanner,true);
909 }
910 if (YY_START==CopyComment)
911 {
912 BEGIN(yyextra->lastCopyCommentContext);
913 }
914 }
915<*>{TEXTT} { // found normal or special comment after something
916 QCString text(yytext);
917 int i=text.find("--");
918 bool isSpecialComment = i!=-1 && yytext[i+2]=='!';
919 if (isSpecialComment)
920 {
921 startFontClass(yyscanner,"comment",true);
922 }
923 codifyLines(yyscanner,yytext,QCString(),false,true);
924 if (isSpecialComment)
925 {
926 endFontClass(yyscanner,true);
927 }
928 }
929
930%%

◆ yyread()

static int yyread ( yyscan_t yyscanner,
char * buf,
int max_size )
static

Definition at line 935 of file vhdlcode.l.

936{
937 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
938 int inputPosition = yyextra->inputPosition;
939 const char *s = yyextra->inputString + inputPosition;
940 int c=0;
941 while( c < max_size && *s)
942 {
943 *buf++ = *s++;
944 c++;
945 }
946 yyextra->inputPosition += c;
947 return c;
948}