Branch: Tag:

1999-03-22

1999-03-22 18:40:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Some fixes to get_token().

Rev: lib/modules/Protocols.pmod/IMAP.pmod/parse_line.pike:1.14

63:    : "%*[ \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;   }
192:    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)
346:    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];