/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2011 Index Data
+ * Copyright (C) 1995-2013 Index Data
* See the file LICENSE for details.
*/
/**
#include <yaz/cql.h>
-static int cql_to_ccl_r(struct cql_node *cn,
+static int cql_to_ccl_r(struct cql_node *cn,
void (*pr)(const char *buf, void *client_data),
void *client_data);
for (cp = *cpp; *cp; cp++)
{
char x[4];
-
+
if (*cp == '\\' && cp[1])
{
if (!quote_mode)
}
pr("#", client_data);
}
- else if (*cp == ' ')
+ else if (*cp == ' ' && stop_at_space)
break;
else
{
*cpp = cp;
}
-static int node(struct cql_node *cn,
+static int node(struct cql_node *cn,
void (*pr)(const char *buf, void *client_data),
void *client_data)
{
{
pr(ccl_field, client_data);
pr(ccl_rel, client_data);
+ if (!split_op)
+ ccl_rel = 0;
}
pr_term(&cp, split_op ? 1 : 0, pr, client_data);
- if (!split_op)
- break;
while (*cp == ' ')
cp++;
if (*cp == '\0')
break;
pr(" ", client_data);
- pr(split_op, client_data);
- pr(" ", client_data);
+ if (split_op)
+ {
+ pr(split_op, client_data);
+ pr(" ", client_data);
+ }
}
if (cn->u.st.extra_terms)
{
}
-static int bool(struct cql_node *cn,
+static int bool(struct cql_node *cn,
void (*pr)(const char *buf, void *client_data),
void *client_data)
{
r = cql_to_ccl_r(cn->u.boolean.left, pr, client_data);
if (r)
return r;
-
+
pr(") ", client_data);
if (strcmp(value, "prox"))
return r;
}
-static int cql_to_ccl_r(struct cql_node *cn,
+static int cql_to_ccl_r(struct cql_node *cn,
void (*pr)(const char *buf, void *client_data),
void *client_data)
{
return -1;
}
-int cql_to_ccl(struct cql_node *cn,
+int cql_to_ccl(struct cql_node *cn,
void (*pr)(const char *buf, void *client_data),
void *client_data)
{