write a canonical header for machine-generated files

Signed-off-by: Denys Smirnov <denys@sourced.tech>
This commit is contained in:
Denys Smirnov 2018-04-28 16:12:03 +03:00 committed by Denys Smirnov
parent 40a21f8e0b
commit 7eafe024af
49 changed files with 167 additions and 742 deletions

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
// LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too. // LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too.
// All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores. // All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores.
var LanguagesByAlias = map[string]string{ var LanguagesByAlias = map[string]string{

View File

@ -1,8 +1,7 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
// linguist's commit from which files were generated. // linguist's commit from which files were generated.
var LinguistCommit = "4cd558c37482e8d2c535d8107f2d11b49afbc5b5" var LinguistCommit = "4cd558c37482e8d2c535d8107f2d11b49afbc5b5"

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
type languageMatcher func([]byte) []string type languageMatcher func([]byte) []string

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
var DocumentationMatchers = substring.Or( var DocumentationMatchers = substring.Or(

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
var LanguagesByExtension = map[string][]string{ var LanguagesByExtension = map[string][]string{
".1": {"Roff"}, ".1": {"Roff"},
".1in": {"Roff"}, ".1in": {"Roff"},

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
var LanguagesByFilename = map[string][]string{ var LanguagesByFilename = map[string][]string{
".Rprofile": {"R"}, ".Rprofile": {"R"},
".XCompose": {"XCompose"}, ".XCompose": {"XCompose"},

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
var LanguagesLogProbabilities = map[string]float64{ var LanguagesLogProbabilities = map[string]float64{
"1C Enterprise": -5.774552, "1C Enterprise": -5.774552,
"ABAP": -7.566311, "ABAP": -7.566311,

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
var LanguagesByInterpreter = map[string][]string{ var LanguagesByInterpreter = map[string][]string{
"Rscript": {"R"}, "Rscript": {"R"},
"apl": {"APL"}, "apl": {"APL"},

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
var LanguagesMime = map[string]string{ var LanguagesMime = map[string]string{
"AGS Script": "text/x-c++src", "AGS Script": "text/x-c++src",
"APL": "text/apl", "APL": "text/apl",

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
var LanguagesType = map[string]int{ var LanguagesType = map[string]int{
"1C Enterprise": 2, "1C Enterprise": 2,
"ABAP": 2, "ABAP": 2,

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5 // Extracted from github/linguist commit: 4cd558c37482e8d2c535d8107f2d11b49afbc5b5
package data
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
var VendorMatchers = substring.Or( var VendorMatchers = substring.Or(

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
// LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too. // LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too.
// All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores. // All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores.
var LanguagesByAlias = map[string]string{ var LanguagesByAlias = map[string]string{

View File

@ -1,8 +1,4 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ . }}
// linguist's commit from which files were generated. // linguist's commit from which files were generated.
var LinguistCommit = "{{- . -}}" var LinguistCommit = "{{- getCommit -}}"

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
type languageMatcher func ([]byte) []string type languageMatcher func ([]byte) []string

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
var DocumentationMatchers = substring.Or( var DocumentationMatchers = substring.Or(

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
var LanguagesByExtension = map[string][]string{ var LanguagesByExtension = map[string][]string{
{{range $extension, $languages := .LanguagesByExtension -}} {{range $extension, $languages := .LanguagesByExtension -}}
"{{ $extension }}": { {{- $languages | formatStringSlice -}} }, "{{ $extension }}": { {{- $languages | formatStringSlice -}} },

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
var LanguagesByFilename = map[string][]string{ var LanguagesByFilename = map[string][]string{
{{range $filename, $languages := . -}} {{range $filename, $languages := . -}}
"{{ $filename }}": { {{- formatStringSlice $languages -}} }, "{{ $filename }}": { {{- formatStringSlice $languages -}} },

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
var LanguagesLogProbabilities = map[string]float64{ var LanguagesLogProbabilities = map[string]float64{
{{ $freqs := . -}} {{ $freqs := . -}}
{{range $index, $language := orderKeys .Languages -}} {{range $index, $language := orderKeys .Languages -}}

View File

@ -0,0 +1,3 @@
// Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: {{ getCommit }}

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
var LanguagesByInterpreter = map[string][]string{ var LanguagesByInterpreter = map[string][]string{
{{range $interpreter, $languages := . -}} {{range $interpreter, $languages := . -}}
"{{ $interpreter }}": { {{- $languages | formatStringSlice -}} }, "{{ $interpreter }}": { {{- $languages | formatStringSlice -}} },

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
var LanguagesMime = map[string]string{ var LanguagesMime = map[string]string{
{{range $language, $mime := . -}} {{range $language, $mime := . -}}
"{{$language}}": "{{$mime -}}", "{{$language}}": "{{$mime -}}",

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
var LanguagesType = map[string]int{ var LanguagesType = map[string]int{
{{range $language, $type := . -}} {{range $language, $type := . -}}
"{{ $language }}": {{ $type -}}, "{{ $language }}": {{ $type -}},

View File

@ -1,9 +1,5 @@
package data package data
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: {{ getCommit }}
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
var VendorMatchers = substring.Or( var VendorMatchers = substring.Or(

View File

@ -2,12 +2,10 @@ package generator
import ( import (
"bytes" "bytes"
"gopkg.in/yaml.v2"
"io" "io"
"io/ioutil" "io/ioutil"
"strings" "strings"
"text/template"
yaml "gopkg.in/yaml.v2"
) )
// Aliases reads from fileToParse and builds source file from tmplPath. It complies with type File signature. // Aliases reads from fileToParse and builds source file from tmplPath. It complies with type File signature.
@ -55,14 +53,5 @@ func convertToAliasKey(s string) (key string) {
} }
func executeAliasesTemplate(out io.Writer, languagesByAlias map[string]string, aliasesTmplPath, aliasesTmpl, commit string) error { func executeAliasesTemplate(out io.Writer, languagesByAlias map[string]string, aliasesTmplPath, aliasesTmpl, commit string) error {
fmap := template.FuncMap{ return executeTemplate(out, aliasesTmpl, aliasesTmplPath, commit, nil, languagesByAlias)
"getCommit": func() string { return commit },
}
t := template.Must(template.New(aliasesTmpl).Funcs(fmap).ParseFiles(aliasesTmplPath))
if err := t.Execute(out, languagesByAlias); err != nil {
return err
}
return nil
} }

View File

@ -2,11 +2,9 @@ package generator
import ( import (
"bytes" "bytes"
"gopkg.in/yaml.v2"
"io" "io"
"io/ioutil" "io/ioutil"
"text/template"
yaml "gopkg.in/yaml.v2"
) )
// Documentation reads from fileToParse and builds source file from tmplPath. It complies with type File signature. // Documentation reads from fileToParse and builds source file from tmplPath. It complies with type File signature.
@ -30,14 +28,5 @@ func Documentation(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit
} }
func executeDocumentationTemplate(out io.Writer, regexpList []string, tmplPath, tmplName, commit string) error { func executeDocumentationTemplate(out io.Writer, regexpList []string, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ return executeTemplate(out, tmplName, tmplPath, commit, nil, regexpList)
"getCommit": func() string { return commit },
}
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, regexpList); err != nil {
return err
}
return nil
} }

View File

@ -81,14 +81,7 @@ func buildLanguageExtensionsMap(languages map[string]*languageInfo) map[string][
func executeExtensionsTemplate(out io.Writer, extInfo *extensionsInfo, tmplPath, tmplName, commit string) error { func executeExtensionsTemplate(out io.Writer, extInfo *extensionsInfo, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ fmap := template.FuncMap{
"getCommit": func() string { return commit },
"formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` }, "formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` },
} }
return executeTemplate(out, tmplName, tmplPath, commit, fmap, extInfo)
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, extInfo); err != nil {
return err
}
return nil
} }

View File

@ -91,14 +91,7 @@ func buildFilenameLanguageMap(languages map[string]*languageInfo) map[string][]s
func executeFilenamesTemplate(out io.Writer, languagesByFilename map[string][]string, tmplPath, tmplName, commit string) error { func executeFilenamesTemplate(out io.Writer, languagesByFilename map[string][]string, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ fmap := template.FuncMap{
"getCommit": func() string { return commit },
"formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` }, "formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` },
} }
return executeTemplate(out, tmplName, tmplPath, commit, fmap, languagesByFilename)
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, languagesByFilename); err != nil {
return err
}
return nil
} }

View File

@ -1,8 +1,12 @@
package generator package generator
import ( import (
"bytes"
"go/format" "go/format"
"io"
"io/ioutil" "io/ioutil"
"path/filepath"
"text/template"
) )
// File is the function's type that generate source file from a file to be parsed, linguist's samples dir and a template. // File is the function's type that generate source file from a file to be parsed, linguist's samples dir and a template.
@ -13,10 +17,45 @@ func formatedWrite(outPath string, source []byte) error {
if err != nil { if err != nil {
return err return err
} }
if err := ioutil.WriteFile(outPath, formatedSource, 0666); err != nil { if err := ioutil.WriteFile(outPath, formatedSource, 0666); err != nil {
return err return err
} }
return nil return nil
} }
func executeTemplate(w io.Writer, name, path, commit string, fmap template.FuncMap, data interface{}) error {
getCommit := func() string {
return commit
}
buf := bytes.NewBuffer(nil)
const headerTmpl = "header.go.tmpl"
headerPath := filepath.Join(filepath.Dir(path), headerTmpl)
h := template.Must(template.New(headerTmpl).Funcs(template.FuncMap{
"getCommit": getCommit,
}).ParseFiles(headerPath))
if err := h.Execute(buf, data); err != nil {
return err
}
if fmap == nil {
fmap = make(template.FuncMap)
}
fmap["getCommit"] = getCommit
t := template.Must(template.New(name).Funcs(fmap).ParseFiles(path))
if err := t.Execute(buf, data); err != nil {
return err
}
src, err := format.Source(buf.Bytes())
if err != nil {
return err
}
_, err = w.Write(src)
return err
}

View File

@ -13,68 +13,71 @@ import (
) )
const ( const (
linguistURL = "https://github.com/github/linguist.git" linguistURL = "https://github.com/github/linguist.git"
linguistClonedEnvVar = "ENRY_TEST_REPO" linguistClonedEnvVar = "ENRY_TEST_REPO"
commit = "d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68" commit = "d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68"
samplesDir = "samples" samplesDir = "samples"
languagesFile = "lib/linguist/languages.yml" languagesFile = "lib/linguist/languages.yml"
testDir = "test_files"
assetsDir = "../assets"
// Extensions test // Extensions test
extensionGold = "test_files/extension.gold" extensionGold = testDir + "/extension.gold"
extensionTestTmplPath = "../assets/extension.go.tmpl" extensionTestTmplPath = assetsDir + "/extension.go.tmpl"
extensionTestTmplName = "extension.go.tmpl" extensionTestTmplName = "extension.go.tmpl"
// Heuristics test // Heuristics test
heuristicsTestFile = "lib/linguist/heuristics.rb" heuristicsTestFile = "lib/linguist/heuristics.rb"
contentGold = "test_files/content.gold" contentGold = testDir + "/content.gold"
contentTestTmplPath = "../assets/content.go.tmpl" contentTestTmplPath = assetsDir + "/content.go.tmpl"
contentTestTmplName = "content.go.tmpl" contentTestTmplName = "content.go.tmpl"
// Vendor test // Vendor test
vendorTestFile = "lib/linguist/vendor.yml" vendorTestFile = "lib/linguist/vendor.yml"
vendorGold = "test_files/vendor.gold" vendorGold = testDir + "/vendor.gold"
vendorTestTmplPath = "../assets/vendor.go.tmpl" vendorTestTmplPath = assetsDir + "/vendor.go.tmpl"
vendorTestTmplName = "vendor.go.tmpl" vendorTestTmplName = "vendor.go.tmpl"
// Documentation test // Documentation test
documentationTestFile = "lib/linguist/documentation.yml" documentationTestFile = "lib/linguist/documentation.yml"
documentationGold = "test_files/documentation.gold" documentationGold = testDir + "/documentation.gold"
documentationTestTmplPath = "../assets/documentation.go.tmpl" documentationTestTmplPath = assetsDir + "/documentation.go.tmpl"
documentationTestTmplName = "documentation.go.tmpl" documentationTestTmplName = "documentation.go.tmpl"
// Types test // Types test
typeGold = "test_files/type.gold" typeGold = testDir + "/type.gold"
typeTestTmplPath = "../assets/type.go.tmpl" typeTestTmplPath = assetsDir + "/type.go.tmpl"
typeTestTmplName = "type.go.tmpl" typeTestTmplName = "type.go.tmpl"
// Interpreters test // Interpreters test
interpreterGold = "test_files/interpreter.gold" interpreterGold = testDir + "/interpreter.gold"
interpreterTestTmplPath = "../assets/interpreter.go.tmpl" interpreterTestTmplPath = assetsDir + "/interpreter.go.tmpl"
interpreterTestTmplName = "interpreter.go.tmpl" interpreterTestTmplName = "interpreter.go.tmpl"
// Filenames test // Filenames test
filenameGold = "test_files/filename.gold" filenameGold = testDir + "/filename.gold"
filenameTestTmplPath = "../assets/filename.go.tmpl" filenameTestTmplPath = assetsDir + "/filename.go.tmpl"
filenameTestTmplName = "filename.go.tmpl" filenameTestTmplName = "filename.go.tmpl"
// Aliases test // Aliases test
aliasGold = "test_files/alias.gold" aliasGold = testDir + "/alias.gold"
aliasTestTmplPath = "../assets/alias.go.tmpl" aliasTestTmplPath = assetsDir + "/alias.go.tmpl"
aliasTestTmplName = "alias.go.tmpl" aliasTestTmplName = "alias.go.tmpl"
// Frequencies test // Frequencies test
frequenciesGold = "test_files/frequencies.gold" frequenciesGold = testDir + "/frequencies.gold"
frequenciesTestTmplPath = "../assets/frequencies.go.tmpl" frequenciesTestTmplPath = assetsDir + "/frequencies.go.tmpl"
frequenciesTestTmplName = "frequencies.go.tmpl" frequenciesTestTmplName = "frequencies.go.tmpl"
// commit test // commit test
commitGold = "test_files/commit.gold" commitGold = testDir + "/commit.gold"
commitTestTmplPath = "../assets/commit.go.tmpl" commitTestTmplPath = assetsDir + "/commit.go.tmpl"
commitTestTmplName = "commit.go.tmpl" commitTestTmplName = "commit.go.tmpl"
// mime test // mime test
mimeTypeGold = "test_files/mimeType.gold" mimeTypeGold = testDir + "/mimeType.gold"
mimeTypeTestTmplPath = "../assets/mimeType.go.tmpl" mimeTypeTestTmplPath = assetsDir + "/mimeType.go.tmpl"
mimeTypeTestTmplName = "mimeType.go.tmpl" mimeTypeTestTmplName = "mimeType.go.tmpl"
) )

View File

@ -428,7 +428,6 @@ func buildLanguagesHeuristics(langsList [][]string, heuristicsList [][]*heuristi
func executeContentTemplate(out io.Writer, disambiguators []*disambiguator, tmplPath, tmplName, commit string) error { func executeContentTemplate(out io.Writer, disambiguators []*disambiguator, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ fmap := template.FuncMap{
"getCommit": func() string { return commit },
"getAllHeuristics": getAllHeuristics, "getAllHeuristics": getAllHeuristics,
"returnStringSlice": func(slice []string) string { "returnStringSlice": func(slice []string) string {
if len(slice) == 0 { if len(slice) == 0 {
@ -440,13 +439,7 @@ func executeContentTemplate(out io.Writer, disambiguators []*disambiguator, tmpl
"returnLanguages": returnLanguages, "returnLanguages": returnLanguages,
"avoidLanguage": avoidLanguage, "avoidLanguage": avoidLanguage,
} }
return executeTemplate(out, tmplName, tmplPath, commit, fmap, disambiguators)
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, disambiguators); err != nil {
return err
}
return nil
} }
func getAllHeuristics(disambiguators []*disambiguator) []*heuristic { func getAllHeuristics(disambiguators []*disambiguator) []*heuristic {

View File

@ -47,14 +47,7 @@ func buildInterpreterLanguagesMap(languages map[string]*languageInfo, orderedKey
func executeInterpretersTemplate(out io.Writer, languagesByInterpreter map[string][]string, tmplPath, tmplName, commit string) error { func executeInterpretersTemplate(out io.Writer, languagesByInterpreter map[string][]string, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ fmap := template.FuncMap{
"getCommit": func() string { return commit },
"formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` }, "formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` },
} }
return executeTemplate(out, tmplName, tmplPath, commit, fmap, languagesByInterpreter)
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, languagesByInterpreter); err != nil {
return err
}
return nil
} }

View File

@ -2,16 +2,13 @@ package generator
import ( import (
"bytes" "bytes"
"text/template"
) )
// Commit takes a commit and builds the source file from tmplPath. It complies with type File signature. // Commit takes a commit and builds the source file from tmplPath. It complies with type File signature.
func Commit(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string) error { func Commit(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string) error {
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
t := template.Must(template.New(tmplName).ParseFiles(tmplPath)) if err := executeTemplate(buf, tmplName, tmplPath, commit, nil, nil); err != nil {
if err := t.Execute(buf, commit); err != nil {
return err return err
} }
return formatedWrite(outPath, buf.Bytes()) return formatedWrite(outPath, buf.Bytes())
} }

View File

@ -2,11 +2,9 @@ package generator
import ( import (
"bytes" "bytes"
"gopkg.in/yaml.v2"
"io" "io"
"io/ioutil" "io/ioutil"
"text/template"
yaml "gopkg.in/yaml.v2"
) )
func MimeType(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string) error { func MimeType(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string) error {
@ -42,14 +40,5 @@ func buildLanguageMimeMap(languages map[string]*languageInfo) map[string]string
} }
func executeMimeTemplate(out io.Writer, langMimeMap map[string]string, tmplPath, tmplName, commit string) error { func executeMimeTemplate(out io.Writer, langMimeMap map[string]string, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ return executeTemplate(out, tmplName, tmplPath, commit, nil, langMimeMap)
"getCommit": func() string { return commit },
}
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, langMimeMap); err != nil {
return err
}
return nil
} }

View File

@ -157,7 +157,6 @@ func getTokens(samples []string) ([]string, error) {
func executeFrequenciesTemplate(out io.Writer, freqs *samplesFrequencies, tmplPath, tmplName, commit string) error { func executeFrequenciesTemplate(out io.Writer, freqs *samplesFrequencies, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ fmap := template.FuncMap{
"getCommit": func() string { return commit },
"toFloat64": func(num int) string { return fmt.Sprintf("%f", float64(num)) }, "toFloat64": func(num int) string { return fmt.Sprintf("%f", float64(num)) },
"orderKeys": func(m map[string]int) []string { "orderKeys": func(m map[string]int) []string {
keys := make([]string, 0, len(m)) keys := make([]string, 0, len(m))
@ -187,11 +186,5 @@ func executeFrequenciesTemplate(out io.Writer, freqs *samplesFrequencies, tmplPa
}, },
"quote": strconv.Quote, "quote": strconv.Quote,
} }
return executeTemplate(out, tmplName, tmplPath, commit, fmap, freqs)
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, freqs); err != nil {
return err
}
return nil
} }

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
// LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too. // LanguagesByAlias keeps alias for different languages and use the name of the languages as an alias too.
// All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores. // All the keys (alias or not) are written in lower case and the whitespaces has been replaced by underscores.
var LanguagesByAlias = map[string]string{ var LanguagesByAlias = map[string]string{

View File

@ -1,8 +1,7 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
// linguist's commit from which files were generated. // linguist's commit from which files were generated.
var LinguistCommit = "d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68" var LinguistCommit = "d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68"

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
type languageMatcher func([]byte) []string type languageMatcher func([]byte) []string

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
var DocumentationMatchers = substring.Or( var DocumentationMatchers = substring.Or(

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
var LanguagesByExtension = map[string][]string{ var LanguagesByExtension = map[string][]string{
".1": {"Roff"}, ".1": {"Roff"},
".1in": {"Roff"}, ".1in": {"Roff"},

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
var LanguagesByFilename = map[string][]string{ var LanguagesByFilename = map[string][]string{
".Rprofile": {"R"}, ".Rprofile": {"R"},
".XCompose": {"XCompose"}, ".XCompose": {"XCompose"},

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
var LanguagesLogProbabilities = map[string]float64{ var LanguagesLogProbabilities = map[string]float64{
"1C Enterprise": -5.724674, "1C Enterprise": -5.724674,
"ABAP": -7.516433, "ABAP": -7.516433,

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
var LanguagesByInterpreter = map[string][]string{ var LanguagesByInterpreter = map[string][]string{
"Rscript": {"R"}, "Rscript": {"R"},
"apl": {"APL"}, "apl": {"APL"},

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
var LanguagesMime = map[string]string{ var LanguagesMime = map[string]string{
"AGS Script": "text/x-c++src", "AGS Script": "text/x-c++src",
"APL": "text/apl", "APL": "text/apl",

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
var LanguagesType = map[string]int{ var LanguagesType = map[string]int{
"1C Enterprise": 2, "1C Enterprise": 2,
"ABAP": 2, "ABAP": 2,

View File

@ -1,9 +1,8 @@
package data // Code generated by gopkg.in/src-d/enry.v1/internal/code-generator DO NOT EDIT.
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
// THIS FILE SHOULD NOT BE EDITED BY HAND
// Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68 // Extracted from github/linguist commit: d5c8db3fb91963c4b2762ca2ea2ff7cfac109f68
package data
import "gopkg.in/toqueteos/substring.v1" import "gopkg.in/toqueteos/substring.v1"
var VendorMatchers = substring.Or( var VendorMatchers = substring.Or(

View File

@ -2,11 +2,9 @@ package generator
import ( import (
"bytes" "bytes"
"gopkg.in/yaml.v2"
"io" "io"
"io/ioutil" "io/ioutil"
"text/template"
yaml "gopkg.in/yaml.v2"
) )
var typeToTypeConst = map[string]int{ var typeToTypeConst = map[string]int{
@ -48,14 +46,5 @@ func buildLanguageTypeMap(languages map[string]*languageInfo) map[string]int {
} }
func executeTypesTemplate(out io.Writer, langTypeMap map[string]int, tmplPath, tmplName, commit string) error { func executeTypesTemplate(out io.Writer, langTypeMap map[string]int, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ return executeTemplate(out, tmplName, tmplPath, commit, nil, langTypeMap)
"getCommit": func() string { return commit },
}
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, langTypeMap); err != nil {
return err
}
return nil
} }

View File

@ -2,11 +2,9 @@ package generator
import ( import (
"bytes" "bytes"
"gopkg.in/yaml.v2"
"io" "io"
"io/ioutil" "io/ioutil"
"text/template"
yaml "gopkg.in/yaml.v2"
) )
// Vendor reads from fileToParse and builds source file from tmplPath. It complies with type File signature. // Vendor reads from fileToParse and builds source file from tmplPath. It complies with type File signature.
@ -30,14 +28,5 @@ func Vendor(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string)
} }
func executeVendorTemplate(out io.Writer, regexpList []string, tmplPath, tmplName, commit string) error { func executeVendorTemplate(out io.Writer, regexpList []string, tmplPath, tmplName, commit string) error {
fmap := template.FuncMap{ return executeTemplate(out, tmplName, tmplPath, commit, nil, regexpList)
"getCommit": func() string { return commit },
}
t := template.Must(template.New(tmplName).Funcs(fmap).ParseFiles(tmplPath))
if err := t.Execute(out, regexpList); err != nil {
return err
}
return nil
} }

View File

@ -92,17 +92,17 @@ func main() {
} }
fileList := []*generatorFiles{ fileList := []*generatorFiles{
&generatorFiles{generator.Extensions, languagesYAML, "", extensionsFile, extensionsTmplPath, extensionsTmpl, commit}, {generator.Extensions, languagesYAML, "", extensionsFile, extensionsTmplPath, extensionsTmpl, commit},
&generatorFiles{generator.Heuristics, heuristicsRuby, "", contentFile, contentTmplPath, contentTmpl, commit}, {generator.Heuristics, heuristicsRuby, "", contentFile, contentTmplPath, contentTmpl, commit},
&generatorFiles{generator.Vendor, vendorYAML, "", vendorFile, vendorTmplPath, vendorTmpl, commit}, {generator.Vendor, vendorYAML, "", vendorFile, vendorTmplPath, vendorTmpl, commit},
&generatorFiles{generator.Documentation, documentationYAML, "", documentationFile, documentationTmplPath, documentationTmpl, commit}, {generator.Documentation, documentationYAML, "", documentationFile, documentationTmplPath, documentationTmpl, commit},
&generatorFiles{generator.Types, languagesYAML, "", typeFile, typeTmplPath, typeTmpl, commit}, {generator.Types, languagesYAML, "", typeFile, typeTmplPath, typeTmpl, commit},
&generatorFiles{generator.Interpreters, languagesYAML, "", interpretersFile, interpretersTmplPath, interpretersTmpl, commit}, {generator.Interpreters, languagesYAML, "", interpretersFile, interpretersTmplPath, interpretersTmpl, commit},
&generatorFiles{generator.Filenames, languagesYAML, samplesDir, filenamesFile, filenamesTmplPath, filenamesTmpl, commit}, {generator.Filenames, languagesYAML, samplesDir, filenamesFile, filenamesTmplPath, filenamesTmpl, commit},
&generatorFiles{generator.Aliases, languagesYAML, "", aliasesFile, aliasesTmplPath, aliasesTmpl, commit}, {generator.Aliases, languagesYAML, "", aliasesFile, aliasesTmplPath, aliasesTmpl, commit},
&generatorFiles{generator.Frequencies, "", samplesDir, frequenciesFile, frequenciesTmplPath, frequenciesTmpl, commit}, {generator.Frequencies, "", samplesDir, frequenciesFile, frequenciesTmplPath, frequenciesTmpl, commit},
&generatorFiles{generator.Commit, "", "", commitFile, commitTmplPath, commitTmpl, commit}, {generator.Commit, "", "", commitFile, commitTmplPath, commitTmpl, commit},
&generatorFiles{generator.MimeType, languagesYAML, "", mimeTypeFile, mimeTypeTmplPath, mimeTypeTmpl, commit}, {generator.MimeType, languagesYAML, "", mimeTypeFile, mimeTypeTmplPath, mimeTypeTmpl, commit},
} }
for _, file := range fileList { for _, file := range fileList {

461
type.go
View File

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