Branch: Tag:

2002-12-11

2002-12-11 17:52:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added @namespace/@endnamespace.

Rev: lib/modules/Tools.pmod/AutoDoc.pmod/DocParser.pmod:1.51

39:    "endclass" : METAKEYWORD,    "module" : METAKEYWORD,    "endmodule" : METAKEYWORD, +  "namespace" : METAKEYWORD, +  "endnamespace" : METAKEYWORD,    "decl" : METAKEYWORD,       "b" : BRACEKEYWORD,
733:    string arg = token->arg;    string endkeyword = 0;    switch (keyword) { +  case "namespace":    case "class":    case "module":    {
747:    meta->type = keyword;    .PikeParser nameparser = .PikeParser(arg, currentPosition);    string s = nameparser->readToken(); -  if (!isIdent(s) && s != "::") +  if (!isIdent(s)) { +  if ((keyword == "namespace") && (s == "::")) { +  } else {    parseError("@%s: expected %s name, got %O", keyword, keyword, s); -  if (nameparser->peekToken() == "::") -  if (keyword == "module") -  s += nameparser->readToken(); -  else -  parseError("@class: 'scope::' only allowed as @module name"); +  } +  } else if (nameparser->peekToken() == "::") { +  nameparser->readToken(); +  if (keyword != "namespace") +  parseError("@%s: '%s::' only allowed as @namespace name", +  keyword, s); +  }    if (nameparser->peekToken() != EOF)    parseError("@%s: expected %s name, got %O", keyword, keyword, arg);    meta->name = s;    }    break;    -  +  case "endnamespace": +  case "endclass": +  case "endmodule": +  { +  if (meta->type || meta->belongs || meta->appears || endkeyword) +  parseError("@%s must stand alone", keyword); +  meta->type = endkeyword = keyword; +  .PikeParser nameparser = .PikeParser(arg, currentPosition); +  while (nameparser->peekToken() != EOF) +  meta->name = (meta->name || "") + nameparser->readToken(); +  } +  break; +     case "decl":    {    if (endkeyword)
796:    break;       case "appears": +  {    if (endkeyword)    parseError("@%s must stand alone", endkeyword);    if (meta->type == "class" || meta->type == "decl"
815:    }    else    parseError("@appears not allowed here"); +  }    break;       case "belongs": -  +  {    if (endkeyword)    parseError("@%s must stand alone", endkeyword);    if (meta->type == "class" || meta->type == "decl"
835:    parseError("@belongs: expected identifier or blank, got %O", arg);    meta->belongs = s || ""; // blank is allowed too, you know ..    } -  break; -  -  case "endclass": -  case "endmodule": -  { -  if (meta->type || meta->belongs || meta->appears || endkeyword) -  parseError("@%s must stand alone", keyword); -  meta->type = endkeyword = keyword; -  .PikeParser nameparser = .PikeParser(arg, currentPosition); -  while (nameparser->peekToken() != EOF) -  meta->name = (meta->name || "") + nameparser->readToken(); +     }    break; -  +     default:    parseError("illegal keyword: @%s", keyword);    }