mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 10:46:15 +02:00
dba1142c01
* docs: add identifiers * clarify attribute set notation and add examples * add definition of names Co-authored-by: Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>
1.5 KiB
1.5 KiB
Identifiers
An identifier is an ASCII character sequence that:
- Starts with a letter (
a-z
,A-Z
) or underscore (_
) - Can contain any number of:
- Letters (
a-z
,A-Z
) - Digits (
0-9
) - Underscores (
_
) - Apostrophes (
'
) - Hyphens (
-
)
- Letters (
- Is not one of the keywords
Syntax
identifier ~
[A-Za-z_][A-Za-z0-9_'-]*
Names
A name can be an identifier or a string literal.
Syntax
name → identifier | string
Names are used in attribute sets, let
bindings, and [inherit
](./syntax.md#inheriting attributes).
Keywords
These keywords are reserved and cannot be used as identifiers:
Note
The Nix language evaluator currently allows
or
to be used as a name in some contexts, for backwards compatibility reasons. Users are advised not to rely on this.There are long-standing issues with how
or
is parsed as a name, which can't be resolved without making a breaking change to the language.