libidav/davqlparser.h

changeset 78
ca7f024dd0f9
parent 77
c80bde9c5390
child 79
59c518ae0641
--- a/libidav/davqlparser.h	Mon Mar 23 15:48:45 2015 +0100
+++ b/libidav/davqlparser.h	Tue Mar 24 12:02:47 2015 +0100
@@ -39,7 +39,7 @@
 /**
  * Enumeration of possible statement types.
  */
-typedef enum {GET, PUT} davqltype_t;
+typedef enum {GET, SET} davqltype_t;
 
 /**
  * Enumeration of possible expression types.
@@ -55,8 +55,9 @@
 typedef enum {
     ADD, SUB, MUL, DIV,
     AND, OR, XOR, NEG,
-    NOT, LAND, LOR,
-    EQ, NEQ, LT, GT, LE, GE
+    NOT, LAND, LOR, LXOR,
+    EQ, NEQ, LT, GT, LE, GE,
+    LIKE, UNLIKE
 } davqloperator_t;
 
 /**
@@ -101,11 +102,58 @@
  * 
  * The grammar for a DavQLStatement is:
  * 
- * <b>GET:</b>
- * document it so
+ * <pre>
+ * Expression = Expression BinaryOperator Expression
+ *            | UnaryOperator Expression
+ *            | FunctionCall | Identifier | Literal
+ *            | "(", Expression, ")";
+ * 
+ * FunctionCall = Identifier, "(", Expression, ")";
+ * Identifier   = ?Character?, {?Character?};
+ * Literal      = ?Digit?, {?Digit?} | String;
+ * String       = "'", {?Character - "'"? | "'''"} , "'";
+ * 
+ * LogicalExpression = LogicalExpression, LogicalOperator, LogicalExpression
+ *                   | "not ", LogicalExpression
+ *                   | Expression, Comparison, Expression
+ *                   | Expression, (" like " | " unlike "), String
+ *                   | "(", LogicalExpression, ")";
+ * 
+ * UnaryOperator   = "-" | "~";
+ * BinaryOperator  = "+" | "-" | "*" | "/" | "&" | "|" | "^";
+ * LogicalOperator = " and " | " or " | " xor ";
+ * Comparison      = | "=" | "<" | ">" | "<=" | ">=" | "!=";
  * 
- * <b>PUT:</b>
- * make it so
+ * FieldExpressions = "*", {",", Expression, " as ", String}
+ *                  | FieldExpression, {",", FieldExpression};
+ * FieldExpression  = Identifier
+ *                  | Expression, " as ", String;
+ * SetExpressions   = SetExpression, {",", {SetExpressions};
+ * SetExpression    = Identifier, "=", Expression;
+ * 
+ * WithClause = "depth", "=", Expression;
+ * 
+ * </pre>
+ * 
+ * Note: mandatory spaces are part of the grammar. But you may also insert an
+ * arbitrary amount of optional spaces between two symbols if they are not part
+ * of an literal or identifier.
+ * 
+ * <b>GET:</b>
+ * <pre>
+ * GetStatement = "get ", FieldExpressions,
+ * " from ", Identifier,
+ * [" where ", LogicalExpression],
+ * [" with ", WithClause];
+  * </pre>
+ * 
+ * <b>SET:</b>
+ * <pre>
+ * "set ",SetExpressions,
+ * " at ", Identifier,
+ * (" where ", LogicalExpression) | " anywhere",
+ * [" with ", WithClause];
+ * </pre>
  * 
  */
 typedef struct {
@@ -124,7 +172,7 @@
      * GET: the list of queried fields (may contain arbitrary expressions)
      * </li>
      * <li>
-     * PUT: the list of DAV properties that shall receive new values
+     * SET: the list of DAV properties that shall receive new values
      * (must be a list of IDENTIFIER expressions)
      * </li>
      * </ul>
@@ -135,7 +183,7 @@
      * The list of DavQLExpressions for the new DAV property values.
      * This is <code>NULL</code> for GET queries.
      */
-    UcxList* putvalues;
+    UcxList* setvalues;
     /**
      * A DavQLExpression that denotes the queried path.
      */

mercurial