mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
changed generator_test.go to use only TestFromFile
modified *.test.yml to contain only necessary information fixed white spaces remove duplicated file languages.test.tmpl
This commit is contained in:
parent
1bf555bc4c
commit
6ddbb79af0
@ -12,18 +12,11 @@ import (
|
|||||||
const (
|
const (
|
||||||
commitTest = "fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7"
|
commitTest = "fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7"
|
||||||
|
|
||||||
// FromFile test
|
|
||||||
formatedLangGold = "test_files/formated_languages.gold"
|
|
||||||
formatedContentGold = "test_files/formated_content.gold"
|
|
||||||
formatedVendorGold = "test_files/formated_vendor.gold"
|
|
||||||
formatedDocumentationGold = "test_files/formated_documentation.gold"
|
|
||||||
formatedTypesGold = "test_files/formated_type.gold"
|
|
||||||
|
|
||||||
// Languages test
|
// Languages test
|
||||||
ymlTestFile = "test_files/languages.test.yml"
|
ymlTestFile = "test_files/languages.test.yml"
|
||||||
langGold = "test_files/languages.gold"
|
langGold = "test_files/languages.gold"
|
||||||
languagesTestTmplPath = "test_files/languages.test.tmpl"
|
languagesTestTmplPath = "test_files/languages.test.go.tmpl"
|
||||||
languagesTestTmplName = "languages.test.tmpl"
|
languagesTestTmplName = "languages.test.go.tmpl"
|
||||||
|
|
||||||
// Heuristics test
|
// Heuristics test
|
||||||
heuristicsTestFile = "test_files/heuristics.test.rb"
|
heuristicsTestFile = "test_files/heuristics.test.rb"
|
||||||
@ -51,19 +44,19 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestFromFile(t *testing.T) {
|
func TestFromFile(t *testing.T) {
|
||||||
goldLang, err := ioutil.ReadFile(formatedLangGold)
|
goldLang, err := ioutil.ReadFile(langGold)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
goldContent, err := ioutil.ReadFile(formatedContentGold)
|
goldContent, err := ioutil.ReadFile(contentGold)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
goldVendor, err := ioutil.ReadFile(formatedVendorGold)
|
goldVendor, err := ioutil.ReadFile(vendorGold)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
goldDocumentation, err := ioutil.ReadFile(formatedDocumentationGold)
|
goldDocumentation, err := ioutil.ReadFile(documentationGold)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
goldTypes, err := ioutil.ReadFile(formatedTypesGold)
|
goldTypes, err := ioutil.ReadFile(typesGold)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
outPathLang, err := ioutil.TempFile("/tmp", "generator-test-")
|
outPathLang, err := ioutil.TempFile("/tmp", "generator-test-")
|
||||||
@ -137,7 +130,7 @@ func TestFromFile(t *testing.T) {
|
|||||||
wantOut: goldDocumentation,
|
wantOut: goldDocumentation,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "tyTestFromFile_Types",
|
name: "TestFromFile_Types",
|
||||||
fileToParse: typesTestFile,
|
fileToParse: typesTestFile,
|
||||||
outPath: outPathTypes.Name(),
|
outPath: outPathTypes.Name(),
|
||||||
tmplPath: typesTestTmplPath,
|
tmplPath: typesTestTmplPath,
|
||||||
@ -158,173 +151,3 @@ func TestFromFile(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLanguages(t *testing.T) {
|
|
||||||
gold, err := ioutil.ReadFile(langGold)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(ymlTestFile)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
input []byte
|
|
||||||
tmplPath string
|
|
||||||
tmplName string
|
|
||||||
commit string
|
|
||||||
wantOut []byte
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "TestLanguages",
|
|
||||||
input: input,
|
|
||||||
tmplPath: languagesTestTmplPath,
|
|
||||||
tmplName: languagesTestTmplName,
|
|
||||||
commit: commitTest,
|
|
||||||
wantOut: gold,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
out, err := Languages(tt.input, tt.tmplPath, tt.tmplName, tt.commit)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.EqualValues(t, tt.wantOut, out, fmt.Sprintf("Languages() = %v, want %v", string(out), string(tt.wantOut)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHeuristics(t *testing.T) {
|
|
||||||
gold, err := ioutil.ReadFile(contentGold)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(heuristicsTestFile)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
input []byte
|
|
||||||
tmplPath string
|
|
||||||
tmplName string
|
|
||||||
commit string
|
|
||||||
wantOut []byte
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "TestHeuristics",
|
|
||||||
input: input,
|
|
||||||
tmplPath: contentTestTmplPath,
|
|
||||||
tmplName: contentTestTmplName,
|
|
||||||
commit: commitTest,
|
|
||||||
wantOut: gold,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
out, err := Heuristics(tt.input, tt.tmplPath, tt.tmplName, tt.commit)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.EqualValues(t, tt.wantOut, out, fmt.Sprintf("Heuristics() = %v, want %v", string(out), string(tt.wantOut)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestVendor(t *testing.T) {
|
|
||||||
gold, err := ioutil.ReadFile(vendorGold)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(vendorTestFile)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
input []byte
|
|
||||||
tmplPath string
|
|
||||||
tmplName string
|
|
||||||
commit string
|
|
||||||
wantOut []byte
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "TestVendor",
|
|
||||||
input: input,
|
|
||||||
tmplPath: vendorTestTmplPath,
|
|
||||||
tmplName: vendorTestTmplName,
|
|
||||||
commit: commitTest,
|
|
||||||
wantOut: gold,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
out, err := Vendor(tt.input, tt.tmplPath, tt.tmplName, tt.commit)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.EqualValues(t, tt.wantOut, out, fmt.Sprintf("Vendor() = %v, want %v", string(out), string(tt.wantOut)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDocumentation(t *testing.T) {
|
|
||||||
gold, err := ioutil.ReadFile(documentationGold)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(documentationTestFile)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
input []byte
|
|
||||||
tmplPath string
|
|
||||||
tmplName string
|
|
||||||
commit string
|
|
||||||
wantOut []byte
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "TestDocumentation",
|
|
||||||
input: input,
|
|
||||||
tmplPath: documentationTestTmplPath,
|
|
||||||
tmplName: documentationTestTmplName,
|
|
||||||
commit: commitTest,
|
|
||||||
wantOut: gold,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
out, err := Documentation(tt.input, tt.tmplPath, tt.tmplName, tt.commit)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.EqualValues(t, tt.wantOut, out, fmt.Sprintf("Documentation() = %v, want %v", string(out), string(tt.wantOut)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTypes(t *testing.T) {
|
|
||||||
gold, err := ioutil.ReadFile(typesGold)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
input, err := ioutil.ReadFile(typesTestFile)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
input []byte
|
|
||||||
tmplPath string
|
|
||||||
tmplName string
|
|
||||||
commit string
|
|
||||||
wantOut []byte
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "TestTypes",
|
|
||||||
input: input,
|
|
||||||
tmplPath: typesTestTmplPath,
|
|
||||||
tmplName: typesTestTmplName,
|
|
||||||
commit: commitTest,
|
|
||||||
wantOut: gold,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
out, err := Types(tt.input, tt.tmplPath, tt.tmplName, tt.commit)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.EqualValues(t, tt.wantOut, out, fmt.Sprintf("Types() = %v, want %v", string(out), string(tt.wantOut)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -20,7 +20,7 @@ func GetLanguageByContent(filename string, content []byte) (lang string, safe bo
|
|||||||
return GetLanguageByExtension(filename)
|
return GetLanguageByExtension(filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
type languageMatcher func ([]byte) (string, bool)
|
type languageMatcher func([]byte) (string, bool)
|
||||||
|
|
||||||
var matchers = map[string]languageMatcher{
|
var matchers = map[string]languageMatcher{
|
||||||
".asc": func(i []byte) (string, bool) {
|
".asc": func(i []byte) (string, bool) {
|
||||||
@ -63,19 +63,19 @@ var matchers = map[string]languageMatcher{
|
|||||||
|
|
||||||
return OtherLanguage, false
|
return OtherLanguage, false
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
asc_PublicKey_Matcher_0 = regexp.MustCompile(`(?m)^(----[- ]BEGIN|ssh-(rsa|dss)) `)
|
asc_PublicKey_Matcher_0 = regexp.MustCompile(`(?m)^(----[- ]BEGIN|ssh-(rsa|dss)) `)
|
||||||
asc_AsciiDoc_Matcher_0 = regexp.MustCompile(`(?m)^[=-]+(\s|\n)|{{[A-Za-z]`)
|
asc_AsciiDoc_Matcher_0 = regexp.MustCompile(`(?m)^[=-]+(\s|\n)|{{[A-Za-z]`)
|
||||||
asc_AGSScript_Matcher_0 = regexp.MustCompile(`(?m)^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])`)
|
asc_AGSScript_Matcher_0 = regexp.MustCompile(`(?m)^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])`)
|
||||||
ms_Groff_Matcher_0 = regexp.MustCompile(`(?mi)^[.'][a-z][a-z](\s|$)`)
|
ms_Groff_Matcher_0 = regexp.MustCompile(`(?mi)^[.'][a-z][a-z](\s|$)`)
|
||||||
mod_XML_Matcher_0 = regexp.MustCompile(`(?m)<!ENTITY `)
|
mod_XML_Matcher_0 = regexp.MustCompile(`(?m)<!ENTITY `)
|
||||||
mod_ModulaDash2_Matcher_0 = regexp.MustCompile(`(?mi)^\s*MODULE [\w\.]+;`)
|
mod_ModulaDash2_Matcher_0 = regexp.MustCompile(`(?mi)^\s*MODULE [\w\.]+;`)
|
||||||
mod_ModulaDash2_Matcher_1 = regexp.MustCompile(`(?mi)^\s*END [\w\.]+;`)
|
mod_ModulaDash2_Matcher_1 = regexp.MustCompile(`(?mi)^\s*END [\w\.]+;`)
|
||||||
pro_Prolog_Matcher_0 = regexp.MustCompile(`(?m)^[^#]+:-`)
|
pro_Prolog_Matcher_0 = regexp.MustCompile(`(?m)^[^#]+:-`)
|
||||||
pro_INI_Matcher_0 = regexp.MustCompile(`(?m)last_client=`)
|
pro_INI_Matcher_0 = regexp.MustCompile(`(?m)last_client=`)
|
||||||
pro_QMake_Matcher_0 = regexp.MustCompile(`(?m)HEADERS`)
|
pro_QMake_Matcher_0 = regexp.MustCompile(`(?m)HEADERS`)
|
||||||
pro_QMake_Matcher_1 = regexp.MustCompile(`(?m)SOURCES`)
|
pro_QMake_Matcher_1 = regexp.MustCompile(`(?m)SOURCES`)
|
||||||
pro_IDL_Matcher_0 = regexp.MustCompile(`(?m)^\s*function[ \w,]+$`)
|
pro_IDL_Matcher_0 = regexp.MustCompile(`(?m)^\s*function[ \w,]+$`)
|
||||||
)
|
)
|
||||||
|
@ -22,4 +22,4 @@ var documentationMatchers = substring.Or(
|
|||||||
substring.Regexp(`(^|/)README(\.|$)`),
|
substring.Regexp(`(^|/)README(\.|$)`),
|
||||||
substring.Regexp(`(^|/)[Rr]eadme(\.|$)`),
|
substring.Regexp(`(^|/)[Rr]eadme(\.|$)`),
|
||||||
substring.Regexp(`^[Ss]amples?/`),
|
substring.Regexp(`^[Ss]amples?/`),
|
||||||
)
|
)
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
package slinguist
|
|
||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
|
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
|
||||||
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
|
||||||
|
|
||||||
import (
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GetLanguageByContent(filename string, content []byte) (lang string, safe bool) {
|
|
||||||
ext := strings.ToLower(filepath.Ext(filename))
|
|
||||||
if fnMatcher, ok := matchers[ext]; ok {
|
|
||||||
lang, safe = fnMatcher(content)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetLanguageByExtension(filename)
|
|
||||||
}
|
|
||||||
|
|
||||||
type languageMatcher func([]byte) (string, bool)
|
|
||||||
|
|
||||||
var matchers = map[string]languageMatcher{
|
|
||||||
".asc": func(i []byte) (string, bool) {
|
|
||||||
if asc_PublicKey_Matcher_0.Match(i) {
|
|
||||||
return "Public Key", true
|
|
||||||
} else if asc_AsciiDoc_Matcher_0.Match(i) {
|
|
||||||
return "AsciiDoc", true
|
|
||||||
} else if asc_AGSScript_Matcher_0.Match(i) {
|
|
||||||
return "AGS Script", true
|
|
||||||
}
|
|
||||||
|
|
||||||
return OtherLanguage, false
|
|
||||||
},
|
|
||||||
".ms": func(i []byte) (string, bool) {
|
|
||||||
if ms_Groff_Matcher_0.Match(i) {
|
|
||||||
return "Groff", true
|
|
||||||
}
|
|
||||||
|
|
||||||
return "MAXScript", true
|
|
||||||
},
|
|
||||||
".mod": func(i []byte) (string, bool) {
|
|
||||||
if mod_XML_Matcher_0.Match(i) {
|
|
||||||
return "XML", true
|
|
||||||
} else if mod_ModulaDash2_Matcher_0.Match(i) || mod_ModulaDash2_Matcher_1.Match(i) {
|
|
||||||
return "Modula-2", true
|
|
||||||
}
|
|
||||||
|
|
||||||
return "Linux Kernel Module", false
|
|
||||||
},
|
|
||||||
".pro": func(i []byte) (string, bool) {
|
|
||||||
if pro_Prolog_Matcher_0.Match(i) {
|
|
||||||
return "Prolog", true
|
|
||||||
} else if pro_INI_Matcher_0.Match(i) {
|
|
||||||
return "INI", true
|
|
||||||
} else if pro_QMake_Matcher_0.Match(i) && pro_QMake_Matcher_1.Match(i) {
|
|
||||||
return "QMake", true
|
|
||||||
} else if pro_IDL_Matcher_0.Match(i) {
|
|
||||||
return "IDL", true
|
|
||||||
}
|
|
||||||
|
|
||||||
return OtherLanguage, false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
asc_PublicKey_Matcher_0 = regexp.MustCompile(`(?m)^(----[- ]BEGIN|ssh-(rsa|dss)) `)
|
|
||||||
asc_AsciiDoc_Matcher_0 = regexp.MustCompile(`(?m)^[=-]+(\s|\n)|{{[A-Za-z]`)
|
|
||||||
asc_AGSScript_Matcher_0 = regexp.MustCompile(`(?m)^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])`)
|
|
||||||
ms_Groff_Matcher_0 = regexp.MustCompile(`(?mi)^[.'][a-z][a-z](\s|$)`)
|
|
||||||
mod_XML_Matcher_0 = regexp.MustCompile(`(?m)<!ENTITY `)
|
|
||||||
mod_ModulaDash2_Matcher_0 = regexp.MustCompile(`(?mi)^\s*MODULE [\w\.]+;`)
|
|
||||||
mod_ModulaDash2_Matcher_1 = regexp.MustCompile(`(?mi)^\s*END [\w\.]+;`)
|
|
||||||
pro_Prolog_Matcher_0 = regexp.MustCompile(`(?m)^[^#]+:-`)
|
|
||||||
pro_INI_Matcher_0 = regexp.MustCompile(`(?m)last_client=`)
|
|
||||||
pro_QMake_Matcher_0 = regexp.MustCompile(`(?m)HEADERS`)
|
|
||||||
pro_QMake_Matcher_1 = regexp.MustCompile(`(?m)SOURCES`)
|
|
||||||
pro_IDL_Matcher_0 = regexp.MustCompile(`(?m)^\s*function[ \w,]+$`)
|
|
||||||
)
|
|
@ -1,25 +0,0 @@
|
|||||||
package slinguist
|
|
||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
|
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
|
||||||
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
|
||||||
|
|
||||||
import "gopkg.in/toqueteos/substring.v1"
|
|
||||||
|
|
||||||
var documentationMatchers = substring.Or(
|
|
||||||
substring.Regexp(`^[Dd]ocs?/`),
|
|
||||||
substring.Regexp(`(^|/)[Dd]ocumentation/`),
|
|
||||||
substring.Regexp(`(^|/)[Jj]avadoc/`),
|
|
||||||
substring.Regexp(`^[Mm]an/`),
|
|
||||||
substring.Regexp(`^[Ee]xamples/`),
|
|
||||||
substring.Regexp(`^[Dd]emos?/`),
|
|
||||||
substring.Regexp(`(^|/)CHANGE(S|LOG)?(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)CONTRIBUTING(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)COPYING(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)INSTALL(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)LICEN[CS]E(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)[Ll]icen[cs]e(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)README(\.|$)`),
|
|
||||||
substring.Regexp(`(^|/)[Rr]eadme(\.|$)`),
|
|
||||||
substring.Regexp(`^[Ss]amples?/`),
|
|
||||||
)
|
|
@ -1,12 +0,0 @@
|
|||||||
package slinguist
|
|
||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
|
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
|
||||||
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
|
||||||
|
|
||||||
var languagesByExtension = map[string][]string{
|
|
||||||
".abap": {"ABAP"},
|
|
||||||
".abnf": {"ABNF"},
|
|
||||||
".bsl": {"1C Enterprise"},
|
|
||||||
".os": {"1C Enterprise"},
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package slinguist
|
|
||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
|
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
|
||||||
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
|
||||||
|
|
||||||
type Type int
|
|
||||||
|
|
||||||
const (
|
|
||||||
TypeUnknown Type = iota
|
|
||||||
TypeData
|
|
||||||
TypeProgramming
|
|
||||||
TypeMarkup
|
|
||||||
TypeProse
|
|
||||||
)
|
|
||||||
|
|
||||||
func GetLanguageType(language string) (langType Type) {
|
|
||||||
langType, _ = languagesType[language]
|
|
||||||
return langType
|
|
||||||
}
|
|
||||||
|
|
||||||
var languagesType = map[string]Type{
|
|
||||||
"Scaml": TypeMarkup,
|
|
||||||
"Scheme": TypeProgramming,
|
|
||||||
"Scilab": TypeProgramming,
|
|
||||||
"Self": TypeProgramming,
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package slinguist
|
|
||||||
|
|
||||||
// CODE GENERATED AUTOMATICALLY WITH github.com/src-d/simple-linguist/cli/slinguist-generate
|
|
||||||
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
|
||||||
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
|
||||||
|
|
||||||
import "gopkg.in/toqueteos/substring.v1"
|
|
||||||
|
|
||||||
var vendorMatchers = substring.Or(
|
|
||||||
substring.Regexp(`(^|/)cache/`),
|
|
||||||
substring.Regexp(`^[Dd]ependencies/`),
|
|
||||||
substring.Regexp(`(^|/)dist/`),
|
|
||||||
substring.Regexp(`^deps/`),
|
|
||||||
substring.Regexp(`^tools/`),
|
|
||||||
substring.Regexp(`(^|/)configure$`),
|
|
||||||
substring.Regexp(`(^|/)config.guess$`),
|
|
||||||
substring.Regexp(`(^|/)config.sub$`),
|
|
||||||
substring.Regexp(`(^|/)aclocal.m4`),
|
|
||||||
substring.Regexp(`(^|/)libtool.m4`),
|
|
||||||
substring.Regexp(`(^|/)ltoptions.m4`),
|
|
||||||
substring.Regexp(`(^|/)ltsugar.m4`),
|
|
||||||
substring.Regexp(`(^|/)ltversion.m4`),
|
|
||||||
substring.Regexp(`(^|/)lt~obsolete.m4`),
|
|
||||||
)
|
|
@ -5,8 +5,8 @@ package slinguist
|
|||||||
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
// Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7
|
||||||
|
|
||||||
var languagesByExtension = map[string][]string{
|
var languagesByExtension = map[string][]string{
|
||||||
".abap": {"ABAP"},
|
".abap": {"ABAP"},
|
||||||
".abnf": {"ABNF"},
|
".abnf": {"ABNF"},
|
||||||
".bsl": {"1C Enterprise"},
|
".bsl": {"1C Enterprise"},
|
||||||
".os": {"1C Enterprise"},
|
".os": {"1C Enterprise"},
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,11 @@
|
|||||||
---
|
---
|
||||||
1C Enterprise:
|
1C Enterprise:
|
||||||
type: programming
|
|
||||||
color: "#814CCC"
|
|
||||||
extensions:
|
extensions:
|
||||||
- ".bsl"
|
- ".bsl"
|
||||||
- ".os"
|
- ".os"
|
||||||
tm_scope: source.bsl
|
|
||||||
ace_mode: text
|
|
||||||
language_id: 0
|
|
||||||
ABAP:
|
ABAP:
|
||||||
type: programming
|
|
||||||
color: "#E8274B"
|
|
||||||
extensions:
|
extensions:
|
||||||
- ".abap"
|
- ".abap"
|
||||||
ace_mode: abap
|
|
||||||
language_id: 1
|
|
||||||
ABNF:
|
ABNF:
|
||||||
type: data
|
|
||||||
ace_mode: text
|
|
||||||
extensions:
|
extensions:
|
||||||
- ".abnf"
|
- ".abnf"
|
||||||
tm_scope: source.abnf
|
|
||||||
language_id: 429
|
|
@ -20,8 +20,8 @@ func GetLanguageType(language string) (langType Type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var languagesType = map[string]Type{
|
var languagesType = map[string]Type{
|
||||||
"Scaml": TypeMarkup,
|
"Scaml": TypeMarkup,
|
||||||
"Scheme": TypeProgramming,
|
"Scheme": TypeProgramming,
|
||||||
"Scilab": TypeProgramming,
|
"Scilab": TypeProgramming,
|
||||||
"Self": TypeProgramming,
|
"Self": TypeProgramming,
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,11 @@
|
|||||||
---
|
---
|
||||||
Scaml:
|
Scaml:
|
||||||
group: HTML
|
|
||||||
type: markup
|
type: markup
|
||||||
extensions:
|
|
||||||
- ".scaml"
|
|
||||||
tm_scope: source.scaml
|
|
||||||
ace_mode: text
|
|
||||||
language_id: 342
|
|
||||||
Scheme:
|
Scheme:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#1e4aec"
|
|
||||||
extensions:
|
|
||||||
- ".scm"
|
|
||||||
- ".sld"
|
|
||||||
- ".sls"
|
|
||||||
- ".sps"
|
|
||||||
- ".ss"
|
|
||||||
interpreters:
|
|
||||||
- guile
|
|
||||||
- bigloo
|
|
||||||
- chicken
|
|
||||||
- csi
|
|
||||||
- gosh
|
|
||||||
- r6rs
|
|
||||||
ace_mode: scheme
|
|
||||||
codemirror_mode: scheme
|
|
||||||
codemirror_mime_type: text/x-scheme
|
|
||||||
language_id: 343
|
|
||||||
Scilab:
|
Scilab:
|
||||||
type: programming
|
type: programming
|
||||||
extensions:
|
|
||||||
- ".sci"
|
|
||||||
- ".sce"
|
|
||||||
- ".tst"
|
|
||||||
ace_mode: text
|
|
||||||
language_id: 344
|
|
||||||
Self:
|
Self:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#0579aa"
|
|
||||||
extensions:
|
|
||||||
- ".self"
|
|
||||||
tm_scope: none
|
|
||||||
ace_mode: text
|
|
||||||
language_id: 345
|
|
||||||
|
|
@ -21,4 +21,4 @@ var vendorMatchers = substring.Or(
|
|||||||
substring.Regexp(`(^|/)ltsugar.m4`),
|
substring.Regexp(`(^|/)ltsugar.m4`),
|
||||||
substring.Regexp(`(^|/)ltversion.m4`),
|
substring.Regexp(`(^|/)ltversion.m4`),
|
||||||
substring.Regexp(`(^|/)lt~obsolete.m4`),
|
substring.Regexp(`(^|/)lt~obsolete.m4`),
|
||||||
)
|
)
|
||||||
|
@ -37,6 +37,11 @@ const (
|
|||||||
typeTmplPath = "internal/code-generator/assets/type.go.tmpl"
|
typeTmplPath = "internal/code-generator/assets/type.go.tmpl"
|
||||||
typeTmpl = "type.go.tmpl"
|
typeTmpl = "type.go.tmpl"
|
||||||
|
|
||||||
|
// interpreters_map.go generation
|
||||||
|
interpretersFile = "interpreters_map.go"
|
||||||
|
interpretersTmplPath = "internal/code-generator/assets/interpreters.go.tmpl"
|
||||||
|
interpretersTmpl = "interpreters.go.tmpl"
|
||||||
|
|
||||||
commitPath = ".git/refs/heads/master"
|
commitPath = ".git/refs/heads/master"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user