projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test_ccl: add special qualifier tests
[yaz-moved-to-github.git]
/
src
/
cclfind.c
diff --git
a/src/cclfind.c
b/src/cclfind.c
index
a80f154
..
3cbeacf
100644
(file)
--- a/
src/cclfind.c
+++ b/
src/cclfind.c
@@
-212,6
+212,19
@@
void ccl_add_attr_string(struct ccl_rpn_node *p, const char *set,
n->value.str = xstrdup(value);
}
n->value.str = xstrdup(value);
}
+static size_t cmp_operator(const char **aliases, const char *input)
+{
+ for (; *aliases; aliases++)
+ {
+ const char *cp = *aliases;
+ size_t i;
+ for (i = 0; *cp && *cp == input[i]; i++, cp++)
+ ;
+ if (*cp == '\0')
+ return i;
+ }
+ return 0;
+}
#define REGEX_CHARS "^[]{}()|.*+?!$"
#define CCL_CHARS "#?\\"
#define REGEX_CHARS "^[]{}()|.*+?!$"
#define CCL_CHARS "#?\\"
@@
-385,11
+398,12
@@
static struct ccl_rpn_node *search_term_x(CCL_parser cclp,
if (p->u.t.term[0] && cclp->look_token->ws_prefix_len)
{
if (p->u.t.term[0] && cclp->look_token->ws_prefix_len)
{
- strxcat(p->u.term, cclp->look_token->ws_prefix_buf,
+ strxcat(p->u.t.term, cclp->look_token->ws_prefix_buf,
cclp->look_token->ws_prefix_len);
}
for (j = 0; j < src_len; j++)
{
cclp->look_token->ws_prefix_len);
}
for (j = 0; j < src_len; j++)
{
+ size_t op_size;
if (j > 0 && src_str[j-1] == '\\')
{
if (regex_trunc && strchr(REGEX_CHARS "\\", src_str[j]))
if (j > 0 && src_str[j-1] == '\\')
{
if (regex_trunc && strchr(REGEX_CHARS "\\", src_str[j]))
@@
-406,8
+420,12
@@
static struct ccl_rpn_node *search_term_x(CCL_parser cclp,
}
else if (src_str[j] == '"')
quote_mode = !quote_mode;
}
else if (src_str[j] == '"')
quote_mode = !quote_mode;
- else if (!quote_mode && src_str[j] == '?')
+ else if (!quote_mode &&
+ (op_size = cmp_operator(truncation_aliases,
+ src_str + j))
+ )
{
{
+ j += (op_size - 1); /* j++ in for loop */
if (regex_trunc)
{
strcat(p->u.t.term, ".*");
if (regex_trunc)
{
strcat(p->u.t.term, ".*");