Branch: Tag:

2001-06-14

2001-06-14 08:35:05 by David Norlin <norlin@roxen.com>

Changed Lexer <=> Parser API.

Rev: lib/modules/Search.pmod/Grammar.pmod/DefaultParser.pike:1.5
Rev: lib/modules/Search.pmod/Grammar.pmod/Lexer.pmod:1.3
Rev: lib/modules/Search.pmod/Grammar.pmod/module.pmod:1.7

82:   static int lookingAtFieldStart(void|int offset) {    multiset(string) fields = options["fields"];    // SHOW(tokens); -  return peek(offset)[0] == TOKEN_WORD +  return peek(offset)[0] == TOKEN_TEXT    && fields[ lower_case(peek(offset)[1]) ]    && peek(offset + 1)[0] == TOKEN_COLON;   }
221:    || (peek()[0] == TOKEN_LPAREN))    break; // it was a higher level IMPLICIT AND    if (peek()[0] == TOKEN_OR) -  if (peek(1)[0] == TOKEN_WORD -  && peek(2)[0] == TOKEN_COLON +  if (lookingAtFieldStart(1)    || peek(1)[0] == TOKEN_LPAREN)    break; // it was a higher level OR    else
254:    if (!prefix && options["implicit"] == "and")    prefix = '+';    -  while (!(< TOKEN_PHRASE, -  TOKEN_WORD, -  TOKEN_END >) [ peek()[0] ]) +  while (!(< TOKEN_TEXT, TOKEN_END >) [ peek()[0] ])    advance(); // ... ????????? or something smarter ?????    -  if (peek()[0] == TOKEN_PHRASE -  || peek()[0] == TOKEN_WORD) { -  string phrase = peek()[1]; +  if (peek()[0] == TOKEN_TEXT) { +  string text = peek()[1];    advance(); -  array(string) words = Unicode.split_words_and_normalize(phrase); +  array(string) words = Unicode.split_words_and_normalize(text);    if (!words || !sizeof(words))    return;    if (sizeof(words) == 1)
288:   loop:    for (;;) {    switch (peek()[0]) { -  case TOKEN_WORD: +  case TOKEN_TEXT:    if (lookingAtFieldStart())    break loop; // it's a field specifier    break; -  case TOKEN_UNKNOWN: +     case TOKEN_MINUS:    case TOKEN_COLON:    break;