xapian-core
1.4.27
|
build a Xapian::Query object from a user query string More...
#include <config.h>
#include "queryparser_internal.h"
#include "api/queryinternal.h"
#include "omassert.h"
#include "str.h"
#include "stringutils.h"
#include "xapian/error.h"
#include "xapian/unicode.h"
#include "queryparser_token.h"
#include "word-breaker.h"
#include <algorithm>
#include <cstring>
#include <limits>
#include <list>
#include <string>
#include <vector>
#include "debuglog.h"
Go to the source code of this file.
Classes | |
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 | SynonymIterator |
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 |
Macros | |
#define | Parse_ENGINEALWAYSONSTACK |
#define | VET_BOOL_ARGS(A, 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 35 |
#define | YYNRULE 56 |
#define | YYNTOKEN 24 |
#define | YY_MAX_SHIFT 34 |
#define | YY_MIN_SHIFTREDUCE 77 |
#define | YY_MAX_SHIFTREDUCE 132 |
#define | YY_ERROR_ACTION 133 |
#define | YY_ACCEPT_ACTION 134 |
#define | YY_NO_ACTION 135 |
#define | YY_MIN_REDUCE 136 |
#define | YY_MAX_REDUCE 191 |
#define | yytestcase(X) |
#define | YY_ACTTAB_COUNT (326) |
#define | YY_SHIFT_COUNT (34) |
#define | YY_SHIFT_MIN (0) |
#define | YY_SHIFT_MAX (311) |
#define | YY_REDUCE_COUNT (14) |
#define | YY_REDUCE_MIN (-25) |
#define | YY_REDUCE_MAX (265) |
#define | YYMALLOCARGTYPE size_t |
#define | yyTraceShift(X, Y, Z) |
#define | TOKEN yyminor |
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 | is_double_quote (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 void | yy_parse_failed (yyParser *) |
static void | ParseInit (yyParser *pParser) |
static void | ParseFinalize (yyParser *pParser) |
static void | yy_destructor (yyParser *yypParser, YYCODETYPE yymajor, YYMINORTYPE *yypminor) |
static void | yy_pop_parser_stack (yyParser *pParser) |
static unsigned 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, ParseTOKENTYPE yyMinor) |
static void | yy_accept (yyParser *) |
static void | yy_reduce (yyParser *yypParser, unsigned int yyruleno, int yyLookahead, ParseTOKENTYPE yyLookaheadToken) |
static void | yy_syntax_error (yyParser *yypParser, int yymajor, ParseTOKENTYPE yyminor) |
static void | Parse (yyParser *yypParser, int yymajor, ParseTOKENTYPE yyminor ParseARG_PDECL) |
Variables | |
const unsigned | UNICODE_IGNORE = numeric_limits<unsigned>::max() |
Value representing "ignore this" when returned by check_infix() or check_infix_digit(). More... | |
static const YYACTIONTYPE | yy_action [] |
static const YYCODETYPE | yy_lookahead [] |
static const unsigned short int | yy_shift_ofst [] |
static const short | yy_reduce_ofst [] |
static const YYACTIONTYPE | yy_default [] |
struct { | |
YYCODETYPE lhs | |
signed char nrhs | |
} | yyRuleInfo [] |
build a Xapian::Query object from a user query string
Definition in file queryparser_internal.cc.
#define INTERFACE 1 |
Definition at line 1270 of file queryparser_internal.cc.
#define Parse_ENGINEALWAYSONSTACK |
Definition at line 78 of file queryparser_internal.cc.
#define ParseARG_FETCH State * state = yypParser->state |
Definition at line 1291 of file queryparser_internal.cc.
Referenced by yy_accept(), yy_destructor(), yy_find_reduce_action(), yy_parse_failed(), yy_reduce(), and yy_syntax_error().
#define ParseARG_PDECL ,State * state |
Definition at line 1290 of file queryparser_internal.cc.
#define ParseARG_SDECL State * state; |
Definition at line 1289 of file queryparser_internal.cc.
#define ParseARG_STORE yypParser->state = state |
Definition at line 1292 of file queryparser_internal.cc.
Referenced by Parse(), yy_accept(), yy_destructor(), yy_find_reduce_action(), yy_parse_failed(), and yy_syntax_error().
#define ParseTOKENTYPE Term * |
Definition at line 1276 of file queryparser_internal.cc.
#define TOKEN yyminor |
Definition at line 1203 of file queryparser_internal.cc.
Referenced by yy_reduce().
#define YY_ACCEPT_ACTION 134 |
Definition at line 1300 of file queryparser_internal.cc.
Referenced by Parse().
#define YY_ACTTAB_COUNT (326) |
Definition at line 1369 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action(), and yy_find_shift_action().
#define YY_ERROR_ACTION 133 |
Definition at line 1299 of file queryparser_internal.cc.
Referenced by Parse(), and yy_reduce().
#define YY_MAX_REDUCE 191 |
Definition at line 1303 of file queryparser_internal.cc.
#define YY_MAX_SHIFT 34 |
Definition at line 1296 of file queryparser_internal.cc.
Referenced by yy_find_shift_action(), yy_reduce(), and yy_shift().
#define YY_MAX_SHIFTREDUCE 132 |
Definition at line 1298 of file queryparser_internal.cc.
Referenced by Parse(), and yy_reduce().
#define YY_MIN_REDUCE 136 |
Definition at line 1302 of file queryparser_internal.cc.
Referenced by Parse(), yy_find_reduce_action(), and yy_shift().
#define YY_MIN_SHIFTREDUCE 77 |
Definition at line 1297 of file queryparser_internal.cc.
Referenced by yy_shift().
#define YY_NO_ACTION 135 |
Definition at line 1301 of file queryparser_internal.cc.
#define YY_REDUCE_COUNT (14) |
Definition at line 1450 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action().
#define YY_REDUCE_MAX (265) |
Definition at line 1452 of file queryparser_internal.cc.
#define YY_REDUCE_MIN (-25) |
Definition at line 1451 of file queryparser_internal.cc.
#define YY_SHIFT_COUNT (34) |
Definition at line 1441 of file queryparser_internal.cc.
Referenced by yy_find_shift_action().
#define YY_SHIFT_MAX (311) |
Definition at line 1443 of file queryparser_internal.cc.
Referenced by yy_find_shift_action().
#define YY_SHIFT_MIN (0) |
Definition at line 1442 of file queryparser_internal.cc.
Referenced by yy_find_shift_action().
#define YYACTIONTYPE unsigned char |
Definition at line 1275 of file queryparser_internal.cc.
Referenced by yy_reduce().
#define YYCODETYPE unsigned char |
Definition at line 1273 of file queryparser_internal.cc.
Referenced by yy_find_shift_action(), and yy_reduce().
#define YYMALLOCARGTYPE size_t |
Definition at line 1678 of file queryparser_internal.cc.
#define YYNOCODE 40 |
Definition at line 1274 of file queryparser_internal.cc.
Referenced by Parse(), yy_find_reduce_action(), and yy_find_shift_action().
#define YYNRULE 56 |
Definition at line 1294 of file queryparser_internal.cc.
#define YYNSTATE 35 |
Definition at line 1293 of file queryparser_internal.cc.
Referenced by ParseFinalize(), and yy_find_reduce_action().
#define YYNTOKEN 24 |
Definition at line 1295 of file queryparser_internal.cc.
Referenced by ParseFinalize(), and yy_find_shift_action().
#define YYSTACKDEPTH 100 |
Definition at line 1287 of file queryparser_internal.cc.
Referenced by ParseInit().
#define yytestcase | ( | X | ) |
Definition at line 1315 of file queryparser_internal.cc.
Referenced by yy_reduce().
#define yyTraceShift | ( | X, | |
Y, | |||
Z | |||
) |
Definition at line 2046 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action(), yy_reduce(), and yy_shift().
Definition at line 1538 of file queryparser_internal.cc.
Definition at line 447 of file queryparser_internal.cc.
References Assert.
Referenced by Terms::as_opwindow_query(), and yy_reduce().
Definition at line 465 of file queryparser_internal.cc.
|
inline |
Definition at line 601 of file queryparser_internal.cc.
References UNICODE_IGNORE.
Referenced by Xapian::QueryParser::Internal::parse_term(), and Xapian::parse_terms().
|
inline |
Definition at line 620 of file queryparser_internal.cc.
References UNICODE_IGNORE, and yy_parse_failed().
Referenced by Xapian::QueryParser::Internal::parse_term(), and Xapian::parse_terms().
|
inline |
Definition at line 114 of file queryparser_internal.cc.
References Xapian::Unicode::DECIMAL_DIGIT_NUMBER, and Xapian::Unicode::Internal::get_category().
Referenced by Xapian::QueryParser::Internal::parse_term(), and Xapian::parse_terms().
|
inline |
Definition at line 126 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 102 of file queryparser_internal.cc.
References Xapian::Unicode::is_whitespace(), and Xapian::Unicode::is_wordchar().
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 109 of file queryparser_internal.cc.
References Xapian::Unicode::is_wordchar().
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 570 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 147 of file queryparser_internal.cc.
References Xapian::Query::OP_NEAR, and Xapian::Query::OP_PHRASE.
Referenced by TermGroup::as_group(), State::State(), and yy_reduce().
|
inline |
Definition at line 579 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 121 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_term().
|
static |
Definition at line 2815 of file queryparser_internal.cc.
References Assert, LOGLINE, ParseARG_STORE, YYMINORTYPE::yy0, yy_accept(), YY_ACCEPT_ACTION, yy_destructor(), YY_ERROR_ACTION, yy_find_reduce_action(), yy_find_shift_action(), YY_MAX_SHIFTREDUCE, YY_MIN_REDUCE, yy_parse_failed(), yy_pop_parser_stack(), yy_reduce(), yy_shift(), yy_syntax_error(), yyParser::yyerrcnt, YYNOCODE, and yyParser::yystack.
Referenced by Xapian::QueryParser::Internal::parse_query().
|
static |
Definition at line 1848 of file queryparser_internal.cc.
References yy_lookahead, yy_pop_parser_stack(), yy_shift_ofst, YYNSTATE, YYNTOKEN, and yyParser::yystack.
Referenced by yyParser::~yyParser().
|
static |
Definition at line 1684 of file queryparser_internal.cc.
References yyParser::yyerrcnt, yyParser::yystack, and YYSTACKDEPTH.
Referenced by yyParser::yyParser().
|
inline |
Definition at line 137 of file queryparser_internal.cc.
References Xapian::Unicode::is_currency(), and U_isupper().
Referenced by Term::get_query_with_synonyms(), and Term::make_term().
|
inline |
Definition at line 585 of file queryparser_internal.cc.
References Xapian::Unicode::Internal::get_category(), Xapian::Unicode::LOWERCASE_LETTER, Xapian::Unicode::MODIFIER_LETTER, Xapian::Unicode::OTHER_LETTER, and Xapian::Unicode::TITLECASE_LETTER.
Referenced by Xapian::TermGenerator::Internal::index_text(), and Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 95 of file queryparser_internal.cc.
References Xapian::Unicode::is_whitespace().
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 90 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_query().
|
inline |
Definition at line 85 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_term(), Xapian::parse_terms(), and prefix_needs_colon().
|
static |
Definition at line 2779 of file queryparser_internal.cc.
References AssertEq, LOGLINE, ParseARG_FETCH, ParseARG_STORE, yyParser::yyerrcnt, and yyParser::yystack.
Referenced by Parse().
|
static |
Definition at line 1738 of file queryparser_internal.cc.
References ParseARG_FETCH, ParseARG_STORE, YYMINORTYPE::yy0, YYMINORTYPE::yy14, YYMINORTYPE::yy32, YYMINORTYPE::yy39, and YYMINORTYPE::yy40.
Referenced by Parse(), yy_pop_parser_stack(), and yy_reduce().
|
static |
Definition at line 1981 of file queryparser_internal.cc.
References Assert, LOGLINE, ParseARG_FETCH, ParseARG_STORE, yy_action, YY_ACTTAB_COUNT, yy_default, yy_lookahead, YY_MIN_REDUCE, yy_pop_parser_stack(), YY_REDUCE_COUNT, yy_reduce_ofst, YYNOCODE, YYNSTATE, yyParser::yystack, and yyTraceShift.
Referenced by Parse(), and yy_reduce().
|
static |
Definition at line 1919 of file queryparser_internal.cc.
References Assert, LOGLINE, yy_action, YY_ACTTAB_COUNT, yy_default, yy_lookahead, YY_MAX_SHIFT, YY_SHIFT_COUNT, YY_SHIFT_MAX, YY_SHIFT_MIN, yy_shift_ofst, YYCODETYPE, YYNOCODE, YYNTOKEN, and yyParser::yystack.
Referenced by Parse().
|
static |
Definition at line 2736 of file queryparser_internal.cc.
References LOGLINE, ParseARG_FETCH, ParseARG_STORE, yy_pop_parser_stack(), and yyParser::yystack.
Referenced by check_infix_digit(), Parse(), yy_reduce(), and yy_syntax_error().
|
static |
Definition at line 1835 of file queryparser_internal.cc.
References Assert, LOGLINE, yy_destructor(), and yyParser::yystack.
Referenced by Parse(), ParseFinalize(), yy_find_reduce_action(), and yy_parse_failed().
|
static |
Definition at line 2148 of file queryparser_internal.cc.
References ProbQuery::add_filter(), ProbQuery::add_filter_range(), Terms::add_positional_term(), TermGroup::add_term(), add_to_query(), Terms::adjust_window(), ProbQuery::append_filter(), ProbQuery::append_filter_range(), Terms::as_adj_query(), TermGroup::as_group(), Terms::as_near_query(), Terms::as_phrase_query(), Assert, TermGroup::create(), Terms::create(), Xapian::Query::empty(), ProbQuery::filter, ProbQuery::hate, is_positional(), LOGLINE, ProbQuery::love, yyStackEntry::major, ProbQuery::merge_filters(), yyStackEntry::minor, nrhs, ParseARG_FETCH, ProbQuery::query, TermGroup::set_empty_ok(), yyStackEntry::stateno, VET_BOOL_ARGS, YYMINORTYPE::yy0, YYMINORTYPE::yy14, YYMINORTYPE::yy32, YYMINORTYPE::yy39, YYMINORTYPE::yy40, yy_destructor(), YY_ERROR_ACTION, yy_find_reduce_action(), YY_MAX_SHIFT, YY_MAX_SHIFTREDUCE, yy_parse_failed(), YYACTIONTYPE, YYCODETYPE, yyRuleInfo, yyParser::yystack, yytestcase, and yyTraceShift.
Referenced by Parse().
|
static |
Definition at line 2052 of file queryparser_internal.cc.
References Assert, YY_MAX_SHIFT, YY_MIN_REDUCE, YY_MIN_SHIFTREDUCE, yyParser::yystack, and yyTraceShift.
Referenced by Parse().
|
static |
Definition at line 2758 of file queryparser_internal.cc.
References ParseARG_FETCH, ParseARG_STORE, and yy_parse_failed().
Referenced by Parse().
YYCODETYPE lhs |
Definition at line 2075 of file queryparser_internal.cc.
signed char nrhs |
Definition at line 2076 of file queryparser_internal.cc.
Referenced by yy_reduce().
const unsigned UNICODE_IGNORE = numeric_limits<unsigned>::max() |
Value representing "ignore this" when returned by check_infix() or check_infix_digit().
Definition at line 599 of file queryparser_internal.cc.
Referenced by Xapian::check_infix(), check_infix(), Xapian::check_infix_digit(), check_infix_digit(), and Xapian::QueryParser::Internal::parse_term().
|
static |
Definition at line 1370 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action(), and yy_find_shift_action().
|
static |
Definition at line 1457 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action(), and yy_find_shift_action().
|
static |
Definition at line 1405 of file queryparser_internal.cc.
Referenced by ParseFinalize(), yy_find_reduce_action(), and yy_find_shift_action().
|
static |
Definition at line 1453 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action().
|
static |
Definition at line 1444 of file queryparser_internal.cc.
Referenced by ParseFinalize(), and yy_find_shift_action().
const { ... } yyRuleInfo[] |
Referenced by yy_reduce().