summaryrefslogtreecommitdiff
path: root/module/sexprs.m
diff options
context:
space:
mode:
Diffstat (limited to 'module/sexprs.m')
-rw-r--r--module/sexprs.m41
1 files changed, 41 insertions, 0 deletions
diff --git a/module/sexprs.m b/module/sexprs.m
new file mode 100644
index 00000000..63053d2e
--- /dev/null
+++ b/module/sexprs.m
@@ -0,0 +1,41 @@
+Sexprs: module
+{
+ PATH: con "/dis/lib/sexprs.dis";
+
+ Sexp: adt {
+ pick {
+ String =>
+ s: string;
+ hint: string;
+ Binary =>
+ data: array of byte;
+ hint: string;
+ List =>
+ l: cyclic list of ref Sexp;
+ }
+
+ read: fn[T](b: T): (ref Sexp, string) for {
+ T =>
+ getb: fn(nil: self T): int;
+ ungetb: fn(nil: self T): int;
+ offset: fn(nil: self T): big;
+ };
+ parse: fn(s: string): (ref Sexp, string, string);
+ unpack: fn(a: array of byte): (ref Sexp, array of byte, string);
+ text: fn(e: self ref Sexp): string;
+ packedsize: fn(e: self ref Sexp): int;
+ pack: fn(e: self ref Sexp): array of byte;
+ b64text: fn(e: self ref Sexp): string;
+
+ islist: fn(e: self ref Sexp): int;
+ els: fn(e: self ref Sexp): list of ref Sexp;
+ op: fn(e: self ref Sexp): string;
+ args: fn(e: self ref Sexp): list of ref Sexp;
+ eq: fn(e: self ref Sexp, t: ref Sexp): int;
+ copy: fn(e: self ref Sexp): ref Sexp;
+ asdata: fn(e: self ref Sexp): array of byte;
+ astext: fn(e: self ref Sexp): string;
+ };
+
+ init: fn();
+};