added type.go generation

This commit is contained in:
Manuel Carmona 2017-04-11 11:26:23 +02:00
parent 5d61ca93d8
commit ef39403555
13 changed files with 836 additions and 74 deletions

View File

@ -12,7 +12,7 @@ func (s *TSuite) TestGetLanguageByExtension(c *C) {
c.Assert(safe, Equals, true) c.Assert(safe, Equals, true)
lang, safe = GetLanguageByExtension("foo.go.php") lang, safe = GetLanguageByExtension("foo.go.php")
c.Assert(lang, Equals, "Hack") c.Assert(lang, Equals, "PHP")
c.Assert(safe, Equals, false) c.Assert(safe, Equals, false)
} }

View File

@ -0,0 +1,24 @@
package slinguist
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
const (
TypeUnknown = iota
TypeData = iota
TypeProgramming = iota
TypeMarkup = iota
TypeProse = iota
)
func GetLanguageType(language string) (langType int) {
langType, _ = languagesType[language]
return langType
}
var languagesType = map[string]int{
{{range $language, $type := . -}}
"{{ $language }}": {{ $type -}},
{{end -}}
}

View File

@ -17,6 +17,7 @@ const (
formatedContentGold = "test_files/formated_content.gold" formatedContentGold = "test_files/formated_content.gold"
formatedVendorGold = "test_files/formated_vendor.gold" formatedVendorGold = "test_files/formated_vendor.gold"
formatedDocumentationGold = "test_files/formated_documentation.gold" formatedDocumentationGold = "test_files/formated_documentation.gold"
formatedTypesGold = "test_files/formated_type.gold"
// Languages test // Languages test
ymlTestFile = "test_files/languages.test.yml" ymlTestFile = "test_files/languages.test.yml"
@ -41,6 +42,12 @@ const (
documentationGold = "test_files/documentation.gold" documentationGold = "test_files/documentation.gold"
documentationTestTmplPath = "test_files/documentation.test.go.tmpl" documentationTestTmplPath = "test_files/documentation.test.go.tmpl"
documentationTestTmplName = "documentation.test.go.tmpl" documentationTestTmplName = "documentation.test.go.tmpl"
// Types test
typesTestFile = "test_files/type.test.yml"
typesGold = "test_files/type.gold"
typesTestTmplPath = "test_files/type.test.go.tmpl"
typesTestTmplName = "type.test.go.tmpl"
) )
func TestFromFile(t *testing.T) { func TestFromFile(t *testing.T) {
@ -56,6 +63,9 @@ func TestFromFile(t *testing.T) {
goldDocumentation, err := ioutil.ReadFile(formatedDocumentationGold) goldDocumentation, err := ioutil.ReadFile(formatedDocumentationGold)
assert.NoError(t, err) assert.NoError(t, err)
goldTypes, err := ioutil.ReadFile(formatedTypesGold)
assert.NoError(t, err)
outPathLang, err := ioutil.TempFile("/tmp", "generator-test-") outPathLang, err := ioutil.TempFile("/tmp", "generator-test-")
assert.NoError(t, err) assert.NoError(t, err)
defer os.Remove(outPathLang.Name()) defer os.Remove(outPathLang.Name())
@ -72,6 +82,10 @@ func TestFromFile(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
defer os.Remove(outPathDocumentation.Name()) defer os.Remove(outPathDocumentation.Name())
outPathTypes, err := ioutil.TempFile("/tmp", "generator-test-")
assert.NoError(t, err)
defer os.Remove(outPathTypes.Name())
tests := []struct { tests := []struct {
name string name string
fileToParse string fileToParse string
@ -122,6 +136,16 @@ func TestFromFile(t *testing.T) {
generate: Documentation, generate: Documentation,
wantOut: goldDocumentation, wantOut: goldDocumentation,
}, },
{
name: "tyTestFromFile_Types",
fileToParse: typesTestFile,
outPath: outPathTypes.Name(),
tmplPath: typesTestTmplPath,
tmplName: typesTestTmplName,
commit: commitTest,
generate: Types,
wantOut: goldTypes,
},
} }
for _, tt := range tests { for _, tt := range tests {
@ -270,3 +294,37 @@ func TestDocumentation(t *testing.T) {
}) })
} }
} }
func TestTypes(t *testing.T) {
gold, err := ioutil.ReadFile(typesGold)
assert.NoError(t, err)
input, err := ioutil.ReadFile(typesTestFile)
assert.NoError(t, err)
tests := []struct {
name string
input []byte
tmplPath string
tmplName string
commit string
wantOut []byte
}{
{
name: "TestTypes",
input: input,
tmplPath: typesTestTmplPath,
tmplName: typesTestTmplName,
commit: commitTest,
wantOut: gold,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
out, err := Types(tt.input, tt.tmplPath, tt.tmplName, tt.commit)
assert.NoError(t, err)
assert.EqualValues(t, tt.wantOut, out, fmt.Sprintf("Types() = %v, want %v", string(out), string(tt.wantOut)))
})
}
}

View File

