tokinizing
This commit is contained in:
parent
dd099f3382
commit
10e16147ba
3 changed files with 360 additions and 124 deletions
|
@ -92,13 +92,13 @@ enum msph_tok_type {
|
|||
TOK_RBRAK, // ]
|
||||
TOK_LPAREN, // (
|
||||
TOK_RPAREN, // )
|
||||
TOK_OP_COLON, // :
|
||||
TOK_OP_EQUALS, // =
|
||||
TOK_COLON, // :
|
||||
TOK_EQUALS, // =
|
||||
|
||||
TOK_OP_AMP, // &
|
||||
TOK_OP_PIPE, // |
|
||||
TOK_OP_RARROW, // =>
|
||||
TOK_OP_SUB, // <:
|
||||
TOK_AMP, // &
|
||||
TOK_PIPE, // |
|
||||
TOK_RARROW, // =>
|
||||
TOK_SUB, // <:
|
||||
|
||||
TOK_KW_TYPE, // type
|
||||
TOK_KW_NOMINAL, // nominal
|
||||
|
@ -135,12 +135,13 @@ struct msph_token {
|
|||
|
||||
struct msph_token_src_file {
|
||||
FILE *f;
|
||||
int eof;
|
||||
size_t pos; // TODO rename bufpos
|
||||
size_t end; // TODO rename bufend
|
||||
size_t read_pos;
|
||||
|
||||
/* circular buffer for reading */
|
||||
size_t pos;
|
||||
size_t end;
|
||||
char buf[MSPH_FILE_BUF_LEN];
|
||||
|
||||
/* file path */
|
||||
char name[MSPH_PATH_LEN];
|
||||
};
|
||||
|
||||
|
@ -157,7 +158,7 @@ union msph_token_src_data {
|
|||
};
|
||||
|
||||
struct msph_token_src {
|
||||
int type
|
||||
int type;
|
||||
union msph_token_src_data inner;
|
||||
};
|
||||
|
||||
|
@ -174,6 +175,8 @@ struct msph_token_stream *msph_token_stream_frombuf(struct msph_ctx *,
|
|||
|
||||
int msph_token_stream_close(struct msph_token_stream*);
|
||||
|
||||
struct msph_token *msph_token_source_pop(struct msph_token_stream *);
|
||||
ssize_t msph_token_stream_read_tok(struct msph_token *, size_t,
|
||||
struct msph_token_stream *);
|
||||
|
||||
|
||||
#endif /* _MSPH_EXPR_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue