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

View File

@@ -54,6 +54,12 @@ Ada:
- .adb
- .ads
Apex:
type: programming
lexer: Text only
extensions:
- .cls
AppleScript:
aliases:
- osascript
@@ -747,8 +753,6 @@ OpenEdge ABL:
- openedge
- abl
primary_extension: .p
overrides:
- .cls
extensions:
- .cls
- .p
@@ -1053,6 +1057,8 @@ Tcsh:
TeX:
type: markup
primary_extension: .tex
overrides:
- .cls
extensions:
- .aux
- .cls