diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb index be4483cf..f8149c82 100644 --- a/lib/linguist/blob_helper.rb +++ b/lib/linguist/blob_helper.rb @@ -467,6 +467,20 @@ module Linguist 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. # diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index a7de46f3..36748a7d 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -717,6 +717,7 @@ Perl: type: programming overrides: - .pl + - .t primary_extension: .pl extensions: - .PL @@ -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