aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/print.hh
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-04-16 14:07:35 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-04-16 14:07:35 +0200
commitb6125772d7d5f82d48873fc93a7f261832154b14 (patch)
tree2700c6ab861df273c949739d06d6b1e6745d1819 /src/libexpr/print.hh
parent28a5cdde02964306e7eb443f696c8d5d59ebf9e9 (diff)
libexpr: Move identifier-like printing to print.cc
Diffstat (limited to 'src/libexpr/print.hh')
-rw-r--r--src/libexpr/print.hh18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libexpr/print.hh b/src/libexpr/print.hh
index 98dd2008d..f9cfc3964 100644
--- a/src/libexpr/print.hh
+++ b/src/libexpr/print.hh
@@ -27,4 +27,22 @@ namespace nix {
/** Print `true` or `false`. */
std::ostream & printLiteralBool(std::ostream & o, bool b);
+
+ /**
+ * Print a string as an attribute name in the Nix expression language syntax.
+ *
+ * Prints a quoted string if necessary.
+ */
+ std::ostream & printAttributeName(std::ostream & o, std::string_view s);
+
+ /**
+ * Print a string as an identifier in the Nix expression language syntax.
+ *
+ * FIXME: "identifier" is ambiguous. Identifiers do not have a single
+ * textual representation. They can be used in variable references,
+ * let bindings, left-hand sides or attribute names in a select
+ * expression, or something else entirely, like JSON. Use one of the
+ * `print*` functions instead.
+ */
+ std::ostream & printIdentifier(std::ostream & o, std::string_view s);
}