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

version» Context lines:

pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:128:    string filename;    int pos;       string parse_message;    // The bare message, without filename and pos etc. Also without    // trailing newline.       protected void create (string filename, int pos, string message,    void|array bt)    { -  this_program::filename = filename; -  this_program::pos = pos; +  this::filename = filename; +  this::pos = pos;    parse_message = message;    ::create (sprintf ("PikeParser: %s:%d: %s\n", filename, pos, message), bt);    }   }      protected int parseError(string message, mixed ... args) {    if (sizeof (args))    message = sprintf(message, @args);    // werror("parseError! \n");    // werror("%s\n", describe_backtrace(backtrace()));
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:263:   //! Expect an identifier.   //!   //! @note   //! Also @expr{::ident@}, @expr{scope::ident@}.   //!   //! @note   //! This function also converts old-style getters and setters   //! into new-style.   string eatIdentifier(void|int allowScopePrefix) {    // SHOW(({lookAhead(0),lookAhead(1),lookAhead(2)})); -  string scope = scopeModules[lookAhead(0)] && lookAhead(1) == "::" -  ? readToken() -  : ""; +  string scope = ""; +  if ((lookAhead(1) == "::") && +  (scopeModules[lookAhead(0)] || isVersion(lookAhead(0)))) { +  scope = readToken(); +  }    string colons = peekToken() == "::" ? readToken() : "";    // werror("scope == %O ,colons == %O\n", scope, colons);       if (sizeof(scope + colons) && !allowScopePrefix)    parseError("scope prefix not allowed");    string s = peekToken();    if (!isIdent(s))    parseError("expected identifier, got %O", s);    readToken();   
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:393:    }    return f;   }         StringType|IntType parseRange(StringType|IntType s)   {    string tk;    if (peekToken() == "(") {    readToken(); -  if (peekToken() != "..") +  switch (peekToken()) { +  case "zero": +  eat("zero"); +  s->min = s->max = "0"; +  eat(")"); +  return s; +  case "..": +  break; +  default:    s->min = eatLiteral(); -  -  if( (<"bit","bits">)[(tk = peekToken())] ) +  if(sscanf(s->min, "%sbit", s->min) || +  (<"bit","bits">)[(tk = peekToken())] )    { -  eat(tk); +  if (tk) eat(tk);    eat(")");    s->max = (string)((1<<(int)s->min)-1);    s->min = "0";    return s;    } -  +  }       eat("..");       if (peekToken() != ")")    s->max = eatLiteral();       eat(")");    }    return s;   }
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:596:    return parseProgram();    case "type":    return parseTypeType();    case "__attribute__":    return parseAttributeType();    case "__deprecated__":    return parseDeprecated();    case ".":    return parseObject();    default: -  if (isIdent(s)) +  if (isIdent(s) || (lookAhead(1) == "::" && isVersion(s)))    return parseObject();    else    return 0;    }   }      //! Parse the list of arguments in a function declaration.   //!   //! @param allowLiterals   //! If allowLiterals != 0 then you can write a literal or Pike idents
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:843:    e->modifiers = modifiers;    readToken();    if (peekToken() != "{")    e->name = eatIdentifier();    return e;    }    else {    Type t = parseOrType();    // only allow lfun::, predef::, :: in front of methods/variables    string name = eatIdentifier(args["allowScopePrefix"]); +     if (peekToken() == "(") { // It's a method def    Method m = Method();    m->modifiers = modifiers;    m->name = name; -  +  m->position = position;    m->returntype = t;    eat("(");    [m->argnames, m->argtypes] = parseArgList(args["allowArgListLiterals"]);    eat(")");    return m;    } else {    array vars = ({ });    for (;;) {    Variable v = Variable();    v->modifiers = modifiers;    v->name = name; -  +  v->position = position;    v->type = t;    vars += ({ v });    skipUntil( (< ";", ",", EOF >) ); // Skip possible init expr    if (peekToken() != ",")    break;    eat(",");    name = eatIdentifier();    }    if (sizeof(vars) == 1)    return vars[0];
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:892:    string s = a[i];    int pos = line;       line += String.count(s, "\n");       // remove preprocessor directives:    if (sizeof(s) > 1 && s[0..0] == "#") {    // But convert #pike directives to corresponding imports,    // so that the resolver can find the correct symbols later.    if (has_prefix(s, "#pike ") || has_prefix(s, "#pike\t")) { -  string version = String.trim_all_whites(s[sizeof("#pike ")..]); +  string version = String.trim(s[sizeof("#pike ")..]);    if (version == "__REAL_VERSION__") {    version = "predef";    }    // NB: Surround the comment with whitespace, to keep    // it from being associated with surrounding code.    t += ({ "\n", "//! @decl import " + version + "::\n", "\n" });    p += ({ pos + 2, pos, pos + 2 });    }    t += ({ "\n" });    p += ({ pos });
pike.git/lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:948: Inside #if TOKEN_DEBUG
  #if TOKEN_DEBUG    werror("PikeParser::setTokens(), tokens = \n%O\n", tokens);   #endif   }      //!   protected void create(string|void s,    string|SourcePosition|void _filename,    int|void line, .Flags|void flags)   { -  if (zero_type(flags)) flags = .FLAG_NORMAL; +  if (undefinedp(flags)) flags = .FLAG_NORMAL;    if (s) {    if (objectp(_filename)) {    line = _filename->firstline;    filename = _filename->filename;    }    if (!line)    error("PikeParser::create() called without line arg.\n");       [tokens, positions] = tokenize(s, line);    }    else {    tokens = ({});    filename = _filename;    }   #if TOKEN_DEBUG    werror("PikeParser::create(), tokens = \n%O\n", tokens);   #endif    tokenPtr = 0;   }