manual: Update Attribute Set section to exclude indented strings and URIs
Indented strings and URIs are string literals but they are not allowed
as names for attrsets, `let` or `inherit`. The following snippets
illustrate that they lead to syntax errors.
==> examples/ind_str-attr.nix <==
{
''indented string'' = "error: syntax error, expecting '}'";
}
==> examples/ind_str-inherit.nix <==
{ inherit ({ "non-indented string" = "error: syntax error, expecting ';'"; })
''non-indented string'';
}
==> examples/ind_str-let.nix <==
let
''indented string'' = "error: syntax error, expecting 'in'";
in
true
==> examples/uri-attr.nix <==
{
http://example.org/foo.tar.bz2 = "error: syntax error, expecting '}'";
}
==> examples/uri-inherit.nix <==
{ inherit ({ "http://example.org/foo.tar.bz2" = "error: syntax error, expecting ';'"; })
http://example.org/foo.tar.bz2;
}
==> examples/uri-let.nix <==
let
http://example.org/foo.tar.bz2 = "error: syntax error, expecting 'in'";
in
true
Change-Id: I6774af93baf9f533877642a563775667c518ea88
This commit is contained in:
@@ -164,7 +164,7 @@ Note that lists are only lazy in values, and they are strict in length.
|
||||
|
||||
An attribute set is a collection of name-value-pairs (called *attributes*) enclosed in curly brackets (`{ }`).
|
||||
|
||||
An attribute name can be an identifier or a [string](#type-string).
|
||||
An attribute name can be an identifier or a [double-quoted string](#type-string).
|
||||
An identifier must start with a letter (`a-z`, `A-Z`) or underscore (`_`), and can otherwise contain letters (`a-z`, `A-Z`), numbers (`0-9`), underscores (`_`), apostrophes (`'`), or dashes (`-`).
|
||||
|
||||
> *name* = *identifier* | *string* \
|
||||
|
||||
Reference in New Issue
Block a user