mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Add heuristic for .inc files: the #declare keyword is unique to POV-Ray.
Also added #local, #macro, and #while.
This commit is contained in:
		@@ -202,6 +202,8 @@ module Linguist
 | 
			
		||||
    disambiguate ".inc" do |data|
 | 
			
		||||
      if /^<\?(?:php)?/.match(data)
 | 
			
		||||
        Language["PHP"]
 | 
			
		||||
      elsif /^\s*#(declare|local|macro|while)\s/.match(data)
 | 
			
		||||
        Language["POV-Ray SDL"]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -122,9 +122,12 @@ class TestHeuristcs < Minitest::Test
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Candidate languages = ["Assembly", "C++", "HTML", "PAWN", "PHP",
 | 
			
		||||
  #                        "POV-Ray SDL", "Pascal", "SQL", "SourcePawn"]
 | 
			
		||||
  def test_inc_by_heuristics
 | 
			
		||||
    assert_heuristics({
 | 
			
		||||
      "PHP" => all_fixtures("PHP", "*.inc")
 | 
			
		||||
      "PHP" => all_fixtures("PHP", "*.inc"),
 | 
			
		||||
      "POV-Ray SDL" => all_fixtures("POV-Ray SDL", "*.inc")
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user