Skip to content

Commit

Permalink
simplify .ms heuristic (#4224)
Browse files Browse the repository at this point in the history
Simplify .ms heuristic for Unix Assembly by just checking that there is no
`/*` string in the file. This is simpler and seems to work with all Unix Assembly
files in GitHub. A synthetic MAXScript file was also tested by adding assembly inside
a multiline comment.
  • Loading branch information
smola authored and lildude committed Aug 20, 2018
1 parent 3fa6fe0 commit 1221480
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/linguist/heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def call(data)
disambiguate ".ms" do |data|
if /^[.'][a-z][a-z](\s|$)/i.match(data)
Language["Roff"]
elsif /(?<!\S)\.(include|globa?l)\s/.match(data) || /(?<!\/\*)(\A|\n)\s*\.[A-Za-z][_A-Za-z0-9]*:/.match(data.gsub(/"([^\\"]|\\.)*"|'([^\\']|\\.)*'|\\\s*(?:--.*)?\n/, ""))
elsif !/\/\*/.match(data) && /^\s*\.(?:include\s|globa?l\s|[A-Za-z][_A-Za-z0-9]*:)/.match(data)
Language["Unix Assembly"]
else
Language["MAXScript"]
Expand Down

0 comments on commit 1221480

Please sign in to comment.