#ifndef PSI_PARSER_H
#define PSI_PARSER_H
-#include <stdarg.h>
-
-#define BSIZE 256
-
#include "token.h"
#include "types.h"
#include "data.h"
+#include "cpp.h"
struct psi_parser {
PSI_DATA_MEMBERS;
token_t num;
unsigned line, col;
- char *cur, *tok, *lim, *eof, *ctx, *mrk;
+ char *cur, *tok, *lim, *ctx, *mrk;
/* internals */
void *proc;
+ struct psi_cpp_data cpp;
struct {
- HashTable defs;
- unsigned level;
- unsigned skip;
- } cpp;
-
- struct {
- enum psi_parser_input_type {
- PSI_PARSE_FILE = 1,
- PSI_PARSE_STRING
- } type;
-
- union {
- struct {
- FILE *handle;
- char *buffer;
-#if HAVE_MMAP
- size_t length;
-#endif
- } file;
- struct {
- char *buffer;
- size_t length;
- } string;
- } data;
+ char *buffer;
+ size_t length;
} input;
};
struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags);
bool psi_parser_open_file(struct psi_parser *P, const char *filename);
bool psi_parser_open_string(struct psi_parser *P, const char *string, size_t length);
-token_t psi_parser_scan(struct psi_parser *P);
-void psi_parser_parse(struct psi_parser *P, struct psi_token *src);
+struct psi_plist *psi_parser_scan(struct psi_parser *P);
+void psi_parser_parse(struct psi_parser *P);
void psi_parser_dtor(struct psi_parser *P);
void psi_parser_free(struct psi_parser **P);
+void *psi_parser_proc_init(void);
+void psi_parser_proc_free(void **parser_proc);
+void psi_parser_proc_parse(void *parser_proc, token_t r, struct psi_token *token, struct psi_parser *parser);
+void psi_parser_proc_trace(FILE *out, char *prefix);
+
#endif