# HG changeset patch # User Mike Becker # Date 1513882107 -3600 # Node ID bacb54502b24c337ad15cfbca9cbfd53f5961508 # Parent 54dbd44ac6b0444b545049ef45d5568999aa2b05 davql: allow ANYWHERE keyword in SELECT statements This may seem pointless, but users might want to be explicit about this and the grammar is more consistent. This commit also adds some no-ops to the functions body of the SET parser, because some day the grammar might allow more clauses after the WHERE clause. diff -r 54dbd44ac6b0 -r bacb54502b24 libidav/davqlparser.c --- a/libidav/davqlparser.c Thu Dec 21 19:42:25 2017 +0100 +++ b/libidav/davqlparser.c Thu Dec 21 19:48:27 2017 +0100 @@ -1613,6 +1613,11 @@ tokens = tokens->next; tokens = ucx_list_get(tokens, dav_parse_where_clause(stmt, tokens)); + } else if (token_is(tokens, DAVQL_TOKEN_KEYWORD) + && tokenvalue_is(tokens, "anywhere")) { + // useless, but the user may want to explicitly express his intent + tokens = tokens->next; + stmt->where = NULL; } if (stmt->errorcode) { return; @@ -1694,10 +1699,12 @@ } else if (token_is(tokens, DAVQL_TOKEN_KEYWORD) && tokenvalue_is(tokens, "anywhere")) { // no-op, but we want the user to be explicit about this + tokens = tokens->next; stmt->where = NULL; } else { dav_error_in_context(DAVQL_ERROR_MISSING_TOKEN, _error_missing_where, stmt, tokens); + return; } } diff -r 54dbd44ac6b0 -r bacb54502b24 libidav/davqlparser.h --- a/libidav/davqlparser.h Thu Dec 21 19:42:25 2017 +0100 +++ b/libidav/davqlparser.h Thu Dec 21 19:48:27 2017 +0100 @@ -225,7 +225,7 @@ * SelectStatement = "select ", FieldExpressions, * " from ", Path, * [" with ", WithClause], - * [" where ", LogicalExpression], + * [(" where ", LogicalExpression) | " anywhere"], * [" order by ", OrderByClause]; * *