diff --git a/alias.go b/alias.go index 153e85d..182b229 100644 --- a/alias.go +++ b/alias.go @@ -2,7 +2,7 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 // 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. @@ -608,9 +608,12 @@ var languagesByAlias = map[string]string{ "visual_basic": "Visual Basic", "volt": "Volt", "vue": "Vue", + "wasm": "WebAssembly", + "wast": "WebAssembly", "wavefront_material": "Wavefront Material", "wavefront_object": "Wavefront Object", "web_ontology_language": "Web Ontology Language", + "webassembly": "WebAssembly", "webidl": "WebIDL", "winbatch": "Batchfile", "wisp": "wisp", diff --git a/classifier.go b/classifier.go index e71cf83..bfa68dc 100644 --- a/classifier.go +++ b/classifier.go @@ -6,36 +6,11 @@ import ( "gopkg.in/src-d/simple-linguist.v1/internal/tokenizer" ) -func getLanguageByClassifier(content []byte, candidates []string, classifier Classifier) string { - if classifier == nil { - classifier = DefaultClassifier - } - - scores := classifier.Classify(content, candidates) - if len(scores) == 0 { - return OtherLanguage - } - - return getLangugeHigherScore(scores) -} - -func getLangugeHigherScore(scores map[string]float64) string { - var language string - higher := -math.MaxFloat64 - for lang, score := range scores { - if higher < score { - language = lang - higher = score - } - } - - return language -} - // Classifier is the interface that contains the method Classify which is in charge to assign scores to the possibles candidates. -// The scores must order the candidates so as the highest score be the most probably language of the content. +// The scores must order the candidates so as the highest score be the most probably language of the content. The candidates is +// a map which can be used to assign weights to languages dynamically. type Classifier interface { - Classify(content []byte, candidates []string) map[string]float64 + Classify(content []byte, candidates map[string]float64) map[string]float64 } type classifier struct { @@ -44,36 +19,36 @@ type classifier struct { tokensTotal float64 } -func (c *classifier) Classify(content []byte, candidates []string) map[string]float64 { +func (c *classifier) Classify(content []byte, candidates map[string]float64) map[string]float64 { if len(content) == 0 { return nil } - var languages []string + var languages map[string]float64 if len(candidates) == 0 { languages = c.knownLangs() } else { - languages = make([]string, 0, len(candidates)) - for _, candidate := range candidates { + languages = make(map[string]float64, len(candidates)) + for candidate, weight := range candidates { if lang, ok := GetLanguageByAlias(candidate); ok { - languages = append(languages, lang) + languages[lang] = weight } } } tokens := tokenizer.Tokenize(content) scores := make(map[string]float64, len(languages)) - for _, language := range languages { + for language := range languages { scores[language] = c.tokensLogProbability(tokens, language) + c.languagesLogProbabilities[language] } return scores } -func (c *classifier) knownLangs() []string { - langs := make([]string, 0, len(c.languagesLogProbabilities)) +func (c *classifier) knownLangs() map[string]float64 { + langs := make(map[string]float64, len(c.languagesLogProbabilities)) for lang := range c.languagesLogProbabilities { - langs = append(langs, lang) + langs[lang]++ } return langs diff --git a/common.go b/common.go index 5d8348b..e2a47c9 100644 --- a/common.go +++ b/common.go @@ -1,6 +1,7 @@ package slinguist import ( + "math" "path/filepath" "strings" ) @@ -8,100 +9,142 @@ import ( // OtherLanguage is used as a zero value when a function can not return a specific language. const OtherLanguage = "Other" +// Strategy type fix the signature for the functions that can be used as a strategy. +type Strategy func(filename string, content []byte) (languages []string) + +var strategies = []Strategy{ + GetLanguagesByModeline, + GetLanguagesByFilename, + GetLanguagesByShebang, + GetLanguagesByExtension, + GetLanguagesByContent, +} + // GetLanguage applies a sequence of strategies based on the given filename and content // to find out the most probably language to return. func GetLanguage(filename string, content []byte) string { - if lang, safe := GetLanguageByModeline(content); safe { - return lang + candidates := map[string]float64{} + for _, strategy := range strategies { + languages := strategy(filename, content) + if len(languages) == 1 { + return languages[0] + } + + if len(languages) > 0 { + for _, language := range languages { + candidates[language]++ + } + } } - if lang, safe := GetLanguageByFilename(filename); safe { - return lang + if len(candidates) == 0 { + return OtherLanguage } - if lang, safe := GetLanguageByShebang(content); safe { - return lang - } - - if lang, safe := GetLanguageByExtension(filename); safe { - return lang - } - - if lang, safe := GetLanguageByContent(filename, content); safe { - return lang - } - - lang := GetLanguageByClassifier(content, nil, nil) + lang := GetLanguageByClassifier(content, candidates, nil) return lang } // GetLanguageByModeline returns the language of the given content looking for the modeline, // and safe to indicate the sureness of returned language. func GetLanguageByModeline(content []byte) (lang string, safe bool) { - return getLanguageByModeline(content) + return getLangAndSafe("", content, GetLanguagesByModeline) } // GetLanguageByFilename returns a language based on the given filename, and safe to indicate // the sureness of returned language. func GetLanguageByFilename(filename string) (lang string, safe bool) { - return getLanguageByFilename(filename) + return getLangAndSafe(filename, nil, GetLanguagesByFilename) } -func getLanguageByFilename(filename string) (lang string, safe bool) { - lang, safe = languagesByFilename[filename] - if lang == "" { - lang = OtherLanguage - } - - return +// GetLanguagesByFilename returns a slice of possible languages for the given filename, content will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByFilename(filename string, content []byte) []string { + return languagesByFilename[filename] } // GetLanguageByShebang returns the language of the given content looking for the shebang line, // and safe to indicate the sureness of returned language. func GetLanguageByShebang(content []byte) (lang string, safe bool) { - return getLanguageByShebang(content) + return getLangAndSafe("", content, GetLanguagesByShebang) } // GetLanguageByExtension returns a language based on the given filename, and safe to indicate // the sureness of returned language. func GetLanguageByExtension(filename string) (lang string, safe bool) { - return getLanguageByExtension(filename) + return getLangAndSafe(filename, nil, GetLanguagesByExtension) } -func getLanguageByExtension(filename string) (lang string, safe bool) { +// GetLanguagesByExtension returns a slice of possible languages for the given filename, content will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByExtension(filename string, content []byte) []string { ext := strings.ToLower(filepath.Ext(filename)) - lang = OtherLanguage - langs, ok := languagesByExtension[ext] - if !ok { - return - } - - lang = langs[0] - safe = len(langs) == 1 - return + return languagesByExtension[ext] } // GetLanguageByContent returns a language based on the filename and heuristics applies to the content, // and safe to indicate the sureness of returned language. func GetLanguageByContent(filename string, content []byte) (lang string, safe bool) { - return getLanguageByContent(filename, content) + return getLangAndSafe(filename, content, GetLanguagesByContent) } -func getLanguageByContent(filename string, content []byte) (lang string, safe bool) { +// GetLanguagesByContent returns a slice of possible languages for the given content, filename will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByContent(filename string, content []byte) []string { ext := strings.ToLower(filepath.Ext(filename)) - if fnMatcher, ok := contentMatchers[ext]; ok { - lang, safe = fnMatcher(content) - } else { - lang = OtherLanguage + fnMatcher, ok := contentMatchers[ext] + if !ok { + return nil } + return fnMatcher(content) +} + +func getLangAndSafe(filename string, content []byte, getLanguageByStrategy Strategy) (lang string, safe bool) { + languages := getLanguageByStrategy(filename, content) + if len(languages) == 0 { + lang = OtherLanguage + return + } + + lang = languages[0] + safe = len(languages) == 1 return } // GetLanguageByClassifier takes in a content and a list of candidates, and apply the classifier's Classify method to -// get the most probably language. If classifier is null then DefaultClassfier will be used. -func GetLanguageByClassifier(content []byte, candidates []string, classifier Classifier) string { - return getLanguageByClassifier(content, candidates, classifier) +// get the most probably language. If classifier is null then DefaultClassfier will be used. If there aren't candidates +// OtherLanguage is returned. +func GetLanguageByClassifier(content []byte, candidates map[string]float64, classifier Classifier) string { + scores := GetLanguagesByClassifier(content, candidates, classifier) + if len(scores) == 0 { + return OtherLanguage + } + + return getLangugeHigherScore(scores) +} + +func getLangugeHigherScore(scores map[string]float64) string { + var language string + higher := -math.MaxFloat64 + for lang, score := range scores { + if higher < score { + language = lang + higher = score + } + } + + return language +} + +// GetLanguagesByClassifier returns a map of possible languages as keys and a score as value based on content and candidates. The values can be ordered +// with the highest value as the most probably language. If classifier is null then DefaultClassfier will be used. +func GetLanguagesByClassifier(content []byte, candidates map[string]float64, classifier Classifier) map[string]float64 { + if classifier == nil { + classifier = DefaultClassifier + } + + return classifier.Classify(content, candidates) } // GetLanguageExtensions returns the different extensions being used by the language. diff --git a/common_test.go b/common_test.go index 75c96ed..6474d12 100644 --- a/common_test.go +++ b/common_test.go @@ -34,7 +34,7 @@ func (s *SimpleLinguistTestSuite) TestGetLanguage() { for _, test := range tests { language := GetLanguage(test.filename, test.content) - assert.Equal(s.T(), language, test.expected, fmt.Sprintf("%v: %v, expected: %v", test.name, language, test.expected)) + assert.Equal(s.T(), test.expected, language, fmt.Sprintf("%v: %v, expected: %v", test.name, language, test.expected)) } } @@ -91,8 +91,8 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByModelineLinguist() { assert.NoError(s.T(), err) lang, safe := GetLanguageByModeline(content) - assert.Equal(s.T(), lang, test.expectedLang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) - assert.Equal(s.T(), safe, test.expectedSafe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) + assert.Equal(s.T(), test.expectedLang, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) + assert.Equal(s.T(), test.expectedSafe, safe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) } } @@ -116,8 +116,8 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByModeline() { for _, test := range tests { lang, safe := GetLanguageByModeline(test.content) - assert.Equal(s.T(), lang, test.expectedLang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) - assert.Equal(s.T(), safe, test.expectedSafe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) + assert.Equal(s.T(), test.expectedLang, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) + assert.Equal(s.T(), test.expectedSafe, safe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) } } @@ -140,8 +140,8 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByFilename() { for _, test := range tests { lang, safe := GetLanguageByFilename(test.filename) - assert.Equal(s.T(), lang, test.expectedLang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) - assert.Equal(s.T(), safe, test.expectedSafe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) + assert.Equal(s.T(), test.expectedLang, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) + assert.Equal(s.T(), test.expectedSafe, safe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) } } @@ -181,8 +181,8 @@ println("The shell script says ",vm.arglist.concat(" "));` for _, test := range tests { lang, safe := GetLanguageByShebang(test.content) - assert.Equal(s.T(), lang, test.expectedLang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) - assert.Equal(s.T(), safe, test.expectedSafe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) + assert.Equal(s.T(), test.expectedLang, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) + assert.Equal(s.T(), test.expectedSafe, safe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) } } @@ -200,8 +200,8 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByExtension() { for _, test := range tests { lang, safe := GetLanguageByExtension(test.filename) - assert.Equal(s.T(), lang, test.expectedLang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) - assert.Equal(s.T(), safe, test.expectedSafe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) + assert.Equal(s.T(), test.expectedLang, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) + assert.Equal(s.T(), test.expectedSafe, safe, fmt.Sprintf("%v: safe = %v, expected: %v", test.name, safe, test.expectedSafe)) } } @@ -263,15 +263,15 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByClassifier() { test := []struct { name string filename string - candidates []string + candidates map[string]float64 expected string }{ - {name: "TestGetLanguageByClassifier_1", filename: filepath.Join(samples, "C/blob.c"), candidates: []string{"python", "ruby", "c", "c++"}, expected: "C"}, + {name: "TestGetLanguageByClassifier_1", filename: filepath.Join(samples, "C/blob.c"), candidates: map[string]float64{"python": 1.00, "ruby": 1.00, "c": 1.00, "c++": 1.00}, expected: "C"}, {name: "TestGetLanguageByClassifier_2", filename: filepath.Join(samples, "C/blob.c"), candidates: nil, expected: "C"}, {name: "TestGetLanguageByClassifier_3", filename: filepath.Join(samples, "C/main.c"), candidates: nil, expected: "C"}, - {name: "TestGetLanguageByClassifier_4", filename: filepath.Join(samples, "C/blob.c"), candidates: []string{"python", "ruby", "c++"}, expected: "C++"}, - {name: "TestGetLanguageByClassifier_5", filename: filepath.Join(samples, "C/blob.c"), candidates: []string{"ruby"}, expected: "Ruby"}, - {name: "TestGetLanguageByClassifier_6", filename: filepath.Join(samples, "Python/django-models-base.py"), candidates: []string{"python", "ruby", "c", "c++"}, expected: "Python"}, + {name: "TestGetLanguageByClassifier_4", filename: filepath.Join(samples, "C/blob.c"), candidates: map[string]float64{"python": 1.00, "ruby": 1.00, "c++": 1.00}, expected: "C++"}, + {name: "TestGetLanguageByClassifier_5", filename: filepath.Join(samples, "C/blob.c"), candidates: map[string]float64{"ruby": 1.00}, expected: "Ruby"}, + {name: "TestGetLanguageByClassifier_6", filename: filepath.Join(samples, "Python/django-models-base.py"), candidates: map[string]float64{"python": 1.00, "ruby": 1.00, "c": 1.00, "c++": 1.00}, expected: "Python"}, {name: "TestGetLanguageByClassifier_7", filename: filepath.Join(samples, "Python/django-models-base.py"), candidates: nil, expected: "Python"}, } @@ -280,7 +280,7 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByClassifier() { assert.NoError(s.T(), err) lang := GetLanguageByClassifier(content, test.candidates, nil) - assert.Equal(s.T(), lang, test.expected, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expected)) + assert.Equal(s.T(), test.expected, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expected)) } } @@ -297,7 +297,7 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageExtensions() { for _, test := range tests { extensions := GetLanguageExtensions(test.language) - assert.EqualValues(s.T(), extensions, test.expected, fmt.Sprintf("%v: extensions = %v, expected: %v", test.name, extensions, test.expected)) + assert.EqualValues(s.T(), test.expected, extensions, fmt.Sprintf("%v: extensions = %v, expected: %v", test.name, extensions, test.expected)) } } @@ -320,7 +320,7 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageType() { for _, test := range tests { langType := GetLanguageType(test.language) - assert.Equal(s.T(), langType, test.expected, fmt.Sprintf("%v: langType = %v, expected: %v", test.name, langType, test.expected)) + assert.Equal(s.T(), test.expected, langType, fmt.Sprintf("%v: langType = %v, expected: %v", test.name, langType, test.expected)) } } @@ -345,7 +345,7 @@ func (s *SimpleLinguistTestSuite) TestGetLanguageByAlias() { for _, test := range tests { lang, ok := GetLanguageByAlias(test.alias) - assert.Equal(s.T(), lang, test.expectedLang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) - assert.Equal(s.T(), ok, test.expectedOk, fmt.Sprintf("%v: ok = %v, expected: %v", test.name, ok, test.expectedOk)) + assert.Equal(s.T(), test.expectedLang, lang, fmt.Sprintf("%v: lang = %v, expected: %v", test.name, lang, test.expectedLang)) + assert.Equal(s.T(), test.expectedOk, ok, fmt.Sprintf("%v: ok = %v, expected: %v", test.name, ok, test.expectedOk)) } } diff --git a/content.go b/content.go index e287746..4b39cc9 100644 --- a/content.go +++ b/content.go @@ -2,447 +2,447 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 import ( "regexp" ) -type languageMatcher func([]byte) (string, bool) +type languageMatcher func([]byte) []string var contentMatchers = map[string]languageMatcher{ - ".asc": func(i []byte) (string, bool) { + ".asc": func(i []byte) []string { if asc_PublicKey_Matcher_0.Match(i) { - return "Public Key", true + return []string{"Public Key"} } else if asc_AsciiDoc_Matcher_0.Match(i) { - return "AsciiDoc", true + return []string{"AsciiDoc"} } else if asc_AGSScript_Matcher_0.Match(i) { - return "AGS Script", true + return []string{"AGS Script"} } - return OtherLanguage, false + return nil }, - ".bb": func(i []byte) (string, bool) { + ".bb": func(i []byte) []string { if bb_BlitzBasic_Matcher_0.Match(i) || bb_BlitzBasic_Matcher_1.Match(i) { - return "BlitzBasic", true + return []string{"BlitzBasic"} } else if bb_BitBake_Matcher_0.Match(i) { - return "BitBake", true + return []string{"BitBake"} } - return OtherLanguage, false + return nil }, - ".builds": func(i []byte) (string, bool) { + ".builds": func(i []byte) []string { if builds_XML_Matcher_0.Match(i) { - return "XML", true + return []string{"XML"} } - return "Text", true + return []string{"Text"} }, - ".ch": func(i []byte) (string, bool) { + ".ch": func(i []byte) []string { if ch_xBase_Matcher_0.Match(i) { - return "xBase", true + return []string{"xBase"} } - return OtherLanguage, false + return nil }, - ".cl": func(i []byte) (string, bool) { + ".cl": func(i []byte) []string { if cl_CommonLisp_Matcher_0.Match(i) { - return "Common Lisp", true + return []string{"Common Lisp"} } else if cl_Cool_Matcher_0.Match(i) { - return "Cool", true + return []string{"Cool"} } else if cl_OpenCL_Matcher_0.Match(i) { - return "OpenCL", true + return []string{"OpenCL"} } - return OtherLanguage, false + return nil }, - ".cls": func(i []byte) (string, bool) { + ".cls": func(i []byte) []string { if cls_TeX_Matcher_0.Match(i) { - return "TeX", true + return []string{"TeX"} } - return OtherLanguage, false + return nil }, - ".cs": func(i []byte) (string, bool) { + ".cs": func(i []byte) []string { if cs_Smalltalk_Matcher_0.Match(i) { - return "Smalltalk", true + return []string{"Smalltalk"} } else if cs_CSharp_Matcher_0.Match(i) || cs_CSharp_Matcher_1.Match(i) { - return "C#", true + return []string{"C#"} } - return OtherLanguage, false + return nil }, - ".d": func(i []byte) (string, bool) { + ".d": func(i []byte) []string { if d_D_Matcher_0.Match(i) { - return "D", true + return []string{"D"} } else if d_DTrace_Matcher_0.Match(i) { - return "DTrace", true + return []string{"DTrace"} } else if d_Makefile_Matcher_0.Match(i) { - return "Makefile", true + return []string{"Makefile"} } - return OtherLanguage, false + return nil }, - ".ecl": func(i []byte) (string, bool) { + ".ecl": func(i []byte) []string { if ecl_ECLiPSe_Matcher_0.Match(i) { - return "ECLiPSe", true + return []string{"ECLiPSe"} } else if ecl_ECL_Matcher_0.Match(i) { - return "ECL", true + return []string{"ECL"} } - return OtherLanguage, false + return nil }, - ".es": func(i []byte) (string, bool) { + ".es": func(i []byte) []string { if es_Erlang_Matcher_0.Match(i) { - return "Erlang", true + return []string{"Erlang"} } - return OtherLanguage, false + return nil }, - ".f": func(i []byte) (string, bool) { + ".f": func(i []byte) []string { if f_Forth_Matcher_0.Match(i) { - return "Forth", true + return []string{"Forth"} } else if f_FilebenchWML_Matcher_0.Match(i) { - return "Filebench WML", true + return []string{"Filebench WML"} } else if f_Fortran_Matcher_0.Match(i) { - return "Fortran", true + return []string{"Fortran"} } - return OtherLanguage, false + return nil }, - ".for": func(i []byte) (string, bool) { + ".for": func(i []byte) []string { if for_Forth_Matcher_0.Match(i) { - return "Forth", true + return []string{"Forth"} } else if for_Fortran_Matcher_0.Match(i) { - return "Fortran", true + return []string{"Fortran"} } - return OtherLanguage, false + return nil }, - ".fr": func(i []byte) (string, bool) { + ".fr": func(i []byte) []string { if fr_Forth_Matcher_0.Match(i) { - return "Forth", true + return []string{"Forth"} } else if fr_Frege_Matcher_0.Match(i) { - return "Frege", true + return []string{"Frege"} } - return "Text", true + return []string{"Text"} }, - ".fs": func(i []byte) (string, bool) { + ".fs": func(i []byte) []string { if fs_Forth_Matcher_0.Match(i) { - return "Forth", true + return []string{"Forth"} } else if fs_FSharp_Matcher_0.Match(i) { - return "F#", true + return []string{"F#"} } else if fs_GLSL_Matcher_0.Match(i) { - return "GLSL", true + return []string{"GLSL"} } else if fs_Filterscript_Matcher_0.Match(i) { - return "Filterscript", true + return []string{"Filterscript"} } - return OtherLanguage, false + return nil }, - ".gs": func(i []byte) (string, bool) { + ".gs": func(i []byte) []string { if gs_Gosu_Matcher_0.Match(i) { - return "Gosu", true + return []string{"Gosu"} } - return OtherLanguage, false + return nil }, - ".h": func(i []byte) (string, bool) { + ".h": func(i []byte) []string { if h_ObjectiveDashC_Matcher_0.Match(i) { - return "Objective-C", true + return []string{"Objective-C"} } else if h_CPlusPlus_Matcher_0.Match(i) || h_CPlusPlus_Matcher_1.Match(i) || h_CPlusPlus_Matcher_2.Match(i) || h_CPlusPlus_Matcher_3.Match(i) || h_CPlusPlus_Matcher_4.Match(i) || h_CPlusPlus_Matcher_5.Match(i) || h_CPlusPlus_Matcher_6.Match(i) { - return "C++", true + return []string{"C++"} } - return OtherLanguage, false + return nil }, - ".inc": func(i []byte) (string, bool) { + ".inc": func(i []byte) []string { if inc_PHP_Matcher_0.Match(i) { - return "PHP", true + return []string{"PHP"} } else if inc_POVDashRaySDL_Matcher_0.Match(i) { - return "POV-Ray SDL", true + return []string{"POV-Ray SDL"} } - return OtherLanguage, false + return nil }, - ".l": func(i []byte) (string, bool) { + ".l": func(i []byte) []string { if l_CommonLisp_Matcher_0.Match(i) { - return "Common Lisp", true + return []string{"Common Lisp"} } else if l_Lex_Matcher_0.Match(i) { - return "Lex", true + return []string{"Lex"} } else if l_Roff_Matcher_0.Match(i) { - return "Roff", true + return []string{"Roff"} } else if l_PicoLisp_Matcher_0.Match(i) { - return "PicoLisp", true + return []string{"PicoLisp"} } - return OtherLanguage, false + return nil }, - ".ls": func(i []byte) (string, bool) { + ".ls": func(i []byte) []string { if ls_LoomScript_Matcher_0.Match(i) { - return "LoomScript", true + return []string{"LoomScript"} } - return "LiveScript", true + return []string{"LiveScript"} }, - ".lsp": func(i []byte) (string, bool) { + ".lsp": func(i []byte) []string { if lsp_CommonLisp_Matcher_0.Match(i) { - return "Common Lisp", true + return []string{"Common Lisp"} } else if lsp_NewLisp_Matcher_0.Match(i) { - return "NewLisp", true + return []string{"NewLisp"} } - return OtherLanguage, false + return nil }, - ".lisp": func(i []byte) (string, bool) { + ".lisp": func(i []byte) []string { if lisp_CommonLisp_Matcher_0.Match(i) { - return "Common Lisp", true + return []string{"Common Lisp"} } else if lisp_NewLisp_Matcher_0.Match(i) { - return "NewLisp", true + return []string{"NewLisp"} } - return OtherLanguage, false + return nil }, - ".m": func(i []byte) (string, bool) { + ".m": func(i []byte) []string { if m_ObjectiveDashC_Matcher_0.Match(i) { - return "Objective-C", true + return []string{"Objective-C"} } else if m_Mercury_Matcher_0.Match(i) { - return "Mercury", true + return []string{"Mercury"} } else if m_MUF_Matcher_0.Match(i) { - return "MUF", true + return []string{"MUF"} } else if m_M_Matcher_0.Match(i) { - return "M", true + return []string{"M"} } else if m_Mathematica_Matcher_0.Match(i) { - return "Mathematica", true + return []string{"Mathematica"} } else if m_Matlab_Matcher_0.Match(i) { - return "Matlab", true + return []string{"Matlab"} } else if m_Limbo_Matcher_0.Match(i) { - return "Limbo", true + return []string{"Limbo"} } - return OtherLanguage, false + return nil }, - ".md": func(i []byte) (string, bool) { + ".md": func(i []byte) []string { if md_Markdown_Matcher_0.Match(i) || md_Markdown_Matcher_1.Match(i) { - return "Markdown", true + return []string{"Markdown"} } else if md_GCCMachineDescription_Matcher_0.Match(i) { - return "GCC Machine Description", true + return []string{"GCC Machine Description"} } - return "Markdown", true + return []string{"Markdown"} }, - ".ml": func(i []byte) (string, bool) { + ".ml": func(i []byte) []string { if ml_OCaml_Matcher_0.Match(i) { - return "OCaml", true + return []string{"OCaml"} } else if ml_StandardML_Matcher_0.Match(i) { - return "Standard ML", true + return []string{"Standard ML"} } - return OtherLanguage, false + return nil }, - ".mod": func(i []byte) (string, bool) { + ".mod": func(i []byte) []string { if mod_XML_Matcher_0.Match(i) { - return "XML", true + return []string{"XML"} } else if mod_ModulaDash2_Matcher_0.Match(i) || mod_ModulaDash2_Matcher_1.Match(i) { - return "Modula-2", true + return []string{"Modula-2"} } - return "Linux Kernel Module", false + return []string{"Linux Kernel Module", "AMPL"} }, - ".ms": func(i []byte) (string, bool) { + ".ms": func(i []byte) []string { if ms_Roff_Matcher_0.Match(i) { - return "Roff", true + return []string{"Roff"} } - return "MAXScript", true + return []string{"MAXScript"} }, - ".n": func(i []byte) (string, bool) { + ".n": func(i []byte) []string { if n_Roff_Matcher_0.Match(i) { - return "Roff", true + return []string{"Roff"} } else if n_Nemerle_Matcher_0.Match(i) { - return "Nemerle", true + return []string{"Nemerle"} } - return OtherLanguage, false + return nil }, - ".ncl": func(i []byte) (string, bool) { + ".ncl": func(i []byte) []string { if ncl_Text_Matcher_0.Match(i) { - return "Text", true + return []string{"Text"} } - return OtherLanguage, false + return nil }, - ".nl": func(i []byte) (string, bool) { + ".nl": func(i []byte) []string { if nl_NL_Matcher_0.Match(i) { - return "NL", true + return []string{"NL"} } - return "NewLisp", true + return []string{"NewLisp"} }, - ".php": func(i []byte) (string, bool) { + ".php": func(i []byte) []string { if php_Hack_Matcher_0.Match(i) { - return "Hack", true + return []string{"Hack"} } else if php_PHP_Matcher_0.Match(i) { - return "PHP", true + return []string{"PHP"} } - return OtherLanguage, false + return nil }, - ".pl": func(i []byte) (string, bool) { + ".pl": func(i []byte) []string { if pl_Prolog_Matcher_0.Match(i) { - return "Prolog", true + return []string{"Prolog"} } else if pl_Perl_Matcher_0.Match(i) { - return "Perl", true + return []string{"Perl"} } else if pl_Perl6_Matcher_0.Match(i) { - return "Perl6", true + return []string{"Perl6"} } - return OtherLanguage, false + return nil }, - ".pm": func(i []byte) (string, bool) { + ".pm": func(i []byte) []string { if pm_Perl6_Matcher_0.Match(i) { - return "Perl6", true + return []string{"Perl6"} } else if pm_Perl_Matcher_0.Match(i) { - return "Perl", true + return []string{"Perl"} } - return OtherLanguage, false + return nil }, - ".pod": func(i []byte) (string, bool) { + ".pod": func(i []byte) []string { if pod_Pod_Matcher_0.Match(i) { - return "Pod", true + return []string{"Pod"} } - return "Perl", true + return []string{"Perl"} }, - ".pro": func(i []byte) (string, bool) { + ".pro": func(i []byte) []string { if pro_Prolog_Matcher_0.Match(i) { - return "Prolog", true + return []string{"Prolog"} } else if pro_INI_Matcher_0.Match(i) { - return "INI", true + return []string{"INI"} } else if pro_QMake_Matcher_0.Match(i) && pro_QMake_Matcher_1.Match(i) { - return "QMake", true + return []string{"QMake"} } else if pro_IDL_Matcher_0.Match(i) { - return "IDL", true + return []string{"IDL"} } - return OtherLanguage, false + return nil }, - ".props": func(i []byte) (string, bool) { + ".props": func(i []byte) []string { if props_XML_Matcher_0.Match(i) { - return "XML", true + return []string{"XML"} } else if props_INI_Matcher_0.Match(i) { - return "INI", true + return []string{"INI"} } - return OtherLanguage, false + return nil }, - ".r": func(i []byte) (string, bool) { + ".r": func(i []byte) []string { if r_Rebol_Matcher_0.Match(i) { - return "Rebol", true + return []string{"Rebol"} } else if r_R_Matcher_0.Match(i) { - return "R", true + return []string{"R"} } - return OtherLanguage, false + return nil }, - ".rno": func(i []byte) (string, bool) { + ".rno": func(i []byte) []string { if rno_RUNOFF_Matcher_0.Match(i) { - return "RUNOFF", true + return []string{"RUNOFF"} } else if rno_Roff_Matcher_0.Match(i) { - return "Roff", true + return []string{"Roff"} } - return OtherLanguage, false + return nil }, - ".rpy": func(i []byte) (string, bool) { + ".rpy": func(i []byte) []string { if rpy_Python_Matcher_0.Match(i) { - return "Python", true + return []string{"Python"} } - return "Ren'Py", true + return []string{"Ren'Py"} }, - ".rs": func(i []byte) (string, bool) { + ".rs": func(i []byte) []string { if rs_Rust_Matcher_0.Match(i) { - return "Rust", true + return []string{"Rust"} } else if rs_RenderScript_Matcher_0.Match(i) { - return "RenderScript", true + return []string{"RenderScript"} } - return OtherLanguage, false + return nil }, - ".sc": func(i []byte) (string, bool) { + ".sc": func(i []byte) []string { if sc_SuperCollider_Matcher_0.Match(i) || sc_SuperCollider_Matcher_1.Match(i) || sc_SuperCollider_Matcher_2.Match(i) { - return "SuperCollider", true + return []string{"SuperCollider"} } else if sc_Scala_Matcher_0.Match(i) || sc_Scala_Matcher_1.Match(i) || sc_Scala_Matcher_2.Match(i) { - return "Scala", true + return []string{"Scala"} } - return OtherLanguage, false + return nil }, - ".sql": func(i []byte) (string, bool) { + ".sql": func(i []byte) []string { if sql_PLpgSQL_Matcher_0.Match(i) || sql_PLpgSQL_Matcher_1.Match(i) || sql_PLpgSQL_Matcher_2.Match(i) { - return "PLpgSQL", true + return []string{"PLpgSQL"} } else if sql_SQLPL_Matcher_0.Match(i) || sql_SQLPL_Matcher_1.Match(i) { - return "SQLPL", true + return []string{"SQLPL"} } else if sql_PLSQL_Matcher_0.Match(i) || sql_PLSQL_Matcher_1.Match(i) { - return "PLSQL", true + return []string{"PLSQL"} } else if sql_SQL_Matcher_0.Match(i) { - return "SQL", true + return []string{"SQL"} } - return OtherLanguage, false + return nil }, - ".srt": func(i []byte) (string, bool) { + ".srt": func(i []byte) []string { if srt_SubRipText_Matcher_0.Match(i) { - return "SubRip Text", true + return []string{"SubRip Text"} } - return OtherLanguage, false + return nil }, - ".t": func(i []byte) (string, bool) { + ".t": func(i []byte) []string { if t_Turing_Matcher_0.Match(i) { - return "Turing", true + return []string{"Turing"} } else if t_Perl6_Matcher_0.Match(i) { - return "Perl6", true + return []string{"Perl6"} } else if t_Perl_Matcher_0.Match(i) { - return "Perl", true + return []string{"Perl"} } - return OtherLanguage, false + return nil }, - ".toc": func(i []byte) (string, bool) { + ".toc": func(i []byte) []string { if toc_WorldofWarcraftAddonData_Matcher_0.Match(i) { - return "World of Warcraft Addon Data", true + return []string{"World of Warcraft Addon Data"} } else if toc_TeX_Matcher_0.Match(i) { - return "TeX", true + return []string{"TeX"} } - return OtherLanguage, false + return nil }, - ".ts": func(i []byte) (string, bool) { + ".ts": func(i []byte) []string { if ts_XML_Matcher_0.Match(i) { - return "XML", true + return []string{"XML"} } - return "TypeScript", true + return []string{"TypeScript"} }, - ".tst": func(i []byte) (string, bool) { + ".tst": func(i []byte) []string { if tst_GAP_Matcher_0.Match(i) { - return "GAP", true + return []string{"GAP"} } - return "Scilab", true + return []string{"Scilab"} }, - ".tsx": func(i []byte) (string, bool) { + ".tsx": func(i []byte) []string { if tsx_TypeScript_Matcher_0.Match(i) { - return "TypeScript", true + return []string{"TypeScript"} } else if tsx_XML_Matcher_0.Match(i) { - return "XML", true + return []string{"XML"} } - return OtherLanguage, false + return nil }, } diff --git a/documentation.go b/documentation.go index 6dc05b6..f253c4a 100644 --- a/documentation.go +++ b/documentation.go @@ -2,7 +2,7 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 import "gopkg.in/toqueteos/substring.v1" diff --git a/extension.go b/extension.go index bbc40fc..bb0c1b1 100644 --- a/extension.go +++ b/extension.go @@ -2,7 +2,7 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 var languagesByExtension = map[string][]string{ ".1": {"Roff"}, @@ -926,6 +926,8 @@ var languagesByExtension = map[string][]string{ ".vw": {"PLSQL"}, ".vxml": {"XML"}, ".w": {"CWeb"}, + ".wast": {"WebAssembly"}, + ".wat": {"WebAssembly"}, ".watchr": {"Ruby"}, ".webidl": {"WebIDL"}, ".weechatlog": {"IRC log"}, @@ -1419,6 +1421,7 @@ var extensionsByLanguage = map[string][]string{ "Wavefront Material": {".mtl"}, "Wavefront Object": {".obj"}, "Web Ontology Language": {".owl"}, + "WebAssembly": {".wast", ".wat"}, "WebIDL": {".webidl"}, "World of Warcraft Addon Data": {".toc"}, "X10": {".x10"}, diff --git a/filename.go b/filename.go index a238bee..ca833bf 100644 --- a/filename.go +++ b/filename.go @@ -2,141 +2,142 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 -var languagesByFilename = map[string]string{ - ".Rprofile": "R", - ".XCompose": "XCompose", - ".abbrev_defs": "Emacs Lisp", - ".arcconfig": "JSON", - ".babelrc": "JSON5", - ".bash_history": "Shell", - ".bash_logout": "Shell", - ".bash_profile": "Shell", - ".bashrc": "Shell", - ".clang-format": "YAML", - ".classpath": "XML", - ".emacs": "Emacs Lisp", - ".emacs.desktop": "Emacs Lisp", - ".factor-boot-rc": "Factor", - ".factor-rc": "Factor", - ".gclient": "Python", - ".gnus": "Emacs Lisp", - ".irbrc": "Ruby", - ".jshintrc": "JSON", - ".nvimrc": "Vim script", - ".php_cs": "PHP", - ".php_cs.dist": "PHP", - ".project": "XML", - ".pryrc": "Ruby", - ".spacemacs": "Emacs Lisp", - ".vimrc": "Vim script", - ".viper": "Emacs Lisp", - "APKBUILD": "Alpine Abuild", - "App.config": "XML", - "Appraisals": "Ruby", - "BSDmakefile": "Makefile", - "BUCK": "Python", - "BUILD": "Python", - "Berksfile": "Ruby", - "Brewfile": "Ruby", - "Buildfile": "Ruby", - "CMakeLists.txt": "CMake", - "COPYING": "Text", - "COPYRIGHT.regex": "Text", - "Cakefile": "CoffeeScript", - "Cask": "Emacs Lisp", - "Dangerfile": "Ruby", - "Deliverfile": "Ruby", - "Dockerfile": "Dockerfile", - "Emakefile": "Erlang", - "FONTLOG": "Text", - "Fakefile": "Fancy", - "Fastfile": "Ruby", - "GNUmakefile": "Makefile", - "Gemfile": "Ruby", - "Gemfile.lock": "Ruby", - "Guardfile": "Ruby", - "INSTALL": "Text", - "INSTALL.mysql": "Text", - "Jakefile": "JavaScript", - "Jarfile": "Ruby", - "Jenkinsfile": "Groovy", - "Kbuild": "Makefile", - "LICENSE": "Text", - "LICENSE.mysql": "Text", - "Makefile": "Makefile", - "Makefile.am": "Makefile", - "Makefile.boot": "Makefile", - "Makefile.frag": "Makefile", - "Makefile.in": "Makefile", - "Makefile.inc": "Makefile", - "Mavenfile": "Ruby", - "Modulefile": "Puppet", - "NEWS": "Text", - "Notebook": "Jupyter Notebook", - "NuGet.config": "XML", - "Nukefile": "Nu", - "PKGBUILD": "Shell", - "Phakefile": "PHP", - "Podfile": "Ruby", - "Project.ede": "Emacs Lisp", - "Puppetfile": "Ruby", - "README.1ST": "Text", - "README.me": "Text", - "README.mysql": "Text", - "ROOT": "Isabelle ROOT", - "Rakefile": "Ruby", - "Rexfile": "Perl6", - "SConscript": "Python", - "SConstruct": "Python", - "Settings.StyleCop": "XML", - "Slakefile": "LiveScript", - "Snakefile": "Python", - "Snapfile": "Ruby", - "Thorfile": "Ruby", - "Vagrantfile": "Ruby", - "WORKSPACE": "Python", - "Web.Debug.config": "XML", - "Web.Release.config": "XML", - "Web.config": "XML", - "XCompose": "XCompose", - "_emacs": "Emacs Lisp", - "_vimrc": "Vim script", - "abbrev_defs": "Emacs Lisp", - "ant.xml": "Ant Build System", - "build.xml": "Ant Build System", - "buildfile": "Ruby", - "click.me": "Text", - "composer.lock": "JSON", - "configure.ac": "M4Sugar", - "delete.me": "Text", - "descrip.mmk": "Module Management System", - "descrip.mms": "Module Management System", - "gradlew": "Shell", - "gvimrc": "Vim script", - "keep.me": "Text", - "ld.script": "Linker Script", - "makefile": "Makefile", - "makefile.sco": "Makefile", - "mcmod.info": "JSON", - "meson.build": "Meson", - "meson_options.txt": "Meson", - "mix.lock": "Elixir", - "mkfile": "Makefile", - "mmn": "Roff", - "mmt": "Roff", - "nginx.conf": "Nginx", - "nvimrc": "Vim script", - "packages.config": "XML", - "pom.xml": "Maven POM", - "read.me": "Text", - "rebar.config": "Erlang", - "rebar.config.lock": "Erlang", - "rebar.lock": "Erlang", - "riemann.config": "Clojure", - "test.me": "Text", - "vimrc": "Vim script", - "wscript": "Python", - "xcompose": "XCompose", +var languagesByFilename = map[string][]string{ + ".Rprofile": {"R"}, + ".XCompose": {"XCompose"}, + ".abbrev_defs": {"Emacs Lisp"}, + ".arcconfig": {"JSON"}, + ".babelrc": {"JSON5"}, + ".bash_history": {"Shell"}, + ".bash_logout": {"Shell"}, + ".bash_profile": {"Shell"}, + ".bashrc": {"Shell"}, + ".clang-format": {"YAML"}, + ".classpath": {"XML"}, + ".emacs": {"Emacs Lisp"}, + ".emacs.desktop": {"Emacs Lisp"}, + ".factor-boot-rc": {"Factor"}, + ".factor-rc": {"Factor"}, + ".gclient": {"Python"}, + ".gnus": {"Emacs Lisp"}, + ".irbrc": {"Ruby"}, + ".jshintrc": {"JSON"}, + ".nvimrc": {"Vim script"}, + ".php_cs": {"PHP"}, + ".php_cs.dist": {"PHP"}, + ".project": {"XML"}, + ".pryrc": {"Ruby"}, + ".spacemacs": {"Emacs Lisp"}, + ".vimrc": {"Vim script"}, + ".viper": {"Emacs Lisp"}, + "APKBUILD": {"Alpine Abuild"}, + "App.config": {"XML"}, + "Appraisals": {"Ruby"}, + "BSDmakefile": {"Makefile"}, + "BUCK": {"Python"}, + "BUILD": {"Python"}, + "Berksfile": {"Ruby"}, + "Brewfile": {"Ruby"}, + "Buildfile": {"Ruby"}, + "CMakeLists.txt": {"CMake"}, + "COPYING": {"Text"}, + "COPYRIGHT.regex": {"Text"}, + "Cakefile": {"CoffeeScript"}, + "Cask": {"Emacs Lisp"}, + "Dangerfile": {"Ruby"}, + "Deliverfile": {"Ruby"}, + "Dockerfile": {"Dockerfile"}, + "Emakefile": {"Erlang"}, + "FONTLOG": {"Text"}, + "Fakefile": {"Fancy"}, + "Fastfile": {"Ruby"}, + "GNUmakefile": {"Makefile"}, + "Gemfile": {"Ruby"}, + "Gemfile.lock": {"Ruby"}, + "Guardfile": {"Ruby"}, + "INSTALL": {"Text"}, + "INSTALL.mysql": {"Text"}, + "Jakefile": {"JavaScript"}, + "Jarfile": {"Ruby"}, + "Jenkinsfile": {"Groovy"}, + "Kbuild": {"Makefile"}, + "LICENSE": {"Text"}, + "LICENSE.mysql": {"Text"}, + "Makefile": {"Makefile"}, + "Makefile.am": {"Makefile"}, + "Makefile.boot": {"Makefile"}, + "Makefile.frag": {"Makefile"}, + "Makefile.in": {"Makefile"}, + "Makefile.inc": {"Makefile"}, + "Makefile.wat": {"Makefile"}, + "Mavenfile": {"Ruby"}, + "Modulefile": {"Puppet"}, + "NEWS": {"Text"}, + "Notebook": {"Jupyter Notebook"}, + "NuGet.config": {"XML"}, + "Nukefile": {"Nu"}, + "PKGBUILD": {"Shell"}, + "Phakefile": {"PHP"}, + "Podfile": {"Ruby"}, + "Project.ede": {"Emacs Lisp"}, + "Puppetfile": {"Ruby"}, + "README.1ST": {"Text"}, + "README.me": {"Text"}, + "README.mysql": {"Text"}, + "ROOT": {"Isabelle ROOT"}, + "Rakefile": {"Ruby"}, + "Rexfile": {"Perl6"}, + "SConscript": {"Python"}, + "SConstruct": {"Python"}, + "Settings.StyleCop": {"XML"}, + "Slakefile": {"LiveScript"}, + "Snakefile": {"Python"}, + "Snapfile": {"Ruby"}, + "Thorfile": {"Ruby"}, + "Vagrantfile": {"Ruby"}, + "WORKSPACE": {"Python"}, + "Web.Debug.config": {"XML"}, + "Web.Release.config": {"XML"}, + "Web.config": {"XML"}, + "XCompose": {"XCompose"}, + "_emacs": {"Emacs Lisp"}, + "_vimrc": {"Vim script"}, + "abbrev_defs": {"Emacs Lisp"}, + "ant.xml": {"Ant Build System"}, + "build.xml": {"Ant Build System"}, + "buildfile": {"Ruby"}, + "click.me": {"Text"}, + "composer.lock": {"JSON"}, + "configure.ac": {"M4Sugar"}, + "delete.me": {"Text"}, + "descrip.mmk": {"Module Management System"}, + "descrip.mms": {"Module Management System"}, + "gradlew": {"Shell"}, + "gvimrc": {"Vim script"}, + "keep.me": {"Text"}, + "ld.script": {"Linker Script"}, + "makefile": {"Makefile"}, + "makefile.sco": {"Makefile"}, + "mcmod.info": {"JSON"}, + "meson.build": {"Meson"}, + "meson_options.txt": {"Meson"}, + "mix.lock": {"Elixir"}, + "mkfile": {"Makefile"}, + "mmn": {"Roff"}, + "mmt": {"Roff"}, + "nginx.conf": {"Nginx"}, + "nvimrc": {"Vim script"}, + "packages.config": {"XML"}, + "pom.xml": {"Maven POM"}, + "read.me": {"Text"}, + "rebar.config": {"Erlang"}, + "rebar.config.lock": {"Erlang"}, + "rebar.lock": {"Erlang"}, + "riemann.config": {"Clojure"}, + "test.me": {"Text"}, + "vimrc": {"Vim script"}, + "wscript": {"Python"}, + "xcompose": {"XCompose"}, } diff --git a/frequencies.go b/frequencies.go index 0349379..21f8997 100644 --- a/frequencies.go +++ b/frequencies.go @@ -2,386 +2,387 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 var DefaultClassifier Classifier = &classifier{ languagesLogProbabilities: map[string]float64{ - "1C Enterprise": -5.717028, - "ABAP": -7.508787, - "ABNF": -7.508787, - "AGS Script": -6.122493, - "AMPL": -6.815640, - "API Blueprint": -6.410175, - "APL": -6.410175, - "ASN.1": -7.508787, - "ATS": -5.311563, - "Agda": -7.508787, - "Alloy": -6.410175, - "Alpine Abuild": -7.508787, - "Ant Build System": -7.508787, - "ApacheConf": -6.122493, - "Apex": -5.717028, - "Apollo Guidance Computer": -7.508787, - "AppleScript": -5.562877, - "Arduino": -6.815640, - "AsciiDoc": -6.410175, - "AspectJ": -6.815640, - "Assembly": -5.717028, - "AutoHotkey": -7.508787, - "Awk": -7.508787, - "BitBake": -6.815640, - "Blade": -6.815640, - "BlitzBasic": -6.410175, - "BlitzMax": -7.508787, - "Bluespec": -6.815640, - "Brainfuck": -5.899349, - "Brightscript": -7.508787, - "C": -3.501454, - "C#": -5.717028, - "C++": -3.702125, - "CLIPS": -6.815640, - "CMake": -5.562877, - "COBOL": -6.122493, - "CSON": -6.122493, - "CSS": -6.815640, - "CSV": -7.508787, - "CWeb": -7.508787, - "CartoCSS": -7.508787, - "Ceylon": -7.508787, - "Chapel": -5.899349, - "Charity": -7.508787, - "Cirru": -5.311563, - "Clarion": -6.122493, - "Clean": -5.311563, - "Click": -6.815640, - "Clojure": -5.311563, - "Closure Templates": -7.508787, - "CoffeeScript": -5.206202, - "ColdFusion": -7.508787, - "ColdFusion CFC": -6.815640, - "Common Lisp": -5.311563, - "Component Pascal": -6.815640, - "Cool": -6.815640, - "Coq": -4.943838, - "Creole": -7.508787, - "Crystal": -6.410175, - "Csound": -6.410175, - "Csound Document": -6.410175, - "Csound Score": -6.410175, - "Cuda": -6.815640, - "Cycript": -7.508787, - "D": -5.311563, - "DIGITAL Command Language": -6.122493, - "DM": -7.508787, - "DNS Zone": -6.815640, - "DTrace": -6.410175, - "Dart": -7.508787, - "Diff": -7.508787, - "Dockerfile": -7.508787, - "Dogescript": -7.508787, - "E": -5.562877, - "EBNF": -6.122493, - "ECL": -7.508787, - "ECLiPSe": -7.508787, - "EJS": -6.815640, - "EQ": -6.410175, - "Eagle": -6.815640, - "Eiffel": -6.410175, - "Elixir": -7.508787, - "Elm": -6.410175, - "Emacs Lisp": -5.110892, - "EmberScript": -7.508787, - "Erlang": -4.869730, - "F#": -5.429346, - "FLUX": -6.122493, - "Filebench WML": -7.508787, - "Filterscript": -6.815640, - "Formatted": -6.410175, - "Forth": -4.736198, - "Fortran": -5.899349, - "FreeMarker": -6.815640, - "Frege": -6.122493, - "G-code": -6.815640, - "GAMS": -7.508787, - "GAP": -5.311563, - "GCC Machine Description": -7.508787, - "GDB": -6.815640, - "GDScript": -6.122493, - "GLSL": -4.869730, - "GN": -5.110892, - "Game Maker Language": -5.110892, - "Genie": -6.815640, - "Gnuplot": -5.717028, - "Go": -6.410175, - "Golo": -4.212950, - "Gosu": -5.899349, - "Grace": -6.815640, - "Gradle": -6.815640, - "Grammatical Framework": -3.795215, - "Graph Modeling Language": -7.508787, - "GraphQL": -6.815640, - "Graphviz (DOT)": -6.815640, - "Groovy": -5.717028, - "Groovy Server Pages": -6.122493, - "HCL": -6.410175, - "HLSL": -5.899349, - "HTML": -5.717028, - "HTML+Django": -7.508787, - "HTML+ECR": -7.508787, - "HTML+EEX": -7.508787, - "HTML+ERB": -6.815640, - "Hack": -4.176583, - "Haml": -6.815640, - "Handlebars": -6.815640, - "Haskell": -5.899349, - "Hy": -6.815640, - "HyPhy": -5.429346, - "IDL": -6.122493, - "IGOR Pro": -6.815640, - "INI": -6.410175, - "Idris": -7.508787, - "Inform 7": -6.815640, - "Inno Setup": -7.508787, - "Ioke": -7.508787, - "Isabelle": -7.508787, - "Isabelle ROOT": -7.508787, - "J": -6.815640, - "JFlex": -6.815640, - "JSON": -5.311563, - "JSON5": -6.410175, - "JSONLD": -7.508787, - "JSONiq": -6.815640, - "JSX": -7.508787, - "Jasmin": -5.429346, - "Java": -5.311563, - "JavaScript": -3.982427, - "Jison": -6.410175, - "Jison Lex": -6.815640, - "Jolie": -5.899349, - "Julia": -6.815640, - "Jupyter Notebook": -7.508787, - "KRL": -7.508787, - "KiCad": -6.122493, - "Kit": -7.508787, - "Kotlin": -7.508787, - "LFE": -6.122493, - "LOLCODE": -7.508787, - "LSL": -6.815640, - "Lasso": -6.122493, - "Latte": -6.815640, - "Lean": -6.815640, - "Less": -7.508787, - "Lex": -7.508787, - "Limbo": -6.410175, - "Linker Script": -6.410175, - "Linux Kernel Module": -6.410175, - "Liquid": -6.815640, - "Literate Agda": -7.508787, - "Literate CoffeeScript": -7.508787, - "LiveScript": -7.508787, - "Logos": -7.508787, - "Logtalk": -7.508787, - "LookML": -6.410175, - "LoomScript": -6.815640, - "Lua": -6.122493, - "M": -4.141491, - "M4": -7.508787, - "M4Sugar": -6.410175, - "MAXScript": -6.122493, - "MQL4": -6.410175, - "MQL5": -6.410175, - "MTML": -7.508787, - "MUF": -6.815640, - "Makefile": -5.110892, - "Markdown": -6.122493, - "Marko": -6.410175, - "Mask": -7.508787, - "Mathematica": -5.023881, - "Matlab": -3.845226, - "Maven POM": -7.508787, - "Max": -6.410175, - "MediaWiki": -6.815640, - "Mercury": -5.206202, - "Meson": -6.815640, - "Metal": -7.508787, - "Modelica": -5.023881, - "Modula-2": -7.508787, - "Module Management System": -5.899349, - "Monkey": -7.508787, - "Moocode": -6.410175, - "MoonScript": -7.508787, - "NCL": -4.736198, - "NL": -6.815640, - "NSIS": -6.815640, - "Nemerle": -7.508787, - "NetLinx": -6.815640, - "NetLinx+ERB": -6.815640, - "NetLogo": -7.508787, - "NewLisp": -6.410175, - "Nginx": -6.815640, - "Nim": -7.508787, - "Nit": -4.330733, - "Nix": -7.508787, - "Nu": -6.815640, - "OCaml": -5.206202, - "Objective-C": -4.417745, - "Objective-C++": -6.815640, - "Objective-J": -6.410175, - "Omgrofl": -7.508787, - "Opa": -6.815640, - "Opal": -7.508787, - "OpenCL": -6.815640, - "OpenEdge ABL": -5.899349, - "OpenRC runscript": -7.508787, - "OpenSCAD": -6.815640, - "Org": -7.508787, - "Ox": -6.410175, - "Oxygene": -7.508787, - "Oz": -7.508787, - "P4": -6.815640, - "PAWN": -6.815640, - "PHP": -4.618415, - "PLSQL": -5.429346, - "PLpgSQL": -5.717028, - "POV-Ray SDL": -5.023881, - "Pan": -7.508787, - "Papyrus": -6.410175, - "Parrot Assembly": -7.508787, - "Parrot Internal Representation": -7.508787, - "Pascal": -5.206202, - "Pep8": -5.562877, - "Perl": -4.513055, - "Perl6": -4.417745, - "Pic": -6.410175, - "Pickle": -6.122493, - "PicoLisp": -7.508787, - "PigLatin": -7.508787, - "Pike": -6.410175, - "Pod": -6.815640, - "PogoScript": -7.508787, - "Pony": -5.717028, - "PostScript": -7.508787, - "PowerBuilder": -5.717028, - "PowerShell": -6.410175, - "Processing": -7.508787, - "Prolog": -5.311563, - "Propeller Spin": -5.206202, - "Protocol Buffer": -7.508787, - "Public Key": -5.562877, - "Pug": -6.815640, - "Puppet": -5.899349, - "PureBasic": -6.815640, - "PureScript": -6.122493, - "Python": -4.330733, - "QML": -7.508787, - "QMake": -6.122493, - "R": -5.429346, - "RAML": -7.508787, - "RDoc": -7.508787, - "REXX": -6.122493, - "RMarkdown": -7.508787, - "RPM Spec": -6.410175, - "RUNOFF": -6.122493, - "Racket": -6.815640, - "Ragel": -6.410175, - "Rascal": -6.122493, - "Reason": -5.899349, - "Rebol": -5.717028, - "Red": -6.815640, - "Regular Expression": -6.122493, - "Ren'Py": -7.508787, - "RenderScript": -6.815640, - "RobotFramework": -6.410175, - "Roff": -5.562877, - "Ruby": -4.043051, - "Rust": -6.410175, - "SAS": -6.410175, - "SCSS": -7.508787, - "SMT": -6.122493, - "SPARQL": -6.815640, - "SQF": -6.815640, - "SQL": -5.023881, - "SQLPL": -5.717028, - "SRecode Template": -7.508787, - "STON": -5.562877, - "Sage": -7.508787, - "SaltStack": -5.717028, - "Sass": -7.508787, - "Scala": -6.122493, - "Scaml": -7.508787, - "Scheme": -6.410175, - "Scilab": -6.410175, - "ShaderLab": -6.410175, - "Shell": -3.747587, - "ShellSession": -6.410175, - "Shen": -6.410175, - "Slash": -7.508787, - "Slim": -7.508787, - "Smali": -5.562877, - "Smalltalk": -5.206202, - "SourcePawn": -5.717028, - "Squirrel": -7.508787, - "Stan": -6.410175, - "Standard ML": -5.899349, - "Stata": -5.562877, - "Stylus": -7.508787, - "SubRip Text": -7.508787, - "Sublime Text Config": -5.023881, - "SuperCollider": -5.899349, - "Swift": -3.747587, - "SystemVerilog": -6.122493, - "TI Program": -6.122493, - "TLA": -6.815640, - "TXL": -7.508787, - "Tcl": -6.122493, - "TeX": -5.562877, - "Tea": -7.508787, - "Terra": -6.410175, - "Text": -4.250691, - "Thrift": -7.508787, - "Turing": -6.815640, - "Turtle": -6.815640, - "Type Language": -6.815640, - "TypeScript": -5.717028, - "Unity3D Asset": -5.899349, - "Unix Assembly": -6.815640, - "Uno": -6.410175, - "UnrealScript": -6.815640, - "UrWeb": -6.815640, - "VCL": -6.815640, - "VHDL": -7.508787, - "Verilog": -4.943838, - "Vim script": -5.899349, - "Visual Basic": -6.410175, - "Volt": -7.508787, - "Vue": -6.815640, - "Wavefront Material": -6.122493, - "Wavefront Object": -5.899349, - "Web Ontology Language": -7.508787, - "WebIDL": -6.815640, - "World of Warcraft Addon Data": -6.410175, - "X10": -4.618415, - "XC": -7.508787, - "XCompose": -7.508787, - "XML": -3.637586, - "XPages": -6.815640, - "XProc": -7.508787, - "XQuery": -7.508787, - "XS": -7.508787, - "XSLT": -7.508787, - "Xojo": -5.717028, - "Xtend": -6.815640, - "YAML": -5.562877, - "YANG": -7.508787, - "Zephir": -6.815640, - "Zimpl": -7.508787, - "desktop": -7.508787, - "eC": -7.508787, - "edn": -7.508787, - "fish": -6.410175, - "reStructuredText": -7.508787, - "wisp": -7.508787, - "xBase": -6.410175, + "1C Enterprise": -5.720858, + "ABAP": -7.512618, + "ABNF": -7.512618, + "AGS Script": -6.126323, + "AMPL": -6.819470, + "API Blueprint": -6.414005, + "APL": -6.414005, + "ASN.1": -7.512618, + "ATS": -5.315393, + "Agda": -7.512618, + "Alloy": -6.414005, + "Alpine Abuild": -7.512618, + "Ant Build System": -7.512618, + "ApacheConf": -6.126323, + "Apex": -5.720858, + "Apollo Guidance Computer": -7.512618, + "AppleScript": -5.566707, + "Arduino": -6.819470, + "AsciiDoc": -6.414005, + "AspectJ": -6.819470, + "Assembly": -5.720858, + "AutoHotkey": -7.512618, + "Awk": -7.512618, + "BitBake": -6.819470, + "Blade": -6.819470, + "BlitzBasic": -6.414005, + "BlitzMax": -7.512618, + "Bluespec": -6.819470, + "Brainfuck": -5.903180, + "Brightscript": -7.512618, + "C": -3.505284, + "C#": -5.720858, + "C++": -3.705955, + "CLIPS": -6.819470, + "CMake": -5.566707, + "COBOL": -6.126323, + "CSON": -6.126323, + "CSS": -6.819470, + "CSV": -7.512618, + "CWeb": -7.512618, + "CartoCSS": -7.512618, + "Ceylon": -7.512618, + "Chapel": -5.903180, + "Charity": -7.512618, + "Cirru": -5.315393, + "Clarion": -6.126323, + "Clean": -5.315393, + "Click": -6.819470, + "Clojure": -5.315393, + "Closure Templates": -7.512618, + "CoffeeScript": -5.210032, + "ColdFusion": -7.512618, + "ColdFusion CFC": -6.819470, + "Common Lisp": -5.315393, + "Component Pascal": -6.819470, + "Cool": -6.819470, + "Coq": -4.947668, + "Creole": -7.512618, + "Crystal": -6.414005, + "Csound": -6.414005, + "Csound Document": -6.414005, + "Csound Score": -6.414005, + "Cuda": -6.819470, + "Cycript": -7.512618, + "D": -5.315393, + "DIGITAL Command Language": -6.126323, + "DM": -7.512618, + "DNS Zone": -6.819470, + "DTrace": -6.414005, + "Dart": -7.512618, + "Diff": -7.512618, + "Dockerfile": -7.512618, + "Dogescript": -7.512618, + "E": -5.566707, + "EBNF": -6.126323, + "ECL": -7.512618, + "ECLiPSe": -7.512618, + "EJS": -6.819470, + "EQ": -6.414005, + "Eagle": -6.819470, + "Eiffel": -6.414005, + "Elixir": -7.512618, + "Elm": -6.414005, + "Emacs Lisp": -5.114722, + "EmberScript": -7.512618, + "Erlang": -4.873560, + "F#": -5.433176, + "FLUX": -6.126323, + "Filebench WML": -7.512618, + "Filterscript": -6.819470, + "Formatted": -6.414005, + "Forth": -4.740029, + "Fortran": -5.903180, + "FreeMarker": -6.819470, + "Frege": -6.126323, + "G-code": -6.819470, + "GAMS": -7.512618, + "GAP": -5.315393, + "GCC Machine Description": -7.512618, + "GDB": -6.819470, + "GDScript": -6.126323, + "GLSL": -4.873560, + "GN": -5.114722, + "Game Maker Language": -5.114722, + "Genie": -6.819470, + "Gnuplot": -5.720858, + "Go": -6.414005, + "Golo": -4.216781, + "Gosu": -5.903180, + "Grace": -6.819470, + "Gradle": -6.819470, + "Grammatical Framework": -3.799045, + "Graph Modeling Language": -7.512618, + "GraphQL": -6.819470, + "Graphviz (DOT)": -6.819470, + "Groovy": -5.720858, + "Groovy Server Pages": -6.126323, + "HCL": -6.414005, + "HLSL": -5.903180, + "HTML": -5.720858, + "HTML+Django": -7.512618, + "HTML+ECR": -7.512618, + "HTML+EEX": -7.512618, + "HTML+ERB": -6.819470, + "Hack": -4.180413, + "Haml": -6.819470, + "Handlebars": -6.819470, + "Haskell": -5.903180, + "Hy": -6.819470, + "HyPhy": -5.433176, + "IDL": -6.126323, + "IGOR Pro": -6.819470, + "INI": -6.414005, + "Idris": -7.512618, + "Inform 7": -6.819470, + "Inno Setup": -7.512618, + "Ioke": -7.512618, + "Isabelle": -7.512618, + "Isabelle ROOT": -7.512618, + "J": -6.819470, + "JFlex": -6.819470, + "JSON": -5.315393, + "JSON5": -6.414005, + "JSONLD": -7.512618, + "JSONiq": -6.819470, + "JSX": -7.512618, + "Jasmin": -5.433176, + "Java": -5.315393, + "JavaScript": -3.986257, + "Jison": -6.414005, + "Jison Lex": -6.819470, + "Jolie": -5.903180, + "Julia": -6.819470, + "Jupyter Notebook": -7.512618, + "KRL": -7.512618, + "KiCad": -6.126323, + "Kit": -7.512618, + "Kotlin": -7.512618, + "LFE": -6.126323, + "LOLCODE": -7.512618, + "LSL": -6.819470, + "Lasso": -6.126323, + "Latte": -6.819470, + "Lean": -6.819470, + "Less": -7.512618, + "Lex": -7.512618, + "Limbo": -6.414005, + "Linker Script": -6.414005, + "Linux Kernel Module": -6.414005, + "Liquid": -6.819470, + "Literate Agda": -7.512618, + "Literate CoffeeScript": -7.512618, + "LiveScript": -7.512618, + "Logos": -7.512618, + "Logtalk": -7.512618, + "LookML": -6.414005, + "LoomScript": -6.819470, + "Lua": -6.126323, + "M": -4.145322, + "M4": -7.512618, + "M4Sugar": -6.414005, + "MAXScript": -6.126323, + "MQL4": -6.414005, + "MQL5": -6.414005, + "MTML": -7.512618, + "MUF": -6.819470, + "Makefile": -5.027711, + "Markdown": -6.126323, + "Marko": -6.414005, + "Mask": -7.512618, + "Mathematica": -5.027711, + "Matlab": -3.849056, + "Maven POM": -7.512618, + "Max": -6.414005, + "MediaWiki": -6.819470, + "Mercury": -5.210032, + "Meson": -6.819470, + "Metal": -7.512618, + "Modelica": -5.027711, + "Modula-2": -7.512618, + "Module Management System": -5.903180, + "Monkey": -7.512618, + "Moocode": -6.414005, + "MoonScript": -7.512618, + "NCL": -4.740029, + "NL": -6.819470, + "NSIS": -6.819470, + "Nemerle": -7.512618, + "NetLinx": -6.819470, + "NetLinx+ERB": -6.819470, + "NetLogo": -7.512618, + "NewLisp": -6.414005, + "Nginx": -6.819470, + "Nim": -7.512618, + "Nit": -4.334564, + "Nix": -7.512618, + "Nu": -6.819470, + "OCaml": -5.210032, + "Objective-C": -4.421575, + "Objective-C++": -6.819470, + "Objective-J": -6.414005, + "Omgrofl": -7.512618, + "Opa": -6.819470, + "Opal": -7.512618, + "OpenCL": -6.819470, + "OpenEdge ABL": -5.903180, + "OpenRC runscript": -7.512618, + "OpenSCAD": -6.819470, + "Org": -7.512618, + "Ox": -6.414005, + "Oxygene": -7.512618, + "Oz": -7.512618, + "P4": -6.819470, + "PAWN": -6.819470, + "PHP": -4.622246, + "PLSQL": -5.433176, + "PLpgSQL": -5.720858, + "POV-Ray SDL": -5.027711, + "Pan": -7.512618, + "Papyrus": -6.414005, + "Parrot Assembly": -7.512618, + "Parrot Internal Representation": -7.512618, + "Pascal": -5.210032, + "Pep8": -5.566707, + "Perl": -4.516885, + "Perl6": -4.421575, + "Pic": -6.414005, + "Pickle": -6.126323, + "PicoLisp": -7.512618, + "PigLatin": -7.512618, + "Pike": -6.414005, + "Pod": -6.819470, + "PogoScript": -7.512618, + "Pony": -5.720858, + "PostScript": -7.512618, + "PowerBuilder": -5.720858, + "PowerShell": -6.414005, + "Processing": -7.512618, + "Prolog": -5.315393, + "Propeller Spin": -5.210032, + "Protocol Buffer": -7.512618, + "Public Key": -5.566707, + "Pug": -6.819470, + "Puppet": -5.903180, + "PureBasic": -6.819470, + "PureScript": -6.126323, + "Python": -4.334564, + "QML": -7.512618, + "QMake": -6.126323, + "R": -5.433176, + "RAML": -7.512618, + "RDoc": -7.512618, + "REXX": -6.126323, + "RMarkdown": -7.512618, + "RPM Spec": -6.414005, + "RUNOFF": -6.126323, + "Racket": -6.819470, + "Ragel": -6.414005, + "Rascal": -6.126323, + "Reason": -5.903180, + "Rebol": -5.720858, + "Red": -6.819470, + "Regular Expression": -6.126323, + "Ren'Py": -7.512618, + "RenderScript": -6.819470, + "RobotFramework": -6.414005, + "Roff": -5.566707, + "Ruby": -4.046882, + "Rust": -6.414005, + "SAS": -6.414005, + "SCSS": -7.512618, + "SMT": -6.126323, + "SPARQL": -6.819470, + "SQF": -6.819470, + "SQL": -5.027711, + "SQLPL": -5.720858, + "SRecode Template": -7.512618, + "STON": -5.566707, + "Sage": -7.512618, + "SaltStack": -5.720858, + "Sass": -7.512618, + "Scala": -6.126323, + "Scaml": -7.512618, + "Scheme": -6.414005, + "Scilab": -6.414005, + "ShaderLab": -6.414005, + "Shell": -3.751417, + "ShellSession": -6.414005, + "Shen": -6.414005, + "Slash": -7.512618, + "Slim": -7.512618, + "Smali": -5.566707, + "Smalltalk": -5.210032, + "SourcePawn": -5.720858, + "Squirrel": -7.512618, + "Stan": -6.414005, + "Standard ML": -5.903180, + "Stata": -5.566707, + "Stylus": -7.512618, + "SubRip Text": -7.512618, + "Sublime Text Config": -5.027711, + "SuperCollider": -5.903180, + "Swift": -3.751417, + "SystemVerilog": -6.126323, + "TI Program": -6.126323, + "TLA": -6.819470, + "TXL": -7.512618, + "Tcl": -6.126323, + "TeX": -5.566707, + "Tea": -7.512618, + "Terra": -6.414005, + "Text": -4.254521, + "Thrift": -7.512618, + "Turing": -6.819470, + "Turtle": -6.819470, + "Type Language": -6.819470, + "TypeScript": -5.720858, + "Unity3D Asset": -5.903180, + "Unix Assembly": -6.819470, + "Uno": -6.414005, + "UnrealScript": -6.819470, + "UrWeb": -6.819470, + "VCL": -6.819470, + "VHDL": -7.512618, + "Verilog": -4.947668, + "Vim script": -5.903180, + "Visual Basic": -6.414005, + "Volt": -7.512618, + "Vue": -6.819470, + "Wavefront Material": -6.126323, + "Wavefront Object": -5.903180, + "Web Ontology Language": -7.512618, + "WebAssembly": -5.720858, + "WebIDL": -6.819470, + "World of Warcraft Addon Data": -6.414005, + "X10": -4.622246, + "XC": -7.512618, + "XCompose": -7.512618, + "XML": -3.641417, + "XPages": -6.819470, + "XProc": -7.512618, + "XQuery": -7.512618, + "XS": -7.512618, + "XSLT": -7.512618, + "Xojo": -5.720858, + "Xtend": -6.819470, + "YAML": -5.566707, + "YANG": -7.512618, + "Zephir": -6.819470, + "Zimpl": -7.512618, + "desktop": -7.512618, + "eC": -7.512618, + "edn": -7.512618, + "fish": -6.414005, + "reStructuredText": -7.512618, + "wisp": -7.512618, + "xBase": -6.414005, }, tokensLogProbabilities: map[string]map[string]float64{ "1C Enterprise": map[string]float64{ @@ -53194,495 +53195,596 @@ var DefaultClassifier Classifier = &classifier{ "}": -7.099202, }, "Makefile": map[string]float64{ - "!": -5.731902, - "$": -2.238767, - "&": -7.235979, - "&&": -5.983216, - "(": -2.645923, - ")": -2.651012, - "*": -7.929126, - "*.": -7.929126, - "*.o": -7.929126, - "*.woff": -7.929126, - "*o": -7.929126, - "+": -3.977883, - ",": -4.984688, - "-": -2.698018, - ".": -7.235979, - "../zlib": -7.235979, - "./pngtestd": -7.929126, - "./pngtesti": -7.929126, - ".BEGIN": -7.929126, - ".CURDIR": -5.626541, - ".DEFAULT": -7.235979, - ".FLAGS": -7.929126, - ".MAKEFLAGS": -7.929126, - ".OBJDIR": -7.235979, - ".PATH": -7.929126, - ".PHONY": -7.929126, - ".TARGETS": -7.929126, - ".WAIT": -7.929126, - ".a": -7.929126, - ".else": -7.929126, - ".endif": -6.542832, - ".h": -4.078979, - ".if": -6.542832, - ".include": -5.983216, - ".map": -7.235979, - ".so": -7.929126, - ".so.": -7.929126, - ".sym": -6.830514, - ".tmp": -7.929126, - ".ttf": -7.929126, - ".woff": -7.235979, - "/": -3.903775, - "/*.php": -6.542832, - "/*.svg": -7.929126, - "/..": -6.830514, - "/../../../": -7.929126, - "/../../../../..": -7.929126, - "/../../lib": -7.235979, - "/../Makefile.boot": -7.235979, - "/../version": -7.929126, - "/arch": -7.929126, - "/arch/": -7.929126, - "/bin": -7.929126, - "/bin/rm": -7.929126, - "/conf/newvers_stand.sh": -7.929126, - "/conf/stand.ldscript": -7.929126, - "/dev/null": -6.830514, - "/fonts/file": -7.929126, - "/include": -7.235979, - "/lib": -6.830514, - "/lib/libsa": -7.235979, - "/man": -7.929126, - "/n/": -7.929126, - "/stand": -7.929126, - "/usr/local": -7.929126, - "/usr/mdec": -7.929126, - ":": -3.770243, - ";": -4.373778, - "<": -6.319689, - "": -7.929126, - "<\\/g>": -7.235979, - "<\\?xml.*?\\?>": -7.929126, - "": -7.929126, - "": -7.929126, - "": -7.929126, - "": -7.929126, - "": -7.929126, - "": -7.929126, - "=": -2.938694, - ">": -3.314006, - "?": -5.095913, - "@": -6.137367, - "@./create": -7.929126, - "@echo": -4.167926, - "@for": -6.542832, - "@gmake": -7.929126, - "@ln": -7.929126, - "@mv": -7.235979, - "@perl": -7.235979, - "@rm": -7.235979, - "@unzip": -7.929126, - "@which": -7.929126, - "ACTIVE_CC": -7.929126, - "AFLAGS": -7.929126, - "AFLAGS.biosboot.S": -7.929126, - "ANNOUNCE": -7.929126, - "AR_RC": -7.929126, - "ATOM_FILE_ICONS": -7.235979, - "Alhadis/FileIcons": -7.929126, - "BINDIR": -7.929126, - "BINMODE": -7.929126, - "BINPATH": -6.319689, - "C/": -7.929126, - "CC": -6.542832, - "CFLAGS": -6.137367, - "CHANGES": -7.929126, - "CLEANFILES": -7.929126, - "CONFIG_KVM": -7.929126, - "COPTS": -7.235979, - "CP": -7.929126, - "CPPFLAGS": -4.838084, - "CPUFLAGS": -7.235979, - "DCONSADDR": -7.929126, - "DCONSOLE_KEYMAP": -7.929126, - "DCONSPEED": -7.929126, - "DDIRECT_SERIAL": -7.929126, - "DEFS": -7.235979, - "DEPIA_HACK": -7.929126, - "DHEAP_LIMIT": -7.929126, - "DHEAP_START": -7.929126, - "DI": -7.929126, - "DIR": -7.929126, - "DL": -7.235979, - "DLIBSA_ENABLE_LS_OP": -7.929126, - "DLIBSA_PRINTF_LONGLONG_SUPPORT": -7.929126, - "DOCS": -7.235979, - "DPASS_BIOSGEOM": -7.929126, - "DPASS_MEMMAP": -7.929126, - "DST": -7.929126, - "DSTANDALONE": -7.929126, - "DSUPPORT_CD": -7.929126, - "DSUPPORT_DOSFS": -7.929126, - "DSUPPORT_EXT": -7.929126, - "DSUPPORT_PS": -7.929126, - "DSUPPORT_SERIAL": -7.929126, - "DSUPPORT_USTARFS": -7.929126, - "D_STANDALONE": -7.929126, - "Did": -7.929126, - "ENTRY": -7.235979, - "ERROR_NO_PKG": -7.929126, - "EXTRACFLAGS": -7.235979, - "FLAGS": -7.929126, - "GREETINGS": -6.830514, - "HOST_SH": -7.929126, - "I": -5.095913, - "I.": -7.929126, - "IB": -7.929126, - "IFS": -7.929126, - "INCLUDES": -6.830514, - "INCPATH": -7.929126, - "INSTALL": -7.929126, - "J": -7.929126, - "KERNLIB": -7.929126, - "KERNMISCMAKEFLAGS": -7.929126, - "KERN_AS": -7.235979, - "KINFO": -7.929126, - "KLINK_MACHINE": -7.929126, - "KNOWNBUG": -7.929126, - "L": -6.542832, - "L.": -7.929126, - "LDFLAGS": -6.319689, - "LDSCRIPT": -7.235979, - "LIBC": -7.929126, - "LIBCRT": -7.929126, - "LIBCRTBEGIN": -7.929126, - "LIBCRTEND": -7.929126, - "LIBCRTI": -7.929126, - "LIBI": -6.830514, - "LIBKERN": -7.235979, - "LIBKERN_ARCH": -7.929126, - "LIBLIST": -6.542832, - "LIBNAME": -5.983216, - "LIBPATH": -7.929126, - "LIBSA": -6.830514, - "LIBSO": -7.235979, - "LIBSOMAJ": -6.830514, - "LIBSOREL": -7.929126, - "LIBZ": -7.235979, - "LICENSE": -7.929126, - "LN_SF": -7.929126, - "MACHINE": -7.929126, - "MACHINE_ARCH": -7.929126, - "MANPATH": -7.929126, - "MKDIR_P": -7.929126, - "Map": -7.929126, - "N": -7.235979, - "NAME": -7.929126, - "NEWVERSWHAT": -7.235979, - "NOMACHINE": -7.929126, - "NOMAN": -7.929126, - "O": -7.235979, - "OBJCOPY": -7.929126, - "OBJS": -7.235979, - "OLDSO": -7.929126, - "Os": -7.929126, - "PHP_DIR": -3.977883, - "PHP_LIB": -4.057925, - "PIE_AFLAGS": -7.929126, - "PIE_CFLAGS": -7.929126, - "PIE_LDFLAGS": -7.929126, - "PNGMAJ": -7.235979, - "PROG": -5.731902, - "R": -7.929126, - "RANLIB": -7.929126, - "README": -7.929126, - "REAL_VIRT": -7.929126, - "RELEASE": -7.929126, - "RELOC": -7.929126, - "RM_F": -7.235979, - "S": -5.626541, - "S/arch/i": -7.235979, - "SALIB": -7.929126, - "SAMISCCPPFLAGS": -7.235979, - "SAMISCMAKEFLAGS": -6.542832, - "SA_AS": -7.929126, - "SA_INCLUDE_NET": -7.929126, - "SA_USE_CREAD": -7.929126, - "SHEBANG#!make": -7.929126, - "SOURCES": -6.830514, - "SRCS": -7.235979, - "STRIPFLAG": -7.929126, - "T": -7.929126, - "TODO": -7.929126, - "Testing": -7.929126, - "Ttext": -7.235979, - "V": -7.929126, - "VERSIONFILE": -6.830514, - "Wall": -7.929126, - "Werror": -7.929126, - "Wl": -6.137367, - "Wmissing": -7.929126, - "Wno": -7.929126, - "Wstrict": -7.929126, - "X": -7.929126, - "Y": -7.929126, - "ZLIB": -7.929126, - "ZLIBINC": -7.235979, - "ZLIBLIB": -6.542832, - "Z_AS": -7.929126, - "[": -6.319689, - "\\": -3.977883, - "]": -6.319689, - "^": -6.319689, - "_MKTARGET_LINK": -7.929126, - "_STAND_DIR": -7.235979, - "__stand_makefile_inc": -7.235979, - "_compress": -7.235979, - "_start": -7.929126, - "`": -5.156538, - "a": -7.929126, - "all": -6.319689, - "all_targets": -7.929126, - "ar": -7.235979, - "arch/mips/Kbuild.platforms": -7.929126, - "as": -7.929126, - "bar/baz.h": -7.235979, - "bar/foo.c": -7.929126, - "bar/foo.o": -7.929126, - "bb": -7.235979, - "belf": -7.929126, - "binary": -7.929126, - "biosboot.S": -7.929126, - "bonjour": -7.929126, - "boot": -7.235979, - "boot_params.bp_consaddr": -7.929126, - "boot_params.bp_consdev": -7.929126, - "boot_params.bp_conspeed": -7.929126, - "boot_params.bp_keymap": -7.929126, - "boot_start": -7.929126, - "c": -6.542832, - "cachebust": -7.929126, - "call": -7.235979, - "cc": -7.929126, - "ccflags": -7.929126, - "ch": -7.929126, - "charmap": -6.319689, - "charmap.md": -7.929126, - "chmod": -7.929126, - "clean": -7.235979, - "cleandir": -7.235979, - "cleanlibdir": -7.235979, - "commit": -7.929126, - "conf.c": -7.929126, - "config": -5.626541, - "cp": -7.929126, - "cref": -7.929126, - "dd": -7.929126, - "defined": -7.235979, - "depend": -7.929126, - "devopen.c": -7.929126, - "dist": -7.929126, - "distclean": -7.929126, - "do": -6.542832, - "dobredan": -7.929126, - "done": -6.542832, - "dy": -7.929126, - "dynamic": -7.929126, - "e": -6.542832, - "echo": -4.838084, - "elf_i": -7.929126, - "endif": -7.929126, - "exec.c": -7.929126, - "exec_prefix": -6.830514, - "exit": -6.830514, - "f": -5.626541, - "f.o": -7.929126, - "factorial.cpp": -7.235979, - "factorial.o": -6.830514, - "ffreestanding": -7.929126, - "file": -7.235979, - "float": -7.929126, - "fno": -7.929126, - "folder": -5.626541, - "font": -5.156538, - "for": -7.929126, - "g": -6.542832, - "gday": -7.929126, - "generate": -7.235979, - "git": -7.929126, - "gmake": -7.929126, - "greet.": -7.235979, - "h": -7.929126, - "hash": -7.929126, - "hello": -6.319689, - "hello.cpp": -7.235979, - "hello.o": -6.830514, - "hoi": -7.929126, - "hola": -7.929126, - "i": -5.983216, - "icomoon.json": -7.929126, - "icon": -6.319689, - "icons": -7.235979, - "if": -7.929126, - "ifdef": -7.929126, - "in": -6.137367, - "include": -7.929126, - "index": -7.235979, - "installed": -7.235979, - "integrated": -7.929126, - "kaixo": -7.929126, - "kernel/": -7.929126, - "kernlibdir": -7.929126, - "konnichiwa": -7.929126, - "kvm/": -7.929126, - "l": -7.929126, - "last": -7.929126, - "lib": -7.235979, - "libdep": -7.929126, - "libpng": -7.235979, - "libpng.a": -7.929126, - "libpng.pc": -7.929126, - "libpng.so": -7.929126, - "library": -6.319689, - "link": -6.830514, - "lint": -7.929126, - "lm": -7.929126, - "ln": -7.235979, - "log": -7.929126, - "lpng": -7.929126, - "ls": -6.319689, - "lz": -7.929126, - "m": -6.830514, - "machine": -6.830514, - "main.cpp": -7.235979, - "main.o": -6.830514, - "make": -5.983216, - "map.pl": -7.929126, - "march": -7.929126, - "mean": -7.929126, - "mk": -7.235979, - "mkdir": -7.929126, - "mm/": -7.929126, - "mno": -6.830514, - "msoft": -7.929126, - "mtune": -7.929126, - "namaste": -7.929126, - "name": -4.984688, - "need": -6.542832, - "net/": -7.929126, - "nihao": -7.929126, - "no": -7.235979, - "nostdinc": -7.929126, - "nostdlib": -7.929126, - "o": -6.542832, - "obj": -5.983216, - "objcopy": -7.929126, - "objects": -5.983216, - "oifs": -7.929126, - "ola": -7.929126, - "php": -5.444220, - "pi": -7.235979, - "platform": -7.235979, - "png.h": -5.156538, - "png.o": -7.929126, - "png.pic.o": -7.929126, - "pngconf.h": -5.156538, - "pngdebug.h": -5.221076, - "pngerror.o": -7.929126, - "pngerror.pic.o": -7.929126, - "pngget.o": -7.929126, - "pngget.pic.o": -7.929126, - "pnginfo.h": -5.221076, - "pnglibconf.h": -5.095913, - "pngmem.o": -7.929126, - "pngmem.pic.o": -7.929126, - "pngout.png": -7.929126, - "pngpread.o": -7.929126, - "pngpread.pic.o": -7.929126, - "pngpriv.h": -5.221076, - "pngread.o": -7.929126, - "pngread.pic.o": -7.929126, - "pngrio.o": -7.929126, - "pngrio.pic.o": -7.929126, - "pngrtran.o": -7.929126, - "pngrtran.pic.o": -7.929126, - "pngrutil.o": -7.929126, - "pngrutil.pic.o": -7.929126, - "pngset.o": -7.929126, - "pngset.pic.o": -7.929126, - "pngstruct.h": -5.221076, - "pngtest": -7.235979, - "pngtest.o": -7.929126, - "pngtest.png": -7.235979, - "pngtestd": -7.929126, - "pngtesti": -7.235979, - "pngtrans.o": -7.929126, - "pngtrans.pic.o": -7.929126, - "pngwio.o": -7.929126, - "pngwio.pic.o": -7.929126, - "pngwrite.o": -7.929126, - "pngwrite.pic.o": -7.929126, - "pngwtran.o": -7.929126, - "pngwtran.pic.o": -7.929126, - "pngwutil.o": -7.929126, - "pngwutil.pic.o": -7.929126, - "pointer": -7.929126, - "prefix": -6.542832, - "printer": -7.929126, - "protector": -7.929126, - "prototypes": -7.235979, - "qd": -7.929126, - "r": -7.929126, - "rc": -7.929126, - "rcs": -7.929126, - "relink": -7.929126, - "repo": -7.235979, - "rest": -7.929126, - "rf": -6.319689, - "rm": -6.830514, - "s": -7.235979, - "sadep": -7.929126, - "salaam": -7.929126, - "salibdir": -7.929126, - "scripts/*": -7.929126, - "sed": -7.235979, - "shared": -7.929126, - "shell": -7.929126, - "sign": -7.929126, - "size": -7.929126, - "sse": -6.830514, - "stack": -7.929126, - "static": -7.929126, - "stem": -7.929126, - "subdir": -7.929126, - "subst": -7.929126, - "svg": -6.830514, - "symbol": -7.929126, - "tag": -7.929126, - "test": -6.830514, - "this": -7.929126, - "tmp": -6.830514, - "tmp/fonts": -7.929126, - "tmp/selection.json": -7.929126, - "unpack": -7.235979, - "v": -7.929126, - "var": -7.235979, - "vers.c": -6.830514, - "w": -7.929126, - "wildcard": -7.235979, - "woff": -7.235979, - "writelock": -7.929126, - "x": -7.929126, - "y": -5.983216, - "yes": -7.929126, - "you": -7.929126, - "{": -3.921793, - "|": -5.983216, - "||": -6.830514, - "}": -3.940142, + "!": -5.863631, + "$": -2.264798, + "&": -5.575949, + "&&": -6.114946, + "(": -2.631510, + ")": -2.635906, + "*": -7.367709, + "*.": -8.060856, + "*.c": -8.060856, + "*.err": -8.060856, + "*.o": -8.060856, + "*.obj": -8.060856, + "*.woff": -8.060856, + "*o": -8.060856, + "+": -4.090564, + ",": -5.116417, + "-": -2.767551, + ".": -5.421798, + "../zlib": -7.367709, + "./pngtestd": -8.060856, + "./pngtesti": -8.060856, + ".BEGIN": -8.060856, + ".CURDIR": -5.758271, + ".DEFAULT": -7.367709, + ".EXTENSIONS": -7.367709, + ".FLAGS": -8.060856, + ".MAKEFLAGS": -8.060856, + ".OBJDIR": -7.367709, + ".PATH": -8.060856, + ".PHONY": -8.060856, + ".TARGETS": -8.060856, + ".WAIT": -8.060856, + ".a": -8.060856, + ".c": -7.367709, + ".c.obj": -8.060856, + ".else": -8.060856, + ".endif": -6.674561, + ".h": -4.169035, + ".if": -6.674561, + ".include": -6.114946, + ".lib": -8.060856, + ".map": -7.367709, + ".obj": -7.367709, + ".so": -8.060856, + ".so.": -8.060856, + ".sym": -6.962243, + ".symbolic": -6.451418, + ".tmp": -8.060856, + ".ttf": -8.060856, + ".woff": -7.367709, + "/": -4.035504, + "/*.php": -6.674561, + "/*.svg": -8.060856, + "/..": -6.962243, + "/../../../": -8.060856, + "/../../../../..": -8.060856, + "/../../lib": -7.367709, + "/../Makefile.boot": -7.367709, + "/../version": -8.060856, + "/arch": -8.060856, + "/arch/": -8.060856, + "/bin": -8.060856, + "/bin/rm": -8.060856, + "/conf/newvers_stand.sh": -8.060856, + "/conf/stand.ldscript": -8.060856, + "/dev/null": -6.962243, + "/fo": -7.367709, + "/fonts/file": -8.060856, + "/include": -7.367709, + "/lib": -6.962243, + "/lib/libsa": -7.367709, + "/man": -8.060856, + "/n/": -8.060856, + "/otexanl": -8.060856, + "/s": -8.060856, + "/stand": -8.060856, + "/usr/local": -8.060856, + "/usr/mdec": -8.060856, + "/w": -8.060856, + "/zq": -8.060856, + ":": -3.717050, + ";": -4.347284, + "<": -6.451418, + "": -8.060856, + "<\\/g>": -7.367709, + "<\\?xml.*?\\?>": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "": -8.060856, + "=": -2.925057, + ">": -3.445735, + "?": -5.227642, + "@": -5.758271, + "@./create": -8.060856, + "@echo": -4.299656, + "@for": -6.674561, + "@gmake": -8.060856, + "@ln": -8.060856, + "@mv": -7.367709, + "@perl": -7.367709, + "@rm": -7.367709, + "@unzip": -8.060856, + "@which": -8.060856, + "ACTIVE_CC": -8.060856, + "AFLAGS": -8.060856, + "AFLAGS.biosboot.S": -8.060856, + "ANNOUNCE": -8.060856, + "ARCH": -6.451418, + "AR_RC": -8.060856, + "ATOM_FILE_ICONS": -7.367709, + "Alhadis/FileIcons": -8.060856, + "BINDIR": -8.060856, + "BINMODE": -8.060856, + "BINPATH": -6.451418, + "C/": -8.060856, + "CC": -6.114946, + "CCFLAGS": -6.962243, + "CFLAGS": -6.269096, + "CHANGES": -8.060856, + "CLEANFILES": -8.060856, + "CONFIG_KVM": -8.060856, + "COPTS": -7.367709, + "CP": -8.060856, + "CPPFLAGS": -4.969813, + "CPUFLAGS": -7.367709, + "DCONSADDR": -8.060856, + "DCONSOLE_KEYMAP": -8.060856, + "DCONSPEED": -8.060856, + "DDIRECT_SERIAL": -8.060856, + "DEFS": -7.367709, + "DEPIA_HACK": -8.060856, + "DHEAP_LIMIT": -8.060856, + "DHEAP_START": -8.060856, + "DI": -8.060856, + "DIR": -8.060856, + "DL": -7.367709, + "DLIBSA_ENABLE_LS_OP": -8.060856, + "DLIBSA_PRINTF_LONGLONG_SUPPORT": -8.060856, + "DOCS": -7.367709, + "DPASS_BIOSGEOM": -8.060856, + "DPASS_MEMMAP": -8.060856, + "DST": -8.060856, + "DSTANDALONE": -8.060856, + "DSUPPORT_CD": -8.060856, + "DSUPPORT_DOSFS": -8.060856, + "DSUPPORT_EXT": -8.060856, + "DSUPPORT_PS": -8.060856, + "DSUPPORT_SERIAL": -8.060856, + "DSUPPORT_USTARFS": -8.060856, + "D_STANDALONE": -8.060856, + "Did": -8.060856, + "ENTRY": -7.367709, + "ERROR_NO_PKG": -8.060856, + "EXTRACFLAGS": -7.367709, + "FLAGS": -8.060856, + "FT_MAKE": -6.962243, + "FT_MAKEFILE": -6.962243, + "GREETINGS": -6.962243, + "HOST_SH": -8.060856, + "I": -5.227642, + "I.": -7.367709, + "IB": -8.060856, + "IFS": -8.060856, + "INCLUDES": -6.962243, + "INCPATH": -8.060856, + "INSTALL": -8.060856, + "Iarch": -8.060856, + "Iextend": -8.060856, + "J": -8.060856, + "KERNLIB": -8.060856, + "KERNMISCMAKEFLAGS": -8.060856, + "KERN_AS": -7.367709, + "KINFO": -8.060856, + "KLINK_MACHINE": -8.060856, + "KNOWNBUG": -8.060856, + "L": -6.674561, + "L.": -8.060856, + "LDFLAGS": -6.451418, + "LDSCRIPT": -7.367709, + "LIBC": -8.060856, + "LIBCRT": -8.060856, + "LIBCRTBEGIN": -8.060856, + "LIBCRTEND": -8.060856, + "LIBCRTI": -8.060856, + "LIBI": -6.962243, + "LIBKERN": -7.367709, + "LIBKERN_ARCH": -8.060856, + "LIBLIST": -6.674561, + "LIBNAME": -6.114946, + "LIBPATH": -8.060856, + "LIBSA": -6.962243, + "LIBSO": -7.367709, + "LIBSOMAJ": -6.962243, + "LIBSOREL": -8.060856, + "LIBZ": -7.367709, + "LIB_FILES": -8.060856, + "LICENSE": -8.060856, + "LN_SF": -8.060856, + "MACHINE": -8.060856, + "MACHINE_ARCH": -8.060856, + "MANPATH": -8.060856, + "MKDIR_P": -8.060856, + "Makefile.wat": -8.060856, + "Map": -8.060856, + "N": -7.367709, + "NAME": -8.060856, + "NEWVERSWHAT": -7.367709, + "NOMACHINE": -8.060856, + "NOMAN": -8.060856, + "O": -7.367709, + "OBJCOPY": -8.060856, + "OBJS": -7.367709, + "OBJS_M": -6.674561, + "OBJS_S": -8.060856, + "OBJS_X": -6.962243, + "OBJ_S": -6.674561, + "OLDSO": -8.060856, + "Os": -8.060856, + "PHP_DIR": -4.109612, + "PHP_LIB": -4.189655, + "PIE_AFLAGS": -8.060856, + "PIE_CFLAGS": -8.060856, + "PIE_LDFLAGS": -8.060856, + "PNGMAJ": -7.367709, + "PORT": -7.367709, + "PORT_OBJS": -7.367709, + "PROG": -5.863631, + "R": -8.060856, + "RANLIB": -8.060856, + "README": -8.060856, + "REAL_VIRT": -8.060856, + "RELEASE": -8.060856, + "RELOC": -8.060856, + "RM_F": -7.367709, + "S": -5.758271, + "S/arch/i": -7.367709, + "SALIB": -8.060856, + "SAMISCCPPFLAGS": -7.367709, + "SAMISCMAKEFLAGS": -6.674561, + "SA_AS": -8.060856, + "SA_INCLUDE_NET": -8.060856, + "SA_USE_CREAD": -8.060856, + "SHEBANG#!make": -8.060856, + "SOURCES": -6.962243, + "SRCS": -7.367709, + "SRC_M": -7.367709, + "SRC_S": -6.962243, + "SRC_X": -8.060856, + "STRIPFLAG": -8.060856, + "T": -8.060856, + "TODO": -8.060856, + "TTFILE": -7.367709, + "TTFILE_OBJ": -7.367709, + "TTMEMORY": -7.367709, + "TTMEMORY_OBJ": -7.367709, + "TTMUTEX": -7.367709, + "TTMUTEX_OBJ": -7.367709, + "Testing": -8.060856, + "Ttext": -7.367709, + "V": -8.060856, + "VERSIONFILE": -6.962243, + "Wall": -8.060856, + "Werror": -8.060856, + "Wl": -6.269096, + "Wmissing": -8.060856, + "Wno": -8.060856, + "Wstrict": -8.060856, + "X": -8.060856, + "Y": -8.060856, + "ZLIB": -8.060856, + "ZLIBINC": -7.367709, + "ZLIBLIB": -6.674561, + "Z_AS": -8.060856, + "[": -6.114946, + "\\": -3.630039, + "]": -6.451418, + "^": -6.451418, + "_MKTARGET_LINK": -8.060856, + "_STAND_DIR": -7.367709, + "__stand_makefile_inc": -7.367709, + "_compress": -7.367709, + "_start": -8.060856, + "`": -5.288267, + "a": -8.060856, + "all": -6.269096, + "all_targets": -8.060856, + "ar": -7.367709, + "arch": -8.060856, + "arch/mips/Kbuild.platforms": -8.060856, + "as": -8.060856, + "bar/baz.h": -7.367709, + "bar/foo.c": -8.060856, + "bar/foo.o": -8.060856, + "bb": -7.367709, + "belf": -8.060856, + "binary": -8.060856, + "biosboot.S": -8.060856, + "bonjour": -8.060856, + "boot": -7.367709, + "boot_params.bp_consaddr": -8.060856, + "boot_params.bp_consdev": -8.060856, + "boot_params.bp_conspeed": -8.060856, + "boot_params.bp_keymap": -8.060856, + "boot_start": -8.060856, + "c": -6.674561, + "cachebust": -8.060856, + "call": -7.367709, + "cc": -8.060856, + "ccflags": -8.060856, + "ch": -8.060856, + "charmap": -6.451418, + "charmap.md": -8.060856, + "chmod": -8.060856, + "clean": -6.674561, + "cleandir": -7.367709, + "cleanlibdir": -7.367709, + "commit": -8.060856, + "conf.c": -8.060856, + "config": -5.758271, + "cp": -8.060856, + "cref": -8.060856, + "dd": -8.060856, + "debug": -8.060856, + "defined": -7.367709, + "depend": -8.060856, + "devopen.c": -8.060856, + "dist": -8.060856, + "distclean": -7.367709, + "do": -6.674561, + "dobredan": -8.060856, + "done": -6.674561, + "dy": -8.060856, + "dynamic": -8.060856, + "e": -6.674561, + "echo": -4.969813, + "elf_i": -8.060856, + "endif": -8.060856, + "erase": -6.962243, + "exec.c": -8.060856, + "exec_prefix": -6.962243, + "exit": -6.962243, + "extend": -4.925362, + "f": -5.575949, + "f.o": -8.060856, + "factorial.cpp": -7.367709, + "factorial.o": -6.962243, + "ffreestanding": -8.060856, + "file": -7.367709, + "float": -8.060856, + "fno": -8.060856, + "folder": -5.758271, + "font": -5.288267, + "for": -8.060856, + "freetype.c": -8.060856, + "freetype.obj": -8.060856, + "ftxcmap.c": -8.060856, + "ftxcmap.obj": -8.060856, + "ftxgasp.c": -8.060856, + "ftxgasp.obj": -8.060856, + "ftxgdef.c": -8.060856, + "ftxgdef.obj": -8.060856, + "ftxgpos.c": -8.060856, + "ftxgpos.obj": -8.060856, + "ftxgsub.c": -8.060856, + "ftxgsub.obj": -8.060856, + "ftxkern.c": -8.060856, + "ftxkern.obj": -8.060856, + "ftxopen.c": -8.060856, + "ftxopen.obj": -8.060856, + "ftxpost.c": -8.060856, + "ftxpost.obj": -8.060856, + "ftxsbit.c": -8.060856, + "ftxsbit.obj": -8.060856, + "ftxwidth.c": -8.060856, + "ftxwidth.obj": -8.060856, + "g": -6.674561, + "gday": -8.060856, + "generate": -7.367709, + "git": -8.060856, + "gmake": -8.060856, + "greet.": -7.367709, + "h": -7.367709, + "hash": -8.060856, + "hello": -6.451418, + "hello.cpp": -7.367709, + "hello.o": -6.962243, + "hoi": -8.060856, + "hola": -8.060856, + "i": -6.114946, + "icomoon.json": -8.060856, + "icon": -6.451418, + "icons": -7.367709, + "if": -8.060856, + "ifdef": -8.060856, + "in": -6.269096, + "include": -8.060856, + "index": -7.367709, + "installed": -7.367709, + "integrated": -8.060856, + "kaixo": -8.060856, + "kernel/": -8.060856, + "kernlibdir": -8.060856, + "konnichiwa": -8.060856, + "kvm/": -8.060856, + "l": -8.060856, + "last": -8.060856, + "lib": -7.367709, + "libdep": -8.060856, + "libpng": -7.367709, + "libpng.a": -8.060856, + "libpng.pc": -8.060856, + "libpng.so": -8.060856, + "library": -6.451418, + "libttf.lib": -6.451418, + "link": -6.962243, + "lint": -8.060856, + "lm": -8.060856, + "ln": -7.367709, + "log": -8.060856, + "lpng": -8.060856, + "ls": -6.451418, + "lz": -8.060856, + "m": -6.962243, + "machine": -6.962243, + "main.cpp": -7.367709, + "main.o": -6.962243, + "make": -6.114946, + "map.pl": -8.060856, + "march": -8.060856, + "mean": -8.060856, + "mk": -7.367709, + "mkdir": -8.060856, + "mm/": -8.060856, + "mno": -6.962243, + "msoft": -8.060856, + "mtune": -8.060856, + "n": -8.060856, + "namaste": -8.060856, + "name": -5.116417, + "need": -6.674561, + "net/": -8.060856, + "new": -8.060856, + "nihao": -8.060856, + "no": -7.367709, + "nostdinc": -8.060856, + "nostdlib": -8.060856, + "o": -6.674561, + "obj": -6.114946, + "objcopy": -8.060856, + "objects": -6.114946, + "oifs": -8.060856, + "ola": -8.060856, + "os": -7.367709, + "php": -5.575949, + "pi": -7.367709, + "platform": -7.367709, + "png.h": -5.288267, + "png.o": -8.060856, + "png.pic.o": -8.060856, + "pngconf.h": -5.288267, + "pngdebug.h": -5.352806, + "pngerror.o": -8.060856, + "pngerror.pic.o": -8.060856, + "pngget.o": -8.060856, + "pngget.pic.o": -8.060856, + "pnginfo.h": -5.352806, + "pnglibconf.h": -5.227642, + "pngmem.o": -8.060856, + "pngmem.pic.o": -8.060856, + "pngout.png": -8.060856, + "pngpread.o": -8.060856, + "pngpread.pic.o": -8.060856, + "pngpriv.h": -5.352806, + "pngread.o": -8.060856, + "pngread.pic.o": -8.060856, + "pngrio.o": -8.060856, + "pngrio.pic.o": -8.060856, + "pngrtran.o": -8.060856, + "pngrtran.pic.o": -8.060856, + "pngrutil.o": -8.060856, + "pngrutil.pic.o": -8.060856, + "pngset.o": -8.060856, + "pngset.pic.o": -8.060856, + "pngstruct.h": -5.352806, + "pngtest": -7.367709, + "pngtest.o": -8.060856, + "pngtest.png": -7.367709, + "pngtestd": -8.060856, + "pngtesti": -7.367709, + "pngtrans.o": -8.060856, + "pngtrans.pic.o": -8.060856, + "pngwio.o": -8.060856, + "pngwio.pic.o": -8.060856, + "pngwrite.o": -8.060856, + "pngwrite.pic.o": -8.060856, + "pngwtran.o": -8.060856, + "pngwtran.pic.o": -8.060856, + "pngwutil.o": -8.060856, + "pngwutil.pic.o": -8.060856, + "pointer": -8.060856, + "prefix": -6.674561, + "printer": -8.060856, + "protector": -8.060856, + "prototypes": -7.367709, + "q": -8.060856, + "qd": -8.060856, + "r": -8.060856, + "rc": -8.060856, + "rcs": -8.060856, + "relink": -8.060856, + "repo": -7.367709, + "rest": -8.060856, + "rf": -6.451418, + "rm": -6.962243, + "s": -7.367709, + "sadep": -8.060856, + "salaam": -8.060856, + "salibdir": -8.060856, + "scripts/*": -8.060856, + "sed": -7.367709, + "shared": -8.060856, + "shell": -8.060856, + "sign": -8.060856, + "size": -8.060856, + "sse": -6.962243, + "stack": -8.060856, + "static": -8.060856, + "stem": -8.060856, + "subdir": -8.060856, + "subst": -8.060856, + "svg": -6.962243, + "symbol": -8.060856, + "tag": -8.060856, + "test": -6.962243, + "this": -8.060856, + "tmp": -6.962243, + "tmp/fonts": -8.060856, + "tmp/selection.json": -8.060856, + "ttapi.c": -8.060856, + "ttapi.obj": -8.060856, + "ttcache.c": -8.060856, + "ttcache.obj": -8.060856, + "ttcalc.c": -8.060856, + "ttcalc.obj": -8.060856, + "ttcmap.c": -8.060856, + "ttcmap.obj": -8.060856, + "ttextend.c": -8.060856, + "ttextend.obj": -8.060856, + "ttfile.c": -8.060856, + "ttfile.obj": -8.060856, + "ttgload.c": -8.060856, + "ttgload.obj": -8.060856, + "ttinterp.c": -8.060856, + "ttinterp.obj": -8.060856, + "ttload.c": -8.060856, + "ttload.obj": -8.060856, + "ttmemory.c": -8.060856, + "ttmemory.obj": -8.060856, + "ttmutex.c": -8.060856, + "ttmutex.obj": -8.060856, + "ttobjs.c": -8.060856, + "ttobjs.obj": -8.060856, + "ttraster.c": -8.060856, + "ttraster.obj": -8.060856, + "unpack": -7.367709, + "v": -8.060856, + "var": -7.367709, + "vers.c": -6.962243, + "w": -8.060856, + "wcc": -8.060856, + "wildcard": -7.367709, + "wlib": -8.060856, + "wmake": -8.060856, + "woff": -7.367709, + "writelock": -8.060856, + "wtouch": -8.060856, + "x": -8.060856, + "y": -6.114946, + "yes": -8.060856, + "you": -8.060856, + "{": -4.053523, + "|": -6.114946, + "||": -6.962243, + "}": -4.071872, }, "Markdown": map[string]float64{ "'": -6.093570, @@ -116686,6 +116788,167 @@ var DefaultClassifier Classifier = &classifier{ "xmlns": -6.763500, "xsd": -7.862112, }, + "WebAssembly": map[string]float64{ + "!": -6.526983, + "$": -2.342391, + "'": -7.625595, + "(": -1.597317, + ")": -1.597317, + ",": -5.060646, + "-": -5.833836, + ";": -3.713572, + "STACKTOP": -6.932448, + "STACK_MAX": -6.932448, + "a": -4.986538, + "add": -4.258299, + "an": -7.625595, + "and": -6.932448, + "are": -6.239301, + "as": -7.625595, + "asm": -6.239301, + "b": -5.060646, + "bad": -6.239301, + "basics": -6.932448, + "be": -6.932448, + "become": -7.625595, + "block": -4.986538, + "br": -7.625595, + "br_if": -4.853006, + "br_ifs": -7.625595, + "but": -6.932448, + "by": -7.625595, + "call": -4.581073, + "can": -6.932448, + "changed": -7.625595, + "const": -2.981204, + "data": -6.016157, + "do": -6.526983, + "drop": -4.447541, + "effect": -6.932448, + "effects": -6.239301, + "endl": -6.016157, + "equal": -7.625595, + "eqz": -6.932448, + "export": -5.546154, + "f": -6.526983, + "fi": -6.932448, + "fibonacci_iter": -6.932448, + "fibonacci_rec": -6.526983, + "finally": -7.625595, + "float": -7.625595, + "for": -7.625595, + "func": -4.159859, + "get": -7.625595, + "get_global": -6.239301, + "get_local": -3.988009, + "global": -4.792382, + "globals": -7.625595, + "have": -6.526983, + "here": -6.932448, + "i": -2.322290, + "if": -5.323010, + "ignored": -6.526983, + "implicit": -7.625595, + "import": -4.986538, + "imports": -6.526983, + "initialized": -7.625595, + "int": -7.625595, + "it": -7.625595, + "join": -7.625595, + "keep": -6.932448, + "label": -7.625595, + "lhs": -6.932448, + "linear": -7.625595, + "load": -7.625595, + "loads": -7.625595, + "local": -5.140688, + "locals": -7.625595, + "loop": -7.625595, + "main": -5.833836, + "matter": -7.625595, + "may": -6.526983, + "means": -7.625595, + "memory": -5.140688, + "mine": -6.932448, + "modify": -7.625595, + "module": -5.833836, + "must": -6.932448, + "mut": -6.239301, + "n": -5.679685, + "names": -7.625595, + "ne": -7.625595, + "never": -7.625595, + "no": -7.625595, + "non": -7.625595, + "nop": -7.625595, + "not": -6.526983, + "oad": -5.833836, + "ok": -6.526983, + "or": -7.625595, + "other": -6.932448, + "our": -7.625595, + "out": -4.406719, + "param": -4.853006, + "print": -5.833836, + "printFloat": -6.932448, + "printInt": -5.679685, + "recursive": -6.932448, + "rem": -7.625595, + "rem_s": -7.625595, + "result": -6.016157, + "return": -6.932448, + "rhs": -6.932448, + "sad": -7.625595, + "same": -6.526983, + "save": -6.932448, + "select": -7.625595, + "self": -7.625595, + "set_global": -5.833836, + "set_local": -5.833836, + "should": -7.625595, + "shrinking": -7.625595, + "side": -5.833836, + "so": -7.625595, + "space": -6.526983, + "special": -7.625595, + "stack": -6.239301, + "store": -5.679685, + "sub": -6.526983, + "t": -7.625595, + "tee_local": -6.526983, + "temp": -5.833836, + "tempDoublePtr": -6.526983, + "test": -5.833836, + "the": -5.833836, + "their": -7.625595, + "they": -7.625595, + "this": -6.932448, + "to": -6.526983, + "touched": -7.625595, + "traps": -7.625595, + "trunc_u/f": -7.625595, + "type": -6.239301, + "unless": -6.526983, + "unreachable": -6.239301, + "unwind": -7.625595, + "us": -6.932448, + "use": -6.932448, + "use.": -7.625595, + "used": -7.625595, + "uses": -7.625595, + "valid": -7.625595, + "value": -6.932448, + "var": -5.140688, + "was": -7.625595, + "wasm": -6.239301, + "we": -6.932448, + "which": -7.625595, + "with": -7.625595, + "x": -5.227700, + "xor": -7.625595, + "y": -5.428370, + "yet": -7.625595, + }, "WebIDL": map[string]float64{ "(": -2.890372, ")": -2.890372, @@ -125265,5 +125528,5 @@ var DefaultClassifier Classifier = &classifier{ "}": -3.584980, }, }, - tokensTotal: 1439615.000000, + tokensTotal: 1442056.000000, } diff --git a/internal/code-generator/assets/content.go.tmpl b/internal/code-generator/assets/content.go.tmpl index bc42773..066f07f 100644 --- a/internal/code-generator/assets/content.go.tmpl +++ b/internal/code-generator/assets/content.go.tmpl @@ -8,11 +8,11 @@ import ( "regexp" ) -type languageMatcher func ([]byte) (string, bool) +type languageMatcher func ([]byte) []string var contentMatchers = map[string]languageMatcher{ {{ range $index, $disambiguator := . -}} - {{ printf "%q" $disambiguator.Extension }}: func(i []byte) (string, bool) { + {{ printf "%q" $disambiguator.Extension }}: func(i []byte) []string { {{ range $i, $language := $disambiguator.Languages -}} {{- if not (avoidLanguage $language) }} @@ -20,14 +20,14 @@ var contentMatchers = map[string]languageMatcher{ {{- if gt $i 0 }} else {{ end -}} if {{- range $j, $heuristic := $language.Heuristics }} {{ $heuristic.Name }}.Match(i) {{- if lt $j (len $language.LogicRelations) }} {{index $language.LogicRelations $j}} {{- end -}} {{ end }} { - return {{ printf "%q" $language.Language }}, true + return []string{ {{- printf "%q" $language.Language -}} } } {{- end -}} {{- end -}} {{- end}} - return {{ returnLanguage $disambiguator.Languages }}, {{ safeLanguage $disambiguator.Languages }} + return {{ returnLanguages $disambiguator.Languages | returnStringSlice }} }, {{ end -}} } diff --git a/internal/code-generator/assets/filenames.go.tmpl b/internal/code-generator/assets/filenames.go.tmpl index f0a7952..0272854 100644 --- a/internal/code-generator/assets/filenames.go.tmpl +++ b/internal/code-generator/assets/filenames.go.tmpl @@ -4,8 +4,8 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: {{ getCommit }} -var languagesByFilename = map[string]string{ - {{range $filename, $language := . -}} - "{{ $filename }}": {{- printf "%q" $language -}}, +var languagesByFilename = map[string][]string{ + {{range $filename, $languages := . -}} + "{{ $filename }}": { {{- formatStringSlice $languages -}} }, {{end -}} } diff --git a/internal/code-generator/generator/documentation.go b/internal/code-generator/generator/documentation.go index 58e10d0..3662fe7 100644 --- a/internal/code-generator/generator/documentation.go +++ b/internal/code-generator/generator/documentation.go @@ -2,8 +2,8 @@ package generator import ( "bytes" - "html/template" "io" + "text/template" yaml "gopkg.in/yaml.v2" ) diff --git a/internal/code-generator/generator/filenames.go b/internal/code-generator/generator/filenames.go index e0bc7e5..16dcb9c 100644 --- a/internal/code-generator/generator/filenames.go +++ b/internal/code-generator/generator/filenames.go @@ -3,6 +3,7 @@ package generator import ( "bytes" "io" + "strings" "text/template" yaml "gopkg.in/yaml.v2" @@ -25,20 +26,21 @@ func Filenames(data []byte, filenamesTmplPath, filenamesTmplName, commit string) return buf.Bytes(), nil } -func buildFilenameLanguageMap(languages map[string]*languageInfo) map[string]string { - filenameLangMap := make(map[string]string) +func buildFilenameLanguageMap(languages map[string]*languageInfo) map[string][]string { + filenameLangMap := make(map[string][]string) for lang, langInfo := range languages { for _, filename := range langInfo.Filenames { - filenameLangMap[filename] = lang + filenameLangMap[filename] = append(filenameLangMap[filename], lang) } } return filenameLangMap } -func executeFilenamesTemplate(out io.Writer, languagesByFilename map[string]string, filenamesTmplPath, filenamesTmpl, commit string) error { +func executeFilenamesTemplate(out io.Writer, languagesByFilename map[string][]string, filenamesTmplPath, filenamesTmpl, commit string) error { fmap := template.FuncMap{ - "getCommit": func() string { return commit }, + "getCommit": func() string { return commit }, + "formatStringSlice": func(slice []string) string { return `"` + strings.Join(slice, `","`) + `"` }, } t := template.Must(template.New(filenamesTmpl).Funcs(fmap).ParseFiles(filenamesTmplPath)) diff --git a/internal/code-generator/generator/heuristics.go b/internal/code-generator/generator/heuristics.go index d01c979..a671a1a 100644 --- a/internal/code-generator/generator/heuristics.go +++ b/internal/code-generator/generator/heuristics.go @@ -24,6 +24,8 @@ func Heuristics(heuristics []byte, contentTmplPath, contentTmplName, commit stri } return buf.Bytes(), nil + // fmt.Println(string(buf.Bytes())) + // return nil, nil } const unknownLanguage = "OtherLanguage" @@ -417,9 +419,15 @@ func executeContentTemplate(out io.Writer, disambiguators []*disambiguator, cont fmap := template.FuncMap{ "getCommit": func() string { return commit }, "getAllHeuristics": getAllHeuristics, - "returnLanguage": returnLanguage, - "safeLanguage": safeLanguage, - "avoidLanguage": avoidLanguage, + "returnStringSlice": func(slice []string) string { + if len(slice) == 0 { + return "nil" + } + + return `[]string{` + strings.Join(slice, `, `) + `}` + }, + "returnLanguages": returnLanguages, + "avoidLanguage": avoidLanguage, } t := template.Must(template.New(contentTmpl).Funcs(fmap).ParseFiles(contentTmplPath)) @@ -458,18 +466,7 @@ func containsInvalidRegexp(reg string) bool { return strings.Contains(reg, `(?<`) || strings.Contains(reg, `\1`) } -func returnLanguage(langsHeuristics []*languageHeuristics) string { - lang, _ := returnLangAndSafe(langsHeuristics) - return lang -} - -func safeLanguage(langsHeuristics []*languageHeuristics) bool { - _, safe := returnLangAndSafe(langsHeuristics) - return safe -} - -func returnLangAndSafe(langsHeuristics []*languageHeuristics) (string, bool) { - // at the moment, only returns one string although might be exists several language to return as a []string. +func returnLanguages(langsHeuristics []*languageHeuristics) []string { langs := make([]string, 0) for _, langHeu := range langsHeuristics { if len(langHeu.Heuristics) == 0 { @@ -477,12 +474,5 @@ func returnLangAndSafe(langsHeuristics []*languageHeuristics) (string, bool) { } } - lang := unknownLanguage - safe := false - if len(langs) != 0 { - lang = langs[0] - safe = len(langs) == 1 - } - - return lang, safe + return langs } diff --git a/internal/code-generator/generator/test_files/content.gold b/internal/code-generator/generator/test_files/content.gold index 6d4eba8..d871160 100644 --- a/internal/code-generator/generator/test_files/content.gold +++ b/internal/code-generator/generator/test_files/content.gold @@ -8,102 +8,102 @@ import ( "regexp" ) -type languageMatcher func([]byte) (string, bool) +type languageMatcher func([]byte) []string var contentMatchers = map[string]languageMatcher{ - ".asc": func(i []byte) (string, bool) { + ".asc": func(i []byte) []string { if asc_PublicKey_Matcher_0.Match(i) { - return "Public Key", true + return []string{"Public Key"} } else if asc_AsciiDoc_Matcher_0.Match(i) { - return "AsciiDoc", true + return []string{"AsciiDoc"} } else if asc_AGSScript_Matcher_0.Match(i) { - return "AGS Script", true + return []string{"AGS Script"} } - return OtherLanguage, false + return nil }, - ".f": func(i []byte) (string, bool) { + ".f": func(i []byte) []string { if f_Forth_Matcher_0.Match(i) { - return "Forth", true + return []string{"Forth"} } else if f_FilebenchWML_Matcher_0.Match(i) { - return "Filebench WML", true + return []string{"Filebench WML"} } else if f_FORTRAN_Matcher_0.Match(i) { - return "FORTRAN", true + return []string{"FORTRAN"} } - return OtherLanguage, false + return nil }, - ".h": func(i []byte) (string, bool) { + ".h": func(i []byte) []string { if h_ObjectiveDashC_Matcher_0.Match(i) { - return "Objective-C", true + return []string{"Objective-C"} } else if h_CPlusPlus_Matcher_0.Match(i) || h_CPlusPlus_Matcher_1.Match(i) || h_CPlusPlus_Matcher_2.Match(i) || h_CPlusPlus_Matcher_3.Match(i) || h_CPlusPlus_Matcher_4.Match(i) || h_CPlusPlus_Matcher_5.Match(i) || h_CPlusPlus_Matcher_6.Match(i) { - return "C++", true + return []string{"C++"} } - return OtherLanguage, false + return nil }, - ".lsp": func(i []byte) (string, bool) { + ".lsp": func(i []byte) []string { if lsp_CommonLisp_Matcher_0.Match(i) { - return "Common Lisp", true + return []string{"Common Lisp"} } else if lsp_NewLisp_Matcher_0.Match(i) { - return "NewLisp", true + return []string{"NewLisp"} } - return OtherLanguage, false + return nil }, - ".lisp": func(i []byte) (string, bool) { + ".lisp": func(i []byte) []string { if lisp_CommonLisp_Matcher_0.Match(i) { - return "Common Lisp", true + return []string{"Common Lisp"} } else if lisp_NewLisp_Matcher_0.Match(i) { - return "NewLisp", true + return []string{"NewLisp"} } - return OtherLanguage, false + return nil }, - ".md": func(i []byte) (string, bool) { + ".md": func(i []byte) []string { if md_Markdown_Matcher_0.Match(i) || md_Markdown_Matcher_1.Match(i) { - return "Markdown", true + return []string{"Markdown"} } else if md_GCCmachinedescription_Matcher_0.Match(i) { - return "GCC machine description", true + return []string{"GCC machine description"} } - return "Markdown", true + return []string{"Markdown"} }, - ".ms": func(i []byte) (string, bool) { + ".ms": func(i []byte) []string { if ms_Groff_Matcher_0.Match(i) { - return "Groff", true + return []string{"Groff"} } - return "MAXScript", true + return []string{"MAXScript"} }, - ".mod": func(i []byte) (string, bool) { + ".mod": func(i []byte) []string { if mod_XML_Matcher_0.Match(i) { - return "XML", true + return []string{"XML"} } else if mod_ModulaDash2_Matcher_0.Match(i) || mod_ModulaDash2_Matcher_1.Match(i) { - return "Modula-2", true + return []string{"Modula-2"} } - return "Linux Kernel Module", false + return []string{"Linux Kernel Module", "AMPL"} }, - ".pro": func(i []byte) (string, bool) { + ".pro": func(i []byte) []string { if pro_Prolog_Matcher_0.Match(i) { - return "Prolog", true + return []string{"Prolog"} } else if pro_INI_Matcher_0.Match(i) { - return "INI", true + return []string{"INI"} } else if pro_QMake_Matcher_0.Match(i) && pro_QMake_Matcher_1.Match(i) { - return "QMake", true + return []string{"QMake"} } else if pro_IDL_Matcher_0.Match(i) { - return "IDL", true + return []string{"IDL"} } - return OtherLanguage, false + return nil }, - ".rpy": func(i []byte) (string, bool) { + ".rpy": func(i []byte) []string { if rpy_Python_Matcher_0.Match(i) { - return "Python", true + return []string{"Python"} } - return "Ren'Py", true + return []string{"Ren'Py"} }, } diff --git a/internal/code-generator/generator/test_files/filenames.gold b/internal/code-generator/generator/test_files/filenames.gold index 8e03aaa..1279a6c 100644 --- a/internal/code-generator/generator/test_files/filenames.gold +++ b/internal/code-generator/generator/test_files/filenames.gold @@ -4,9 +4,9 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: 0123456789abcdef0123456789abcdef01234567 -var languagesByFilename = map[string]string{ - "APKBUILD": "Alpine Abuild", - "CMakeLists.txt": "CMake", - "Cakefile": "CoffeeScript", - "mix.lock": "Elixir", +var languagesByFilename = map[string][]string{ + "APKBUILD": {"Alpine Abuild"}, + "CMakeLists.txt": {"CMake"}, + "Cakefile": {"CoffeeScript"}, + "mix.lock": {"Elixir"}, } diff --git a/internal/code-generator/generator/vendor.go b/internal/code-generator/generator/vendor.go index 19107a6..3456d1a 100644 --- a/internal/code-generator/generator/vendor.go +++ b/internal/code-generator/generator/vendor.go @@ -2,8 +2,8 @@ package generator import ( "bytes" - "html/template" "io" + "text/template" yaml "gopkg.in/yaml.v2" ) diff --git a/interpreter.go b/interpreter.go index 7af8f26..b113211 100644 --- a/interpreter.go +++ b/interpreter.go @@ -2,7 +2,7 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 var languagesByInterpreter = map[string][]string{ "Rscript": {"R"}, diff --git a/modeline.go b/modeline.go index fee646a..fb6c850 100644 --- a/modeline.go +++ b/modeline.go @@ -5,38 +5,60 @@ import ( "regexp" ) -func getLanguageByModeline(content []byte) (lang string, safe bool) { +const ( + searchScope = 5 +) + +// GetLanguagesByModeline returns a slice of possible languages for the given content, filename will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByModeline(filename string, content []byte) []string { headFoot := getHeaderAndFooter(content) + var languages []string for _, getLang := range modelinesFunc { - lang, safe = getLang(headFoot) - if safe { + languages = getLang("", headFoot) + if len(languages) > 0 { break } } - return + return languages } func getHeaderAndFooter(content []byte) []byte { - const ( - searchScope = 5 - eol = "\n" - ) - - if bytes.Count(content, []byte(eol)) < 2*searchScope { + if bytes.Count(content, []byte("\n")) < 2*searchScope { return content } - splitted := bytes.Split(content, []byte(eol)) - header := splitted[:searchScope] - footer := splitted[len(splitted)-searchScope:] - headerAndFooter := append(header, footer...) - return bytes.Join(headerAndFooter, []byte(eol)) + header := headScope(content, searchScope) + footer := footScope(content, searchScope) + headerAndFooter := make([]byte, 0, len(content[:header])+len(content[footer:])) + headerAndFooter = append(headerAndFooter, content[:header]...) + headerAndFooter = append(headerAndFooter, content[footer:]...) + return headerAndFooter } -var modelinesFunc = []func(content []byte) (string, bool){ - GetLanguageByEmacsModeline, - GetLanguageByVimModeline, +func headScope(content []byte, scope int) (index int) { + for i := 0; i < scope; i++ { + eol := bytes.IndexAny(content, "\n") + content = content[eol+1:] + index += eol + } + + return index + scope - 1 +} + +func footScope(content []byte, scope int) (index int) { + for i := 0; i < scope; i++ { + index = bytes.LastIndexAny(content, "\n") + content = content[:index] + } + + return index + 1 +} + +var modelinesFunc = []func(filename string, content []byte) []string{ + GetLanguagesByEmacsModeline, + GetLanguagesByVimModeline, } var ( @@ -49,9 +71,20 @@ var ( // GetLanguageByEmacsModeline detecs if the content has a emacs modeline and try to get a // language basing on alias. If couldn't retrieve a valid language, it returns OtherLanguage and false. func GetLanguageByEmacsModeline(content []byte) (string, bool) { + languages := GetLanguagesByEmacsModeline("", content) + if len(languages) == 0 { + return OtherLanguage, false + } + + return languages[0], true +} + +// GetLanguagesByEmacsModeline returns a slice of possible languages for the given content, filename will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByEmacsModeline(filename string, content []byte) []string { matched := reEmacsModeline.FindAllSubmatch(content, -1) if matched == nil { - return OtherLanguage, false + return nil } // only take the last matched line, discard previous lines @@ -64,22 +97,38 @@ func GetLanguageByEmacsModeline(content []byte) (string, bool) { alias = string(lastLineMatched) } - return GetLanguageByAlias(alias) + language, ok := GetLanguageByAlias(alias) + if !ok { + return nil + } + + return []string{language} } // GetLanguageByVimModeline detecs if the content has a vim modeline and try to get a // language basing on alias. If couldn't retrieve a valid language, it returns OtherLanguage and false. func GetLanguageByVimModeline(content []byte) (string, bool) { + languages := GetLanguagesByVimModeline("", content) + if len(languages) == 0 { + return OtherLanguage, false + } + + return languages[0], true +} + +// GetLanguagesByVimModeline returns a slice of possible languages for the given content, filename will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByVimModeline(filename string, content []byte) []string { matched := reVimModeline.FindAllSubmatch(content, -1) if matched == nil { - return OtherLanguage, false + return nil } // only take the last matched line, discard previous lines lastLineMatched := matched[len(matched)-1][1] matchedAlias := reVimLang.FindAllSubmatch(lastLineMatched, -1) if matchedAlias == nil { - return OtherLanguage, false + return nil } alias := string(matchedAlias[0][1]) @@ -90,11 +139,15 @@ func GetLanguageByVimModeline(content []byte) (string, bool) { for _, match := range matchedAlias { otherAlias := string(match[1]) if otherAlias != alias { - alias = OtherLanguage - break + return nil } } } - return GetLanguageByAlias(alias) + language, ok := GetLanguageByAlias(alias) + if !ok { + return nil + } + + return []string{language} } diff --git a/shebang.go b/shebang.go index a5f16f4..32382f2 100644 --- a/shebang.go +++ b/shebang.go @@ -14,15 +14,11 @@ var ( pythonVersion = regexp.MustCompile(`python\d\.\d+`) ) -func getLanguageByShebang(content []byte) (lang string, safe bool) { +// GetLanguagesByShebang returns a slice of possible languages for the given content, filename will be ignored. +// It accomplish the signature to be a Strategy type. +func GetLanguagesByShebang(filename string, content []byte) (languages []string) { interpreter := getInterpreter(content) - lang = OtherLanguage - if langs, ok := languagesByInterpreter[interpreter]; ok { - lang = langs[0] - safe = len(langs) == 1 - } - - return + return languagesByInterpreter[interpreter] } func getInterpreter(data []byte) (interpreter string) { diff --git a/type.go b/type.go index ea4418a..4b80317 100644 --- a/type.go +++ b/type.go @@ -2,7 +2,7 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 var languagesType = map[string]Type{ "1C Enterprise": Programming, @@ -427,6 +427,7 @@ var languagesType = map[string]Type{ "Wavefront Material": Data, "Wavefront Object": Data, "Web Ontology Language": Markup, + "WebAssembly": Programming, "WebIDL": Programming, "World of Warcraft Addon Data": Data, "X10": Programming, diff --git a/utils.go b/utils.go index 7b5eed3..b0efb00 100644 --- a/utils.go +++ b/utils.go @@ -4,8 +4,6 @@ import ( "bytes" "path/filepath" "strings" - - "gopkg.in/toqueteos/substring.v1" ) var ( @@ -46,16 +44,12 @@ func IsDotFile(path string) bool { // IsVendor returns whether or not path is a vendor path. func IsVendor(path string) bool { - return findIndex(path, vendorMatchers) >= 0 + return vendorMatchers.Match(path) } // IsDocumentation returns whether or not path is a documentation path. func IsDocumentation(path string) bool { - return findIndex(path, documentationMatchers) >= 0 -} - -func findIndex(path string, matchers substring.StringsMatcher) int { - return matchers.MatchIndex(path) + return documentationMatchers.Match(path) } const sniffLen = 8000 diff --git a/vendor.go b/vendor.go index 400dc59..d51de7f 100644 --- a/vendor.go +++ b/vendor.go @@ -2,7 +2,7 @@ package slinguist // CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/simple-linguist.v1/internal/code-generator // THIS FILE SHOULD NOT BE EDITED BY HAND -// Extracted from github/linguist commit: 60f864a138650dd17fafc94814be9ee2d3aaef8c +// Extracted from github/linguist commit: b6460f8ed6b249281ada099ca28bd8f1230b8892 import "gopkg.in/toqueteos/substring.v1" @@ -41,20 +41,20 @@ var vendorMatchers = substring.Or( substring.Regexp(`3rd[-_]?party/`), substring.Regexp(`vendors?/`), substring.Regexp(`extern(al)?/`), - substring.Regexp(`(^|/)[Vv]+endor/`), + substring.Regexp(`(^|/)[Vv]+endor/`), substring.Regexp(`^debian/`), substring.Regexp(`run.n$`), substring.Regexp(`bootstrap-datepicker/`), substring.Regexp(`(^|/)jquery([^.]*)\.js$`), - substring.Regexp(`(^|/)jquery\-\d\.\d+(\.\d+)?\.js$`), - substring.Regexp(`(^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$`), + substring.Regexp(`(^|/)jquery\-\d\.\d+(\.\d+)?\.js$`), + substring.Regexp(`(^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$`), substring.Regexp(`(^|/)jquery\.(ui|effects)\.([^.]*)\.(js|css)$`), substring.Regexp(`jquery.fn.gantt.js`), substring.Regexp(`jquery.fancybox.(js|css)`), substring.Regexp(`fuelux.js`), - substring.Regexp(`(^|/)jquery\.fileupload(-\w+)?\.js$`), - substring.Regexp(`(^|/)slick\.\w+.js$`), - substring.Regexp(`(^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$`), + substring.Regexp(`(^|/)jquery\.fileupload(-\w+)?\.js$`), + substring.Regexp(`(^|/)slick\.\w+.js$`), + substring.Regexp(`(^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$`), substring.Regexp(`leaflet.draw-src.js`), substring.Regexp(`leaflet.draw.css`), substring.Regexp(`Control.FullScreen.css`), @@ -68,7 +68,7 @@ var vendorMatchers = substring.Or( substring.Regexp(`(^|/)controls\.js$`), substring.Regexp(`(^|/)dragdrop\.js$`), substring.Regexp(`(.*?)\.d\.ts$`), - substring.Regexp(`(^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$`), + substring.Regexp(`(^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$`), substring.Regexp(`(^|/)dojo\.js$`), substring.Regexp(`(^|/)MochiKit\.js$`), substring.Regexp(`(^|/)yahoo-([^.]*)\.js$`), @@ -80,16 +80,16 @@ var vendorMatchers = substring.Or( substring.Regexp(`(^|/)fontello(.*?)\.css$`), substring.Regexp(`(^|/)MathJax/`), substring.Regexp(`(^|/)Chart\.js$`), - substring.Regexp(`(^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)`), + substring.Regexp(`(^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)`), substring.Regexp(`(^|/)shBrush([^.]*)\.js$`), substring.Regexp(`(^|/)shCore\.js$`), substring.Regexp(`(^|/)shLegacy\.js$`), substring.Regexp(`(^|/)angular([^.]*)\.js$`), - substring.Regexp(`(^|\/)d3(\.v\d+)?([^.]*)\.js$`), + substring.Regexp(`(^|\/)d3(\.v\d+)?([^.]*)\.js$`), substring.Regexp(`(^|/)react(-[^.]*)?\.js$`), - substring.Regexp(`(^|/)modernizr\-\d\.\d+(\.\d+)?\.js$`), - substring.Regexp(`(^|/)modernizr\.custom\.\d+\.js$`), - substring.Regexp(`(^|/)knockout-(\d+\.){3}(debug\.)?js$`), + substring.Regexp(`(^|/)modernizr\-\d\.\d+(\.\d+)?\.js$`), + substring.Regexp(`(^|/)modernizr\.custom\.\d+\.js$`), + substring.Regexp(`(^|/)knockout-(\d+\.){3}(debug\.)?js$`), substring.Regexp(`(^|/)docs?/_?(build|themes?|templates?|static)/`), substring.Regexp(`(^|/)admin_media/`), substring.Regexp(`(^|/)env/`), @@ -117,7 +117,7 @@ var vendorMatchers = substring.Or( substring.Regexp(`(^|/)jquery([^.]*)\.validate(\.unobtrusive)?\.js$`), substring.Regexp(`(^|/)jquery([^.]*)\.unobtrusive\-ajax\.js$`), substring.Regexp(`(^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$`), - substring.Regexp(`^[Pp]ackages\/.+\.\d+\/`), + substring.Regexp(`^[Pp]ackages\/.+\.\d+\/`), substring.Regexp(`(^|/)extjs/.*?\.js$`), substring.Regexp(`(^|/)extjs/.*?\.xml$`), substring.Regexp(`(^|/)extjs/.*?\.txt$`),