#define PSI_ERROR 16
#define PSI_WARNING 32
-typedef void (*psi_error_cb)(PSI_Token *token, int type, const char *msg, ...);
+typedef void (*psi_error_cb)(void *context, PSI_Token *token, int type, const char *msg, ...);
#define PSI_DATA(D) ((PSI_Data *) (D))
#define PSI_DATA_MEMBERS \
decl_file file; \
decl_libs libs; \
} psi; \
- psi_error_cb error
+ psi_error_cb error; \
+ unsigned errors; \
+ unsigned flags
typedef struct PSI_Data {
PSI_DATA_MEMBERS;
} PSI_Data;
FILE *fp;
token_t num;
void *proc;
- unsigned flags, errors, line, col;
+ unsigned line, col;
char *cur, *tok, *lim, *eof, *ctx, *mrk, buf[BSIZE];
} PSI_Parser;
}
#define PSI_PARSER_DEBUG 0x1
+#define PSI_PARSER_SILENT 0x2
PSI_Parser *PSI_ParserInit(PSI_Parser *P, const char *filename, psi_error_cb error, unsigned flags);
void PSI_ParserSyntaxError(PSI_Parser *P, const char *fn, size_t ln, const char *msg, ...);