search_query.parser_base
Base query parser.
Classes
|
|
QueryParserBase class |
|
|
Abstract base class for query string parsers |
- class search_query.parser_base.QueryListParser(query_list: str, *, parser_class: type[QueryStringParser], field_general: str, ignore_failing_linter: bool = False)
Bases:
QueryParserBase- LIST_ITEM_REFERENCE = re.compile('#\\d+|(?:^|\\s|\\(|\\)|\\{|})([sScC]\\d+|\\d{1,2})(?=$|\\s|\\(|\\)|\\{|})')
- LIST_QUERY_LINE_REGEX: re.Pattern = re.compile('^\\s*(\\d+).\\s+(.*)$')
- adapt_linter_messages_for_list_query(parser_messages: list, artificial_to_original_pos: dict)
- assign_linter_messages(parser_messages) None
Assign linter messages to the appropriate query nodes.
- build_query_str() Tuple[str, dict, set, dict]
Build the query string from the list format.
- extract_reference_value(reference: str) str
Extract the numerical value of a list reference.
- linter: QueryListLinter
- map_artificial_to_original_positions(parser_messages: list, artificial_to_original_pos: dict)
Map artificial parentheses positions back to the original positions of the list references.
- tokenize_list() None
Tokenize the query_list.
- tokenize_operator_node(query_str: str, node_nr: int) list
Tokenize the query string into list-references and non-list-reference contents.
- class search_query.parser_base.QueryParserBase
Bases:
ABCQueryParserBase class
- linter: QueryStringLinter | QueryListLinter
- class search_query.parser_base.QueryStringParser(query_str: str, *, field_general: str = '', offset: dict | None = None, original_str: str | None = None, silent: bool = False, ignore_failing_linter: bool = False)
Bases:
QueryParserBase,ABCAbstract base class for query string parsers
- LOGIC_OPERATOR_REGEX = re.compile('\\b(AND|OR|NOT)\\b', re.IGNORECASE)
- OPERATOR_REGEX: re.Pattern = re.compile('^(AND|OR|NOT)$', re.IGNORECASE)
- adjust_token_positions() None
Adjust virtual positions of tokens using offset mapping.
- combine_subsequent_terms() None
Combine all consecutive TERM tokens into one. Combine contents inside quotation marks into single TERM token.
- linter: QueryStringLinter
- print_tokens() None
Print the tokens in a formatted table.
- split_operators_with_missing_whitespace() None
Split operators that are not separated by whitespace.