Skip to content

Commit

Permalink
Added Turing language detection
Browse files Browse the repository at this point in the history
  • Loading branch information
trishume committed Nov 16, 2011
1 parent 2e653dd commit 5d40573
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/linguist/blob_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,20 @@ def guess_r_language
Language['R']
end
end

# Internal: Guess language of .t files.
#
# Makes fairly sure that it is Turing.
# Turing is not very popular so it would not be good to have perl users' files being confused.
#
# Returns a Language.
def guess_t_language
if lines.grep(/:=/).any? && lines.grep(/proc |procedure |fcn |function /).any? && lines.grep(/var/).any?
Language['Turing']
else
Language['Perl']
end
end

# Internal: Guess language of .gsp files.
#
Expand Down
9 changes: 9 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ Perl:
type: programming
overrides:
- .pl
- .t
primary_extension: .pl
extensions:
- .PL
Expand Down Expand Up @@ -965,6 +966,14 @@ Textile:
lexer: Text only
extensions:
- .textile

Turing:
type: programming
lexer: Text only
primary_extension: .t
extensions:
- .t
- .tu

Twig:
type: markup
Expand Down

0 comments on commit 5d40573

Please sign in to comment.