summaryrefslogtreecommitdiff
path: root/pygments/lexers/agile.py
diff options
context:
space:
mode:
authorblackbird <devnull@localhost>2006-10-27 23:59:07 +0200
committerblackbird <devnull@localhost>2006-10-27 23:59:07 +0200
commit0b4ae9ab3fa6057dce2833a3e34ba01511c10e44 (patch)
treef4afa530b3b9aae10144448d0aaa25bc990fb482 /pygments/lexers/agile.py
parenta400243228ed76501b820f2a6d0e7f924d5f9882 (diff)
downloadpygments-0b4ae9ab3fa6057dce2833a3e34ba01511c10e44.tar.gz
[svn] checked in changes from the last days. including:
- text in logo - documentation update - new `guess_lexer` method
Diffstat (limited to 'pygments/lexers/agile.py')
-rw-r--r--pygments/lexers/agile.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py
index 61292824..aec32450 100644
--- a/pygments/lexers/agile.py
+++ b/pygments/lexers/agile.py
@@ -19,7 +19,7 @@ from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, \
LexerContext, include, combined, do_insertions, bygroups
from pygments.token import Error, Text, \
Comment, Operator, Keyword, Name, String, Number, Generic
-from pygments.util import get_bool_opt, get_list_opt
+from pygments.util import get_bool_opt, get_list_opt, shebang_matches
__all__ = ['PythonLexer', 'PythonConsoleLexer', 'RubyLexer',
@@ -145,6 +145,9 @@ class PythonLexer(RegexLexer):
],
}
+ def analyse_text(text):
+ return shebang_matches(text, r'pythonw?(2\.\d)?')
+
class PythonConsoleLexer(Lexer):
"""
@@ -504,6 +507,9 @@ class RubyLexer(ExtendedRegexLexer):
}
tokens.update(gen_rubystrings_rules())
+ def analyse_text(text):
+ return shebang_matches(text, r'ruby(1\.\d)?')
+
class RubyConsoleLexer(Lexer):
"""
@@ -675,6 +681,9 @@ class PerlLexer(RegexLexer):
]
}
+ def analyse_text(text):
+ return shebang_matches(text, r'perl(\d\.\d\.\d)?')
+
class LuaLexer(RegexLexer):
name = 'Lua'