Branch: Tag:

1998-10-26

1998-10-26 22:08:28 by Niels Möller <nisse@lysator.liu.se>

Added accept_options argument to get_token(). Define eol == -1 to mean
that end-of-line is also end-of-list.

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

21:    sscanf(buffer, "%*[ \t]%s", buffer);   }    + #if 0   int eolp()   {    skip_whitespace();    return !strlen(buffer);   } -  + #endif      // Returns -1 on error. All valid numbers ar non-negative.   int get_number()
153:   }      /* Parses an object that can be a string, an atom (possibly with -  * options in brackets) or a list */ - mapping get_token(int eol) +  * options in brackets) or a list. +  * +  * eol can be 0, meaning no end of line or list expected, +  * a positive int, meaning a character (e.g. ')' or ']' that terminates the list, +  * or -1, meaning that the list terminates at end of line. +  */ + mapping get_token(int eol, int accept_options)   {    skip_whitespace();    if (!strlen(buffer)) -  return 0; +  return (eol == -1) && ([ "type" : "eol", "eol" : 1 ]);       if (eol && (buffer[0] == eol))    {
179:    return s && ([ "type" : "literal", "length" : s->length ]);    }    default: { -  string atom = get_atom(1); +  string atom = get_atom(accept_options);    -  if (!strlen(buffer) || (buffer[0] != '[')) +  if (!accept_options || !strlen(buffer) || (buffer[0] != '['))    return ([ "type" : "atom", "atom" : atom ]);       buffer = buffer[1..];