lib/linguist/heuristics.rb in github-linguist-4.7.6 vs lib/linguist/heuristics.rb in github-linguist-4.8.0
- old
+ new
@@ -311,18 +311,34 @@
elsif /^\s*function[ \w,]+$/.match(data)
Language["IDL"]
end
end
+ disambiguate ".props" do |data|
+ if /^(\s*)(<Project|<Import|<Property|<?xml|xmlns)/i.match(data)
+ Language["XML"]
+ elsif /\w+\s*=\s*/i.match(data)
+ Language["INI"]
+ end
+ end
+
disambiguate ".r" do |data|
if /\bRebol\b/i.match(data)
Language["Rebol"]
elsif data.include?("<-")
Language["R"]
end
end
+ disambiguate ".rpy" do |data|
+ if /(^(import|from|class|def)[\s\S])/m.match(data)
+ Language["Python"]
+ else
+ Language["Ren'Py"]
+ end
+ end
+
disambiguate ".rs" do |data|
if /^(use |fn |mod |pub |macro_rules|impl|#!?\[)/.match(data)
Language["Rust"]
elsif /#include|#pragma\s+(rs|version)|__attribute__/.match(data)
Language["RenderScript"]
@@ -336,10 +352,10 @@
Language["Scala"]
end
end
disambiguate ".sql" do |data|
- if /^\\i\b|AS \$\$|LANGUAGE '+plpgsql'+/i.match(data) || /SECURITY (DEFINER|INVOKER)/i.match(data) || /BEGIN( WORK| TRANSACTION)?;/i.match(data)
+ if /^\\i\b|AS \$\$|LANGUAGE '?plpgsql'?/i.match(data) || /SECURITY (DEFINER|INVOKER)/i.match(data) || /BEGIN( WORK| TRANSACTION)?;/i.match(data)
#Postgres
Language["PLpgSQL"]
elsif /(alter module)|(language sql)|(begin( NOT)+ atomic)/i.match(data) || /signal SQLSTATE '[0-9]+'/i.match(data)
#IBM db2
Language["SQLPL"]