projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
cpp
[m6w6/ext-psi]
/
src
/
parser.h
diff --git
a/src/parser.h
b/src/parser.h
index f75fc8b2e4cee8a9c3ac087fce772c408f651559..07dc563908085b119f7aa4c64e1edeb9bc0f43b2 100644
(file)
--- a/
src/parser.h
+++ b/
src/parser.h
@@
-26,57
+26,38
@@
#ifndef PSI_PARSER_H
#define PSI_PARSER_H
#ifndef PSI_PARSER_H
#define PSI_PARSER_H
-#include <stdarg.h>
-
-#define BSIZE 256
-
#include "token.h"
#include "types.h"
#include "data.h"
#include "token.h"
#include "types.h"
#include "data.h"
+#include "cpp.h"
struct psi_parser {
PSI_DATA_MEMBERS;
token_t num;
unsigned line, col;
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;
/* internals */
void *proc;
+ struct psi_cpp_data cpp;
struct {
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);
} 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_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
#endif