# HG changeset patch # User Mike Becker # Date 1428162273 -7200 # Node ID 0ab1cf261a44b8d08e7716ed3a8ce37e909eaf2b # Parent 7fca3788261d3b9fa7c02cabc1ec191dc9294254 improved grammar + changed depth default, type and added infinity diff -r 7fca3788261d -r 0ab1cf261a44 libidav/davqlparser.c --- a/libidav/davqlparser.c Fri Apr 03 14:53:28 2015 +0200 +++ b/libidav/davqlparser.c Sat Apr 04 17:44:33 2015 +0200 @@ -105,10 +105,10 @@ } // WITH attributes - if (stmt->depth == SIZE_MAX) { - printf("Depth: unbound\n"); + if (stmt->depth < 0) { + printf("Depth: infinity\n"); } else { - printf("Depth: %zu\n", stmt->depth); + printf("Depth: %d\n", stmt->depth); } } @@ -426,7 +426,7 @@ // default values stmt->type = -1; - stmt->depth = SIZE_MAX; + stmt->depth = 1; // save trimmed source text stmt->srctext = sstrtrim(srctext); diff -r 7fca3788261d -r 0ab1cf261a44 libidav/davqlparser.h --- a/libidav/davqlparser.h Fri Apr 03 14:53:28 2015 +0200 +++ b/libidav/davqlparser.h Sat Apr 04 17:44:33 2015 +0200 @@ -114,7 +114,8 @@ * Identifier = IdentifierChar - ?Digit?, {IdentifierChar} * | "`", ?Character?, {?Character?}, "`"; * IdentifierChar = ?Character - (" "|",")?; - * Literal = ?Digit?, {?Digit?} | String; + * Literal = Number | String; + * Number = ?Digit?, {?Digit?} | "%d"; * String = "'", {?Character - "'"? | "'''"} , "'"; * * LogicalExpression = LogicalExpression, LogicalOperator, LogicalExpression @@ -135,7 +136,7 @@ * SetExpressions = SetExpression, {",", {SetExpressions}; * SetExpression = Identifier, "=", Expression; * - * WithClause = "depth", "=", Expression; + * WithClause = "depth", "=", (Number | "infinity"); * * * @@ -189,11 +190,16 @@ DavQLExpression* where; /** * The recursion depth for the statement. - * Defaults to SIZE_MAX (unbound recursion). + * Defaults to 1. */ - size_t depth; + int depth; } DavQLStatement; +/** + * Infinity recursion depth for a DavQLStatement. + */ +#define DAV_DEPTH_INFINITY -1 + /** * Starts an interactive debugger for a DavQLStatement.