X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fcql.y;h=25a4287ec108c296a5a28d00f5540e80b81324a0;hp=26702163cccff844c6e962ae3eab7d6e94962647;hb=82b56be0c22f75d8d40f295e09ca8b7c628fa530;hpb=a29d852d610296e871716c137337fb44510eee1d diff --git a/src/cql.y b/src/cql.y index 2670216..25a4287 100644 --- a/src/cql.y +++ b/src/cql.y @@ -1,13 +1,8 @@ -/* $Id: cql.y,v 1.17 2008-01-06 16:22:02 adam Exp $ - Copyright (C) 2002-2006 - Index Data ApS - -This file is part of the YAZ toolkit. - -See the file LICENSE. - - bison parser for CQL grammar. -*/ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data + * See the file LICENSE for details. + */ +/* bison parser for CQL grammar. */ %{ /** * \file cql.c @@ -58,7 +53,7 @@ See the file LICENSE. %} %pure_parser -%token DOTTERM TERM AND OR NOT PROX GE LE NE EXACT +%token DOTTERM TERM AND OR NOT PROX GE LE NE EXACT SORTBY %% @@ -66,12 +61,20 @@ top: { $$.rel = cql_node_mk_sc(((CQL_parser) parm)->nmem, "cql.serverChoice", "=", 0); ((CQL_parser) parm)->top = 0; -} cqlQuery1 { +} cqlQuery1 sortby { cql_node_destroy($$.rel); ((CQL_parser) parm)->top = $2.cql; } ; +sortby: /* empty */ +| SORTBY sortSpec; + +sortSpec: sortSpec singleSpec +| singleSpec; + +singleSpec: index modifiers ; + cqlQuery1: cqlQuery | cqlQuery error { cql_node_destroy($1.cql); @@ -208,6 +211,7 @@ searchTerm: | OR | NOT | PROX +| SORTBY ; %% @@ -363,6 +367,11 @@ int yylex(YYSTYPE *lval, void *vp) lval->buf = "prox"; return PROX; } + if (!cql_strcmp(lval->buf, "sortby")) + { + lval->buf = "sortby"; + return SORTBY; + } if (!cql_strcmp(lval->buf, "all")) relation_like = 1; if (!cql_strcmp(lval->buf, "any"))