# Common heuristics ObjectiveCRegex = /^\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\b|#import\s+.+\.h[">])/ disambiguate ".asc" do |data| if /^(----[- ]BEGIN|ssh-(rsa|dss)) /.match(data) Language["Public Key"] elsif /^[=-]+(\s|\n)|{{[A-Za-z]/.match(data) Language["AsciiDoc"] elsif /^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])/.match(data) Language["AGS Script"] end end fortran_rx = /^([c*][^abd-z]| (subroutine|program|end|data)\s|\s*!)/i disambiguate ".f" do |data| if /^: /.match(data) Language["Forth"] elsif data.include?("flowop") Language["Filebench WML"] elsif fortran_rx.match(data) Language["FORTRAN"] end end disambiguate ".h" do |data| if ObjectiveCRegex.match(data) Language["Objective-C"] elsif (/^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>/.match(data) || /^\s*template\s*])|<\//i.match(data) || data.empty? Language["Markdown"] elsif /^(;;|\(define_)/.match(data) Language["GCC machine description"] else Language["Markdown"] end end disambiguate ".ms" do |data| if /^[.'][a-z][a-z](\s|$)/i.match(data) Language["Groff"] elsif /(?