#include <config.h>#include "omassert.h"#include "queryparser_internal.h"#include <xapian/error.h>#include <xapian/unicode.h>#include "stringutils.h"#include "queryparser_token.h"#include <algorithm>#include <list>#include <string>#include <string.h>#include "omdebug.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. 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... | |
| struct | ProbQuery |
| class | TermGroup |
| class | TermList |
| 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 38 |
| #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 73 |
| #define | YYNRULE 51 |
| #define | YYERRORSYMBOL 22 |
| #define | YYERRSYMDT yy75 |
| #define | YY_NO_ACTION (YYNSTATE+YYNRULE+2) |
| #define | YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) |
| #define | YY_ERROR_ACTION (YYNSTATE+YYNRULE) |
| #define | YY_SHIFT_USE_DFLT (-1) |
| #define | YY_REDUCE_USE_DFLT (-24) |
| #define | YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0])) |
| #define | TOKEN (yyminor.yy0) |
Typedefs | |
| typedef 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) |
| 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 std::string &term) |
| unsigned | check_infix (unsigned ch) |
| unsigned | check_infix_digit (unsigned ch) |
| static yyParser * | ParseAlloc () |
| static void | ParseFree (yyParser *) |
| static void | Parse (yyParser *, int, Term *, State *) |
| static void | yy_parse_failed (yyParser *) |
| static void | yy_destructor (YYCODETYPE yymajor, YYMINORTYPE *yypminor) |
| static int | yy_pop_parser_stack (yyParser *pParser) |
| static int | yy_find_shift_action (yyParser *pParser, int iLookAhead) |
| static int | yy_find_reduce_action (yyParser *pParser, int 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 | |
| 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 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 1310 of file queryparser_internal.cc.
Referenced by yy_reduce().
| #define INTERFACE 1 |
Definition at line 1336 of file queryparser_internal.cc.
| #define YYCODETYPE unsigned char |
Definition at line 1371 of file queryparser_internal.cc.
Referenced by Parse(), and yy_pop_parser_stack().
| #define YYNOCODE 38 |
Definition at line 1372 of file queryparser_internal.cc.
Referenced by Parse(), yy_find_reduce_action(), and yy_find_shift_action().
| #define YYACTIONTYPE unsigned char |
Definition at line 1373 of file queryparser_internal.cc.
| #define ParseTOKENTYPE Term * |
Definition at line 1374 of file queryparser_internal.cc.
| #define YYSTACKDEPTH 100 |
Definition at line 1384 of file queryparser_internal.cc.
Definition at line 1385 of file queryparser_internal.cc.
Definition at line 1386 of file queryparser_internal.cc.
Definition at line 1387 of file queryparser_internal.cc.
Referenced by yy_accept(), yy_parse_failed(), yy_reduce(), and yy_syntax_error().
Definition at line 1388 of file queryparser_internal.cc.
Referenced by Parse(), yy_accept(), yy_parse_failed(), and yy_syntax_error().
| #define YYNSTATE 73 |
| #define YYNRULE 51 |
| #define YYERRORSYMBOL 22 |
| #define YYERRSYMDT yy75 |
Definition at line 1392 of file queryparser_internal.cc.
| #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) |
Definition at line 1393 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action(), and yy_find_shift_action().
| #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) |
Definition at line 1394 of file queryparser_internal.cc.
| #define YY_ERROR_ACTION (YYNSTATE+YYNRULE) |
| #define YY_SHIFT_USE_DFLT (-1) |
| #define YY_REDUCE_USE_DFLT (-24) |
Definition at line 1540 of file queryparser_internal.cc.
Referenced by yy_find_reduce_action(), and yy_find_shift_action().
| #define TOKEN (yyminor.yy0) |
Definition at line 1594 of file queryparser_internal.cc.
| bool U_isupper | ( | unsigned | ch | ) | [inline] |
Definition at line 50 of file queryparser_internal.cc.
References C_isupper().
Referenced by prefix_needs_colon().
| bool U_isdigit | ( | unsigned | ch | ) | [inline] |
| bool U_isalpha | ( | unsigned | ch | ) | [inline] |
| bool is_not_whitespace | ( | unsigned | ch | ) | [inline] |
| bool is_not_wordchar | ( | unsigned | ch | ) | [inline] |
| bool is_digit | ( | unsigned | ch | ) | [inline] |
Definition at line 79 of file queryparser_internal.cc.
References Xapian::Unicode::DECIMAL_DIGIT_NUMBER, and Xapian::Unicode::get_category().
| bool is_suffix | ( | unsigned | ch | ) | [inline] |
Definition at line 86 of file queryparser_internal.cc.
Referenced by Xapian::QueryParser::Internal::parse_term().
| bool prefix_needs_colon | ( | const string & | prefix, | |
| unsigned | ch | |||
| ) | [inline] |
Definition at line 91 of file queryparser_internal.cc.
References U_isupper().
Referenced by Term::get_query_with_synonyms(), and Term::make_term().
Definition at line 305 of file queryparser_internal.cc.
References Assert.
Referenced by TermList::as_opwindow_query(), and yy_reduce().
Definition at line 317 of file queryparser_internal.cc.
| bool is_phrase_generator | ( | unsigned | ch | ) | [inline] |
Definition at line 379 of file queryparser_internal.cc.
| bool is_stem_preventer | ( | unsigned | ch | ) | [inline] |
Definition at line 388 of file queryparser_internal.cc.
| bool should_stem | ( | const std::string & | term | ) | [inline] |
Definition at line 394 of file queryparser_internal.cc.
References Xapian::Unicode::get_category(), Xapian::Unicode::LOWERCASE_LETTER, Xapian::Unicode::MODIFIER_LETTER, Xapian::Unicode::OTHER_LETTER, and Xapian::Unicode::TITLECASE_LETTER.
| unsigned check_infix | ( | unsigned | ch | ) | [inline] |
Definition at line 405 of file queryparser_internal.cc.
| unsigned check_infix_digit | ( | unsigned | ch | ) | [inline] |
Definition at line 419 of file queryparser_internal.cc.
| static yyParser * ParseAlloc | ( | ) | [static] |
Definition at line 1708 of file queryparser_internal.cc.
| static void ParseFree | ( | yyParser * | ) | [static] |
Definition at line 1815 of file queryparser_internal.cc.
References yy_pop_parser_stack(), and yyParser::yystack.
| static void yy_parse_failed | ( | yyParser * | ) | [static] |
Definition at line 2469 of file queryparser_internal.cc.
References DEBUGLINE, ParseARG_FETCH, ParseARG_STORE, yy_pop_parser_stack(), and yyParser::yystack.
Referenced by Parse(), and yy_reduce().
| static void yy_destructor | ( | YYCODETYPE | yymajor, | |
| YYMINORTYPE * | yypminor | |||
| ) | [static] |
Definition at line 1717 of file queryparser_internal.cc.
References TermGroup::destroy(), YYMINORTYPE::yy0, YYMINORTYPE::yy1, YYMINORTYPE::yy13, YYMINORTYPE::yy60, and YYMINORTYPE::yy9.
Referenced by Parse(), yy_pop_parser_stack(), and yy_reduce().
| static int yy_pop_parser_stack | ( | yyParser * | pParser | ) | [static] |
Definition at line 1795 of file queryparser_internal.cc.
References DEBUGLINE, yyStackEntry::major, yyStackEntry::minor, yy_destructor(), YYCODETYPE, and yyParser::yystack.
Referenced by Parse(), ParseFree(), yy_accept(), and yy_parse_failed().
| static int yy_find_shift_action | ( | yyParser * | pParser, | |
| int | iLookAhead | |||
| ) | [static] |
Definition at line 1831 of file queryparser_internal.cc.
References DEBUGLINE, YY_NO_ACTION, YY_SHIFT_USE_DFLT, YY_SZ_ACTTAB, YYNOCODE, and yyParser::yystack.
Referenced by Parse().
| static int yy_find_reduce_action | ( | yyParser * | pParser, | |
| int | iLookAhead | |||
| ) | [static] |
Definition at line 1872 of file queryparser_internal.cc.
References YY_NO_ACTION, YY_REDUCE_USE_DFLT, YY_SZ_ACTTAB, YYNOCODE, and yyParser::yystack.
Referenced by yy_reduce().
| static void yy_shift | ( | yyParser * | yypParser, | |
| int | yyNewState, | |||
| int | yyMajor, | |||
| YYMINORTYPE * | yypMinor | |||
| ) | [static] |
Definition at line 1897 of file queryparser_internal.cc.
References DEBUGLINE, and yyParser::yystack.
Referenced by Parse(), and yy_reduce().
| static void yy_accept | ( | yyParser * | ) | [static] |
Definition at line 2503 of file queryparser_internal.cc.
References DEBUGLINE, ParseARG_FETCH, ParseARG_STORE, yy_pop_parser_stack(), and yyParser::yystack.
Referenced by Parse(), and yy_reduce().
| static void yy_reduce | ( | yyParser * | yypParser, | |
| int | yyruleno | |||
| ) | [static] |
Definition at line 1988 of file queryparser_internal.cc.
References TermList::add_positional_term(), TermGroup::add_term(), add_to_query(), TermList::adjust_window(), TermList::as_adj_query(), TermGroup::as_group(), TermList::as_near_query(), TermList::as_phrase_query(), Xapian::BAD_VALUENO, BOOL_OP_TO_QUERY, DEBUGLINE, Xapian::Query::empty(), ProbQuery::filter, ProbQuery::hate, ProbQuery::love, ProbQuery::merge_filters(), yyStackEntry::minor, ParseARG_FETCH, ProbQuery::query, YYMINORTYPE::yy0, YYMINORTYPE::yy1, YYMINORTYPE::yy13, YYMINORTYPE::yy60, YYMINORTYPE::yy9, yy_accept(), yy_destructor(), yy_find_reduce_action(), yy_parse_failed(), yy_shift(), YYNRULE, YYNSTATE, yyRuleInfo, and yyParser::yystack.
Referenced by Parse().
| static void yy_syntax_error | ( | yyParser * | yypParser, | |
| int | yymajor, | |||
| YYMINORTYPE | yyminor | |||
| ) | [static] |
Definition at line 2488 of file queryparser_internal.cc.
References ParseARG_FETCH, and ParseARG_STORE.
Referenced by Parse().
| static void Parse | ( | yyParser * | yypParser, | |
| int | yymajor, | |||
| ParseTOKENTYPE yyminor | ParseARG_PDECL | |||
| ) | [static] |
Definition at line 2533 of file queryparser_internal.cc.
References DEBUGLINE, ParseARG_STORE, YYMINORTYPE::yy0, yy_accept(), yy_destructor(), YY_ERROR_ACTION, yy_find_shift_action(), yy_parse_failed(), yy_pop_parser_stack(), yy_reduce(), yy_shift(), yy_syntax_error(), YYCODETYPE, yyParser::yyerrcnt, YYERRORSYMBOL, YYNOCODE, YYNRULE, YYNSTATE, and yyParser::yystack.
const YYACTIONTYPE yy_action[] [static] |
Definition at line 1444 of file queryparser_internal.cc.
const YYCODETYPE yy_lookahead[] [static] |
Definition at line 1476 of file queryparser_internal.cc.
const short yy_shift_ofst[] [static] |
Initial value:
{
87, 9, -1, 160, 103, -1, 118, -1, 118, 89,
118, 95, -1, 133, -1, 272, -1, -1, 11, -1,
24, -1, -1, -1, -1, 37, 105, -1, -1, -1,
48, -1, 62, -1, 104, 98, -1, 108, 110, -1,
118, 109, -1, -1, 107, -1, 274, 113, -1, 158,
-1, -1, 272, -1, 125, -1, 169, -1, -1, -1,
224, -1, 176, -1, -1, 187, -1, -1, -1, 154,
271, 118, -1,
}
Definition at line 1509 of file queryparser_internal.cc.
const short yy_reduce_ofst[] [static] |
Initial value:
{
-23, -24, -24, -24, -10, -24, 3, -24, 16, -24,
29, -24, -24, 178, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, 73, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
42, -24, -24, -24, -24, -24, -24, -24, -24, 188,
-24, -24, -24, -24, -24, -24, 197, -24, -24, -24,
215, -24, 225, -24, -24, 234, -24, -24, -24, -24,
-24, 55, -24,
}
Definition at line 1520 of file queryparser_internal.cc.
const YYACTIONTYPE yy_default[] [static] |
Initial value:
{
82, 81, 75, 124, 82, 76, 82, 77, 82, 79,
82, 80, 81, 83, 88, 101, 116, 118, 124, 120,
124, 122, 102, 105, 106, 124, 124, 107, 115, 114,
108, 117, 109, 119, 110, 124, 121, 111, 124, 123,
82, 81, 112, 84, 124, 85, 124, 124, 86, 124,
90, 98, 103, 104, 124, 113, 124, 92, 94, 96,
100, 87, 124, 89, 97, 124, 91, 93, 95, 101,
102, 82, 78,
}
Definition at line 1530 of file queryparser_internal.cc.
| YYCODETYPE lhs |
Definition at line 1926 of file queryparser_internal.cc.
| unsigned char nrhs |
Definition at line 1927 of file queryparser_internal.cc.
struct { ... } yyRuleInfo[] [static] |
Referenced by yy_reduce().