parsing prefix version (binary operators) of msph
This commit is contained in:
parent
7e5f080282
commit
17be15d7b5
12 changed files with 617 additions and 92 deletions
|
@ -69,15 +69,18 @@ enum msph_tok_type {
|
|||
TOK_IDENT, // identifiers
|
||||
TOK_INVAL, // special: invalid, use to mark invalid toks
|
||||
TOK_WSPACE, // special: whitespace
|
||||
TOK_END // special: denote end of array
|
||||
TOK_END // special: end of array/token stream
|
||||
};
|
||||
|
||||
#define MSPH_TAB_WIDTH 8
|
||||
|
||||
union msph_token_data {
|
||||
char str[MSPH_IDENT_LEN];
|
||||
};
|
||||
|
||||
struct msph_token {
|
||||
int type;
|
||||
struct msph_text_pos pos;
|
||||
union msph_token_data data;
|
||||
|
||||
SLIST_ENTRY(msph_token) entries;
|
||||
|
@ -110,21 +113,23 @@ union msph_token_src_data {
|
|||
|
||||
struct msph_token_src {
|
||||
int type;
|
||||
struct msph_text_pos pos;
|
||||
union msph_token_src_data inner;
|
||||
};
|
||||
|
||||
struct msph_token_stream {
|
||||
struct msph_ctx *ctx;
|
||||
|
||||
char name[MSPH_NAME_LEN];
|
||||
struct msph_token_src src;
|
||||
};
|
||||
|
||||
void msph_ctx_init(struct msph_ctx *);
|
||||
|
||||
struct msph_token_stream *msph_token_stream_file(struct msph_ctx *,
|
||||
FILE *);
|
||||
const char *, FILE *);
|
||||
struct msph_token_stream *msph_token_stream_frombuf(struct msph_ctx *,
|
||||
const char *, size_t);
|
||||
const char *, const char *, size_t);
|
||||
|
||||
int msph_token_stream_close(struct msph_token_stream*);
|
||||
|
||||
|
@ -135,8 +140,7 @@ int msph_token_stream_print(struct msph_token_stream *, FILE *);
|
|||
|
||||
ssize_t msph_token_str(char *, size_t, struct msph_token *);
|
||||
|
||||
struct msph_token * msph_token_create(struct msph_ctx *, int,
|
||||
union msph_token_data *);
|
||||
struct msph_token * msph_token_copy(struct msph_ctx *, struct msph_token *);
|
||||
|
||||
|
||||
#endif /* _MSPH_EXPR_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue