diff options
author | Tim Hatch <tim@timhatch.com> | 2014-05-17 09:13:14 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-05-17 09:13:14 -0700 |
commit | ff12540907fe9d98bf02c9508a171659457b14b2 (patch) | |
tree | d20a3538c3757a1cc4b05c6fd6804504ebe41c75 /pygments/lexers/jvm.py | |
parent | 0bf931830db86644b28f6fae9e66f16f21406b56 (diff) | |
parent | 08efa68bf22fd1e9d4eddabdbee9818ebe066973 (diff) | |
download | pygments-ff12540907fe9d98bf02c9508a171659457b14b2.tar.gz |
Merged in jaingaurav2/pygments-main-993 (pull request #359)
Add shebang support to Groovy lexer
Diffstat (limited to 'pygments/lexers/jvm.py')
-rw-r--r-- | pygments/lexers/jvm.py | 8 |
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): """ |