With this is_valid_nix_identifier should line up with the upstream lexer
definition:
ID [a-zA-Z\_][a-zA-Z0-9\_\'\-]*
While we're working on this, add a simple test checking the various
formatting rules. Interestingly, it would not be suitable as an identity
test, since you have to write
{ "assert" = null; }
in order to avoid an evaluation error, but C++ Nix is happy to print
this as
{ assert = null; }
– maybe should be considered to be a bug.
Change-Id: I0a4e1ccb5033a80f3767fb8d1c4bba08d303c5d8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7744
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
30 lines
485 B
Nix
30 lines
485 B
Nix
{
|
|
__internal = true;
|
|
_internal = true;
|
|
normal = true;
|
|
VeryNormal = true;
|
|
normal2 = true;
|
|
Very2Normal = true;
|
|
_'12 = true;
|
|
foldl' = true;
|
|
x = true;
|
|
x' = true;
|
|
x'' = true;
|
|
|
|
true = true;
|
|
false = true;
|
|
null = true;
|
|
or = true;
|
|
"assert" = true; # -ish
|
|
throw = true;
|
|
abort = true;
|
|
|
|
"9front" = false;
|
|
"2normal" = false;
|
|
"-20°" = false;
|
|
"45 44 43-'3 2 1" = false;
|
|
"attr.path" = false;
|
|
"'quoted'" = false;
|
|
"_'12.5" = false;
|
|
"😀" = false;
|
|
}
|