![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Implementation of the small boolean field-query language. More...
#include "nilorea/n_query.h"#include "nilorea/n_log.h"#include "nilorea/n_pcre.h"#include <ctype.h>#include <stdlib.h>#include <string.h>#include <strings.h>
Include dependency graph for n_query.c:Go to the source code of this file.
Data Structures | |
| struct | N_QUERY |
| Opaque compiled query (see n_query_compile / n_query_eval / n_query_free). More... | |
| struct | PARSER |
| struct | QNODE |
Enumerations | |
| enum | { OP_EQ , OP_NE , OP_CONT , OP_NCONT , OP_REGEX , OP_GT , OP_LT , OP_GE , OP_LE } |
| enum | { N_AND , N_OR , N_NOT , N_CMP } |
| enum | { TK_END , TK_WORD , TK_AND , TK_OR , TK_NOT , TK_LP , TK_RP , TK_OP } |
Functions | |
| static int | ci_contains (const char *hay, const char *needle) |
| static char * | dupn (const char *s, size_t n) |
| static int | eval_node (const QNODE *n, N_QUERY_GET get, void *ud) |
| static int | is_op_char (char c) |
| static void | lex_next (PARSER *P) |
| N_QUERY * | n_query_compile (const char *expr, char *errbuf, size_t errlen) |
| Compile an expression into a query. | |
| int | n_query_eval (const N_QUERY *query, N_QUERY_GET get, void *user_data) |
Evaluate a compiled query against one record via get. | |
| void | n_query_free (N_QUERY **query) |
| Free a compiled query and set the pointer to NULL. | |
| static void | node_free (QNODE *n) |
| static QNODE * | node_new (int kind) |
| static QNODE * | parse_and (PARSER *P) |
| static QNODE * | parse_not (PARSER *P) |
| static QNODE * | parse_or (PARSER *P) |
| static QNODE * | parse_primary (PARSER *P) |
Implementation of the small boolean field-query language.
Definition in file n_query.c.
| struct N_QUERY |
Opaque compiled query (see n_query_compile / n_query_eval / n_query_free).
Collaboration diagram for N_QUERY:| Data Fields | ||
|---|---|---|
| QNODE * | root | |
| struct PARSER |
| struct QNODE |
| anonymous enum |
| anonymous enum |
|
static |
Definition at line 101 of file n_query.c.
Referenced by eval_node().
Here is the caller graph for this function:
|
static |
Definition at line 86 of file n_query.c.
Referenced by lex_next(), and parse_primary().
Here is the caller graph for this function:
|
static |
Definition at line 416 of file n_query.c.
References QNODE::a, QNODE::b, ci_contains(), eval_node(), QNODE::field, QNODE::kind, N_AND, N_CMP, N_NOT, N_OR, npcre_match(), QNODE::op, OP_CONT, OP_EQ, OP_GE, OP_GT, OP_LE, OP_LT, OP_NCONT, OP_NE, OP_REGEX, QNODE::re, and QNODE::value.
Referenced by eval_node(), and n_query_eval().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 96 of file n_query.c.
Referenced by lex_next().
Here is the caller graph for this function:
|
static |
Definition at line 116 of file n_query.c.
References dupn(), is_op_char(), OP_CONT, OP_EQ, OP_GE, OP_GT, OP_LE, OP_LT, OP_NCONT, OP_NE, OP_REGEX, PARSER::p, TK_AND, TK_END, TK_LP, TK_NOT, TK_OP, TK_OR, TK_RP, TK_WORD, PARSER::tok, PARSER::top, and PARSER::tval.
Referenced by n_query_compile(), parse_and(), parse_not(), parse_or(), and parse_primary().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 229 of file n_query.c.
References QNODE::a, QNODE::b, QNODE::field, node_free(), npcre_delete(), QNODE::re, and QNODE::value.
Referenced by n_query_compile(), n_query_free(), node_free(), parse_and(), parse_not(), parse_or(), and parse_primary().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 222 of file n_query.c.
References QNODE::kind.
Referenced by parse_and(), parse_not(), parse_or(), and parse_primary().
Here is the caller graph for this function:Definition at line 323 of file n_query.c.
References QNODE::a, QNODE::b, lex_next(), N_AND, node_free(), node_new(), parse_not(), TK_AND, and PARSER::tok.
Referenced by parse_or().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 304 of file n_query.c.
References QNODE::a, lex_next(), N_NOT, node_free(), node_new(), parse_not(), parse_primary(), TK_NOT, and PARSER::tok.
Referenced by parse_and(), and parse_not().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 349 of file n_query.c.
References QNODE::a, QNODE::b, lex_next(), N_OR, node_free(), node_new(), parse_and(), TK_OR, and PARSER::tok.
Referenced by n_query_compile(), and parse_primary().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 243 of file n_query.c.
References dupn(), PARSER::err, QNODE::field, lex_next(), N_CMP, node_free(), node_new(), npcre_new(), QNODE::op, OP_REGEX, parse_or(), QNODE::re, TK_AND, TK_LP, TK_NOT, TK_OP, TK_OR, TK_RP, TK_WORD, PARSER::tok, PARSER::top, PARSER::tval, and QNODE::value.
Referenced by parse_not().
Here is the call graph for this function:
Here is the caller graph for this function: