diff options
| author | 2022-08-17 22:47:36 +0200 | |
|---|---|---|
| committer | 2022-08-17 22:47:36 +0200 | |
| commit | 1c25c197d860ad49bb6a84e077a54e5aaf441bbd (patch) | |
| tree | 8f7b963d1c891cfaa2d490a2f651ac0b8fa83c42 /src/cffc.hff | |
| parent | 86242b6cc1f53a86fcce1312211d3232661bf454 (diff) | |
parse defmacro
Diffstat (limited to 'src/cffc.hff')
| -rw-r--r-- | src/cffc.hff | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/cffc.hff b/src/cffc.hff index 2252373..aad2ee4 100644 --- a/src/cffc.hff +++ b/src/cffc.hff @@ -68,6 +68,7 @@ struct AggField { ty *const Type, off usize, } +struct EnumVal { name *const u8, i i64 } struct Type { size usize, @@ -87,13 +88,20 @@ struct Type { variadic bool, ret *const Type, }, + Enum struct { + intty *const Type, + name *const u8, + lax bool, + id int, + vals [#]EnumVal, + }, Agg struct { kind AggKind, name *const u8, id int, fwd bool, flds [#]AggField, - decls [#]*Decl, + decls *Env, }, }, @@ -190,6 +198,16 @@ struct Var { fnid int, } +struct MacroCase { + variadic bool, + params [#]*const u8, + body [#]Tok, +} + +struct Macro { + cs [#]MacroCase +} + struct Decl { name *const u8, loc Loc, @@ -199,6 +217,7 @@ struct Decl { Static Var, Def Expr, Fn Fn, + Macro Macro, Ty *const Type, }, } @@ -317,3 +336,6 @@ extern fn envput(*Env, Decl, **const Decl) *Decl; extern fn envfind(*Env, *const u8) *Decl; extern fn envfind_noparent(*Env, *const u8) *Decl; extern fn envfree(*Env) void; + +// fold.cff +extern fn fold(*Expr) bool; |