File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ Using directives
64
64
//> using jvm graalvm:21
65
65
//> using scala 3.3.0
66
66
//> using dep foo:bar:1,2,3,url=https://github.com
67
- //> using exclude "examples/*" "*/resources/*"
67
+ //> using exclude "examples/*" "*/resources/*"
68
68
// > just a comment
69
69
70
70
--------------------------------------------------------------------------------
@@ -87,3 +87,16 @@ Using directives
87
87
(using_directive_key)
88
88
(using_directive_value)))
89
89
(comment))
90
+
91
+ ================================================================================
92
+ Shebang
93
+ ================================================================================
94
+
95
+ #!/usr/bin/env -S scala-cli shebang -S 3
96
+
97
+ "shebang"
98
+ --------------------------------------------------------------------------------
99
+
100
+ (compilation_unit
101
+ (comment)
102
+ (string))
Original file line number Diff line number Diff line change @@ -103,8 +103,10 @@ module.exports = grammar({
103
103
104
104
rules : {
105
105
// TopStats ::= TopStat {semi TopStat}
106
- compilation_unit : $ =>
106
+ compilation_unit : $ => seq (
107
+ optional ( $ . _shebang ) ,
107
108
optional ( trailingSep1 ( $ . _semicolon , $ . _top_level_definition ) ) ,
109
+ ) ,
108
110
109
111
_top_level_definition : $ =>
110
112
choice (
@@ -1712,6 +1714,8 @@ module.exports = grammar({
1712
1714
repeat1 ( $ . guard ) ,
1713
1715
) ,
1714
1716
1717
+ _shebang : $ => alias ( token ( seq ( "#!" , / .* / ) ) , $ . comment ) ,
1718
+
1715
1719
comment : $ => seq ( token ( "//" ) , choice ( $ . using_directive , $ . _comment_text ) ) ,
1716
1720
_comment_text : $ => token ( prec ( PREC . comment , / .* / ) ) ,
1717
1721
You can’t perform that action at this time.
0 commit comments