pike.git / lib / modules / Protocols.pmod / IMAP.pmod / parse_line.pike

version» Context lines:

pike.git/lib/modules/Protocols.pmod/IMAP.pmod/parse_line.pike:56:    string atom;       werror("get_atom: buffer = '%s'\n", buffer);       sscanf(buffer,    (with_options    ? "%*[ \t]%[^][(){ \0-\037\177%\"]%s"    : "%*[ \t]%[^(){ \0-\037\177%\"]%s"),    atom, buffer);    - #if 0 /* FIXME: This code is broken */ -  if (strlen(buffer)) -  switch(buffer[0]) -  { -  case ' ': -  case '\t': -  case ')': -  case ']': -  break; -  case '[': -  if (with_options) -  break; -  /* Fall through */ -  default: -  werror("=> atom: 0\n"); -  return 0; -  } - #endif /* 0 */ -  +     werror(sprintf("=> atom: %O\n", atom));    return strlen(atom) && atom;   }      string|object get_string()   {    werror("get_string: buffer = '%s'\n", buffer);       skip_whitespace();   
pike.git/lib/modules/Protocols.pmod/IMAP.pmod/parse_line.pike:185:    return ([ "type" : "list", "list" : 1 ]);    case '"': {    string s = get_string();    return s && ([ "type" : "string", "string" : s ]);    }    case "{": {    object s = get_string();    return s && ([ "type" : "literal", "length" : s->length ]);    }    default: { +  if (accept_options) { +  return get_atom_options(2); +  } else {    string atom = get_atom(accept_options); -  -  if (!accept_options || !strlen(buffer) || (buffer[0] != '[')) +     return ([ "type" : "atom", "atom" : atom ]); -  -  buffer = buffer[1..]; -  return ([ "type" : "atom_options", "atom" : atom, "options" : 1 ]); +     }    }    } -  + }      /* Reads a <start.size> suffix */   mapping get_range(mapping atom)   {    if (!strlen(buffer) || (buffer[0] != '<'))    return atom;       buffer = buffer[1..];       int start = get_number();
pike.git/lib/modules/Protocols.pmod/IMAP.pmod/parse_line.pike:339:    if (!strlen(buffer) || (buffer[0] != '['))    {    res->raw = atom;    return res;    }       /* Parse options */    string option_start = buffer;       array options = do_parse_simple_list(max_depth - 1, ']'); -  if (!options) -  return 0; +  if (!options) { +  res->options = ({ ([ "type":"atom", "atom":"" ]) }); +  return res; +  }       res->options = options;    res->raw = option_start[..sizeof(option_start) - sizeof(buffer) - 1];       if (!strlen(buffer) || (buffer[0] != '<'))    return res;       /* Parse <start.size> suffix */    buffer = buffer[1..];