CollectionParser
[Collections]

Generate a collection structure from a string pattern. More...

Functions

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

Detailed Description

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
 

Function Documentation

xmmsv_coll_t* xmmsv_coll_default_parse_build ( xmmsv_coll_token_t tokens  ) 

Default collection structure builder.

Parameters:
tokens The chained list of tokens.
Returns:
The corresponding collection structure.

Definition at line 365 of file collparser.c.

Referenced by xmmsv_coll_parse().

xmmsv_coll_token_t* xmmsv_coll_default_parse_tokens ( const char *  str,
const char **  newpos 
)

The default token parser.

Parameters:
str The string to parse for a token.
newpos The position in the string after the found token.
Returns:
The token found in the string.

Definition at line 215 of file collparser.c.

Referenced by xmmsv_coll_parse().

int xmmsv_coll_parse ( const char *  pattern,
xmmsv_coll_t **  coll 
)

Try to parse the given pattern to produce a collection structure.

Parameters:
pattern The string to generate a collection from.
coll The pointer to which the collection will be saved.
Returns:
TRUE if the parsing succeeded, false otherwise.

Definition at line 135 of file collparser.c.

int xmmsv_coll_parse_custom ( const char *  pattern,
xmmsv_coll_parse_tokens_f  parse_f,
xmmsv_coll_parse_build_f  build_f,
xmmsv_coll_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.

Parameters:
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.
Returns:
TRUE if the parsing succeeded, false otherwise.

Definition at line 160 of file collparser.c.

Referenced by xmmsv_coll_parse().


Generated on Tue Feb 23 18:17:57 2010 for XmmsClient by  doxygen 1.6.1