9.2.2.1 `sic.c' & `sic.h'
Here are the functions for creating and managing sic parsers.
|
#ifndef SIC_SIC_H
#define SIC_SIC_H 1
#include <sic/common.h>
#include <sic/error.h>
#include <sic/list.h>
#include <sic/syntax.h>
typedef struct sic {
char *result; /* result string */
size_t len; /* bytes used by result field */
size_t lim; /* bytes allocated to result field */
struct builtintab *builtins; /* tables of builtin functions */
SyntaxTable **syntax; /* dispatch table for syntax of input */
List *syntax_init; /* stack of syntax state initialisers */
List *syntax_finish; /* stack of syntax state finalizers */
SicState *state; /* state data from syntax extensions */
} Sic;
#endif /* !SIC_SIC_H */
|
This structure has fields to store registered command (builtins )
and syntax (syntax ) handlers, along with other state information
(state ) that can be used to share information between various
handlers, and some room to build a result or error string (result ).
|