Skip to content
Browse files

fully qualified names for anchors

  • Loading branch information...
1 parent 763f118 commit 654d39fe17397e0a80c95ce500f09ae49130bf2d @adamdruppe committed Feb 18, 2012
Showing with 17 additions and 6 deletions.
  1. +17 −6 src/doc.c
View
23 src/doc.c
@@ -183,7 +183,7 @@ DDOC_PARAM_ID = $(TD $0)\n\
DDOC_PARAM_DESC = $(TD $0)\n\
DDOC_BLANKLINE = $(BR)$(BR)\n\
\n\
-DDOC_PSYMBOL = $(U $0)\n\
+DDOC_PSYMBOL = $(U $1)\n\
DDOC_KEYWORD = $(B $0)\n\
DDOC_PARAM = $(I $0)\n\
\n\
@@ -929,7 +929,7 @@ void AggregateDeclaration::toDocBuffer(OutBuffer *buf)
#if 0
emitProtection(buf, protection);
#endif
- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars());
+ buf->printf("%s $(DDOC_PSYMBOL %s, %s)", kind(), toChars(), toPrettyChars());
buf->writestring(";\n");
}
}
@@ -953,7 +953,7 @@ void StructDeclaration::toDocBuffer(OutBuffer *buf)
}
else
{
- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars());
+ buf->printf("%s $(DDOC_PSYMBOL %s, %s)", kind(), toChars(), toPrettyChars());
}
buf->writestring(";\n");
}
@@ -980,7 +980,7 @@ void ClassDeclaration::toDocBuffer(OutBuffer *buf)
{
if (isAbstract())
buf->writestring("abstract ");
- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars());
+ buf->printf("%s $(DDOC_PSYMBOL %s, %s)", kind(), toChars(), toPrettyChars());
}
int any = 0;
for (size_t i = 0; i < baseclasses->dim; i++)
@@ -1017,7 +1017,7 @@ void EnumDeclaration::toDocBuffer(OutBuffer *buf)
{
if (ident)
{
- buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars());
+ buf->printf("%s $(DDOC_PSYMBOL %s, %s)", kind(), toChars(), toPrettyChars());
buf->writestring(";\n");
}
}
@@ -1975,6 +1975,15 @@ void highlightCode(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset)
char *sid = s->ident->toChars();
FuncDeclaration *f = s->isFuncDeclaration();
+ const char *fullyQualifiedName = s->toPrettyChars();
+ int total = strlen(fullyQualifiedName);
+ char *terminator = (char*) malloc(total + 3);
+ terminator[0] = ','; // end the first argument
+ strncpy(terminator + 1, fullyQualifiedName, total);
+ ++total; // because of the comma
+ terminator[total] = ')'; // to close the DDOC_PSYMBOL macro
+ terminator[total + 1] = 0; // terminate the string
+
//printf("highlightCode(s = '%s', kind = %s)\n", sid, s->kind());
for (unsigned i = offset; i < buf->offset; i++)
{ unsigned char c = buf->data[i];
@@ -1988,7 +1997,7 @@ void highlightCode(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset)
{
if (cmp(sid, buf->data + i, j - i) == 0)
{
- i = buf->bracket(i, "$(DDOC_PSYMBOL ", j, ")") - 1;
+ i = buf->bracket(i, "$(DDOC_PSYMBOL ", j, terminator) - 1;
continue;
}
else if (f)
@@ -2004,6 +2013,8 @@ void highlightCode(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset)
}
}
}
+
+ free(terminator);
}
/****************************************

0 comments on commit 654d39f

Please sign in to comment.
Something went wrong with that request. Please try again.