mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Added heuristics to distinguish between AsciiDoc and Adventure Game Studio
This commit is contained in:
@@ -19,10 +19,23 @@ module Linguist
|
|||||||
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
||||||
result = disambiguate_ecl(data, languages)
|
result = disambiguate_ecl(data, languages)
|
||||||
end
|
end
|
||||||
|
if languages.all? { |l| ["Adventure Game Studio", "AsciiDoc"].include?(l) }
|
||||||
|
result = disabiguate_asc(data, languages)
|
||||||
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.disabiguate_asc(data, languages)
|
||||||
|
matches = []
|
||||||
|
if (/^(\/\/\s*|\s*((import|export)?\s*(function|int|float|char)\s*((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(]?))/.match(data))
|
||||||
|
matches << Language["Adventure Game Studio"]
|
||||||
|
elsif (/^\s*([=~\+\-\^]+\s*|\[.*?\]\s*)$|[\+\*\-\=]+/.match(data))
|
||||||
|
matches << Language["AsciiDoc"]
|
||||||
|
end
|
||||||
|
matches
|
||||||
|
end
|
||||||
|
|
||||||
# .h extensions are ambigious between C, C++, and Objective-C.
|
# .h extensions are ambigious between C, C++, and Objective-C.
|
||||||
# We want to shortcut look for Objective-C _and_ now C++ too!
|
# We want to shortcut look for Objective-C _and_ now C++ too!
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user