Skip to content

Commit

Permalink
Revert "Don't parse "x:x" as a URI"
Browse files Browse the repository at this point in the history
This reverts commit f90f660.

This broke Hydra's release.nix, which contained

  preCheck = ''export LOGNAME=${LOGNAME:-foo}'';
  • Loading branch information
edolstra committed Nov 14, 2017
1 parent 5773d66 commit 2c39e4e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libexpr/lexer.l
Expand Up @@ -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\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+|channel\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+
URI [a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+


%%
Expand Down
2 changes: 1 addition & 1 deletion tests/lang/lib.nix
Expand Up @@ -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; # sic
id = x: x;

const = x: y: x;

Expand Down
3 changes: 1 addition & 2 deletions tests/lang/parse-okay-url.nix
@@ -1,8 +1,7 @@
[
[ 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
]

4 comments on commit 2c39e4e

@copumpkin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☹️

@copumpkin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is that snippet from Hydra's release nix even valid? Isn't the `${} parsed as a Nix substitution, but the thing after the colon looks like a shell-ism?

@vcunat
Copy link
Member

@vcunat vcunat commented on 2c39e4e Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-D surprise

In any case, it would be better to fix such occurrences, as they worked purely by chance (i.e. the meaning is not URI/URL at all).

@vcunat
Copy link
Member

@vcunat vcunat commented on 2c39e4e Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think that 1.11 -> 1.12 could contain this kind of "regression" (documented in release notes).

Please sign in to comment.