diff options
| author | 2022-08-19 10:41:25 +0200 | |
|---|---|---|
| committer | 2022-08-19 10:41:25 +0200 | |
| commit | e9543de5ab1de08a452de4b9df705c43aa9ff6ac (patch) | |
| tree | 0bfbb8c2794a1181c4e52d29b351239c447f42c8 /src/cffc.hff | |
| parent | b6c31ebc4a33831c8f59e43984f3af950d418b88 (diff) | |
templates
Diffstat (limited to 'src/cffc.hff')
| -rw-r--r-- | src/cffc.hff | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/cffc.hff b/src/cffc.hff index 686de57..c8c90ac 100644 --- a/src/cffc.hff +++ b/src/cffc.hff @@ -36,9 +36,9 @@ enum TokT : i32 { ident, macident, gensym, - type, label, strify, + typearg, eof, } def NUM_KEYWORDS int = TokT:NUM_KEYWORDS; @@ -68,8 +68,11 @@ struct AggField { ty *const Type, off usize, } + struct EnumVal { name *const u8, i i64 } +enum union TeplArg; + struct Type { size usize, align usize, @@ -101,6 +104,7 @@ struct Type { id int, fwd bool, enumty *const Type, + tpargs [#]TeplArg, flds [#]AggField, decls *Env, }, @@ -228,6 +232,33 @@ struct Macro { cs [#]MacroCase } +struct TeplParam { + name *const u8, + u enum union { + Ty, + Val *const Type, + } +} + +enum union TeplArg { + Ty *const Type, + Val Tok, +} + +struct TeplCache { + next *TeplCache, + args [#]TeplArg, + ty *const Type, +} + +struct Tepl { + kind AggKind, + env *Env, + params [#]TeplParam, + toks [#]Tok, + cache *TeplCache, +} + struct Decl { name *const u8, loc Loc, @@ -235,10 +266,11 @@ struct Decl { u enum union { Let Var, Static Var, + Ty *const Type, Def Expr, Fn Fn, Macro Macro, - Ty *const Type, + Tepl Tepl, }, myenv *Env, } @@ -253,6 +285,7 @@ struct Expan { toks [#]Tok, name *const u8, loc Loc, + tepl bool, idx int, peektok Option<Tok> } |