infix parsing and prebind fixes
This commit is contained in:
parent
65066c493e
commit
33f38c03d6
14 changed files with 1555 additions and 1089 deletions
|
@ -39,6 +39,8 @@
|
|||
|
||||
|
||||
enum msph_tok_type {
|
||||
TOK_INVAL = -1, // special: invalid, use to mark invalid toks
|
||||
TOK_EOF = 0, // special: end-of-file
|
||||
TOK_LBRACE, // {
|
||||
TOK_RBRACE, // }
|
||||
TOK_LBRAK, // [
|
||||
|
@ -67,9 +69,10 @@ enum msph_tok_type {
|
|||
TOK_CONST_FALSE, // False
|
||||
|
||||
TOK_IDENT, // identifiers
|
||||
TOK_INVAL, // special: invalid, use to mark invalid toks
|
||||
TOK_WSPACE, // special: whitespace
|
||||
TOK_END // special: end of array/token stream
|
||||
TOK_WSPACE, // whitespace
|
||||
|
||||
TOK_NOPE // special indicator: end of info array,
|
||||
// start of parsing
|
||||
};
|
||||
|
||||
#define MSPH_TAB_WIDTH 8
|
||||
|
|
|
@ -37,6 +37,8 @@ struct msph_decor {
|
|||
#define MSPH_TREE_BOX 0x004a
|
||||
#define MSPH_TREE_FORALL 0x004b
|
||||
#define MSPH_TREE_PAREN 0x004c
|
||||
#define MSPH_TREE_SUBT 0x004d
|
||||
|
||||
|
||||
#define MSPH_TREE_IDENT 0x0100
|
||||
#define MSPH_TREE_NAMEDECL 0x0101
|
||||
|
@ -162,8 +164,7 @@ struct msph_tree_membdecl {
|
|||
struct msph_tree_assert {
|
||||
struct msph_tree_dir hd_dir;
|
||||
|
||||
struct msph_tree_tpexpr *ltp;
|
||||
struct msph_tree_tpexpr *rtp;
|
||||
struct msph_tree_tpexpr *tp;
|
||||
};
|
||||
|
||||
struct msph_tree_namedecl {
|
||||
|
@ -209,6 +210,7 @@ struct msph_tree_trait {
|
|||
struct msph_tree_body *body;
|
||||
};
|
||||
|
||||
/* XXX should probably merge all binary type ops into one */
|
||||
struct msph_tree_conj {
|
||||
struct msph_tree_tpexpr hd_tpe;
|
||||
|
||||
|
@ -230,6 +232,13 @@ struct msph_tree_impl {
|
|||
struct msph_tree_tpexpr *rtp;
|
||||
};
|
||||
|
||||
struct msph_tree_subt {
|
||||
struct msph_tree_tpexpr hd_tpe;
|
||||
|
||||
struct msph_tree_tpexpr *ltp;
|
||||
struct msph_tree_tpexpr *rtp;
|
||||
};
|
||||
|
||||
struct msph_tree_arrow {
|
||||
struct msph_tree_tpexpr hd_tpe;
|
||||
|
||||
|
@ -259,7 +268,11 @@ struct msph_tree_paren {
|
|||
|
||||
struct msph_tree_root *msph_tree_makeroot(struct msph_ctx *);
|
||||
|
||||
int msph_tree_parse(struct msph_token_stream *, struct msph_tree_root *);
|
||||
#define MSPH_PARSE_PREFIX 1
|
||||
#define MSPH_PARSE_INFIX 2
|
||||
|
||||
int msph_tree_parse(struct msph_token_stream *, struct msph_tree_root *,
|
||||
int);
|
||||
|
||||
ssize_t msph_tree_fprint(FILE *, struct msph_tree *);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue