queryparser/queryparser_internal.cc File Reference

#include <config.h>
#include "omassert.h"
#include "queryparser_internal.h"
#include <xapian/error.h>
#include <xapian/unicode.h>
#include "str.h"
#include "stringutils.h"
#include "queryparser_token.h"
#include "cjk-tokenizer.h"
#include <algorithm>
#include <limits>
#include <list>
#include <string>
#include <string.h>
#include "debuglog.h"

Include dependency graph for queryparser_internal.cc:

Go to the source code of this file.

Classes

struct  filter_group_id
 A structure identifying a group of filter terms or a value range. More...
class  Term
 Class used to pass information about a token from lexer to parser. More...
class  State
 Parser State shared between the lexer and the parser. More...
class  ParserHandler
struct  ProbQuery
class  TermGroup
 A group of terms separated only by whitespace. More...
class  Terms
 Some terms which form a positional sub-query. More...
union  YYMINORTYPE
struct  yyStackEntry
struct  yyParser

Defines

#define BOOL_OP_TO_QUERY(E, A, OP, B, OP_TXT)
#define INTERFACE   1
#define YYCODETYPE   unsigned char
#define YYNOCODE   40
#define YYACTIONTYPE   unsigned char
#define ParseTOKENTYPE   Term *
#define YYSTACKDEPTH   100
#define ParseARG_SDECL   State * state;
#define ParseARG_PDECL   ,State * state
#define ParseARG_FETCH   State * state = yypParser->state
#define ParseARG_STORE   yypParser->state = state
#define YYNSTATE   77
#define YYNRULE   56
#define YY_NO_ACTION   (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION   (YYNSTATE+YYNRULE+1)
#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
#define yytestcase(X)
#define YY_SHIFT_USE_DFLT   (-4)
#define YY_SHIFT_MAX   34
#define YY_REDUCE_USE_DFLT   (-26)
#define YY_REDUCE_MAX   14
#define YY_SZ_ACTTAB   (int)(sizeof(yy_action)/sizeof(yy_action[0]))
#define TOKEN   (yyminor.yy0)

Typedefs

typedef struct yyParser yyParser

Functions

bool U_isupper (unsigned ch)
bool U_isdigit (unsigned ch)
bool U_isalpha (unsigned ch)
bool is_not_whitespace (unsigned ch)
bool is_not_wordchar (unsigned ch)
bool is_digit (unsigned ch)
bool is_suffix (unsigned ch)
bool prefix_needs_colon (const string &prefix, unsigned ch)
bool is_positional (Xapian::Query::op op)
static void add_to_query (Query *&q, Query::op op, Query *term)
static void add_to_query (Query *&q, Query::op op, const Query &term)
bool is_phrase_generator (unsigned ch)
bool is_stem_preventer (unsigned ch)
bool should_stem (const string &term)
unsigned check_infix (unsigned ch)
unsigned check_infix_digit (unsigned ch)
static yyParserParseAlloc ()
static void ParseFree (yyParser *)
static void Parse (yyParser *, int, Term *, State *)
static void yy_parse_failed (yyParser *)
static void yy_destructor (yyParser *yypParser, YYCODETYPE yymajor, YYMINORTYPE *yypminor)
static int yy_pop_parser_stack (yyParser *pParser)
static int yy_find_shift_action (yyParser *pParser, YYCODETYPE iLookAhead)
static int yy_find_reduce_action (int stateno, YYCODETYPE iLookAhead)
static void yy_shift (yyParser *yypParser, int yyNewState, int yyMajor, YYMINORTYPE *yypMinor)
static void yy_accept (yyParser *)
static void yy_reduce (yyParser *yypParser, int yyruleno)
static void yy_syntax_error (yyParser *yypParser, int yymajor, YYMINORTYPE yyminor)
static void Parse (yyParser *yypParser, int yymajor, ParseTOKENTYPE yyminorParseARG_PDECL)

Variables

const unsigned UNICODE_IGNORE = numeric_limits<unsigned>::max()
 Value representing "ignore this" when returned by check_infix() or check_infix_digit().
static const YYACTIONTYPE yy_action []
static const YYCODETYPE yy_lookahead []
static const short yy_shift_ofst []
static const short yy_reduce_ofst []
static const YYACTIONTYPE yy_default []
struct {
   YYCODETYPE   lhs
   unsigned char   nrhs
yyRuleInfo []


Define Documentation

#define BOOL_OP_TO_QUERY ( E,
A,
OP,
B,
OP_TXT   ) 

Value:

do {\
        if (!A || !B) {\
            state->error = "Syntax: <expression> "OP_TXT" <expression>";\
            yy_parse_failed(yypParser);\
            return;\
        }\
        E = new Query(OP, *A, *B);\
        delete A;\
        delete B;\
    } while (0)

Definition at line 1626 of file queryparser_internal.cc.

Referenced by yy_reduce().

#define INTERFACE   1

Definition at line 1652 of file queryparser_internal.cc.

#define ParseARG_FETCH   State * state = yypParser->state

#define ParseARG_PDECL   ,State * state

Definition at line 1705 of file queryparser_internal.cc.

#define ParseARG_SDECL   State * state;

Definition at line 1704 of file queryparser_internal.cc.

#define ParseARG_STORE   yypParser->state = state

#define ParseTOKENTYPE   Term *

Definition at line 1691 of file queryparser_internal.cc.

#define TOKEN   (yyminor.yy0)

#define YY_ACCEPT_ACTION   (YYNSTATE+YYNRULE+1)

Definition at line 1711 of file queryparser_internal.cc.

#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)

Definition at line 1712 of file queryparser_internal.cc.

Referenced by Parse().

#define YY_NO_ACTION   (YYNSTATE+YYNRULE+2)

Definition at line 1710 of file queryparser_internal.cc.

#define YY_REDUCE_MAX   14

Definition at line 1852 of file queryparser_internal.cc.

Referenced by yy_find_reduce_action().

#define YY_REDUCE_USE_DFLT   (-26)

Definition at line 1851 of file queryparser_internal.cc.

Referenced by yy_find_reduce_action().

#define YY_SHIFT_MAX   34

Definition at line 1844 of file queryparser_internal.cc.

Referenced by yy_find_shift_action().

#define YY_SHIFT_USE_DFLT   (-4)

Definition at line 1843 of file queryparser_internal.cc.

Referenced by yy_find_shift_action().

#define YY_SZ_ACTTAB   (int)(sizeof(yy_action)/sizeof(yy_action[0]))

Definition at line 1867 of file queryparser_internal.cc.

Referenced by yy_find_reduce_action(), and yy_find_shift_action().

#define YYACTIONTYPE   unsigned char

Definition at line 1690 of file queryparser_internal.cc.

#define YYCODETYPE   unsigned char

#define YYNOCODE   40

Definition at line 1689 of file queryparser_internal.cc.

Referenced by Parse(), yy_find_reduce_action(), and yy_find_shift_action().

#define YYNRULE   56

Definition at line 1709 of file queryparser_internal.cc.

Referenced by Parse(), and yy_reduce().

#define YYNSTATE   77

Definition at line 1708 of file queryparser_internal.cc.

Referenced by Parse(), and yy_reduce().

#define YYSTACKDEPTH   100

Definition at line 1702 of file queryparser_internal.cc.

#define yytestcase (  ) 

Definition at line 1723 of file queryparser_internal.cc.

Referenced by yy_reduce().


Typedef Documentation

typedef struct yyParser yyParser

Definition at line 1920 of file queryparser_internal.cc.


Function Documentation

static void add_to_query ( Query *&  q,
Query::op  op,
const Query term 
) [static]

Definition at line 369 of file queryparser_internal.cc.

static void add_to_query ( Query *&  q,
Query::op  op,
Query term 
) [static]

Definition at line 357 of file queryparser_internal.cc.

References Assert.

Referenced by Terms::as_opwindow_query(), and yy_reduce().

unsigned check_infix ( unsigned  ch  )  [inline]

Definition at line 514 of file queryparser_internal.cc.

References UNICODE_IGNORE.

unsigned check_infix_digit ( unsigned  ch  )  [inline]

Definition at line 530 of file queryparser_internal.cc.

References UNICODE_IGNORE.

bool is_digit ( unsigned  ch  )  [inline]

bool is_not_whitespace ( unsigned  ch  )  [inline]

Definition at line 76 of file queryparser_internal.cc.

References Xapian::Unicode::is_whitespace().

bool is_not_wordchar ( unsigned  ch  )  [inline]

Definition at line 83 of file queryparser_internal.cc.

References Xapian::Unicode::is_wordchar().

bool is_phrase_generator ( unsigned  ch  )  [inline]

Definition at line 483 of file queryparser_internal.cc.

bool is_positional ( Xapian::Query::op  op  )  [inline]

Definition at line 110 of file queryparser_internal.cc.

References Xapian::Query::OP_NEAR, and Xapian::Query::OP_PHRASE.

Referenced by TermGroup::as_group(), and yy_reduce().

bool is_stem_preventer ( unsigned  ch  )  [inline]

Definition at line 492 of file queryparser_internal.cc.

bool is_suffix ( unsigned  ch  )  [inline]

Definition at line 95 of file queryparser_internal.cc.

Referenced by Xapian::QueryParser::Internal::parse_term().

static void Parse ( yyParser yypParser,
int  yymajor,
ParseTOKENTYPE yyminor  ParseARG_PDECL 
) [static]

static void Parse ( yyParser ,
int  ,
Term ,
State  
) [static]

static yyParser * ParseAlloc (  )  [static]

Definition at line 2037 of file queryparser_internal.cc.

static void ParseFree ( yyParser pParser  )  [static]

Definition at line 2163 of file queryparser_internal.cc.

References yy_pop_parser_stack(), and yyParser::yystack.

Referenced by ParserHandler::~ParserHandler().

bool prefix_needs_colon ( const string &  prefix,
unsigned  ch 
) [inline]

Definition at line 100 of file queryparser_internal.cc.

References U_isupper().

Referenced by Term::get_query_with_synonyms(), and Term::make_term().

bool should_stem ( const string &  term  )  [inline]

bool U_isalpha ( unsigned  ch  )  [inline]

Definition at line 69 of file queryparser_internal.cc.

References C_isalpha().

bool U_isdigit ( unsigned  ch  )  [inline]

Definition at line 64 of file queryparser_internal.cc.

References C_isdigit().

bool U_isupper ( unsigned  ch  )  [inline]

Definition at line 59 of file queryparser_internal.cc.

References C_isupper().

Referenced by prefix_needs_colon().

static void yy_accept ( yyParser yypParser  )  [static]

static void yy_destructor ( yyParser yypParser,
YYCODETYPE  yymajor,
YYMINORTYPE yypminor 
) [static]

static int yy_find_reduce_action ( int  stateno,
YYCODETYPE  iLookAhead 
) [static]

Definition at line 2229 of file queryparser_internal.cc.

References Assert, YY_REDUCE_MAX, YY_REDUCE_USE_DFLT, YY_SZ_ACTTAB, and YYNOCODE.

Referenced by Parse(), and yy_reduce().

static int yy_find_shift_action ( yyParser pParser,
YYCODETYPE  iLookAhead 
) [static]

static void yy_parse_failed ( yyParser yypParser  )  [static]

static int yy_pop_parser_stack ( yyParser pParser  )  [static]

static void yy_reduce ( yyParser yypParser,
int  yyruleno 
) [static]

static void yy_shift ( yyParser yypParser,
int  yyNewState,
int  yyMajor,
YYMINORTYPE yypMinor 
) [static]

Definition at line 2259 of file queryparser_internal.cc.

References LOGLINE, and yyParser::yystack.

Referenced by Parse(), and yy_reduce().

static void yy_syntax_error ( yyParser yypParser,
int  yymajor,
YYMINORTYPE  yyminor 
) [static]

Definition at line 2916 of file queryparser_internal.cc.

References ParseARG_FETCH, ParseARG_STORE, and yy_parse_failed().

Referenced by Parse().


Variable Documentation

YYCODETYPE lhs

Definition at line 2288 of file queryparser_internal.cc.

unsigned char nrhs

Definition at line 2289 of file queryparser_internal.cc.

const unsigned UNICODE_IGNORE = numeric_limits<unsigned>::max()

Value representing "ignore this" when returned by check_infix() or check_infix_digit().

Definition at line 512 of file queryparser_internal.cc.

Referenced by check_infix(), and check_infix_digit().

const YYACTIONTYPE yy_action[] [static]

Definition at line 1773 of file queryparser_internal.cc.

const YYACTIONTYPE yy_default[] [static]

Initial value:

 {
     87,   87,   87,   87,   87,   87,   87,   87,   88,  133,
    133,  133,  133,  105,  133,  106,  107,  133,  106,  133,
    108,   84,  133,   85,  114,   86,  133,  133,  113,  115,
    133,  116,  133,   86,  133,   79,   80,   81,   86,   93,
    124,  126,  129,  131,  107,  110,  111,  112,  122,  123,
    120,  121,  125,  127,  128,  130,  132,  117,   89,   90,
     91,   95,  103,  109,  118,  119,   97,   99,  101,   92,
     94,  102,   96,   98,  100,   82,   83,
}

Definition at line 1857 of file queryparser_internal.cc.

const YYCODETYPE yy_lookahead[] [static]

Definition at line 1808 of file queryparser_internal.cc.

const short yy_reduce_ofst[] [static]

Initial value:

 {
    -25,   27,   40,   53,   66,   79,   92,  105,  220,  229,
    239,  248,  257,  265,  -12,
}

Definition at line 1853 of file queryparser_internal.cc.

const short yy_shift_ofst[] [static]

Initial value:

 {
     30,    9,  136,  136,  136,  136,  136,  136,  152,  180,
    192,  204,  216,  228,   39,  173,  304,   31,  175,  302,
    175,  309,  171,   11,  126,   23,   -3,   20,   26,   37,
     25,   67,   32,  125,   75,
}

Definition at line 1845 of file queryparser_internal.cc.

struct { ... } yyRuleInfo[] [static]

Referenced by yy_reduce().


Documentation for Xapian (version 1.2.8).
Generated on 14 Dec 2011 by Doxygen 1.5.9.