@ -10,11 +10,11 @@ import (
) )
type languageInfo struct { type languageInfo struct {
Type string `yaml:"type,omitempty" json:"type,omitempty"` Type string `yaml:"type,omitempty"`
Aliases []string `yaml:"aliases,omitempty,flow" json:"aliases,omitempty"` Aliases []string `yaml:"aliases,omitempty,flow"`
Extensions []string `yaml:"extensions,omitempty,flow" json:"extensions,omitempty"` Extensions []string `yaml:"extensions,omitempty,flow"`
Interpreters []string `yaml:"interpreters,omitempty,flow" json:"interpreters,omitempty"` Interpreters []string `yaml:"interpreters,omitempty,flow"`
Group string `yaml:"group,omitempty" json:"group,omitempty"` Group string `yaml:"group,omitempty"`
} }
// Languages reads from buf and builds languages.go file from languagesTmplPath. // Languages reads from buf and builds languages.go file from languagesTmplPath.
@ -24,10 +24,7 @@ func Languages(data []byte, languagesTmplPath, languagesTmplName, commit string)
return nil, err return nil, err
} }
languagesByExtension, err := buildExtensionLanguageMap(languages) languagesByExtension := buildExtensionLanguageMap(languages)
if err != nil {
return nil, err
}
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
if err := executeLanguagesTemplate(buf, languagesByExtension, languagesTmplPath, languagesTmplName, commit); err != nil { if err := executeLanguagesTemplate(buf, languagesByExtension, languagesTmplPath, languagesTmplName, commit); err != nil {
@ -37,7 +34,7 @@ func Languages(data []byte, languagesTmplPath, languagesTmplName, commit string)
return buf.Bytes(), nil return buf.Bytes(), nil
} }
func buildExtensionLanguageMap(languages map[string]*languageInfo) (map[string][]string, error) { func buildExtensionLanguageMap(languages map[string]*languageInfo) map[string][]string {
extensionLangsMap := make(map[string][]string) extensionLangsMap := make(map[string][]string)
for lang, info := range languages { for lang, info := range languages {
for _, extension := range info.Extensions { for _, extension := range info.Extensions {
@ -45,7 +42,7 @@ func buildExtensionLanguageMap(languages map[string]*languageInfo) (map[string][
} }
} }
return extensionLangsMap, nil return extensionLangsMap
} }
func executeLanguagesTemplate(out io.Writer, languagesByExtension map[string][]string, languagesTmplPath, languagesTmpl, commit string) error { func executeLanguagesTemplate(out io.Writer, languagesByExtension map[string][]string, languagesTmplPath, languagesTmpl, commit string) error {

View File

@ -0,0 +1,25 @@
package slinguist
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
const (
TypeUnknown = iota
TypeData = iota
TypeProgramming = iota
TypeMarkup = iota
TypeProse = iota
)
func GetLanguageType(language string) (langType int) {
langType, _ = languagesType[language]
return langType
}
var languagesType = map[string]int{
"Scaml": TypeMarkup,
"Scheme": TypeProgramming,
"Scilab": TypeProgramming,
"Self": TypeProgramming,
}

View File

@ -0,0 +1,25 @@
package slinguist
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
const (
TypeUnknown = iota
TypeData = iota
TypeProgramming = iota
TypeMarkup = iota
TypeProse = iota
)
func GetLanguageType(language string) (langType int) {
langType, _ = languagesType[language]
return langType
}
var languagesType = map[string]int{
"Scaml": TypeMarkup,
"Scheme": TypeProgramming,
"Scilab": TypeProgramming,
"Self": TypeProgramming,
}

View File

@ -0,0 +1,24 @@
package slinguist
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
const (
TypeUnknown = iota
TypeData = iota
TypeProgramming = iota
TypeMarkup = iota
TypeProse = iota
)
func GetLanguageType(language string) (langType int) {
langType, _ = languagesType[language]
return langType
}
var languagesType = map[string]int{
{{range $language, $type := . -}}
"{{ $language }}": {{ $type -}},
{{end -}}
}

View File

@ -0,0 +1,46 @@
---
Scaml:
group: HTML
type: markup
extensions:
- ".scaml"
tm_scope: source.scaml
ace_mode: text
language_id: 342
Scheme:
type: programming
color: "#1e4aec"
extensions:
- ".scm"
- ".sld"
- ".sls"
- ".sps"
- ".ss"
interpreters:
- guile
- bigloo
- chicken
- csi
- gosh
- r6rs
ace_mode: scheme
codemirror_mode: scheme
codemirror_mime_type: text/x-scheme
language_id: 343
Scilab:
type: programming
extensions:
- ".sci"
- ".sce"
- ".tst"
ace_mode: text
language_id: 344
Self:
type: programming
color: "#0579aa"
extensions:
- ".self"
tm_scope: none
ace_mode: text
language_id: 345

View File

@ -0,0 +1,55 @@
package generator
import (
"bytes"
"io"
"text/template"
yaml "gopkg.in/yaml.v2"
)
var typeToTypeConst = map[string]string{
"data": "TypeData",
"programming": "TypeProgramming",
"markup": "TypeMarkup",
"prose": "TypeProse",
}
// Types reads from buf and builds type.go file from typeTmplPath.
func Types(data []byte, typeTmplPath, typeTmplName, commit string) ([]byte, error) {
languages := make(map[string]*languageInfo)
if err := yaml.Unmarshal(data, &languages); err != nil {
return nil, err
}
langTypeMap := buildLanguageTypeMap(languages)
buf := &bytes.Buffer{}
if err := executeTypesTemplate(buf, langTypeMap, typeTmplPath, typeTmplName, commit); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func buildLanguageTypeMap(languages map[string]*languageInfo) map[string]string {
langTypeMap := make(map[string]string)
for lang, info := range languages {
langTypeMap[lang] = typeToTypeConst[info.Type]
}
return langTypeMap
}
func executeTypesTemplate(out io.Writer, langTypeMap map[string]string, typeTmplPath, typeTmpl, commit string) error {
fmap := template.FuncMap{
"getCommit": func() string { return commit },
}
t := template.Must(template.New(typeTmpl).Funcs(fmap).ParseFiles(typeTmplPath))
if err := t.Execute(out, langTypeMap); err != nil {
return err
}
return nil
}

View File

@ -28,29 +28,40 @@ const (
documentationTmplPath = "internal/code-generator/assets/documentation.go.tmpl" documentationTmplPath = "internal/code-generator/assets/documentation.go.tmpl"
documentationTmpl = "documentation.go.tmpl" documentationTmpl = "documentation.go.tmpl"
typeFile = "type.go"
typeTmplPath = "internal/code-generator/assets/type.go.tmpl"
typeTmpl = "type.go.tmpl"
commitPath = ".git/refs/heads/master" commitPath = ".git/refs/heads/master"
) )
type generatorArgs struct {
fileToParse string
outPath string
tmplPath string
tmplName string
commit string
generate generator.Func
}
func main() { func main() {
commit, err := getCommit(commitPath) commit, err := getCommit(commitPath)
if err != nil { if err != nil {
log.Printf("couldn't find commit: %v", err) log.Printf("couldn't find commit: %v", err)
} }
if err := generator.FromFile(languagesYAML, langFile, languagesTmplPath, languagesTmpl, commit, generator.Languages); err != nil { argsList := []*generatorArgs{
log.Println(err) &generatorArgs{languagesYAML, langFile, languagesTmplPath, languagesTmpl, commit, generator.Languages},
&generatorArgs{heuristicsRuby, contentFile, contentTmplPath, contentTmpl, commit, generator.Heuristics},
&generatorArgs{vendorYAML, vendorFile, vendorTmplPath, vendorTmpl, commit, generator.Vendor},
&generatorArgs{documentationYAML, documentationFile, documentationTmplPath, documentationTmpl, commit, generator.Documentation},
&generatorArgs{languagesYAML, typeFile, typeTmplPath, typeTmpl, commit, generator.Types},
} }
if err := generator.FromFile(heuristicsRuby, contentFile, contentTmplPath, contentTmpl, commit, generator.Heuristics); err != nil { for _, args := range argsList {
if err := generator.FromFile(args.fileToParse, args.outPath, args.tmplPath, args.tmplName, args.commit, args.generate); err != nil {
log.Println(err) log.Println(err)
} }
if err := generator.FromFile(vendorYAML, vendorFile, vendorTmplPath, vendorTmpl, commit, generator.Vendor); err != nil {
log.Println(err)
}
if err := generator.FromFile(documentationYAML, documentationFile, documentationTmplPath, documentationTmpl, commit, generator.Documentation); err != nil {
log.Println(err)
} }
} }

View File

@ -62,7 +62,7 @@ var languagesByExtension = map[string][]string{
".arpa": {"DNS Zone"}, ".arpa": {"DNS Zone"},
".as": {"ActionScript"}, ".as": {"ActionScript"},
".asax": {"ASP"}, ".asax": {"ASP"},
".asc": {"AsciiDoc", "AGS Script", "Public Key"}, ".asc": {"AGS Script", "Public Key", "AsciiDoc"},
".asciidoc": {"AsciiDoc"}, ".asciidoc": {"AsciiDoc"},
".ascx": {"ASP"}, ".ascx": {"ASP"},
".asd": {"Common Lisp"}, ".asd": {"Common Lisp"},
@ -87,7 +87,7 @@ var languagesByExtension = map[string][]string{
".axml": {"XML"}, ".axml": {"XML"},
".axs": {"NetLinx"}, ".axs": {"NetLinx"},
".axs.erb": {"NetLinx+ERB"}, ".axs.erb": {"NetLinx+ERB"},
".b": {"Limbo", "Brainfuck"}, ".b": {"Brainfuck", "Limbo"},
".bas": {"Visual Basic"}, ".bas": {"Visual Basic"},
".bash": {"Shell"}, ".bash": {"Shell"},
".bat": {"Batchfile"}, ".bat": {"Batchfile"},
@ -95,7 +95,7 @@ var languagesByExtension = map[string][]string{
".bb": {"BlitzBasic", "BitBake"}, ".bb": {"BlitzBasic", "BitBake"},
".bbx": {"TeX"}, ".bbx": {"TeX"},
".befunge": {"Befunge"}, ".befunge": {"Befunge"},
".bf": {"HyPhy", "Brainfuck"}, ".bf": {"Brainfuck", "HyPhy"},
".bib": {"TeX"}, ".bib": {"TeX"},
".bison": {"Bison"}, ".bison": {"Bison"},
".blade": {"Blade"}, ".blade": {"Blade"},
@ -104,7 +104,7 @@ var languagesByExtension = map[string][]string{
".bones": {"JavaScript"}, ".bones": {"JavaScript"},
".boo": {"Boo"}, ".boo": {"Boo"},
".boot": {"Clojure"}, ".boot": {"Clojure"},
".brd": {"KiCad", "Eagle"}, ".brd": {"Eagle", "KiCad"},
".bro": {"Bro"}, ".bro": {"Bro"},
".brs": {"Brightscript"}, ".brs": {"Brightscript"},
".bsl": {"1C Enterprise"}, ".bsl": {"1C Enterprise"},
@ -117,7 +117,7 @@ var languagesByExtension = map[string][]string{
".c++-objdump": {"Cpp-ObjDump"}, ".c++-objdump": {"Cpp-ObjDump"},
".c++objdump": {"Cpp-ObjDump"}, ".c++objdump": {"Cpp-ObjDump"},
".c-objdump": {"C-ObjDump"}, ".c-objdump": {"C-ObjDump"},
".cake": {"CoffeeScript", "C#"}, ".cake": {"C#", "CoffeeScript"},
".capnp": {"Cap'n Proto"}, ".capnp": {"Cap'n Proto"},
".cats": {"C"}, ".cats": {"C"},
".cbl": {"COBOL"}, ".cbl": {"COBOL"},
@ -131,7 +131,7 @@ var languagesByExtension = map[string][]string{
".cfg": {"INI"}, ".cfg": {"INI"},
".cfm": {"ColdFusion"}, ".cfm": {"ColdFusion"},
".cfml": {"ColdFusion"}, ".cfml": {"ColdFusion"},
".cgi": {"Shell", "Python", "Perl"}, ".cgi": {"Python", "Perl", "Shell"},
".ch": {"Charity", "xBase"}, ".ch": {"Charity", "xBase"},
".chem": {"Pic"}, ".chem": {"Pic"},
".chpl": {"Chapel"}, ".chpl": {"Chapel"},
@ -139,7 +139,7 @@ var languagesByExtension = map[string][]string{
".cirru": {"Cirru"}, ".cirru": {"Cirru"},
".cjsx": {"CoffeeScript"}, ".cjsx": {"CoffeeScript"},
".ck": {"ChucK"}, ".ck": {"ChucK"},
".cl": {"OpenCL", "Common Lisp", "Cool"}, ".cl": {"Common Lisp", "OpenCL", "Cool"},
".cl2": {"Clojure"}, ".cl2": {"Clojure"},
".click": {"Click"}, ".click": {"Click"},
".clixml": {"XML"}, ".clixml": {"XML"},
@ -150,7 +150,7 @@ var languagesByExtension = map[string][]string{
".cljscm": {"Clojure"}, ".cljscm": {"Clojure"},
".cljx": {"Clojure"}, ".cljx": {"Clojure"},
".clp": {"CLIPS"}, ".clp": {"CLIPS"},
".cls": {"TeX", "Apex", "OpenEdge ABL", "Visual Basic"}, ".cls": {"Apex", "TeX", "Visual Basic", "OpenEdge ABL"},
".clw": {"Clarion"}, ".clw": {"Clarion"},
".cmake": {"CMake"}, ".cmake": {"CMake"},
".cmake.in": {"CMake"}, ".cmake.in": {"CMake"},
@ -161,7 +161,7 @@ var languagesByExtension = map[string][]string{
".com": {"DIGITAL Command Language"}, ".com": {"DIGITAL Command Language"},
".command": {"Shell"}, ".command": {"Shell"},
".coq": {"Coq"}, ".coq": {"Coq"},
".cp": {"C++", "Component Pascal"}, ".cp": {"Component Pascal", "C++"},
".cpp": {"C++"}, ".cpp": {"C++"},
".cpp-objdump": {"Cpp-ObjDump"}, ".cpp-objdump": {"Cpp-ObjDump"},
".cppobjdump": {"Cpp-ObjDump"}, ".cppobjdump": {"Cpp-ObjDump"},
@ -189,7 +189,7 @@ var languagesByExtension = map[string][]string{
".cxx": {"C++"}, ".cxx": {"C++"},
".cxx-objdump": {"Cpp-ObjDump"}, ".cxx-objdump": {"Cpp-ObjDump"},
".cy": {"Cycript"}, ".cy": {"Cycript"},
".d": {"Makefile", "DTrace", "D"}, ".d": {"Makefile", "D", "DTrace"},
".d-objdump": {"D-ObjDump"}, ".d-objdump": {"D-ObjDump"},
".dae": {"COLLADA"}, ".dae": {"COLLADA"},
".darcspatch": {"Darcs Patch"}, ".darcspatch": {"Darcs Patch"},
@ -229,7 +229,7 @@ var languagesByExtension = map[string][]string{
".ebnf": {"EBNF"}, ".ebnf": {"EBNF"},
".ebuild": {"Gentoo Ebuild"}, ".ebuild": {"Gentoo Ebuild"},
".ec": {"eC"}, ".ec": {"eC"},
".ecl": {"ECLiPSe", "ECL"}, ".ecl": {"ECL", "ECLiPSe"},
".eclass": {"Gentoo Eclass"}, ".eclass": {"Gentoo Eclass"},
".eclxml": {"ECL"}, ".eclxml": {"ECL"},
".ecr": {"HTML+ECR"}, ".ecr": {"HTML+ECR"},
@ -251,13 +251,13 @@ var languagesByExtension = map[string][]string{
".erb": {"HTML+ERB"}, ".erb": {"HTML+ERB"},
".erb.deface": {"HTML+ERB"}, ".erb.deface": {"HTML+ERB"},
".erl": {"Erlang"}, ".erl": {"Erlang"},
".es": {"Erlang", "JavaScript"}, ".es": {"JavaScript", "Erlang"},
".es6": {"JavaScript"}, ".es6": {"JavaScript"},
".escript": {"Erlang"}, ".escript": {"Erlang"},
".ex": {"Elixir"}, ".ex": {"Elixir"},
".exs": {"Elixir"}, ".exs": {"Elixir"},
".eye": {"Ruby"}, ".eye": {"Ruby"},
".f": {"Fortran", "Filebench WML", "Forth"}, ".f": {"Fortran", "Forth", "Filebench WML"},
".f03": {"Fortran"}, ".f03": {"Fortran"},
".f08": {"Fortran"}, ".f08": {"Fortran"},
".f77": {"Fortran"}, ".f77": {"Fortran"},
@ -266,24 +266,24 @@ var languagesByExtension = map[string][]string{
".factor": {"Factor"}, ".factor": {"Factor"},
".fan": {"Fantom"}, ".fan": {"Fantom"},
".fancypack": {"Fancy"}, ".fancypack": {"Fancy"},
".fcgi": {"Lua", "Shell", "PHP", "Python", "Perl", "Ruby"}, ".fcgi": {"PHP", "Python", "Perl", "Shell", "Ruby", "Lua"},
".fea": {"OpenType Feature File"}, ".fea": {"OpenType Feature File"},
".feature": {"Gherkin"}, ".feature": {"Gherkin"},
".filters": {"XML"}, ".filters": {"XML"},
".fish": {"fish"}, ".fish": {"fish"},
".flex": {"JFlex"}, ".flex": {"JFlex"},
".flux": {"FLUX"}, ".flux": {"FLUX"},
".for": {"Formatted", "Fortran", "Forth"}, ".for": {"Fortran", "Formatted", "Forth"},
".forth": {"Forth"}, ".forth": {"Forth"},
".fp": {"GLSL"}, ".fp": {"GLSL"},
".fpp": {"Fortran"}, ".fpp": {"Fortran"},
".fr": {"Text", "Frege", "Forth"}, ".fr": {"Forth", "Frege", "Text"},
".frag": {"JavaScript", "GLSL"}, ".frag": {"JavaScript", "GLSL"},
".frg": {"GLSL"}, ".frg": {"GLSL"},
".frm": {"Visual Basic"}, ".frm": {"Visual Basic"},
".frt": {"Forth"}, ".frt": {"Forth"},
".frx": {"Visual Basic"}, ".frx": {"Visual Basic"},
".fs": {"Filterscript", "GLSL", "F#", "Forth"}, ".fs": {"F#", "Forth", "Filterscript", "GLSL"},
".fsh": {"GLSL"}, ".fsh": {"GLSL"},
".fshader": {"GLSL"}, ".fshader": {"GLSL"},
".fsi": {"F#"}, ".fsi": {"F#"},
@ -302,7 +302,7 @@ var languagesByExtension = map[string][]string{
".gawk": {"Awk"}, ".gawk": {"Awk"},
".gco": {"G-code"}, ".gco": {"G-code"},
".gcode": {"G-code"}, ".gcode": {"G-code"},
".gd": {"GDScript", "GAP"}, ".gd": {"GAP", "GDScript"},
".gdb": {"GDB"}, ".gdb": {"GDB"},
".gdbinit": {"GDB"}, ".gdbinit": {"GDB"},
".gemspec": {"Ruby"}, ".gemspec": {"Ruby"},
@ -315,7 +315,7 @@ var languagesByExtension = map[string][]string{
".glf": {"Glyph"}, ".glf": {"Glyph"},
".glsl": {"GLSL"}, ".glsl": {"GLSL"},
".glslv": {"GLSL"}, ".glslv": {"GLSL"},
".gml": {"Graph Modeling Language", "Game Maker Language", "XML"}, ".gml": {"XML", "Graph Modeling Language", "Game Maker Language"},
".gms": {"GAMS"}, ".gms": {"GAMS"},
".gn": {"GN"}, ".gn": {"GN"},
".gni": {"GN"}, ".gni": {"GN"},
@ -341,7 +341,7 @@ var languagesByExtension = map[string][]string{
".gvy": {"Groovy"}, ".gvy": {"Groovy"},
".gyp": {"Python"}, ".gyp": {"Python"},
".gypi": {"Python"}, ".gypi": {"Python"},
".h": {"C", "Objective-C", "C++"}, ".h": {"C++", "C", "Objective-C"},
".h++": {"C++"}, ".h++": {"C++"},
".haml": {"Haml"}, ".haml": {"Haml"},
".haml.deface": {"Haml"}, ".haml.deface": {"Haml"},
@ -350,7 +350,7 @@ var languagesByExtension = map[string][]string{
".hb": {"Harbour"}, ".hb": {"Harbour"},
".hbs": {"Handlebars"}, ".hbs": {"Handlebars"},
".hcl": {"HCL"}, ".hcl": {"HCL"},
".hh": {"C++", "Hack"}, ".hh": {"Hack", "C++"},
".hic": {"Clojure"}, ".hic": {"Clojure"},
".hlean": {"Lean"}, ".hlean": {"Lean"},
".hlsl": {"HLSL"}, ".hlsl": {"HLSL"},
@ -378,7 +378,7 @@ var languagesByExtension = map[string][]string{
".ik": {"Ioke"}, ".ik": {"Ioke"},
".ily": {"LilyPond"}, ".ily": {"LilyPond"},
".iml": {"XML"}, ".iml": {"XML"},
".inc": {"Assembly", "POV-Ray SDL", "HTML", "PHP", "PAWN", "Pascal", "C++", "SQL", "SourcePawn"}, ".inc": {"PHP", "Assembly", "HTML", "POV-Ray SDL", "SQL", "Pascal", "C++", "SourcePawn", "PAWN"},
".ini": {"INI"}, ".ini": {"INI"},
".inl": {"C++"}, ".inl": {"C++"},
".ino": {"Arduino"}, ".ino": {"Arduino"},
@ -392,7 +392,7 @@ var languagesByExtension = map[string][]string{
".irclog": {"IRC log"}, ".irclog": {"IRC log"},
".iss": {"Inno Setup"}, ".iss": {"Inno Setup"},
".ivy": {"XML"}, ".ivy": {"XML"},
".j": {"Jasmin", "Objective-J"}, ".j": {"Objective-J", "Jasmin"},
".jade": {"Pug"}, ".jade": {"Pug"},
".jake": {"JavaScript"}, ".jake": {"JavaScript"},
".java": {"Java"}, ".java": {"Java"},
@ -425,7 +425,7 @@ var languagesByExtension = map[string][]string{
".kt": {"Kotlin"}, ".kt": {"Kotlin"},
".ktm": {"Kotlin"}, ".ktm": {"Kotlin"},
".kts": {"Kotlin"}, ".kts": {"Kotlin"},
".l": {"Roff", "Common Lisp", "PicoLisp", "Lex"}, ".l": {"Common Lisp", "Roff", "PicoLisp", "Lex"},
".lagda": {"Literate Agda"}, ".lagda": {"Literate Agda"},
".las": {"Lasso"}, ".las": {"Lasso"},
".lasso": {"Lasso"}, ".lasso": {"Lasso"},
@ -454,7 +454,7 @@ var languagesByExtension = map[string][]string{
".lol": {"LOLCODE"}, ".lol": {"LOLCODE"},
".lookml": {"LookML"}, ".lookml": {"LookML"},
".lpr": {"Pascal"}, ".lpr": {"Pascal"},
".ls": {"LoomScript", "LiveScript"}, ".ls": {"LiveScript", "LoomScript"},
".lsl": {"LSL"}, ".lsl": {"LSL"},
".lslp": {"LSL"}, ".lslp": {"LSL"},
".lsp": {"NewLisp", "Common Lisp"}, ".lsp": {"NewLisp", "Common Lisp"},
@ -462,8 +462,8 @@ var languagesByExtension = map[string][]string{
".lua": {"Lua"}, ".lua": {"Lua"},
".lvproj": {"LabVIEW"}, ".lvproj": {"LabVIEW"},
".ly": {"LilyPond"}, ".ly": {"LilyPond"},
".m": {"M", "Limbo", "Objective-C", "MUF", "Matlab", "Mercury", "Mathematica"}, ".m": {"Matlab", "M", "Limbo", "Objective-C", "Mathematica", "MUF", "Mercury"},
".m4": {"M4", "M4Sugar"}, ".m4": {"M4Sugar", "M4"},
".ma": {"Mathematica"}, ".ma": {"Mathematica"},
".mak": {"Makefile"}, ".mak": {"Makefile"},
".make": {"Makefile"}, ".make": {"Makefile"},
@ -483,7 +483,7 @@ var languagesByExtension = map[string][]string{
".maxpat": {"Max"}, ".maxpat": {"Max"},
".maxproj": {"Max"}, ".maxproj": {"Max"},
".mcr": {"MAXScript"}, ".mcr": {"MAXScript"},
".md": {"GCC Machine Description", "Markdown"}, ".md": {"Markdown", "GCC Machine Description"},
".mdown": {"Markdown"}, ".mdown": {"Markdown"},
".mdpolicy": {"XML"}, ".mdpolicy": {"XML"},
".mdwn": {"Markdown"}, ".mdwn": {"Markdown"},
@ -507,19 +507,19 @@ var languagesByExtension = map[string][]string{
".mli": {"OCaml"}, ".mli": {"OCaml"},
".mll": {"OCaml"}, ".mll": {"OCaml"},
".mly": {"OCaml"}, ".mly": {"OCaml"},
".mm": {"Objective-C++", "XML"}, ".mm": {"XML", "Objective-C++"},
".mmk": {"Module Management System"}, ".mmk": {"Module Management System"},
".mms": {"Module Management System"}, ".mms": {"Module Management System"},
".mo": {"Modelica"}, ".mo": {"Modelica"},
".mod": {"Linux Kernel Module", "AMPL", "Modula-2", "XML"}, ".mod": {"XML", "Modula-2", "AMPL", "Linux Kernel Module"},
".model.lkml": {"LookML"}, ".model.lkml": {"LookML"},
".monkey": {"Monkey"}, ".monkey": {"Monkey"},
".moo": {"Mercury", "Moocode"}, ".moo": {"Moocode", "Mercury"},
".moon": {"MoonScript"}, ".moon": {"MoonScript"},
".mq4": {"MQL4"}, ".mq4": {"MQL4"},
".mq5": {"MQL5"}, ".mq5": {"MQL5"},
".mqh": {"MQL4", "MQL5"}, ".mqh": {"MQL5", "MQL4"},
".ms": {"Roff", "Unix Assembly", "MAXScript"}, ".ms": {"Unix Assembly", "Roff", "MAXScript"},
".mspec": {"Ruby"}, ".mspec": {"Ruby"},
".mss": {"CartoCSS"}, ".mss": {"CartoCSS"},
".mt": {"Mathematica"}, ".mt": {"Mathematica"},
@ -533,7 +533,7 @@ var languagesByExtension = map[string][]string{
".mxt": {"Max"}, ".mxt": {"Max"},
".mysql": {"SQL"}, ".mysql": {"SQL"},
".myt": {"Myghty"}, ".myt": {"Myghty"},
".n": {"Roff", "Nemerle"}, ".n": {"Nemerle", "Roff"},
".nasm": {"Assembly"}, ".nasm": {"Assembly"},
".nawk": {"Awk"}, ".nawk": {"Awk"},
".nb": {"Text", "Mathematica"}, ".nb": {"Text", "Mathematica"},
@ -619,7 +619,7 @@ var languagesByExtension = map[string][]string{
".pkgproj": {"XML"}, ".pkgproj": {"XML"},
".pkl": {"Pickle"}, ".pkl": {"Pickle"},
".pks": {"PLSQL"}, ".pks": {"PLSQL"},
".pl": {"Prolog", "Perl", "Perl6"}, ".pl": {"Perl", "Perl6", "Prolog"},
".pl6": {"Perl6"}, ".pl6": {"Perl6"},
".plb": {"PLSQL"}, ".plb": {"PLSQL"},
".plist": {"XML"}, ".plist": {"XML"},
@ -627,13 +627,13 @@ var languagesByExtension = map[string][]string{
".pls": {"PLSQL"}, ".pls": {"PLSQL"},
".plsql": {"PLSQL"}, ".plsql": {"PLSQL"},
".plt": {"Gnuplot"}, ".plt": {"Gnuplot"},
".pluginspec": {"Ruby", "XML"}, ".pluginspec": {"XML", "Ruby"},
".plx": {"Perl"}, ".plx": {"Perl"},
".pm": {"Perl", "Perl6"}, ".pm": {"Perl", "Perl6"},
".pm6": {"Perl6"}, ".pm6": {"Perl6"},
".pmod": {"Pike"}, ".pmod": {"Pike"},
".po": {"Gettext Catalog"}, ".po": {"Gettext Catalog"},
".pod": {"Pod", "Perl"}, ".pod": {"Perl", "Pod"},
".podsl": {"Common Lisp"}, ".podsl": {"Common Lisp"},
".podspec": {"Ruby"}, ".podspec": {"Ruby"},
".pogo": {"PogoScript"}, ".pogo": {"PogoScript"},
@ -647,7 +647,7 @@ var languagesByExtension = map[string][]string{
".prefs": {"INI"}, ".prefs": {"INI"},
".prg": {"xBase"}, ".prg": {"xBase"},
".pri": {"QMake"}, ".pri": {"QMake"},
".pro": {"IDL", "INI", "Prolog", "QMake"}, ".pro": {"IDL", "QMake", "INI", "Prolog"},
".prolog": {"Prolog"}, ".prolog": {"Prolog"},
".properties": {"INI"}, ".properties": {"INI"},
".props": {"XML"}, ".props": {"XML"},
@ -727,7 +727,7 @@ var languagesByExtension = map[string][]string{
".ron": {"Markdown"}, ".ron": {"Markdown"},
".rpy": {"Python", "Ren'Py"}, ".rpy": {"Python", "Ren'Py"},
".rq": {"SPARQL"}, ".rq": {"SPARQL"},
".rs": {"Rust", "RenderScript"}, ".rs": {"RenderScript", "Rust"},
".rs.in": {"Rust"}, ".rs.in": {"Rust"},
".rsc": {"Rascal"}, ".rsc": {"Rascal"},
".rsh": {"RenderScript"}, ".rsh": {"RenderScript"},
@ -751,7 +751,7 @@ var languagesByExtension = map[string][]string{
".scaml": {"Scaml"}, ".scaml": {"Scaml"},
".scd": {"SuperCollider"}, ".scd": {"SuperCollider"},
".sce": {"Scilab"}, ".sce": {"Scilab"},
".sch": {"KiCad", "Eagle", "XML"}, ".sch": {"XML", "Eagle", "KiCad"},
".sci": {"Scilab"}, ".sci": {"Scilab"},
".scm": {"Scheme"}, ".scm": {"Scheme"},
".sco": {"Csound Score"}, ".sco": {"Csound Score"},
@ -774,7 +774,7 @@ var languagesByExtension = map[string][]string{
".sl": {"Slash"}, ".sl": {"Slash"},
".sld": {"Scheme"}, ".sld": {"Scheme"},
".slim": {"Slim"}, ".slim": {"Slim"},
".sls": {"Scheme", "SaltStack"}, ".sls": {"SaltStack", "Scheme"},
".sma": {"SourcePawn"}, ".sma": {"SourcePawn"},
".smali": {"Smali"}, ".smali": {"Smali"},
".sml": {"Standard ML"}, ".sml": {"Standard ML"},
@ -786,15 +786,15 @@ var languagesByExtension = map[string][]string{
".spin": {"Propeller Spin"}, ".spin": {"Propeller Spin"},
".sps": {"Scheme"}, ".sps": {"Scheme"},
".sqf": {"SQF"}, ".sqf": {"SQF"},
".sql": {"PLpgSQL", "PLSQL", "SQL", "SQLPL"}, ".sql": {"SQLPL", "SQL", "PLpgSQL", "PLSQL"},
".sra": {"PowerBuilder"}, ".sra": {"PowerBuilder"},
".srdf": {"XML"}, ".srdf": {"XML"},
".srt": {"SubRip Text", "SRecode Template"}, ".srt": {"SRecode Template", "SubRip Text"},
".sru": {"PowerBuilder"}, ".sru": {"PowerBuilder"},
".srw": {"PowerBuilder"}, ".srw": {"PowerBuilder"},
".ss": {"Scheme"}, ".ss": {"Scheme"},
".ssjs": {"JavaScript"}, ".ssjs": {"JavaScript"},
".st": {"HTML", "Smalltalk"}, ".st": {"Smalltalk", "HTML"},
".stTheme": {"XML"}, ".stTheme": {"XML"},
".stan": {"Stan"}, ".stan": {"Stan"},
".sthlp": {"Stata"}, ".sthlp": {"Stata"},
@ -822,7 +822,7 @@ var languagesByExtension = map[string][]string{
".svh": {"SystemVerilog"}, ".svh": {"SystemVerilog"},
".swift": {"Swift"}, ".swift": {"Swift"},
".syntax": {"YAML"}, ".syntax": {"YAML"},
".t": {"Turing", "Perl", "Terra", "Perl6"}, ".t": {"Turing", "Perl", "Perl6", "Terra"},
".tab": {"SQL"}, ".tab": {"SQL"},
".tac": {"Python"}, ".tac": {"Python"},
".targets": {"XML"}, ".targets": {"XML"},
@ -846,15 +846,15 @@ var languagesByExtension = map[string][]string{
".tmac": {"Roff"}, ".tmac": {"Roff"},
".tml": {"XML"}, ".tml": {"XML"},
".tmux": {"Shell"}, ".tmux": {"Shell"},
".toc": {"TeX", "World of Warcraft Addon Data"}, ".toc": {"World of Warcraft Addon Data", "TeX"},
".toml": {"TOML"}, ".toml": {"TOML"},
".tool": {"Shell"}, ".tool": {"Shell"},
".topojson": {"JSON"}, ".topojson": {"JSON"},
".tpl": {"Smarty"}, ".tpl": {"Smarty"},
".tpp": {"C++"}, ".tpp": {"C++"},
".ts": {"TypeScript", "XML"}, ".ts": {"XML", "TypeScript"},
".tst": {"Scilab", "GAP"}, ".tst": {"GAP", "Scilab"},
".tsx": {"TypeScript", "XML"}, ".tsx": {"XML", "TypeScript"},
".ttl": {"Turtle"}, ".ttl": {"Turtle"},
".tu": {"Turing"}, ".tu": {"Turing"},
".twig": {"Twig"}, ".twig": {"Twig"},
@ -890,7 +890,7 @@ var languagesByExtension = map[string][]string{
".vhf": {"VHDL"}, ".vhf": {"VHDL"},
".vhi": {"VHDL"}, ".vhi": {"VHDL"},
".vho": {"VHDL"}, ".vho": {"VHDL"},
".vhost": {"Nginx", "ApacheConf"}, ".vhost": {"ApacheConf", "Nginx"},
".vhs": {"VHDL"}, ".vhs": {"VHDL"},
".vht": {"VHDL"}, ".vht": {"VHDL"},
".vhw": {"VHDL"}, ".vhw": {"VHDL"},

465
type.go Normal file
View File

@ -0,0 +1,465 @@
package slinguist
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: dae33dc2b20cddc85d1300435c3be7118a7115a9
const (
TypeUnknown = iota
TypeData = iota
TypeProgramming = iota
TypeMarkup = iota
TypeProse = iota
)
func GetLanguageType(language string) (langType int) {
langType, _ = languagesType[language]
return langType
}
var languagesType = map[string]int{
"1C Enterprise": TypeProgramming,
"ABAP": TypeProgramming,
"ABNF": TypeData,
"AGS Script": TypeProgramming,
"AMPL": TypeProgramming,
"ANTLR": TypeProgramming,
"API Blueprint": TypeMarkup,
"APL": TypeProgramming,
"ASN.1": TypeData,
"ASP": TypeProgramming,
"ATS": TypeProgramming,
"ActionScript": TypeProgramming,
"Ada": TypeProgramming,
"Agda": TypeProgramming,
"Alloy": TypeProgramming,
"Alpine Abuild": TypeProgramming,
"Ant Build System": TypeData,
"ApacheConf": TypeMarkup,
"Apex": TypeProgramming,
"Apollo Guidance Computer": TypeProgramming,
"AppleScript": TypeProgramming,
"Arc": TypeProgramming,
"Arduino": TypeProgramming,
"AsciiDoc": TypeProse,
"AspectJ": TypeProgramming,
"Assembly": TypeProgramming,
"Augeas": TypeProgramming,
"AutoHotkey": TypeProgramming,
"AutoIt": TypeProgramming,
"Awk": TypeProgramming,
"Batchfile": TypeProgramming,
"Befunge": TypeProgramming,
"Bison": TypeProgramming,
"BitBake": TypeProgramming,
"Blade": TypeMarkup,
"BlitzBasic": TypeProgramming,
"BlitzMax": TypeProgramming,
"Bluespec": TypeProgramming,
"Boo": TypeProgramming,
"Brainfuck": TypeProgramming,
"Brightscript": TypeProgramming,
"Bro": TypeProgramming,
"C": TypeProgramming,
"C#": TypeProgramming,
"C++": TypeProgramming,
"C-ObjDump": TypeData,
"C2hs Haskell": TypeProgramming,
"CLIPS": TypeProgramming,
"CMake": TypeProgramming,
"COBOL": TypeProgramming,
"COLLADA": TypeData,
"CSON": TypeData,
"CSS": TypeMarkup,
"CSV": TypeData,
"Cap'n Proto": TypeProgramming,
"CartoCSS": TypeProgramming,
"Ceylon": TypeProgramming,
"Chapel": TypeProgramming,
"Charity": TypeProgramming,
"ChucK": TypeProgramming,
"Cirru": TypeProgramming,
"Clarion": TypeProgramming,
"Clean": TypeProgramming,
"Click": TypeProgramming,
"Clojure": TypeProgramming,
"CoffeeScript": TypeProgramming,
"ColdFusion": TypeProgramming,
"ColdFusion CFC": TypeProgramming,
"Common Lisp": TypeProgramming,
"Component Pascal": TypeProgramming,
"Cool": TypeProgramming,
"Coq": TypeProgramming,
"Cpp-ObjDump": TypeData,
"Creole": TypeProse,
"Crystal": TypeProgramming,
"Csound": TypeProgramming,
"Csound Document": TypeProgramming,
"Csound Score": TypeProgramming,
"Cuda": TypeProgramming,
"Cycript": TypeProgramming,
"Cython": TypeProgramming,
"D": TypeProgramming,
"D-ObjDump": TypeData,
"DIGITAL Command Language": TypeProgramming,
"DM": TypeProgramming,
"DNS Zone": TypeData,
"DTrace": TypeProgramming,
"Darcs Patch": TypeData,
"Dart": TypeProgramming,
"Diff": TypeData,
"Dockerfile": TypeData,
"Dogescript": TypeProgramming,
"Dylan": TypeProgramming,
"E": TypeProgramming,
"EBNF": TypeData,
"ECL": TypeProgramming,
"ECLiPSe": TypeProgramming,
"EJS": TypeMarkup,
"EQ": TypeProgramming,
"Eagle": TypeMarkup,
"Ecere Projects": TypeData,
"Eiffel": TypeProgramming,
"Elixir": TypeProgramming,
"Elm": TypeProgramming,
"Emacs Lisp": TypeProgramming,
"EmberScript": TypeProgramming,
"Erlang": TypeProgramming,
"F#": TypeProgramming,
"FLUX": TypeProgramming,
"Factor": TypeProgramming,
"Fancy": TypeProgramming,
"Fantom": TypeProgramming,
"Filebench WML": TypeProgramming,
"Filterscript": TypeProgramming,
"Formatted": TypeData,
"Forth": TypeProgramming,
"Fortran": TypeProgramming,
"FreeMarker": TypeProgramming,
"Frege": TypeProgramming,
"G-code": TypeData,
"GAMS": TypeProgramming,
"GAP": TypeProgramming,
"GCC Machine Description": TypeProgramming,
"GDB": TypeProgramming,
"GDScript": TypeProgramming,
"GLSL": TypeProgramming,
"GN": TypeData,
"Game Maker Language": TypeProgramming,
"Genie": TypeProgramming,
"Genshi": TypeProgramming,
"Gentoo Ebuild": TypeProgramming,
"Gentoo Eclass": TypeProgramming,
"Gettext Catalog": TypeProse,
"Gherkin": TypeProgramming,
"Glyph": TypeProgramming,
"Gnuplot": TypeProgramming,
"Go": TypeProgramming,
"Golo": TypeProgramming,
"Gosu": TypeProgramming,
"Grace": TypeProgramming,
"Gradle": TypeData,
"Grammatical Framework": TypeProgramming,
"Graph Modeling Language": TypeData,
"GraphQL": TypeData,
"Graphviz (DOT)": TypeData,
"Groovy": TypeProgramming,
"Groovy Server Pages": TypeProgramming,
"HCL": TypeProgramming,
"HLSL": TypeProgramming,
"HTML": TypeMarkup,
"HTML+Django": TypeMarkup,
"HTML+ECR": TypeMarkup,
"HTML+EEX": TypeMarkup,
"HTML+ERB": TypeMarkup,
"HTML+PHP": TypeMarkup,
"HTTP": TypeData,
"Hack": TypeProgramming,
"Haml": TypeMarkup,
"Handlebars": TypeMarkup,
"Harbour": TypeProgramming,
"Haskell": TypeProgramming,
"Haxe": TypeProgramming,
"Hy": TypeProgramming,
"HyPhy": TypeProgramming,
"IDL": TypeProgramming,
"IGOR Pro": TypeProgramming,
"INI": TypeData,
"IRC log": TypeData,
"Idris": TypeProgramming,
"Inform 7": TypeProgramming,
"Inno Setup": TypeProgramming,
"Io": TypeProgramming,
"Ioke": TypeProgramming,
"Isabelle": TypeProgramming,
"Isabelle ROOT": TypeProgramming,
"J": TypeProgramming,
"JFlex": TypeProgramming,
"JSON": TypeData,
"JSON5": TypeData,
"JSONLD": TypeData,
"JSONiq": TypeProgramming,
"JSX": TypeProgramming,
"Jasmin": TypeProgramming,
"Java": TypeProgramming,
"Java Server Pages": TypeProgramming,
"JavaScript": TypeProgramming,
"Jison": TypeProgramming,
"Jison Lex": TypeProgramming,
"Julia": TypeProgramming,
"Jupyter Notebook": TypeMarkup,
"KRL": TypeProgramming,
"KiCad": TypeProgramming,
"Kit": TypeMarkup,
"Kotlin": TypeProgramming,
"LFE": TypeProgramming,
"LLVM": TypeProgramming,
"LOLCODE": TypeProgramming,
"LSL": TypeProgramming,
"LabVIEW": TypeProgramming,
"Lasso": TypeProgramming,
"Latte": TypeMarkup,
"Lean": TypeProgramming,
"Less": TypeMarkup,
"Lex": TypeProgramming,
"LilyPond": TypeProgramming,
"Limbo": TypeProgramming,
"Linker Script": TypeData,
"Linux Kernel Module": TypeData,
"Liquid": TypeMarkup,
"Literate Agda": TypeProgramming,
"Literate CoffeeScript": TypeProgramming,
"Literate Haskell": TypeProgramming,
"LiveScript": TypeProgramming,
"Logos": TypeProgramming,
"Logtalk": TypeProgramming,
"LookML": TypeProgramming,
"LoomScript": TypeProgramming,
"Lua": TypeProgramming,
"M": TypeProgramming,
"M4": TypeProgramming,
"M4Sugar": TypeProgramming,
"MAXScript": TypeProgramming,
"MQL4": TypeProgramming,
"MQL5": TypeProgramming,
"MTML": TypeMarkup,
"MUF": TypeProgramming,
"Makefile": TypeProgramming,
"Mako": TypeProgramming,
"Markdown": TypeProse,
"Marko": TypeMarkup,
"Mask": TypeMarkup,
"Mathematica": TypeProgramming,
"Matlab": TypeProgramming,
"Maven POM": TypeData,
"Max": TypeProgramming,
"MediaWiki": TypeProse,
"Mercury": TypeProgramming,
"Meson": TypeProgramming,
"Metal": TypeProgramming,
"MiniD": TypeProgramming,
"Mirah": TypeProgramming,
"Modelica": TypeProgramming,
"Modula-2": TypeProgramming,
"Module Management System": TypeProgramming,
"Monkey": TypeProgramming,
"Moocode": TypeProgramming,
"MoonScript": TypeProgramming,
"Myghty": TypeProgramming,
"NCL": TypeProgramming,
"NL": TypeData,
"NSIS": TypeProgramming,
"Nemerle": TypeProgramming,
"NetLinx": TypeProgramming,
"NetLinx+ERB": TypeProgramming,
"NetLogo": TypeProgramming,
"NewLisp": TypeProgramming,
"Nginx": TypeMarkup,
"Nim": TypeProgramming,
"Ninja": TypeData,
"Nit": TypeProgramming,
"Nix": TypeProgramming,
"Nu": TypeProgramming,
"NumPy": TypeProgramming,
"OCaml": TypeProgramming,
"ObjDump": TypeData,
"Objective-C": TypeProgramming,
"Objective-C++": TypeProgramming,
"Objective-J": TypeProgramming,
"Omgrofl": TypeProgramming,
"Opa": TypeProgramming,
"Opal": TypeProgramming,
"OpenCL": TypeProgramming,
"OpenEdge ABL": TypeProgramming,
"OpenRC runscript": TypeProgramming,
"OpenSCAD": TypeProgramming,
"OpenType Feature File": TypeData,
"Org": TypeProse,
"Ox": TypeProgramming,
"Oxygene": TypeProgramming,
"Oz": TypeProgramming,
"P4": TypeProgramming,
"PAWN": TypeProgramming,
"PHP": TypeProgramming,
"PLSQL": TypeProgramming,
"PLpgSQL": TypeProgramming,
"POV-Ray SDL": TypeProgramming,
"Pan": TypeProgramming,
"Papyrus": TypeProgramming,
"Parrot": TypeProgramming,
"Parrot Assembly": TypeProgramming,
"Parrot Internal Representation": TypeProgramming,
"Pascal": TypeProgramming,
"Perl": TypeProgramming,
"Perl6": TypeProgramming,
"Pic": TypeMarkup,
"Pickle": TypeData,
"PicoLisp": TypeProgramming,
"PigLatin": TypeProgramming,
"Pike": TypeProgramming,
"Pod": TypeProse,
"PogoScript": TypeProgramming,
"Pony": TypeProgramming,
"PostScript": TypeMarkup,
"PowerBuilder": TypeProgramming,
"PowerShell": TypeProgramming,
"Processing": TypeProgramming,
"Prolog": TypeProgramming,
"Propeller Spin": TypeProgramming,
"Protocol Buffer": TypeMarkup,
"Public Key": TypeData,
"Pug": TypeMarkup,
"Puppet": TypeProgramming,
"Pure Data": TypeProgramming,
"PureBasic": TypeProgramming,
"PureScript": TypeProgramming,
"Python": TypeProgramming,
"Python console": TypeProgramming,
"Python traceback": TypeData,
"QML": TypeProgramming,
"QMake": TypeProgramming,
"R": TypeProgramming,
"RAML": TypeMarkup,
"RDoc": TypeProse,
"REALbasic": TypeProgramming,
"REXX": TypeProgramming,
"RHTML": TypeMarkup,
"RMarkdown": TypeProse,
"RPM Spec": TypeData,
"RUNOFF": TypeMarkup,
"Racket": TypeProgramming,
"Ragel": TypeProgramming,
"Rascal": TypeProgramming,
"Raw token data": TypeData,
"Reason": TypeProgramming,
"Rebol": TypeProgramming,
"Red": TypeProgramming,
"Redcode": TypeProgramming,
"Regular Expression": TypeData,
"Ren'Py": TypeProgramming,
"RenderScript": TypeProgramming,
"RobotFramework": TypeProgramming,
"Roff": TypeMarkup,
"Rouge": TypeProgramming,
"Ruby": TypeProgramming,
"Rust": TypeProgramming,
"SAS": TypeProgramming,
"SCSS": TypeMarkup,
"SMT": TypeProgramming,
"SPARQL": TypeData,
"SQF": TypeProgramming,
"SQL": TypeData,
"SQLPL": TypeProgramming,
"SRecode Template": TypeMarkup,
"STON": TypeData,
"SVG": TypeData,
"Sage": TypeProgramming,
"SaltStack": TypeProgramming,
"Sass": TypeMarkup,
"Scala": TypeProgramming,
"Scaml": TypeMarkup,
"Scheme": TypeProgramming,
"Scilab": TypeProgramming,
"Self": TypeProgramming,
"Shell": TypeProgramming,
"ShellSession": TypeProgramming,
"Shen": TypeProgramming,
"Slash": TypeProgramming,
"Slim": TypeMarkup,
"Smali": TypeProgramming,
"Smalltalk": TypeProgramming,
"Smarty": TypeProgramming,
"SourcePawn": TypeProgramming,
"Spline Font Database": TypeData,
"Squirrel": TypeProgramming,
"Stan": TypeProgramming,
"Standard ML": TypeProgramming,
"Stata": TypeProgramming,
"Stylus": TypeMarkup,
"SubRip Text": TypeData,
"Sublime Text Config": TypeData,
"SuperCollider": TypeProgramming,
"Swift": TypeProgramming,
"SystemVerilog": TypeProgramming,
"TI Program": TypeProgramming,
"TLA": TypeProgramming,
"TOML": TypeData,
"TXL": TypeProgramming,
"Tcl": TypeProgramming,
"Tcsh": TypeProgramming,
"TeX": TypeMarkup,
"Tea": TypeMarkup,
"Terra": TypeProgramming,
"Text": TypeProse,
"Textile": TypeProse,
"Thrift": TypeProgramming,
"Turing": TypeProgramming,
"Turtle": TypeData,
"Twig": TypeMarkup,
"TypeScript": TypeProgramming,
"Unified Parallel C": TypeProgramming,
"Unity3D Asset": TypeData,
"Unix Assembly": TypeProgramming,
"Uno": TypeProgramming,
"UnrealScript": TypeProgramming,
"UrWeb": TypeProgramming,
"VCL": TypeProgramming,
"VHDL": TypeProgramming,
"Vala": TypeProgramming,
"Verilog": TypeProgramming,
"Vim script": TypeProgramming,
"Visual Basic": TypeProgramming,
"Volt": TypeProgramming,
"Vue": TypeMarkup,
"Wavefront Material": TypeData,
"Wavefront Object": TypeData,
"Web Ontology Language": TypeMarkup,
"WebIDL": TypeProgramming,
"World of Warcraft Addon Data": TypeData,
"X10": TypeProgramming,
"XC": TypeProgramming,
"XCompose": TypeData,
"XML": TypeData,
"XPages": TypeProgramming,
"XProc": TypeProgramming,
"XQuery": TypeProgramming,
"XS": TypeProgramming,
"XSLT": TypeProgramming,
"Xojo": TypeProgramming,
"Xtend": TypeProgramming,
"YAML": TypeData,
"YANG": TypeData,
"Yacc": TypeProgramming,
"Zephir": TypeProgramming,
"Zimpl": TypeProgramming,
"desktop": TypeData,
"eC": TypeProgramming,
"edn": TypeData,
"fish": TypeProgramming,
"mupad": TypeProgramming,
"nesC": TypeProgramming,
"ooc": TypeProgramming,
"reStructuredText": TypeProse,
"wisp": TypeProgramming,
"xBase": TypeProgramming,
}

32
type_test.go Normal file
View File

@ -0,0 +1,32 @@
package slinguist
import . "gopkg.in/check.v1"
func (s *TSuite) TestGetLanguageType(c *C) {
langType := GetLanguageType("BestLanguageEver")
c.Assert(langType, Equals, TypeUnknown)
langType = GetLanguageType("JSON")
c.Assert(langType, Equals, TypeData)
langType = GetLanguageType("COLLADA")
c.Assert(langType, Equals, TypeData)
langType = GetLanguageType("Go")
c.Assert(langType, Equals, TypeProgramming)
langType = GetLanguageType("Brainfuck")
c.Assert(langType, Equals, TypeProgramming)
langType = GetLanguageType("HTML")
c.Assert(langType, Equals, TypeMarkup)
langType = GetLanguageType("Sass")
c.Assert(langType, Equals, TypeMarkup)
langType = GetLanguageType("AsciiDoc")
c.Assert(langType, Equals, TypeProse)
langType = GetLanguageType("Textile")
c.Assert(langType, Equals, TypeProse)
}