|
9.2.2.4 `syntax.c' & `syntax.h'
When tokenize splits a char * string into parts, by
default it breaks the string into words delimited by whitespace. These
files define the interface for changing this default behaviour, by
registering callback functions which the parser will run when it meets
an `interesting' symbol in the input stream. Here are the
declarations from `syntax.h':
|
BEGIN_C_DECLS
typedef int SyntaxHandler (struct sic *sic, BufferIn *in,
BufferOut *out);
typedef struct syntax {
SyntaxHandler *handler;
char *ch;
} Syntax;
extern int syntax_install (struct sic *sic, Syntax *table);
extern SyntaxHandler *syntax_handler (struct sic *sic, int ch);
END_C_DECLS
|
A SyntaxHandler is a function called by tokenize as it
consumes its input to create a Tokens structure; the two
functions associate a table of such handlers with a given Sic
parser, and find the particular handler for a given character in that
Sic parser, respectively.
|