Fri, 05 Jun 2015 10:10:14 +0200
added missing keywords + fixed missing source text for boolean primaries
libidav/davqlparser.c | file | annotate | diff | comparison | revisions | |
libidav/davqlparser.h | file | annotate | diff | comparison | revisions |
--- a/libidav/davqlparser.c Wed Jun 03 11:47:38 2015 +0200 +++ b/libidav/davqlparser.c Fri Jun 05 10:10:14 2015 +0200 @@ -435,7 +435,9 @@ static _Bool iskeyword(DavQLToken *token) { sstr_t keywords[] ={ST("select"), ST("set"), ST("from"), ST("at"), ST("as"), - ST("where"), ST("with"), ST("order"), ST("by"), ST("asc"), ST("desc") + ST("where"), ST("anywhere"), ST("like"), ST("unlike"), ST("and"), + ST("or"), ST("not"), ST("xor"), ST("with"), ST("infinity"), + ST("order"), ST("by"), ST("asc"), ST("desc") }; for (int i = 0 ; i < sizeof(keywords)/sizeof(sstr_t) ; i++) { if (!sstrcasecmp(token->value, keywords[i])) { @@ -1067,6 +1069,7 @@ DavQLExpression *expr) { expr->type = DAVQL_LOGICAL; + expr->srctext = token_sstr(token); int total_consumed = 0; @@ -1093,6 +1096,8 @@ dqlsec_mallocz(stmt, expr->right, DavQLExpression); expr->right->type = DAVQL_STRING; expr->right->srctext = token_sstr(token); + expr->srctext.length = expr->right->srctext.ptr - + expr->srctext.ptr + expr->right->srctext.length; return total_consumed + 1; } else { @@ -1149,6 +1154,9 @@ memcpy(expr->left, &bexpr, sizeof(DavQLExpression)); dqlsec_malloc(stmt, expr->right, DavQLExpression); memcpy(expr->right, &rexpr, sizeof(DavQLExpression)); + + expr->srctext.length = expr->right->srctext.ptr - + expr->srctext.ptr + expr->right->srctext.length; return total_consumed; }
--- a/libidav/davqlparser.h Wed Jun 03 11:47:38 2015 +0200 +++ b/libidav/davqlparser.h Fri Jun 05 10:10:14 2015 +0200 @@ -157,7 +157,9 @@ * The grammar for a DavQLStatement is: * * <pre> - * Keyword = "select" | "set" | "from" | "at" | "as" | "where" | "with" + * Keyword = "select" | "set" | "from" | "at" | "as" + * | "where" | "anywhere" | "like" | "unlike" + * | "and" | "or" | "not" | "xor" | "with" | "infinity" * | "order" | "by" | "asc" | "desc"; * * Expression = AddExpression; @@ -229,7 +231,7 @@ * * <b>SET:</b> * <pre> - * "set ",SetExpressions, + * SetStatement = "set ",SetExpressions, * " at ", Path, * [" with ", WithClause], * (" where ", LogicalExpression) | " anywhere";