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
Flag zero-zero as error in completeBER
[yaz-moved-to-github.git]
/
cql
/
cql.y
diff --git
a/cql/cql.y
b/cql/cql.y
index
0bcc9cb
..
026dd36
100644
(file)
--- a/
cql/cql.y
+++ b/
cql/cql.y
@@
-1,4
+1,4
@@
-/* $Id: cql.y,v 1.2 2003-01-11 03:18:53 adam Exp $
+/* $Id: cql.y,v 1.6 2003-09-04 18:13:39 adam Exp $
Copyright (C) 2002-2003
Index Data Aps
Copyright (C) 2002-2003
Index Data Aps
@@
-13,14
+13,15
@@
See the file LICENSE.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <yaz/nmem.h>
#include <yaz/cql.h>
typedef struct {
struct cql_node *rel;
struct cql_node *cql;
#include <yaz/cql.h>
typedef struct {
struct cql_node *rel;
struct cql_node *cql;
- char buf[80];
+ char *buf;
size_t len;
size_t len;
- size_t max;
+ size_t size;
} token;
struct cql_parser {
} token;
struct cql_parser {
@@
-30,6
+31,7
@@
See the file LICENSE.
int last_error;
int last_pos;
struct cql_node *top;
int last_error;
int last_pos;
struct cql_node *top;
+ NMEM nmem;
};
#define YYSTYPE token
};
#define YYSTYPE token
@@
-42,7
+44,7
@@
See the file LICENSE.
%}
%pure_parser
%}
%pure_parser
-%token TERM AND OR NOT PROX EXACT ALL ANY GE LE NE SCR
+%token TERM AND OR NOT PROX GE LE NE
%expect 8
%%
%expect 8
%%
@@
-71,9
+73,9
@@
cqlQuery:
} searchClause {
struct cql_node *cn = cql_node_mk_boolean($2.buf);
} searchClause {
struct cql_node *cn = cql_node_mk_boolean($2.buf);
- cn->u.bool.modifiers = $2.rel;
- cn->u.bool.left = $1.cql;
- cn->u.bool.right = $4.cql;
+ cn->u.boolean.modifiers = $2.rel;
+ cn->u.boolean.left = $1.cql;
+ cn->u.boolean.right = $4.cql;
$$.cql = cn;
}
$$.cql = cn;
}
@@
-112,6
+114,8
@@
searchClause:
}
;
}
;
+/* unary NOT search TERM here .. */
+
boolean:
AND | OR | NOT | PROX proxqualifiers {
$$ = $1;
boolean:
AND | OR | NOT | PROX proxqualifiers {
$$ = $1;
@@
-204,10
+208,7
@@
baseRelation:
| GE
| LE
| NE
| GE
| LE
| NE
-| EXACT
-| ALL
-| ANY
-| SCR
+| TERM
;
index:
;
index:
@@
-218,9
+219,6
@@
searchTerm:
| AND
| OR
| NOT
| AND
| OR
| NOT
-| EXACT
-| ALL
-| ANY
| PROX
;
| PROX
;
@@
-242,6
+240,8
@@
int cql_parser_stream(CQL_parser cp,
cp->getbyte = getbyte;
cp->ungetbyte = ungetbyte;
cp->client_data = client_data;
cp->getbyte = getbyte;
cp->ungetbyte = ungetbyte;
cp->client_data = client_data;
+ if (cp->top)
+ cql_node_destroy(cp->top);
cql_parse(cp);
if (cp->top)
return 0;
cql_parse(cp);
if (cp->top)
return 0;
@@
-250,14
+250,22
@@
int cql_parser_stream(CQL_parser cp,
CQL_parser cql_parser_create(void)
{
CQL_parser cql_parser_create(void)
{
- CQL_parser cp = malloc (sizeof(*cp));
-
+ CQL_parser cp = (CQL_parser) malloc (sizeof(*cp));
+
+ cp->top = 0;
+ cp->getbyte = 0;
+ cp->ungetbyte = 0;
+ cp->client_data = 0;
+ cp->last_error = 0;
+ cp->last_pos = 0;
+ cp->nmem = nmem_create();
return cp;
}
void cql_parser_destroy(CQL_parser cp)
{
cql_node_destroy(cp->top);
return cp;
}
void cql_parser_destroy(CQL_parser cp)
{
cql_node_destroy(cp->top);
+ nmem_destroy(cp->nmem);
free (cp);
}
free (cp);
}