improved grammar + changed depth default, type and added infinity

Sat, 04 Apr 2015 17:44:33 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 04 Apr 2015 17:44:33 +0200
changeset 85
0ab1cf261a44
parent 84
7fca3788261d
child 86
ecba8bdf9741

improved grammar + changed depth default, type and added infinity

libidav/davqlparser.c file | annotate | diff | comparison | revisions
libidav/davqlparser.h file | annotate | diff | comparison | revisions
--- 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);
--- 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");
  * 
  * </pre>
  * 
@@ -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.

mercurial