--- a/libidav/davqlparser.h Tue Mar 31 10:18:55 2015 +0200 +++ b/libidav/davqlparser.h Tue Mar 31 13:00:17 2015 +0200 @@ -40,14 +40,14 @@ /** * Enumeration of possible statement types. */ -typedef enum {GET, SET} davqltype_t; +typedef enum {DAVQL_ERROR, DAVQL_GET, DAVQL_SET} davqltype_t; /** * Enumeration of possible expression types. */ typedef enum { - LITERAL, IDENTIFIER, - UNARY, BINARY, LOGICAL, FUNCCALL + DAVQL_LITERAL, DAVQL_IDENTIFIER, + DAVQL_UNARY, DAVQL_BINARY, DAVQL_LOGICAL, DAVQL_FUNCCALL } davqlexprtype_t; /** @@ -104,15 +104,17 @@ * The grammar for a DavQLStatement is: * * <pre> - * Expression = Expression BinaryOperator Expression - * | UnaryOperator Expression + * Expression = Expression, BinaryOperator, Expression + * | UnaryOperator, Expression * | FunctionCall | Identifier | Literal * | "(", Expression, ")"; * - * FunctionCall = Identifier, "(", Expression, ")"; - * Identifier = ?Character?, {?Character?}; - * Literal = ?Digit?, {?Digit?} | String; - * String = "'", {?Character - "'"? | "'''"} , "'"; + * FunctionCall = Identifier, "(", Expression, ")"; + * Identifier = IdentifierChar, {IdentifierChar} + * | "`", ?Character?, {?Character?}, "`"; + * IdentifierChar = ?Character - (" "|",")?; + * Literal = ?Digit?, {?Digit?} | String; + * String = "'", {?Character - "'"? | "'''"} , "'"; * * LogicalExpression = LogicalExpression, LogicalOperator, LogicalExpression * | "not ", LogicalExpression @@ -178,7 +180,7 @@ /** * A DavQLExpression that denotes the queried path. */ - DavQLExpression path; + DavQLExpression* path; /** * Logical expression for selection. * <code>NULL</code>, if there is no where clause. @@ -197,7 +199,7 @@ * * @param stmt the statement to debug */ -void dav_debug_ql_statement(DavQLStatement *stmt); +void dav_debug_statement(DavQLStatement *stmt); /** * Parses a statement. @@ -211,6 +213,12 @@ */ #define dav_parse_cstr_statement(stmt) dav_parse_statement(S(stmt)) +/** + * Frees a DavQLStatement. + * @param stmt the statement object to free + */ +void dav_free_statement(DavQLStatement *stmt); + #ifdef __cplusplus } #endif