summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/jvm.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py
index 4633c66f..51f17ae0 100644
--- a/pygments/lexers/jvm.py
+++ b/pygments/lexers/jvm.py
@@ -437,6 +437,11 @@ class GroovyLexer(RegexLexer):
tokens = {
'root': [
+ # Groovy allows a file to start with a shebang
+ (r'#!(.*?)$', Comment.Preproc, 'base'),
+ (r'', Text, 'base'),
+ ],
+ 'base': [
# method names
(r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return arguments
r'([a-zA-Z_]\w*)' # method name
@@ -481,6 +486,9 @@ class GroovyLexer(RegexLexer):
],
}
+ def analyse_text(text):
+ return shebang_matches(text, r'groovy')
+
class IokeLexer(RegexLexer):
"""