about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/manual/release-notes.xml5
-rw-r--r--misc/emacs/nix-mode.el2
-rw-r--r--src/libexpr/lexer.l2
-rw-r--r--tests/lang/eval-okay-attrs5.nix4
4 files changed, 9 insertions, 4 deletions
diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml
index 0a69f43b1fc2..6fbd7c269c46 100644
--- a/doc/manual/release-notes.xml
+++ b/doc/manual/release-notes.xml
@@ -15,6 +15,11 @@
 <itemizedlist>
 
   <listitem>
+    <para>Dashes are now valid as part of identifiers and attribute
+    names.</para>
+  </listitem>
+
+  <listitem>
     <para>Nix no longer sets the immutable bit on files in the Nix
     store.  Instead, the recommended way to guard the Nix store
     against accidental modification on Linux is to make it a read-only
diff --git a/misc/emacs/nix-mode.el b/misc/emacs/nix-mode.el
index 121a9172b633..986edcf6e321 100644
--- a/misc/emacs/nix-mode.el
+++ b/misc/emacs/nix-mode.el
@@ -78,7 +78,7 @@ The hook `nix-mode-hook' is run when Nix mode is started.
     ("\\<isNull\\>" . font-lock-builtin-face)
     ("[a-zA-Z][a-zA-Z0-9\\+-\\.]*:[a-zA-Z0-9%/\\?:@&=\\+\\$,_\\.!~\\*'-]+"
      . font-lock-constant-face)
-    ("\\<\\([a-zA-Z_][a-zA-Z0-9_'\.]*\\)[ \t]*="
+    ("\\<\\([a-zA-Z_][a-zA-Z0-9_'\-\.]*\\)[ \t]*="
      (1 font-lock-variable-name-face nil nil))
     ("<[a-zA-Z0-9._\\+-]+\\(/[a-zA-Z0-9._\\+-]+\\)*>"
      . font-lock-constant-face)
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index d46b66d9ff7c..b61d5ea7713c 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -78,7 +78,7 @@ static Expr * unescapeStr(SymbolTable & symbols, const char * s)
 %}
 
 
-ID          [a-zA-Z\_][a-zA-Z0-9\_\']*
+ID          [a-zA-Z\_][a-zA-Z0-9\_\'\-]*
 INT         [0-9]+
 PATH        [a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+
 SPATH       \<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\>
diff --git a/tests/lang/eval-okay-attrs5.nix b/tests/lang/eval-okay-attrs5.nix
index e77ee7a1c22b..0a98b8fdffa6 100644
--- a/tests/lang/eval-okay-attrs5.nix
+++ b/tests/lang/eval-okay-attrs5.nix
@@ -4,7 +4,7 @@ let
 
   as = { x.y.z = 123; a.b.c = 456; };
 
-  bs = { foo.bar = "foo"; };
+  bs = { f-o-o.bar = "foo"; };
 
   or = x: y: x || y;
   
@@ -13,7 +13,7 @@ in
     as.foo or "foo"
     as.x.y.bla or as.a.b.c
     as.a.b.c or as.x.y.z
-    as.x.y.bla or bs.foo.bar or "xyzzy"
+    as.x.y.bla or bs.f-o-o.bar or "xyzzy"
     as.x.y.bla or bs.bar.foo or "xyzzy"
     123.bla or null.foo or "xyzzy"
     # Backwards compatibility test.