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
Remove SSL via OpenSSL support YAZ-732
[yaz-moved-to-github.git]
/
src
/
ccltoken.c
diff --git
a/src/ccltoken.c
b/src/ccltoken.c
index
f1f7708
..
a572ce2
100644
(file)
--- a/
src/ccltoken.c
+++ b/
src/ccltoken.c
@@
-1,16
+1,18
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
-/**
+/**
* \file ccltoken.c
* \brief Implements CCL lexical analyzer (scanner)
*/
* \file ccltoken.c
* \brief Implements CCL lexical analyzer (scanner)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
-
+#include <yaz/yaz-iconv.h>
#include "cclp.h"
/*
#include "cclp.h"
/*
@@
-101,7
+103,7
@@
struct ccl_token *ccl_parser_tokenize(CCL_parser cclp, const char *command)
case '%':
case '!':
last->kind = CCL_TOK_PROX;
case '%':
case '!':
last->kind = CCL_TOK_PROX;
- while (isdigit(*cp))
+ while (yaz_isdigit(*cp))
{
++ last->len;
cp++;
{
++ last->len;
cp++;
@@
-121,29
+123,39
@@
struct ccl_token *ccl_parser_tokenize(CCL_parser cclp, const char *command)
else
last->kind = CCL_TOK_REL;
break;
else
last->kind = CCL_TOK_REL;
break;
- case '\"':
+ default:
+ --cp;
+ --last->len;
+
last->kind = CCL_TOK_TERM;
last->name = (const char *) cp;
last->kind = CCL_TOK_TERM;
last->name = (const char *) cp;
- last->len = 0;
- while (*cp && *cp != '\"')
+ while (*cp && !strchr("(),%!><= \t\n\r", *cp))
{
{
- cp++;
- ++ last->len;
- }
- if (*cp == '\"')
- cp++;
- break;
- default:
- if (!strchr("(),%!><= \t\n\r", cp[-1]))
- {
- while (*cp && !strchr("(),%!><= \t\n\r", *cp))
+ if (*cp == '\\' && cp[1])
{
cp++;
++ last->len;
}
{
cp++;
++ last->len;
}
+ else if (*cp == '"')
+ {
+ while (*cp)
+ {
+ cp++;
+ ++ last->len;
+ if (*cp == '\\' && cp[1])
+ {
+ cp++;
+ ++ last->len;
+ }
+ else if (*cp == '"')
+ break;
+ }
+ }
+ if (!*cp)
+ break;
+ cp++;
+ ++ last->len;
}
}
- last->kind = CCL_TOK_TERM;
-
aliases = ccl_qual_search_special(cclp->bibset, "and");
if (!aliases)
aliases = cclp->ccl_token_and;
aliases = ccl_qual_search_special(cclp->bibset, "and");
if (!aliases)
aliases = cclp->ccl_token_and;
@@
-190,7
+202,7
@@
struct ccl_token *ccl_token_add(struct ccl_token *at)
n->ws_prefix_len = 0;
return n;
}
n->ws_prefix_len = 0;
return n;
}
-
+
/*
* ccl_token_del: delete CCL tokens
*/
/*
* ccl_token_del: delete CCL tokens
*/
@@
-198,7
+210,7
@@
void ccl_token_del(struct ccl_token *list)
{
struct ccl_token *list1;
{
struct ccl_token *list1;
- while (list)
+ while (list)
{
list1 = list->next;
xfree(list);
{
list1 = list->next;
xfree(list);