summaryrefslogtreecommitdiff
path: root/pygments/lexers/jvm.py
diff options
context:
space:
mode:
authorDavid Corbett <corbett.dav@husky.neu.edu>2014-05-13 20:50:08 -0400
committerDavid Corbett <corbett.dav@husky.neu.edu>2014-05-13 20:50:08 -0400
commit16ca415efcb9c6bd009f6a85f47b47d0f83d9dd3 (patch)
treee39c0ea37f1a4022abd02ae01484b7fe280c66f3 /pygments/lexers/jvm.py
parentf7bd44802ad0abdc116b9dfc30c179cd0addecfe (diff)
downloadpygments-16ca415efcb9c6bd009f6a85f47b47d0f83d9dd3.tar.gz
Fix Jasmin and Smali code snippet detection
Diffstat (limited to 'pygments/lexers/jvm.py')
-rw-r--r--pygments/lexers/jvm.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/pygments/lexers/jvm.py b/pygments/lexers/jvm.py
index f0fe6a50..87bf3ff4 100644
--- a/pygments/lexers/jvm.py
+++ b/pygments/lexers/jvm.py
@@ -1507,12 +1507,13 @@ class JasminLexer(RegexLexer):
}
def analyse_text(text):
- if not re.search(r'^\s*\.class\s', text, re.MULTILINE):
- return 0
+ score = 0
+ if re.search(r'^\s*\.class\s', text, re.MULTILINE):
+ score += 0.5
+ if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE):
+ score += 0.3
if re.search(r'^\s*\.(attribute|bytecode|debug|deprecated|enclosing|'
r'inner|interface|limit|set|signature|stack)\b', text,
re.MULTILINE):
- return 1
- if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE):
- return 0.8
- return 0.5
+ score += 0.6
+ return score