allow more env paths

This commit is contained in:
2023-07-04 10:13:53 +00:00
parent 70f836ead6
commit 522472eaac
2 changed files with 25 additions and 3 deletions

View File

@@ -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))

View File

@@ -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: $ => / */,