summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-08 00:20:06 +0200
committerGeorg Brandl <georg@python.org>2014-10-08 00:20:06 +0200
commit506f11db8b046c97b3730ae40ae4180d5f4112f2 (patch)
treee9e89e4e9809287365595e0be557b05d1161ef49 /pygments
parent1fd65ff28bc90c6ea89a4f4e6397818ab1a99b4c (diff)
downloadpygments-506f11db8b046c97b3730ae40ae4180d5f4112f2.tar.gz
Closes #892: fix overzealous analyse_text of the SourcesListLexer.
Also remove any "default" return from analyse_text methods.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/basic.py5
-rw-r--r--pygments/lexers/dsls.py2
-rw-r--r--pygments/lexers/installers.py8
3 files changed, 6 insertions, 9 deletions
diff --git a/pygments/lexers/basic.py b/pygments/lexers/basic.py
index b3733e6f..a5e79e5e 100644
--- a/pygments/lexers/basic.py
+++ b/pygments/lexers/basic.py
@@ -354,7 +354,7 @@ class CbmBasicV2Lexer(RegexLexer):
# if it starts with a line number, it shouldn't be a "modern" Basic
# like VB.net
if re.match(r'\d+', text):
- return True
+ return 0.2
class QBasicLexer(RegexLexer):
@@ -496,4 +496,5 @@ class QBasicLexer(RegexLexer):
}
def analyse_text(text):
- return 0.2
+ if '$DYNAMIC' in text or '$STATIC' in text:
+ return 0.9
diff --git a/pygments/lexers/dsls.py b/pygments/lexers/dsls.py
index db2e2d48..e059ecfd 100644
--- a/pygments/lexers/dsls.py
+++ b/pygments/lexers/dsls.py
@@ -300,8 +300,6 @@ class RslLexer(RegexLexer):
"""
if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None:
return 1.0
- else:
- return 0.01
class MscgenLexer(RegexLexer):
diff --git a/pygments/lexers/installers.py b/pygments/lexers/installers.py
index b76db0a9..54369da1 100644
--- a/pygments/lexers/installers.py
+++ b/pygments/lexers/installers.py
@@ -258,12 +258,10 @@ class SourcesListLexer(RegexLexer):
}
def analyse_text(text):
- for line in text.split('\n'):
+ for line in text.splitlines():
line = line.strip()
- if not (line.startswith('#') or line.startswith('deb ') or
- line.startswith('deb-src ') or not line):
- return False
- return True
+ if line.startswith('deb ') or line.startswith('deb-src '):
+ return True
class DebianControlLexer(RegexLexer):