Skip to content

Commit

Permalink
simplify .ms heuristic
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 committed Aug 6, 2018
1 parent ed44c0b commit c2d20bc
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 @@ -323,7 +323,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 c2d20bc

Please sign in to comment.