pike.git / lib / modules / Tools.pmod / AutoDoc.pmod / CExtractor.pmod

version» Context lines:

pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:27:    werror("CExtractor error! %O %O\n", message, sp);    throw (AutoDocError(sp, "CExtractor", message));   }      protected private class Extractor {    protected constant EOF = .PikeParser.EOF;    protected string filename;    protected array(.DocParser.Parse) tokens = ({});       protected void create(string s, string filename) { -  this_program::filename = filename; +  this::filename = filename;       array(string) ctokens = Parser.C.split(s);    array(array(SourcePosition|string)) a = ({});    int line = 1;    foreach(ctokens, string ctoken) {    if (has_prefix(ctoken, "/*!")) {    int firstLine = line;    array(string) lines = ctoken[1 .. sizeof(ctoken) - 3]/"\n";    // werror("%O\n", lines);    int lastLine = firstLine + sizeof(lines) - 1;
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:74:    Parse token = tokens[0];    if (!token)    return 0;    MetaData meta = token->metadata();    array(PikeObject) decls = meta->decls;    switch (meta->type) {    case "namespace":    // Namespaces are always located in the root.    parent = root;    // FALL_THROUGH +  case "enum":    case "class":    case "module":    {    object(Class)|object(Module) alreadyChild =    parent->findChild(meta->name);    object(Class)|object(Module) c;       // see if we are re-entering a previously created class/module...    if (alreadyChild) {    c = alreadyChild;
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:96:    "'%s %s' doesnt match '%s %s'"    " in previous declaration",    meta->type, meta->name, c->objtype, c->name);    if (meta->appears || meta->belongs)    extractorErrorAt(token->currentPosition,    "cannot specify @appears or @belongs on"    " reentrance into '%s %s'", c->objtype, c->name);    }    else {    c = (["module":Module, +  "enum":Enum,    "class":Class,    "namespace":NameSpace])[meta->type]();    c->name = meta->name;    foreach(meta->inherits, PikeObject p) -  c->AddInherit(p); +  c->addInherit(p);    }    decls = ({ c });    tokens = tokens[1..];    parseClassBody(c, root);    .DocParser.Parse p = tokens[0];    MetaData endmeta = p ? p->metadata() : 0;    if (!endmeta)    extractorErrorAt(token->currentPosition,    "'@%s %s' without matching '@end%s'",    meta->type, meta->name, meta->type);
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:185:    break;    case 0:    extractorErrorAt(token->currentPosition,    "doc comment without destination");    default:    return 0;    }       }    -  void parseClassBody(Class|Module|NameSpace c, AutoDoc root) { +  void parseClassBody(Enum|Class|Module|NameSpace c, AutoDoc root) {    for(;;) { -  array(string|Class|Module|DocGroup) a = parseObject(c, root); +  array(string|Enum|Class|Module|DocGroup) a = parseObject(c, root);    if (!a)    return;    switch ([string]a[0]) {    case "namespace":    //werror("in parent %O: found child %O\n", c->name, a[1]->name);    // Check if it was a namespace we already know of:    if (search(root->children, a[1]) < 0) -  root->AddChild([object(NameSpace)]a[1]); +  root->addChild([object(NameSpace)]a[1]);    break;       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) -  c->AddChild([object(Class)|object(Module)]a[1]); +  c->addChild([object(Class)|object(Module)]a[1]);    break;    case "docgroup": -  c->AddGroup([object(DocGroup)]a[1]); +  c->addGroup([object(DocGroup)]a[1]);    break;    default:    werror("parseClassBody(): Unhandled object: %O\n", a);    break;    }    }    }   }      AutoDoc extract(string s, string|void filename, string|void namespace,
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/CExtractor.pmod:230:    Extractor e = Extractor(s, filename);       // Create the top-level module.    AutoDoc m = AutoDoc();       // Create the default namespace.    NameSpace ns = NameSpace();    ns->name = namespace || "predef";    ns->documentation = Documentation();    ns->documentation->xml = ""; -  m->AddChild(ns); +  m->addChild(ns);       // Perform the actual parsing.    e->parseClassBody(ns, m);    return m;   }