Skip to content

Commit adb0975

Browse files
authored
Allow Groovy files to start with a shebang (#2091)
1 parent 7511041 commit adb0975

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/rouge/lexers/groovy.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def self.constants
4242
end
4343

4444
state :root do
45+
# groovy allows a file to start with a shebang
46+
rule %r/\A#!(.*?)$/, Comment::Preproc
47+
rule %r//, Text, :base
48+
end
49+
50+
state :base do
4551
rule %r(^
4652
(\s*(?:\w[\w.\[\]]*\s+)+?) # return arguments
4753
(\w\w*) # method name

0 commit comments

Comments
 (0)