about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-30T16·56+0100
committerEelco Dolstra <edolstra@gmail.com>2017-10-30T16·58+0100
commitf90f660b243866b8860eeb24cc4a345d32cc7ce7 (patch)
tree43637c7bd7b617745ca065247a806a8d02f28838
parent12991152be43f63634e48a7d118040e485125df4 (diff)
Don't parse "x:x" as a URI
URIs now have to contain "://" or start with "channel:".
-rw-r--r--src/libexpr/lexer.l2
-rw-r--r--tests/lang/lib.nix2
-rw-r--r--tests/lang/parse-okay-url.nix3
3 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 28a0a6a87896..828356bbf447 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -90,7 +90,7 @@ FLOAT       (([1-9][0-9]*\.[0-9]*)|(0?\.[0-9]+))([Ee][+-]?[0-9]+)?
 PATH        [a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+\/?
 HPATH       \~(\/[a-zA-Z0-9\.\_\-\+]+)+\/?
 SPATH       \<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\>
-URI         [a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+
+URI         [a-zA-Z][a-zA-Z0-9\+\-\.]*\:\/\/[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+|channel\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+
 
 
 %%
diff --git a/tests/lang/lib.nix b/tests/lang/lib.nix
index 028a538314b7..1c63b2f31d67 100644
--- a/tests/lang/lib.nix
+++ b/tests/lang/lib.nix
@@ -49,7 +49,7 @@ rec {
     if comp (head list2) (head list1) then [(head list2)] ++ mergeLists comp list1 (tail list2) else
     [(head list1)] ++ mergeLists comp (tail list1) list2;
 
-  id = x: x;
+  id = x:x; # sic
 
   const = x: y: x;
 
diff --git a/tests/lang/parse-okay-url.nix b/tests/lang/parse-okay-url.nix
index fce3b13ee64b..fb74d66f0923 100644
--- a/tests/lang/parse-okay-url.nix
+++ b/tests/lang/parse-okay-url.nix
@@ -1,7 +1,8 @@
-[ x:x
+[
   https://svn.cs.uu.nl:12443/repos/trace/trunk
   http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2
   http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz
   http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz
   ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz
+  channel:nixos-17.09
 ]