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
yaz-iconv: fix typos
[yaz-moved-to-github.git]
/
src
/
cql.y
diff --git
a/src/cql.y
b/src/cql.y
index
d1d5d1b
..
ed5735d
100644
(file)
--- a/
src/cql.y
+++ b/
src/cql.y
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/* bison parser for CQL grammar. */
* See the file LICENSE for details.
*/
/* bison parser for CQL grammar. */
@@
-16,6
+16,10
@@
#endif
#include <stdio.h>
#include <stdlib.h>
#endif
#include <stdio.h>
#include <stdlib.h>
+/* avoid that bison stuff defines malloc/free - already in stdlib.h */
+#ifdef _MSC_VER
+#define _STDLIB_H 1
+#endif
#include <string.h>
#include <yaz/yaz-iconv.h>
#include <yaz/xmalloc.h>
#include <string.h>
#include <yaz/yaz-iconv.h>
#include <yaz/xmalloc.h>
@@
-44,18
+48,20
@@
int last_pos;
struct cql_node *top;
NMEM nmem;
int last_pos;
struct cql_node *top;
NMEM nmem;
+ int strict;
};
#define YYSTYPE token
};
#define YYSTYPE token
-#define YYPARSE_PARAM parm
-#define YYLEX_PARAM parm
+int yylex(YYSTYPE *lval, void *vp);
+int yyerror(void *lval, char *msg);
- int yylex(YYSTYPE *lval, void *vp);
- int yyerror(char *s);
%}
%}
-%pure_parser
+
+%lex-param {void *parm}
+%parse-param {void *parm}
+%pure-parser
%token PREFIX_NAME SIMPLE_STRING AND OR NOT PROX GE LE NE EXACT SORTBY
%%
%token PREFIX_NAME SIMPLE_STRING AND OR NOT PROX GE LE NE EXACT SORTBY
%%
@@
-228,7
+234,7
@@
searchTerm:
%%
%%
-int yyerror(char *s)
+int yyerror(void *locp, char *s)
{
return 0;
}
{
return 0;
}
@@
-384,6
+390,8
@@
int yylex(YYSTYPE *lval, void *vp)
lval->buf = "sortby";
return SORTBY;
}
lval->buf = "sortby";
return SORTBY;
}
+ if (cp->strict)
+ return PREFIX_NAME;
if (!cql_strcmp(lval->buf, "all"))
relation_like = 1;
if (!cql_strcmp(lval->buf, "any"))
if (!cql_strcmp(lval->buf, "all"))
relation_like = 1;
if (!cql_strcmp(lval->buf, "any"))
@@
-424,6
+432,7
@@
CQL_parser cql_parser_create(void)
cp->last_error = 0;
cp->last_pos = 0;
cp->nmem = nmem_create();
cp->last_error = 0;
cp->last_pos = 0;
cp->nmem = nmem_create();
+ cp->strict = 0;
return cp;
}
return cp;
}
@@
-439,6
+448,11
@@
struct cql_node *cql_parser_result(CQL_parser cp)
return cp->top;
}
return cp->top;
}
+void cql_parser_strict(CQL_parser cp, int mode)
+{
+ cp->strict = mode;
+}
+
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4