libidav/davqlparser.h

changeset 78
ca7f024dd0f9
parent 77
c80bde9c5390
child 79
59c518ae0641
equal deleted inserted replaced
77:c80bde9c5390 78:ca7f024dd0f9
37 #include "ucx/list.h" 37 #include "ucx/list.h"
38 38
39 /** 39 /**
40 * Enumeration of possible statement types. 40 * Enumeration of possible statement types.
41 */ 41 */
42 typedef enum {GET, PUT} davqltype_t; 42 typedef enum {GET, SET} davqltype_t;
43 43
44 /** 44 /**
45 * Enumeration of possible expression types. 45 * Enumeration of possible expression types.
46 */ 46 */
47 typedef enum { 47 typedef enum {
53 * Enumeration of possible expression operators. 53 * Enumeration of possible expression operators.
54 */ 54 */
55 typedef enum { 55 typedef enum {
56 ADD, SUB, MUL, DIV, 56 ADD, SUB, MUL, DIV,
57 AND, OR, XOR, NEG, 57 AND, OR, XOR, NEG,
58 NOT, LAND, LOR, 58 NOT, LAND, LOR, LXOR,
59 EQ, NEQ, LT, GT, LE, GE 59 EQ, NEQ, LT, GT, LE, GE,
60 LIKE, UNLIKE
60 } davqloperator_t; 61 } davqloperator_t;
61 62
62 /** 63 /**
63 * An expression within a DAVQL query. 64 * An expression within a DAVQL query.
64 */ 65 */
99 * Query statement object. 100 * Query statement object.
100 * Contains the binary information about the parsed query. 101 * Contains the binary information about the parsed query.
101 * 102 *
102 * The grammar for a DavQLStatement is: 103 * The grammar for a DavQLStatement is:
103 * 104 *
105 * <pre>
106 * Expression = Expression BinaryOperator Expression
107 * | UnaryOperator Expression
108 * | FunctionCall | Identifier | Literal
109 * | "(", Expression, ")";
110 *
111 * FunctionCall = Identifier, "(", Expression, ")";
112 * Identifier = ?Character?, {?Character?};
113 * Literal = ?Digit?, {?Digit?} | String;
114 * String = "'", {?Character - "'"? | "'''"} , "'";
115 *
116 * LogicalExpression = LogicalExpression, LogicalOperator, LogicalExpression
117 * | "not ", LogicalExpression
118 * | Expression, Comparison, Expression
119 * | Expression, (" like " | " unlike "), String
120 * | "(", LogicalExpression, ")";
121 *
122 * UnaryOperator = "-" | "~";
123 * BinaryOperator = "+" | "-" | "*" | "/" | "&" | "|" | "^";
124 * LogicalOperator = " and " | " or " | " xor ";
125 * Comparison = | "=" | "<" | ">" | "<=" | ">=" | "!=";
126 *
127 * FieldExpressions = "*", {",", Expression, " as ", String}
128 * | FieldExpression, {",", FieldExpression};
129 * FieldExpression = Identifier
130 * | Expression, " as ", String;
131 * SetExpressions = SetExpression, {",", {SetExpressions};
132 * SetExpression = Identifier, "=", Expression;
133 *
134 * WithClause = "depth", "=", Expression;
135 *
136 * </pre>
137 *
138 * Note: mandatory spaces are part of the grammar. But you may also insert an
139 * arbitrary amount of optional spaces between two symbols if they are not part
140 * of an literal or identifier.
141 *
104 * <b>GET:</b> 142 * <b>GET:</b>
105 * document it so 143 * <pre>
106 * 144 * GetStatement = "get ", FieldExpressions,
107 * <b>PUT:</b> 145 * " from ", Identifier,
108 * make it so 146 * [" where ", LogicalExpression],
147 * [" with ", WithClause];
148 * </pre>
149 *
150 * <b>SET:</b>
151 * <pre>
152 * "set ",SetExpressions,
153 * " at ", Identifier,
154 * (" where ", LogicalExpression) | " anywhere",
155 * [" with ", WithClause];
156 * </pre>
109 * 157 *
110 */ 158 */
111 typedef struct { 159 typedef struct {
112 /** 160 /**
113 * The original query text. 161 * The original query text.
122 * <ul> 170 * <ul>
123 * <li> 171 * <li>
124 * GET: the list of queried fields (may contain arbitrary expressions) 172 * GET: the list of queried fields (may contain arbitrary expressions)
125 * </li> 173 * </li>
126 * <li> 174 * <li>
127 * PUT: the list of DAV properties that shall receive new values 175 * SET: the list of DAV properties that shall receive new values
128 * (must be a list of IDENTIFIER expressions) 176 * (must be a list of IDENTIFIER expressions)
129 * </li> 177 * </li>
130 * </ul> 178 * </ul>
131 * This may be <code>NULL</code> for GET queries, to request all properties. 179 * This may be <code>NULL</code> for GET queries, to request all properties.
132 */ 180 */
133 UcxList* fields; 181 UcxList* fields;
134 /** 182 /**
135 * The list of DavQLExpressions for the new DAV property values. 183 * The list of DavQLExpressions for the new DAV property values.
136 * This is <code>NULL</code> for GET queries. 184 * This is <code>NULL</code> for GET queries.
137 */ 185 */
138 UcxList* putvalues; 186 UcxList* setvalues;
139 /** 187 /**
140 * A DavQLExpression that denotes the queried path. 188 * A DavQLExpression that denotes the queried path.
141 */ 189 */
142 DavQLExpression from; 190 DavQLExpression from;
143 /** 191 /**

mercurial