Skip to content

Commit d37366f

Browse files
jwnrtamaanq
authored andcommitted
fix: allow shebangs to contain spaces
1 parent 0435214 commit d37366f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ module.exports = grammar({
15841584

15851585
identifier: _ => /(r#)?[_\p{XID_Start}][_\p{XID_Continue}]*/,
15861586

1587-
shebang: _ => /#![\s]*[^\[\s]+/,
1587+
shebang: _ => /#![\s]*[^\[].+/,
15881588

15891589
_reserved_identifier: $ => alias(choice(
15901590
'default',

test/corpus/source_files.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,13 @@ const ψ_2 : Ψ = 1;
218218
(identifier)
219219
(type_identifier)
220220
(integer_literal)))
221+
222+
================================================================================
223+
Shebang line containing spaces
224+
================================================================================
225+
226+
#!/usr/bin/env -S cargo +nightly -Zscript
227+
--------------------------------------------------------------------------------
228+
229+
(source_file
230+
(shebang))

0 commit comments

Comments
 (0)