Improve .cls language detection

This commit is contained in:
Abe Voelker
2012-03-21 10:05:53 -05:00
parent 777f5a3b87
commit 22db59d8c0
10 changed files with 1542 additions and 24 deletions

View File

@@ -423,8 +423,15 @@ module Linguist
def guess_cls_language
if lines.grep(/^(%|\\)/).any?
Language['TeX']
else
elsif lines.grep(/^\s*(CLASS|METHOD|INTERFACE).*:\s*/i).any? || lines.grep(/^\s*(USING|DEFINE)/i).any?
Language['OpenEdge ABL']
elsif lines.grep(/\{$/).any? || lines.grep(/\}$/).any?
Language['Apex']
elsif lines.grep(/^(\'\*|Attribute|Option|Sub|Private|Protected|Public|Friend)/i).any?
Language['Visual Basic']
else
# The most common language should be the fallback
Language['TeX']
end
end