YAZ_EXPORT
int cql_parser_stdio(CQL_parser cp, FILE *f);
+/** \brief configures strict mode
+ \param cp CQL parser
+ \param mode 1=enable strict mode, 0=disable strict mode
+
+ This function is similar to cql_parser_string but reads from
+ stdio FILE handle instead.
+*/
+YAZ_EXPORT
+void cql_parser_strict(CQL_parser cp, int mode);
+
/** \brief Node type: search term */
#define CQL_NODE_ST 1
/** \brief Node type: boolean */
int last_pos;
struct cql_node *top;
NMEM nmem;
+ int strict;
};
#define YYSTYPE token
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"))
cp->last_error = 0;
cp->last_pos = 0;
cp->nmem = nmem_create();
+ cp->strict = 0;
return cp;
}
return cp->top;
}
+void cql_parser_strict(CQL_parser cp, int mode)
+{
+ cp->strict = mode;
+}
+
/*
* Local variables:
* c-basic-offset: 4
static void usage(const char *prog)
{
- fprintf(stderr, "%s: [-c] [-n iterations] [-s] [infile]\n", prog);
+ fprintf(stderr, "%s: [-c] [-n iterations] [-s] [-S] [infile]\n", prog);
exit(1);
}
char *arg;
char *prog = argv[0];
int do_sortkeys = 0;
+ int do_strict = 0;
- while ((ret = options("cn:s", argv, argc, &arg)) != YAZ_OPTIONS_EOF)
+ while ((ret = options("cn:sS", argv, argc, &arg)) != YAZ_OPTIONS_EOF)
{
switch (ret)
{
case 's':
do_sortkeys = 1;
break;
+ case 'S':
+ do_strict = 1;
+ break;
default:
usage(prog);
}
}
cp = cql_parser_create();
+ cql_parser_strict(cp, do_strict);
if (fname)
{
int i;