summaryrefslogtreecommitdiffstats
path: root/src/commentscan.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/commentscan.l')
-rw-r--r--src/commentscan.l88
1 files changed, 66 insertions, 22 deletions
diff --git a/src/commentscan.l b/src/commentscan.l
index fc53c57..3cd8f5f 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -553,7 +553,7 @@ static void addXRefItem(const char *listName,const char *itemTitle,
item->text += " <p>";
if (Doxygen::markdownSupport)
{
- item->text += processMarkdown(yyFileName,current,outputXRef);
+ item->text += processMarkdown(yyFileName,yyLineNr,current,outputXRef);
}
else
{
@@ -575,7 +575,7 @@ static void addXRefItem(const char *listName,const char *itemTitle,
ASSERT(item!=0);
if (Doxygen::markdownSupport)
{
- item->text = processMarkdown(yyFileName,current,outputXRef);
+ item->text = processMarkdown(yyFileName,yyLineNr,current,outputXRef);
}
else
{
@@ -593,11 +593,26 @@ static void addXRefItem(const char *listName,const char *itemTitle,
{
docEntry->doc += cmdString;
}
- SectionInfo *si=new SectionInfo(listName,anchorLabel,
- g_sectionTitle,SectionInfo::Anchor,
- g_sectionLevel);
- Doxygen::sectionDict->append(anchorLabel,si);
- docEntry->anchors->append(si);
+ SectionInfo *si = Doxygen::sectionDict->find(anchorLabel);
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(listName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel,si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(listName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel,si->fileName.data());
+ }
+ }
+ else
+ {
+ si=new SectionInfo(listName,yyLineNr,anchorLabel,
+ g_sectionTitle,SectionInfo::Anchor,
+ g_sectionLevel);
+ Doxygen::sectionDict->append(anchorLabel,si);
+ docEntry->anchors->append(si);
+ }
}
outputXRef.resize(0);
}
@@ -643,18 +658,32 @@ static SectionInfo::SectionType sectionLevelToType(int level)
static void addSection()
{
- // create a new section element
- g_sectionTitle+=yytext;
- g_sectionTitle=g_sectionTitle.stripWhiteSpace();
- SectionInfo *si = new SectionInfo(yyFileName,g_sectionLabel,
+ SectionInfo *si = Doxygen::sectionDict->find(g_sectionLabel);
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",g_sectionLabel.data(),si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s)",g_sectionLabel.data(),si->fileName.data());
+ }
+ }
+ else
+ {
+ // create a new section element
+ g_sectionTitle+=yytext;
+ g_sectionTitle=g_sectionTitle.stripWhiteSpace();
+ si = new SectionInfo(yyFileName,yyLineNr,g_sectionLabel,
g_sectionTitle,sectionLevelToType(g_sectionLevel),g_sectionLevel);
- // add section to this entry
- current->anchors->append(si);
-
- // add section to the global dictionary
- Doxygen::sectionDict->append(g_sectionLabel,si);
+ // add section to this entry
+ current->anchors->append(si);
+ // add section to the global dictionary
+ Doxygen::sectionDict->append(g_sectionLabel,si);
+ }
}
//-----------------------------------------------------------------------------
@@ -1701,9 +1730,24 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of the anchor command ------- */
<AnchorLabel>{LABELID} { // found argument
- SectionInfo *si = new SectionInfo(yyFileName,yytext,0,SectionInfo::Anchor,0);
- Doxygen::sectionDict->append(yytext,si);
- current->anchors->append(si);
+ SectionInfo *si = Doxygen::sectionDict->find(yytext);
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",yytext,si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(yyFileName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s)",yytext,si->fileName.data());
+ }
+ }
+ else
+ {
+ si = new SectionInfo(yyFileName,yyLineNr,yytext,0,SectionInfo::Anchor,0);
+ Doxygen::sectionDict->append(yytext,si);
+ current->anchors->append(si);
+ }
addOutput(yytext);
BEGIN( Comment );
}
@@ -2876,9 +2920,9 @@ bool parseCommentBlock(/* in */ ParserInterface *parser,
if (Doxygen::markdownSupport)
{
- current->brief = processMarkdown(fileName,current,current->brief);
- current->doc = processMarkdown(fileName,current,current->doc);
- current->inbodyDocs = processMarkdown(fileName,current,current->inbodyDocs);
+ current->brief = processMarkdown(fileName,lineNr,current,current->brief);
+ current->doc = processMarkdown(fileName,lineNr,current,current->doc);
+ current->inbodyDocs = processMarkdown(fileName,lineNr,current,current->inbodyDocs);
}
Debug::print(Debug::CommentScan,0,