diff --git a/corpus/shebang.txt b/corpus/shebang.txt index 316e145..ff9caa4 100644 --- a/corpus/shebang.txt +++ b/corpus/shebang.txt @@ -28,7 +28,6 @@ nix-shell shebang no env (source_file (first_line)) - ================== nix-shell shebang whitespace no env ================== @@ -38,3 +37,23 @@ nix-shell shebang whitespace no env (source_file (first_line)) + +================== +nix-shell shebang via relative env +================== + +#!env nix-shell +--- + +(source_file + (first_line)) + +================== +nix-shell shebang via /bin/env +================== + +#!/bin/env nix-shell +--- + +(source_file + (first_line)) diff --git a/grammar.js b/grammar.js index 81b1ac2..00a5ccf 100644 --- a/grammar.js +++ b/grammar.js @@ -47,8 +47,11 @@ module.exports = grammar({ ), _shebang_open: $ => '#!', - // TODO: allow `usr/bin/env`, `env` - _env: $ => '/usr/bin/env', + _env: $ => choice( + '/usr/bin/env', + '/bin/env', + 'env', + ), _nix_shell: $ => 'nix-shell', _ws: $ => / +/, _opt_ws: $ => / */,