aboutsummaryrefslogtreecommitdiff
path: root/src/cffc.hff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-17 05:18:22 +0200
committerlemon <lsof@mailbox.org>2022-08-17 05:18:22 +0200
commitc50a02ec703c7c1c5f6823c8cbd07a424d604792 (patch)
treeef80066da26b0b91c73fba6c6e3234ddc78d869c /src/cffc.hff
parent1ca77f60626666fba792db407dd11ea9b597d9cf (diff)
more exprs, warnings
Diffstat (limited to 'src/cffc.hff')
-rw-r--r--src/cffc.hff22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cffc.hff b/src/cffc.hff
index 8cdf655..ff9d3eb 100644
--- a/src/cffc.hff
+++ b/src/cffc.hff
@@ -120,7 +120,11 @@ struct Expr {
BinOp struct { op TokT, lhs *Expr, rhs *Expr },
UnOp struct { op UnOp, ex *Expr },
Cond struct { test *Expr, t *Expr, f *Expr },
- Call struct { lhs *Expr, args [#]Expr }
+ Index struct { lhs *Expr, rhs *Expr },
+ Slice struct { lhs *Expr, begin *Expr, end *Expr },
+ Call struct { lhs *Expr, args [#]Expr },
+ ZeroIni,
+ Ini struct { },
}
}
@@ -188,6 +192,7 @@ extern fn pfmt(proc *fn(u8, *void) void, parg *void, fmt *const u8, ...) void;
extern fn vefmt(fmt *const u8, ap va_list) void;
extern fn efmt(fmt *const u8, ...) void;
extern fn ssfmt(fmt *const u8, ...) *const u8;
+extern fn warn(P *Parser, Loc, fmt *const u8, ...) void;
extern fn err(P *Parser, Loc, fmt *const u8, ...) void;
extern fn fatal(*Parser, Loc, fmt *const u8, ...) void;
@@ -246,6 +251,21 @@ fn mkptrtype(child *const Type) *const Type {
.u: :Ptr(child)
});
}
+fn mkslicetype(child *const Type) *const Type {
+ return interntype({
+ g_targ.ptrsize,
+ .u: :Ptr(child)
+ });
+}
+fn childtype(ty *const Type) *const Type {
+ switch ty.u {
+ case Ptr t; return t;
+ case Arr a; return a.child;
+ case Slice t; return t;
+ }
+ return #null;
+}
+extern fn completetype(ty *const Type) bool;
extern fn isnumtype(ty *const Type) bool;
extern fn typeof2(a *const Type, b *const Type) *const Type;