|
JASSv2
|
Simple interface to parsing queries. More...
#include <parser_query.h>

Public Types | |
| enum | parser_type { query, raw } |
| Which parser to use. More... | |
Public Member Functions | |
| parser_query (allocator &memory) | |
| Constructor. More... | |
| template<typename STRING_TYPE > | |
| void | parse (query_term_list &parsed_query, const STRING_TYPE &query, parser_type which_parser=parser_type::query) |
| parse and return the list of query tokens. More... | |
Static Public Member Functions | |
| static void | unittest (void) |
| Unit test this class. | |
Private Types | |
| enum | token_status { eof_token, bad_token, valid_token } |
| the parser returns whether the next token is valid or not. More... | |
Private Member Functions | |
| token_status | get_next_token (slice &token) |
| Return the next parsed token from the source query, this parser does case folding and sp on. More... | |
| token_status | get_next_token_raw (slice &token) |
| Return the next parsed token from the source query, this parser assumes the tokens are already normalised (case folded, puncutation removed, and so on). Seperators are whitespace. More... | |
Static Private Member Functions | |
| static std::string | unittest_test_one (parser_query *parser, allocator &memory, const std::string &query) |
| Unit test this class. | |
Private Attributes | |
| allocator & | memory |
| All memory associated with the query. | |
| uint8_t * | current |
| Currtne locaton (in the input query string) of the parser during parsing. | |
| uint8_t * | end_of_query |
| Pointer to the end of the inoput query string. | |
| uint8_t * | buffer_pos |
| Loction where the next token will be written during tokenization and normaloisation. | |
| uint8_t * | buffer_end |
| End of the normalised token buffer. | |
Simple interface to parsing queries.
|
private |
|
inline |
Constructor.
| memory | [in] all allocations happen in the memory object. |
|
private |
Return the next parsed token from the source query, this parser does case folding and sp on.
| token | [in] a slice of the token. |
|
private |
Return the next parsed token from the source query, this parser assumes the tokens are already normalised (case folded, puncutation removed, and so on). Seperators are whitespace.
| token | [in] a slice of the token. |
|
inline |
parse and return the list of query tokens.
| STRING_TYPE | either a std::string or JASS::string (or other string type) |
| parsed_query | [out] The parsed query once parsed. |
| query | [in] The query to be parsed. |
1.8.13