Skip to content
Snippets Groups Projects
Commit 677c2e5b authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added support for @decl enum.

Rev: lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:1.26
parent 93b94647
No related branches found
No related tags found
No related merge requests found
...@@ -145,10 +145,18 @@ static private class Extractor { ...@@ -145,10 +145,18 @@ static private class Extractor {
mapping(string:int) contexts = ([]); mapping(string:int) contexts = ([]);
foreach (decls, PikeObject obj) foreach (decls, PikeObject obj)
contexts[obj->objtype] = 1; contexts[obj->objtype] = 1;
if (contexts["inherit"] && sizeof(decls) > 1)
if (sizeof(decls) > 1) {
if (contexts["enum"])
extractorErrorAt(token->currentPosition,
"enum can not be grouped"
" with other declarations");
if (contexts["inherit"])
extractorErrorAt(token->currentPosition, extractorErrorAt(token->currentPosition,
"inherit can not be grouped" "inherit can not be grouped"
" with other declarations"); " with other declarations");
}
string context; string context;
if (sizeof(indices(contexts)) == 1) if (sizeof(indices(contexts)) == 1)
context = "_" + indices(contexts)[0]; context = "_" + indices(contexts)[0];
...@@ -156,12 +164,18 @@ static private class Extractor { ...@@ -156,12 +164,18 @@ static private class Extractor {
context = "_general"; context = "_general";
Documentation doc = Documentation(); Documentation doc = Documentation();
doc->xml = token->doc(context); doc->xml = token->doc(context);
DocGroup d = DocGroup(decls, doc); object(DocGroup)|Enum d;
if (contexts["enum"]) {
// Enums are their own docgroup...
d = decls[0];
} else {
d = DocGroup(decls, doc);
}
d->appears = meta->appears; d->appears = meta->appears;
d->belongs = meta->belongs; d->belongs = meta->belongs;
d->documentation = doc; d->documentation = doc;
tokens = tokens[1..]; tokens = tokens[1..];
return ({ "docgroup", d }); return ({ d->objtype || "docgroup", d });
} }
break; break;
case 0: case 0:
...@@ -188,6 +202,7 @@ static private class Extractor { ...@@ -188,6 +202,7 @@ static private class Extractor {
case "class": case "class":
case "module": case "module":
case "enum":
//werror("in parent %O: found child %O\n", c->name, a[1]->name); //werror("in parent %O: found child %O\n", c->name, a[1]->name);
// Check if it was a @class or @module that was reentered: // Check if it was a @class or @module that was reentered:
if (search(c->children, a[1]) < 0) if (search(c->children, a[1]) < 0)
...@@ -196,6 +211,9 @@ static private class Extractor { ...@@ -196,6 +211,9 @@ static private class Extractor {
case "docgroup": case "docgroup":
c->AddGroup([object(DocGroup)]a[1]); c->AddGroup([object(DocGroup)]a[1]);
break; break;
default:
werror("parseClassBody(): Unhandled object: %O\n", a);
break;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment