diff options
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/nix-lang-ref.xml | 100 | ||||
-rw-r--r-- | doc/manual/style.css | 5 |
2 files changed, 102 insertions, 3 deletions
diff --git a/doc/manual/nix-lang-ref.xml b/doc/manual/nix-lang-ref.xml index 19917144e7d4..5d53063ce78e 100644 --- a/doc/manual/nix-lang-ref.xml +++ b/doc/manual/nix-lang-ref.xml @@ -4,9 +4,6 @@ <sect1> <title>Grammar</title> - <para> - </para> - <productionset> <title>Expressions</title> @@ -97,6 +94,8 @@ <nonterminal def="#nix.path" /> | <nonterminal def="#nix.uri" /> <sbr />| + 'true' | 'false' | 'null' + <sbr />| '(' <nonterminal def="#nix.expr" /> ')' <sbr />| '{' <nonterminal def="#nix.bind" />* '}' @@ -180,4 +179,99 @@ </sect1> + + + <sect1> + <title>Semantics</title> + + + + <sect2> + <title>Built-in functions</title> + + <para> + The Nix language provides the following built-in function + (<quote>primops</quote>): + </para> + + <variablelist> + + <varlistentry> + <term><function>import</function> + <replaceable>e</replaceable></term> + <listitem> + <para> + Evaluates the expression <replaceable>e</replaceable>, + which must yield a path value. The Nix expression + stored at this path in the file system is then read, + parsed, and evaluated. Returns the result of the + evaluation of the Nix expression just read. + </para> + + <para> + Example: <literal>import ./foo.nix</literal> evaluates + the expression stored in <filename>foo.nix</filename> + (in the directory containing the expression in which the + <function>import</function> occurs). + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><function>derivation</function> + <replaceable>e</replaceable></term> + <listitem> + <para> + Evaluates the expression <replaceable>e</replaceable>, + which must yield an attribute set. [...] + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><function>baseNameOf</function> + <replaceable>e</replaceable></term> + <listitem> + <para> + Evaluates the expression <replaceable>e</replaceable>, + which must yield a string value, and returns a string + representing its <emphasis>base name</emphasis>. This + is the substring following the last path separator + (<literal>/</literal>). + </para> + + <para> + Example: <literal>baseNameOf "/foo/bar"</literal> + returns <literal>"bar"</literal>, and + <literal>baseNameOf "/foo/bar/"</literal> returns + <literal>""</literal>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><function>toString</function> + <replaceable>e</replaceable></term> + <listitem> + <para> + Evaluates the expression <replaceable>e</replaceable> + and coerces it into a string, if possible. Only + strings, paths, and URIs can be so coerced. + </para> + + <para> + Example: <literal>toString + http://www.cs.uu.nl/</literal> returns + <literal>"http://www.cs.uu.nl/"</literal>. + </para> + </listitem> + </varlistentry> + + </variablelist> + + </sect2> + + </sect1> + + </chapter> \ No newline at end of file diff --git a/doc/manual/style.css b/doc/manual/style.css index 5b8534533d05..a9b6fd2c67fc 100644 --- a/doc/manual/style.css +++ b/doc/manual/style.css @@ -218,4 +218,9 @@ div.epigraph { font-style: italic; text-align: right; +} + +table.productionset table.productionset +{ + font-family: monospace; } \ No newline at end of file |