XmmsClient
|
Generate a collection structure from a string pattern. More...
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_t * | xmmsv_coll_default_parse_tokens (const char *str, const char **newpos) |
The default token parser. More... | |
xmmsv_t * | xmmsv_coll_default_parse_build (xmmsv_coll_token_t *tokens) |
Default collection structure builder. More... | |
Generate a collection structure from a string pattern.
The grammar of the default parser is the following:
S := OPERATION EXPR := POSSEQ | IDSEQ | FILTER | TOKEN_GROUP_OPEN OPERATION TOKEN_GROUP_CLOSE | UNARYOP PROP := TOKEN_PROP_LONG | TOKEN_PROP_SHORT INTVAL := INTEGER | SEQUENCE STRVAL := STRING | PATTERN POSSEQ := INTVAL IDSEQ := TOKEN_SYMBOL_ID INTVAL OPERATION := ANDOP UNAOP := TOKEN_OPSET_NOT EXPR | TOKEN_REFERENCE STRING ANDOP := OROP ANDOP | OROP TOKEN_OPSET_AND ANDOP | OROP OROP := EXPR TOKEN_OPSET_OR OROP | EXPR FILTER := UNAFILTER | BINFILTER | STRVAL UNAFILTER := TOKEN_OPFIL_HAS PROP BINFILTER := PROP TOKEN_OPFIL_EQUALS STRING | PROP TOKEN_OPFIL_MATCH STRVAL | PROP TOKEN_OPFIL_SMALLER INTEGER | PROP TOKEN_OPFIL_GREATER INTEGER | TOKEN_OPFIL_EQUALS STRING | TOKEN_OPFIL_MATCH STRVAL
xmmsv_t* xmmsv_coll_default_parse_build | ( | xmmsv_coll_token_t * | tokens | ) |
Default collection structure builder.
tokens | The chained list of tokens. |
Referenced by xmmsv_coll_parse().
xmmsv_coll_token_t* xmmsv_coll_default_parse_tokens | ( | const char * | str, |
const char ** | newpos | ||
) |
The default token parser.
str | The string to parse for a token. |
newpos | The position in the string after the found token. |
Referenced by xmmsv_coll_parse().
int xmmsv_coll_parse | ( | const char * | pattern, |
xmmsv_t ** | coll | ||
) |
Try to parse the given pattern to produce a collection structure.
pattern | The string to generate a collection from. |
coll | The pointer to which the collection will be saved. |
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.
This can be used to extend the default syntax of the parser.
New token ids can be used, starting from XMMS_COLLECTION_TOKEN_CUSTOM upwards.
pattern | The string to generate a collection from. |
parse_f | The parsing function used to generate a list of tokens from the pattern string. |
build_f | The building function that produces the collection structure from the list of tokens. |
coll | The pointer to which the collection will be saved. |
Referenced by xmmsv_coll_parse().