From: Adam Dickmeiss Date: Tue, 16 Jun 2009 10:53:17 +0000 (+0200) Subject: CQL sortby parsing, no semantics yet X-Git-Tag: v3.0.47~2^2 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=82b56be0c22f75d8d40f295e09ca8b7c628fa530;p=yaz-moved-to-github.git CQL sortby parsing, no semantics yet --- diff --git a/src/cql.y b/src/cql.y index c6151a2..25a4287 100644 --- a/src/cql.y +++ b/src/cql.y @@ -53,7 +53,7 @@ %} %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 %% @@ -61,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); @@ -203,6 +211,7 @@ searchTerm: | OR | NOT | PROX +| SORTBY ; %% @@ -358,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"))