This looks like a groovy issue. I’m not particularly familiar with groovy, but my guess is that # is not a comment character, and that groovy as a special case allows the first line to begin with #! but disallows this otherwise.
In this scenario, my recommendation is to instead split it into two files like so:
I started working on the antlr4 grammar to ignore all shebang entries in a groovy script. I was wondering if anyone has an example of a script with more than two directives?
I want to make the lexer so it ignores any number of shebang directives at the top of the file but I also need examples to test with. I thought I saw an example using python somewhere that had 3 directives but I can’t find it. Any thoughts?