pike.git / lib / modules / Search.pmod / Grammar.pmod / DefaultParser.pike

version» Context lines:

pike.git/lib/modules/Search.pmod/Grammar.pmod/DefaultParser.pike:1:   // This file is part of Roxen Search   // Copyright © 2001 Roxen IS. All rights reserved.   // - // $Id: DefaultParser.pike,v 1.8 2002/03/11 14:26:45 grubba Exp $ + // $Id: DefaultParser.pike,v 1.9 2002/03/11 15:02:56 grubba Exp $      static inherit Search.Grammar.AbstractParser;   static inherit Search.Grammar.Lexer;   static private inherit "./module.pmod";   //static constant ParseNode = Search.Grammar.ParseNode;   //static constant OrNode = Search.Grammar.OrNode;   //static constant AndNode = Search.Grammar.AndNode;   //static constant TextNode = Search.Grammar.TextNode;      #include "debug.h"
pike.git/lib/modules/Search.pmod/Grammar.pmod/DefaultParser.pike:103:   }      static ParseNode parseQuery() {    // TRACE;    ParseNode or = OrNode();    for (;;) {    ParseNode n = parseExpr0();    or->addChild(n);    if (peek()[0] == TOKEN_OR)    advance(); -  else +  else if ((< TOKEN_END, +  TOKEN_RPAREN >)[ peek()[0] ] || +  options->implicit != "or")    break;    }    if (sizeof(or->children) == 1)    return or->children[0];    return or;   }      static ParseNode parseExpr0() {    // TRACE;    ParseNode and = AndNode();    for (;;) {    ParseNode n = parseExpr1();    and->addChild(n);    if (peek()[0] == TOKEN_AND)    advance();    else if ((< TOKEN_END,    TOKEN_RPAREN, -  TOKEN_OR >)[ peek()[0] ]) +  TOKEN_OR >)[ peek()[0] ] || +  options->implicit != "and")    break;    // implicit AND    }    if (sizeof(and->children) == 1)    return and->children[0];    return and;   }      static ParseNode parseExpr1() {    // TRACE;
pike.git/lib/modules/Search.pmod/Grammar.pmod/DefaultParser.pike:206:    break;    }    if (sizeof(and->children) == 1)    return and->children[0];    return and;   }      static ParseNode parseExpr5() {    // TRACE;    ParseNode text = TextNode(); -  ParseNode res = AndNode(); +  ParseNode res;    text->field = fieldstack[0]; -  +  if (options->implicit == "or") { +  res = OrNode(); +  } else { +  res = AndNode(); +  }    for (;;) {    int prefix = 0;       if (peek()[0] == TOKEN_MINUS) {    advance();    prefix = '-';    }    else if (peek()[0] == TOKEN_PLUS) {    advance();    prefix = '+';