XmmsClient
Macros | Functions
collparser.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <xmmsclient/xmmsclient.h>
#include <xmmsclientpriv/xmmsclient.h>
#include <xmmsc/xmmsc_idnumbers.h>

Macros

#define XMMS_COLLECTION_PARSER_DEFAULT_NAMESPACE   "Collections"
 
#define TOKEN_MATCH_CHAR(symbol, type)   if (*tmp == (symbol)) { *newpos = tmp + 1; return coll_token_new (type, NULL); }
 
#define TOKEN_MATCH_STRING(expr, type)   if (strncmp (expr, tmp, strlen (expr)) == 0) { *newpos = tmp + strlen (expr); return coll_token_new (type, NULL); }
 
#define TOKEN_ASSERT(token, tktype)
 
#define PARSER_TRY(func)
 

Functions

int xmmsv_coll_parse (const char *pattern, xmmsv_t **coll)
 Try to parse the given pattern to produce a collection structure. More...
 
int xmmsv_coll_parse_custom (const char *pattern, xmmsv_coll_parse_tokens_f parse_f, xmmsv_coll_parse_build_f build_f, xmmsv_t **coll)
 Try to parse the given pattern to produce a collection structure, using custom token-parsing and collection-building functions. More...
 
xmmsv_coll_token_txmmsv_coll_default_parse_tokens (const char *str, const char **newpos)
 The default token parser. More...
 
xmmsv_txmmsv_coll_default_parse_build (xmmsv_coll_token_t *tokens)
 Default collection structure builder. More...
 

Macro Definition Documentation

#define PARSER_TRY (   func)
Value:
do { \
pos = func (tokens, &coll); \
if (coll) { \
*ret = coll; \
return pos; \
} \
} while (0)
#define TOKEN_ASSERT (   token,
  tktype 
)
Value:
do { \
if (!token || (token->type != tktype)) { \
*ret = NULL; \
return tokens; \
} \
} while (0)
#define TOKEN_MATCH_CHAR (   symbol,
  type 
)    if (*tmp == (symbol)) { *newpos = tmp + 1; return coll_token_new (type, NULL); }
#define TOKEN_MATCH_STRING (   expr,
  type 
)    if (strncmp (expr, tmp, strlen (expr)) == 0) { *newpos = tmp + strlen (expr); return coll_token_new (type, NULL); }
#define XMMS_COLLECTION_PARSER_DEFAULT_NAMESPACE   "Collections"