From 677c2e5bc6690338347994c52ddcbb67b8b660d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 24 Jul 2003 16:32:00 +0200 Subject: [PATCH] Added support for @decl enum. Rev: lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:1.26 --- .../Tools.pmod/AutoDoc.pmod/CExtractor.pmod | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod b/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod index 64a2900713..0f1d68e334 100644 --- a/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod +++ b/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod @@ -145,10 +145,18 @@ static private class Extractor { mapping(string:int) contexts = ([]); foreach (decls, PikeObject obj) contexts[obj->objtype] = 1; - if (contexts["inherit"] && sizeof(decls) > 1) - extractorErrorAt(token->currentPosition, - "inherit can not be grouped" - " with other declarations"); + + if (sizeof(decls) > 1) { + if (contexts["enum"]) + extractorErrorAt(token->currentPosition, + "enum can not be grouped" + " with other declarations"); + + if (contexts["inherit"]) + extractorErrorAt(token->currentPosition, + "inherit can not be grouped" + " with other declarations"); + } string context; if (sizeof(indices(contexts)) == 1) context = "_" + indices(contexts)[0]; @@ -156,12 +164,18 @@ static private class Extractor { context = "_general"; Documentation doc = Documentation(); doc->xml = token->doc(context); - DocGroup d = DocGroup(decls, doc); - d->appears = meta->appears; - d->belongs = meta->belongs; + 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->belongs = meta->belongs; d->documentation = doc; tokens = tokens[1..]; - return ({ "docgroup", d }); + return ({ d->objtype || "docgroup", d }); } break; case 0: @@ -188,6 +202,7 @@ static private class Extractor { case "class": case "module": + case "enum": //werror("in parent %O: found child %O\n", c->name, a[1]->name); // Check if it was a @class or @module that was reentered: if (search(c->children, a[1]) < 0) @@ -196,6 +211,9 @@ static private class Extractor { case "docgroup": c->AddGroup([object(DocGroup)]a[1]); break; + default: + werror("parseClassBody(): Unhandled object: %O\n", a); + break; } } } -- GitLab