mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-07-31 09:49:37 +00:00
Integrate heuristics into lexer selection
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
require "yaml"
|
||||
|
||||
# Use linguist's heuristics to disambiguate between languages
|
||||
# This is *shamelessly* stolen from https://github.com/github-linguist/linguist
|
||||
# and ported to Crystal. Deepest thanks to the authors of Linguist
|
||||
# for licensing it liberally.
|
||||
#
|
||||
# Consider this code (c) 2017 GitHub, Inc. even if I wrote it.
|
||||
module Linguist
|
||||
|
||||
# Use linguist's heuristics to disambiguate between languages
|
||||
# This is *shamelessly* stolen from https://github.com/github-linguist/linguist
|
||||
# and ported to Crystal. Deepest thanks to the authors of Linguist
|
||||
# for licensing it liberally.
|
||||
#
|
||||
# Consider this code (c) 2017 GitHub, Inc. even if I wrote it.
|
||||
module Linguist
|
||||
class Heuristic
|
||||
include YAML::Serializable
|
||||
|
||||
@@ -80,7 +79,3 @@ require "yaml"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
h = Linguist::Heuristic.from_yaml(File.read("heuristics/heuristics.yml"))
|
||||
fname = "/usr/include/sqlite3.h"
|
||||
p! h.run(fname, File.read(fname))
|
||||
|
Reference in New Issue
Block a user