commit 18956d45e246e570b0bd308ee8b08658a9b930e2
parent 2300f0693021d3541fa9a5f81ab9d9af57212006
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 18 Apr 2021 09:52:28 -0400
hare::unparse: flesh out documentation
Diffstat:
5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/hare/unparse/expr.ha b/hare/unparse/expr.ha
@@ -3,6 +3,11 @@ use fmt;
use hare::ast;
use hare::lex;
+// Unparses an [ast::expr].
+//
+// A known limitation of the current implementation is that precedence between
+// binary operators (e.g. +) is not accounted for, so such expressions may
+// produce a different AST if parsed again.
export fn expr(
out: *io::stream,
indent: size,
diff --git a/hare/unparse/import.ha b/hare/unparse/import.ha
@@ -3,6 +3,7 @@ use io;
use hare::ast;
use strio;
+// Unparses an [ast::import].
export fn import(out: *io::stream, i: ast::import) (size | io::error) = {
let n = 0z;
n += fmt::fprint(out, "use ")?;
diff --git a/hare/unparse/type.ha b/hare/unparse/type.ha
@@ -103,6 +103,7 @@ fn struct_union_type(
return z;
};
+// Unparses an [ast::_type].
export fn _type(
out: *io::stream,
indent: size,
diff --git a/hare/unparse/unit.ha b/hare/unparse/unit.ha
@@ -2,6 +2,7 @@ use io;
use fmt;
use hare::ast;
+// Unparses an [ast::subunit].
export fn subunit(out: *io::stream, s: ast::subunit) (size | io::error) = {
let n = 0z;
for (let i = 0z; i < len(s.imports); i += 1) {
diff --git a/hare/unparse/util.ha b/hare/unparse/util.ha
@@ -9,4 +9,3 @@ fn newline(out: *io::stream, indent: size) (size | io::error) = {
};
return n;
};
-