aboutsummaryrefslogtreecommitdiff
path: root/src/cffc.hff
diff options
context:
space:
mode:
Diffstat (limited to 'src/cffc.hff')
-rw-r--r--src/cffc.hff37
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>
}