X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fcql.y;h=20013cb2489577457bacafe6b004c0896e36feb3;hb=3b792849c676d96918850e2f1e0af87a75278501;hp=1086549135ef97bed750f6856ca3c96d8abe41f4;hpb=87ca9b11fd146605fc3b54fcafbcad9869487295;p=yaz-moved-to-github.git diff --git a/src/cql.y b/src/cql.y index 1086549..20013cb 100644 --- a/src/cql.y +++ b/src/cql.y @@ -1,6 +1,6 @@ -/* $Id: cql.y,v 1.8 2004-11-01 20:13:02 adam Exp $ - Copyright (C) 2002-2004 - Index Data Aps +/* $Id: cql.y,v 1.15 2007-10-31 21:58:07 adam Exp $ + Copyright (C) 2002-2006 + Index Data ApS This file is part of the YAZ toolkit. @@ -135,13 +135,12 @@ searchClause: /* unary NOT search TERM here .. */ boolean: - AND | OR | NOT | PROX - ; + AND | OR | NOT | PROX ; modifiers: modifiers '/' searchTerm { struct cql_node *mod = cql_node_mk_sc(((CQL_parser)parm)->nmem, - $3.buf, "=", 0); + $3.buf, 0, 0); mod->u.st.modifiers = $1.cql; $$.cql = mod; @@ -279,34 +278,56 @@ int yylex(YYSTYPE *lval, void *vp) while ((c = cp->getbyte(cp->client_data)) != 0 && c != '"') { if (c == '\\') + { + putb(lval, cp, c); c = cp->getbyte(cp->client_data); - putb(lval, cp, c); + if (!c) + break; + } + putb(lval, cp, c); } putb(lval, cp, 0); } else { - putb(lval, cp, c); - while ((c = cp->getbyte(cp->client_data)) != 0 && - !strchr(" \n()=<>/", c)) + while (c != 0 && !strchr(" \n()=<>/", c)) { if (c == '\\') + { + putb(lval, cp, c); c = cp->getbyte(cp->client_data); + if (!c) + break; + } putb(lval, cp, c); + c = cp->getbyte(cp->client_data); } + putb(lval, cp, 0); #if YYDEBUG printf ("got %s\n", lval->buf); #endif if (c != 0) cp->ungetbyte(c, cp->client_data); - if (!strcmp(lval->buf, "and")) + if (!cql_strcmp(lval->buf, "and")) + { + lval->buf = "and"; return AND; - if (!strcmp(lval->buf, "or")) + } + if (!cql_strcmp(lval->buf, "or")) + { + lval->buf = "or"; return OR; - if (!strcmp(lval->buf, "not")) + } + if (!cql_strcmp(lval->buf, "not")) + { + lval->buf = "not"; return NOT; - if (!strncmp(lval->buf, "prox", 4)) + } + if (!cql_strcmp(lval->buf, "prox")) + { + lval->buf = "prox"; return PROX; + } } return TERM; }