#ifndef V_PARSE_H
#define V_PARSE_H

#ifdef	CONFIG_SCANNER

typedef	vhandle_t	scanner_t;

#ifdef  __cplusplus
extern  "C" {
#endif	/* __cplusplus */
	/*
	 * Different constructors
	 */
	/* Create in-memory scanners; 'buffer' must be valid while scanning */
    scanner_t V_GLOBAL	tokParseString(char *buffer,char *delim);
    /*
    TODO
    scanner_t V_GLOBAL	tokParseBuffer(char *buffer,int buffer_len,char *delim);
    */
    /* File scanner */
    scanner_t V_GLOBAL	tokParseFile(char *filename,char *delim);
	/* Resets position to start, optionally (if args != NULL) 
	 * sets new source and delimiters. */
    void		V_GLOBAL	tokRestart(scanner_t tok,
    	char *new_buffer,char *new_delim);
	/* Saving/restoring scanner's cursor position */
    vboolean	V_GLOBAL	tokPush(scanner_t tok);
    vboolean	V_GLOBAL	tokPop(scanner_t tok);
	/*	Returns either string inside 'buffer' (if created  with
	 *	tokStart()), or string inside 'tok' (if created  with
	 *	tokStartFile()).
	 */
    char_p		V_GLOBAL	tokNext(scanner_t tok);
    /*
    TODO
    char_p		V_GLOBAL	tokNextEx(scanner_t tok,vboolean crossline);
    */
	/*
	 *	Same as tokNext(), whitespace and quotes handled as usual chars.
	 */
    char_p		V_GLOBAL	tokStrict(scanner_t tok);
    /*	Returns next string (i.e. sequence ended with EOL);
	 *	EOL itself NOT stored in result.
	 */
	char_p		V_GLOBAL	tokString(scanner_t tok);
    /*
	 *	Returns last result of tok[Next | Strict | String], or
     *	NULL if:
     *		- was no previous call to mentioned functions;
     *		- no more chars (or something else wrong).
	 */
	char_p		V_GLOBAL	tokLast(scanner_t tok);
	/*	Destroys scanner */
	void		V_GLOBAL	tokDestroy(scanner_t tok);
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* CONFIG_SCANNER */

#endif /* V_PARSE_H */
