Nix  2.93.0-dev
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
print.hh File Reference

Common printing functions for the Nix language. More...

#include <iostream>
#include "lix/libutil/fmt.hh"
#include "lix/libexpr/print-options.hh"
#include "lix/libutil/print-elided.hh"
Include dependency graph for print.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nix::ValuePrinter
 

Functions

std::ostream & nix::printLiteralBool (std::ostream &str, bool boolean)
 
std::ostream & nix::printAttributeName (std::ostream &str, std::string_view name)
 
bool nix::isReservedKeyword (const std::string_view str)
 
std::ostream & nix::printIdentifier (std::ostream &str, std::string_view s)
 
void nix::printValue (EvalState &state, std::ostream &output, Value &v, PrintOptions options)
 
std::ostream & nix::operator<< (std::ostream &output, const ValuePrinter &printer)
 

Detailed Description

Common printing functions for the Nix language.

While most types come with their own methods for printing, they share some functions that are placed here.

Function Documentation

◆ isReservedKeyword()

bool nix::isReservedKeyword ( const std::string_view str)

Returns ‘true’ is a string is a reserved keyword which requires quotation when printing attribute set field names.

◆ printAttributeName()

std::ostream & nix::printAttributeName ( std::ostream & o,
std::string_view s )

Print a string as an attribute name in the Nix expression language syntax.

Prints a quoted string if necessary.

◆ printIdentifier()

std::ostream & nix::printIdentifier ( 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.

◆ printLiteralBool()

std::ostream & nix::printLiteralBool ( std::ostream & o,
bool b )

Print true or false.