Merge pull request #3208 from dmaluka/restore-header-matches
Reintroduce `header` patterns for filetype detection
This commit is contained in:
commit
2ab1b3132e
35 changed files with 148 additions and 61 deletions
|
@ -693,15 +693,16 @@ func (b *Buffer) UpdateRules() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// syntaxFileBuffer is a helper structure
|
// syntaxFileInfo is an internal helper structure
|
||||||
// to store properties of one single syntax file
|
// to store properties of one single syntax file
|
||||||
type syntaxFileBuffer struct {
|
type syntaxFileInfo struct {
|
||||||
header *highlight.Header
|
header *highlight.Header
|
||||||
fileName string
|
fileName string
|
||||||
syntaxDef *highlight.Def
|
syntaxDef *highlight.Def
|
||||||
}
|
}
|
||||||
|
|
||||||
syntaxFiles := []syntaxFileBuffer{}
|
fnameMatches := []syntaxFileInfo{}
|
||||||
|
headerMatches := []syntaxFileInfo{}
|
||||||
syntaxFile := ""
|
syntaxFile := ""
|
||||||
foundDef := false
|
foundDef := false
|
||||||
var header *highlight.Header
|
var header *highlight.Header
|
||||||
|
@ -718,26 +719,46 @@ func (b *Buffer) UpdateRules() {
|
||||||
screen.TermMessage("Error parsing header for syntax file " + f.Name() + ": " + err.Error())
|
screen.TermMessage("Error parsing header for syntax file " + f.Name() + ": " + err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matchedFileType := false
|
||||||
|
matchedFileName := false
|
||||||
|
matchedFileHeader := false
|
||||||
|
|
||||||
|
if ft == "unknown" || ft == "" {
|
||||||
|
if header.MatchFileName(b.Path) {
|
||||||
|
matchedFileName = true
|
||||||
|
}
|
||||||
|
if len(fnameMatches) == 0 && header.MatchFileHeader(b.lines[0].data) {
|
||||||
|
matchedFileHeader = true
|
||||||
|
}
|
||||||
|
} else if header.FileType == ft {
|
||||||
|
matchedFileType = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if matchedFileType || matchedFileName || matchedFileHeader {
|
||||||
file, err := highlight.ParseFile(data)
|
file, err := highlight.ParseFile(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
|
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ft == "unknown" || ft == "") && header.MatchFileName(b.Path)) || header.FileType == ft {
|
|
||||||
syndef, err := highlight.ParseDef(file, header)
|
syndef, err := highlight.ParseDef(file, header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
|
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
foundDef = true
|
|
||||||
|
|
||||||
if header.FileType == ft {
|
if matchedFileType {
|
||||||
b.SyntaxDef = syndef
|
b.SyntaxDef = syndef
|
||||||
syntaxFile = f.Name()
|
syntaxFile = f.Name()
|
||||||
|
foundDef = true
|
||||||
break
|
break
|
||||||
} else {
|
}
|
||||||
syntaxFiles = append(syntaxFiles, syntaxFileBuffer{header, f.Name(), syndef})
|
|
||||||
|
if matchedFileName {
|
||||||
|
fnameMatches = append(fnameMatches, syntaxFileInfo{header, f.Name(), syndef})
|
||||||
|
} else if matchedFileHeader {
|
||||||
|
headerMatches = append(headerMatches, syntaxFileInfo{header, f.Name(), syndef})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -759,7 +780,10 @@ func (b *Buffer) UpdateRules() {
|
||||||
|
|
||||||
if ft == "unknown" || ft == "" {
|
if ft == "unknown" || ft == "" {
|
||||||
if header.MatchFileName(b.Path) {
|
if header.MatchFileName(b.Path) {
|
||||||
syntaxFiles = append(syntaxFiles, syntaxFileBuffer{header, f.Name(), nil})
|
fnameMatches = append(fnameMatches, syntaxFileInfo{header, f.Name(), nil})
|
||||||
|
}
|
||||||
|
if len(fnameMatches) == 0 && header.MatchFileHeader(b.lines[0].data) {
|
||||||
|
headerMatches = append(headerMatches, syntaxFileInfo{header, f.Name(), nil})
|
||||||
}
|
}
|
||||||
} else if header.FileType == ft {
|
} else if header.FileType == ft {
|
||||||
syntaxFile = f.Name()
|
syntaxFile = f.Name()
|
||||||
|
@ -769,33 +793,49 @@ func (b *Buffer) UpdateRules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if syntaxFile == "" {
|
if syntaxFile == "" {
|
||||||
length := len(syntaxFiles)
|
matches := fnameMatches
|
||||||
|
if len(matches) == 0 {
|
||||||
|
matches = headerMatches
|
||||||
|
}
|
||||||
|
|
||||||
|
length := len(matches)
|
||||||
if length > 0 {
|
if length > 0 {
|
||||||
signatureMatch := false
|
signatureMatch := false
|
||||||
if length > 1 {
|
if length > 1 {
|
||||||
|
// multiple matching syntax files found, try to resolve the ambiguity
|
||||||
|
// using signatures
|
||||||
detectlimit := util.IntOpt(b.Settings["detectlimit"])
|
detectlimit := util.IntOpt(b.Settings["detectlimit"])
|
||||||
lineCount := len(b.lines)
|
lineCount := len(b.lines)
|
||||||
limit := lineCount
|
limit := lineCount
|
||||||
if detectlimit > 0 && lineCount > detectlimit {
|
if detectlimit > 0 && lineCount > detectlimit {
|
||||||
limit = detectlimit
|
limit = detectlimit
|
||||||
}
|
}
|
||||||
for i := 0; i < length && !signatureMatch; i++ {
|
|
||||||
if syntaxFiles[i].header.HasFileSignature() {
|
matchLoop:
|
||||||
for j := 0; j < limit && !signatureMatch; j++ {
|
for _, m := range matches {
|
||||||
if syntaxFiles[i].header.MatchFileSignature(b.lines[j].data) {
|
if m.header.HasFileSignature() {
|
||||||
syntaxFile = syntaxFiles[i].fileName
|
for i := 0; i < limit; i++ {
|
||||||
b.SyntaxDef = syntaxFiles[i].syntaxDef
|
if m.header.MatchFileSignature(b.lines[i].data) {
|
||||||
header = syntaxFiles[i].header
|
syntaxFile = m.fileName
|
||||||
|
if m.syntaxDef != nil {
|
||||||
|
b.SyntaxDef = m.syntaxDef
|
||||||
|
foundDef = true
|
||||||
|
}
|
||||||
|
header = m.header
|
||||||
signatureMatch = true
|
signatureMatch = true
|
||||||
|
break matchLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if length == 1 || !signatureMatch {
|
if length == 1 || !signatureMatch {
|
||||||
syntaxFile = syntaxFiles[0].fileName
|
syntaxFile = matches[0].fileName
|
||||||
b.SyntaxDef = syntaxFiles[0].syntaxDef
|
if matches[0].syntaxDef != nil {
|
||||||
header = syntaxFiles[0].header
|
b.SyntaxDef = matches[0].syntaxDef
|
||||||
|
foundDef = true
|
||||||
|
}
|
||||||
|
header = matches[0].header
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ type Def struct {
|
||||||
type Header struct {
|
type Header struct {
|
||||||
FileType string
|
FileType string
|
||||||
FileNameRegex *regexp.Regexp
|
FileNameRegex *regexp.Regexp
|
||||||
|
HeaderRegex *regexp.Regexp
|
||||||
SignatureRegex *regexp.Regexp
|
SignatureRegex *regexp.Regexp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ type HeaderYaml struct {
|
||||||
FileType string `yaml:"filetype"`
|
FileType string `yaml:"filetype"`
|
||||||
Detect struct {
|
Detect struct {
|
||||||
FNameRegexStr string `yaml:"filename"`
|
FNameRegexStr string `yaml:"filename"`
|
||||||
|
HeaderRegexStr string `yaml:"header"`
|
||||||
SignatureRegexStr string `yaml:"signature"`
|
SignatureRegexStr string `yaml:"signature"`
|
||||||
} `yaml:"detect"`
|
} `yaml:"detect"`
|
||||||
}
|
}
|
||||||
|
@ -96,18 +98,22 @@ func init() {
|
||||||
// A yaml file might take ~400us to parse while a header file only takes ~20us
|
// A yaml file might take ~400us to parse while a header file only takes ~20us
|
||||||
func MakeHeader(data []byte) (*Header, error) {
|
func MakeHeader(data []byte) (*Header, error) {
|
||||||
lines := bytes.Split(data, []byte{'\n'})
|
lines := bytes.Split(data, []byte{'\n'})
|
||||||
if len(lines) < 3 {
|
if len(lines) < 4 {
|
||||||
return nil, errors.New("Header file has incorrect format")
|
return nil, errors.New("Header file has incorrect format")
|
||||||
}
|
}
|
||||||
header := new(Header)
|
header := new(Header)
|
||||||
var err error
|
var err error
|
||||||
header.FileType = string(lines[0])
|
header.FileType = string(lines[0])
|
||||||
fnameRegexStr := string(lines[1])
|
fnameRegexStr := string(lines[1])
|
||||||
signatureRegexStr := string(lines[2])
|
headerRegexStr := string(lines[2])
|
||||||
|
signatureRegexStr := string(lines[3])
|
||||||
|
|
||||||
if fnameRegexStr != "" {
|
if fnameRegexStr != "" {
|
||||||
header.FileNameRegex, err = regexp.Compile(fnameRegexStr)
|
header.FileNameRegex, err = regexp.Compile(fnameRegexStr)
|
||||||
}
|
}
|
||||||
|
if err == nil && headerRegexStr != "" {
|
||||||
|
header.HeaderRegex, err = regexp.Compile(headerRegexStr)
|
||||||
|
}
|
||||||
if err == nil && signatureRegexStr != "" {
|
if err == nil && signatureRegexStr != "" {
|
||||||
header.SignatureRegex, err = regexp.Compile(signatureRegexStr)
|
header.SignatureRegex, err = regexp.Compile(signatureRegexStr)
|
||||||
}
|
}
|
||||||
|
@ -134,6 +140,9 @@ func MakeHeaderYaml(data []byte) (*Header, error) {
|
||||||
if hdrYaml.Detect.FNameRegexStr != "" {
|
if hdrYaml.Detect.FNameRegexStr != "" {
|
||||||
header.FileNameRegex, err = regexp.Compile(hdrYaml.Detect.FNameRegexStr)
|
header.FileNameRegex, err = regexp.Compile(hdrYaml.Detect.FNameRegexStr)
|
||||||
}
|
}
|
||||||
|
if err == nil && hdrYaml.Detect.HeaderRegexStr != "" {
|
||||||
|
header.HeaderRegex, err = regexp.Compile(hdrYaml.Detect.HeaderRegexStr)
|
||||||
|
}
|
||||||
if err == nil && hdrYaml.Detect.SignatureRegexStr != "" {
|
if err == nil && hdrYaml.Detect.SignatureRegexStr != "" {
|
||||||
header.SignatureRegex, err = regexp.Compile(hdrYaml.Detect.SignatureRegexStr)
|
header.SignatureRegex, err = regexp.Compile(hdrYaml.Detect.SignatureRegexStr)
|
||||||
}
|
}
|
||||||
|
@ -154,6 +163,14 @@ func (header *Header) MatchFileName(filename string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (header *Header) MatchFileHeader(firstLine []byte) bool {
|
||||||
|
if header.HeaderRegex != nil {
|
||||||
|
return header.HeaderRegex.Match(firstLine)
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// HasFileSignature checks the presence of a stored signature
|
// HasFileSignature checks the presence of a stored signature
|
||||||
func (header *Header) HasFileSignature() bool {
|
func (header *Header) HasFileSignature() bool {
|
||||||
return header.SignatureRegex != nil
|
return header.SignatureRegex != nil
|
||||||
|
|
|
@ -271,13 +271,40 @@ detect:
|
||||||
```
|
```
|
||||||
|
|
||||||
Micro will match this regex against a given filename to detect the filetype.
|
Micro will match this regex against a given filename to detect the filetype.
|
||||||
You may also provide an optional `signature` regex that will check a certain
|
|
||||||
amount of lines of a file to find specific marks. For example:
|
In addition to the `filename` regex (or even instead of it) you can provide
|
||||||
|
a `header` regex that will check the first line of the line. For example:
|
||||||
|
|
||||||
```
|
```
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.ya?ml$"
|
filename: "\\.ya?ml$"
|
||||||
signature: "%YAML"
|
header: "%YAML"
|
||||||
|
```
|
||||||
|
|
||||||
|
This is useful in cases when the given file name is not sufficient to determine
|
||||||
|
the filetype, e.g. with the above example, if a YAML file has no `.yaml`
|
||||||
|
extension but may contain a `%YAML` directive in its first line.
|
||||||
|
|
||||||
|
`filename` takes precedence over `header`, i.e. if there is a syntax file that
|
||||||
|
matches the file with a filetype by the `filename` and another syntax file that
|
||||||
|
matches the same file with another filetype by the `header`, the first filetype
|
||||||
|
will be used.
|
||||||
|
|
||||||
|
Finally, in addition to `filename` and/or `header` (but not instead of them)
|
||||||
|
you may also provide an optional `signature` regex which is useful for resolving
|
||||||
|
ambiguities when there are multiple syntax files matching the same file with
|
||||||
|
different filetypes. If a `signature` regex is given, micro will match a certain
|
||||||
|
amount of first lines in the file (this amount is determined by the `detectlimit`
|
||||||
|
option) against this regex, and if any of the lines match, this syntax file's
|
||||||
|
filetype will be preferred over other matching filetypes.
|
||||||
|
|
||||||
|
For example, to distinguish C++ header files from C and Objective-C header files
|
||||||
|
that have the same `.h` extension:
|
||||||
|
|
||||||
|
```
|
||||||
|
detect:
|
||||||
|
filename: "\\.c(c|pp|xx)$|\\.h(h|pp|xx)?$"
|
||||||
|
signature: "namespace|template|public|protected|private"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Syntax rules
|
### Syntax rules
|
||||||
|
|
|
@ -5,7 +5,6 @@ filetype: powershell
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.ps(1|m1|d1)$"
|
filename: "\\.ps(1|m1|d1)$"
|
||||||
#signature: ""
|
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# - comment.block: # Block Comment
|
# - comment.block: # Block Comment
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
Here are micro's syntax files.
|
Here are micro's syntax files.
|
||||||
|
|
||||||
Each yaml file specifies how to detect the filetype based on file extension or given signature. The signature can be matched to all available lines of the file or to the value defined with the option `detectlimit` (to limit parse times) for a best "guess".
|
Each yaml file specifies how to detect the filetype based on file extension or header (first line of the line).
|
||||||
|
In addition, a signature can be provided to help resolving ambiguities when multiple matching filetypes are detected.
|
||||||
Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype.
|
Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype.
|
||||||
|
|
||||||
Making your own syntax files is very simple. I recommend you check the file after you are finished with the
|
Making your own syntax files is very simple. I recommend you check the file after you are finished with the
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: awk
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.awk$"
|
filename: "\\.awk$"
|
||||||
signature: "^#!.*bin/(env +)?awk( |$)"
|
header: "^#!.*bin/(env +)?awk( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- preproc: "\\$[A-Za-z0-9_!@#$*?\\-]+"
|
- preproc: "\\$[A-Za-z0-9_!@#$*?\\-]+"
|
||||||
|
|
|
@ -2,7 +2,6 @@ filetype: batch
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.bat$|\\.cmd$)"
|
filename: "(\\.bat$|\\.cmd$)"
|
||||||
# signature: ""
|
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# Numbers
|
# Numbers
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: crontab
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "crontab$"
|
filename: "crontab$"
|
||||||
signature: "^#.*?/etc/crontab"
|
header: "^#.*?/etc/crontab"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# The time and date fields are:
|
# The time and date fields are:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
filetype: csharp-script
|
filetype: csharp-script
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.csx$"
|
filename: "\\.csx$"
|
||||||
signature: "^#!.*/(env +)?dotnet-script( |$)"
|
header: "^#!.*/(env +)?dotnet-script( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- include: "csharp"
|
- include: "csharp"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: fish
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.fish$"
|
filename: "\\.fish$"
|
||||||
signature: "^#!.*/(env +)?fish( |$)"
|
header: "^#!.*/(env +)?fish( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# Numbers
|
# Numbers
|
||||||
|
|
|
@ -5,7 +5,7 @@ filetype: godoc
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.godoc$"
|
filename: "\\.godoc$"
|
||||||
signature: package.*import
|
header: package.*import
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- preproc: "^[^ ].*"
|
- preproc: "^[^ ].*"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: groovy
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.(groovy|gy|gvy|gsh|gradle)$|^[Jj]enkinsfile$)"
|
filename: "(\\.(groovy|gy|gvy|gsh|gradle)$|^[Jj]enkinsfile$)"
|
||||||
signature: "^#!.*/(env +)?groovy *$"
|
header: "^#!.*/(env +)?groovy *$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# And the style guide for constants is CONSTANT_CASE
|
# And the style guide for constants is CONSTANT_CASE
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: html4
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.htm[l]?4$"
|
filename: "\\.htm[l]?4$"
|
||||||
signature: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN|http://www.w3.org/TR/html4/strict.dtd\">"
|
header: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN|http://www.w3.org/TR/html4/strict.dtd\">"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- error: "<[^!].*?>"
|
- error: "<[^!].*?>"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: html5
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.htm[l]?5$"
|
filename: "\\.htm[l]?5$"
|
||||||
signature: "<!DOCTYPE html5>"
|
header: "<!DOCTYPE html5>"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- error: "<[^!].*?>"
|
- error: "<[^!].*?>"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: javascript
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.js$|\\.es[5678]?$|\\.mjs$)"
|
filename: "(\\.js$|\\.es[5678]?$|\\.mjs$)"
|
||||||
signature: "^#!.*/(env +)?node( |$)"
|
header: "^#!.*/(env +)?node( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
|
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: json
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.json$"
|
filename: "\\.json$"
|
||||||
signature: "^\\{$"
|
header: "^\\{$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
|
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: julia
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.jl$"
|
filename: "\\.jl$"
|
||||||
signature: "^#!.*/(env +)?julia( |$)"
|
header: "^#!.*/(env +)?julia( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ filetype: 'justfile'
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(^\\.?[Jj]ustfile|\\.just)$"
|
filename: "(^\\.?[Jj]ustfile|\\.just)$"
|
||||||
signature: "^#!.*/(env +)?[bg]?just --justfile"
|
header: "^#!.*/(env +)?[bg]?just --justfile"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>"
|
- preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: mail
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(.*/mutt-.*|\\.eml)$"
|
filename: "(.*/mutt-.*|\\.eml)$"
|
||||||
signature: "^From .* \\d+:\\d+:\\d+ \\d+"
|
header: "^From .* \\d+:\\d+:\\d+ \\d+"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- type: "^From .*"
|
- type: "^From .*"
|
||||||
|
|
|
@ -18,6 +18,7 @@ type HeaderYaml struct {
|
||||||
FileType string `yaml:"filetype"`
|
FileType string `yaml:"filetype"`
|
||||||
Detect struct {
|
Detect struct {
|
||||||
FNameRgx string `yaml:"filename"`
|
FNameRgx string `yaml:"filename"`
|
||||||
|
HeaderRgx string `yaml:"header"`
|
||||||
SignatureRgx string `yaml:"signature"`
|
SignatureRgx string `yaml:"signature"`
|
||||||
} `yaml:"detect"`
|
} `yaml:"detect"`
|
||||||
}
|
}
|
||||||
|
@ -25,6 +26,7 @@ type HeaderYaml struct {
|
||||||
type Header struct {
|
type Header struct {
|
||||||
FileType string
|
FileType string
|
||||||
FNameRgx string
|
FNameRgx string
|
||||||
|
HeaderRgx string
|
||||||
SignatureRgx string
|
SignatureRgx string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ func encode(name string, c HeaderYaml) {
|
||||||
f, _ := os.Create(name + ".hdr")
|
f, _ := os.Create(name + ".hdr")
|
||||||
f.WriteString(c.FileType + "\n")
|
f.WriteString(c.FileType + "\n")
|
||||||
f.WriteString(c.Detect.FNameRgx + "\n")
|
f.WriteString(c.Detect.FNameRgx + "\n")
|
||||||
|
f.WriteString(c.Detect.HeaderRgx + "\n")
|
||||||
f.WriteString(c.Detect.SignatureRgx + "\n")
|
f.WriteString(c.Detect.SignatureRgx + "\n")
|
||||||
f.Close()
|
f.Close()
|
||||||
}
|
}
|
||||||
|
@ -70,7 +73,8 @@ func decode(name string) Header {
|
||||||
var hdr Header
|
var hdr Header
|
||||||
hdr.FileType = string(strs[0])
|
hdr.FileType = string(strs[0])
|
||||||
hdr.FNameRgx = string(strs[1])
|
hdr.FNameRgx = string(strs[1])
|
||||||
hdr.SignatureRgx = string(strs[2])
|
hdr.HeaderRgx = string(strs[2])
|
||||||
|
hdr.SignatureRgx = string(strs[3])
|
||||||
fmt.Printf("took %v\n", time.Since(start))
|
fmt.Printf("took %v\n", time.Since(start))
|
||||||
|
|
||||||
return hdr
|
return hdr
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: makefile
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "([Mm]akefile|\\.ma?k)$"
|
filename: "([Mm]akefile|\\.ma?k)$"
|
||||||
signature: "^#!.*/(env +)?[bg]?make( |$)"
|
header: "^#!.*/(env +)?[bg]?make( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>"
|
- preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: nginx
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "nginx.*\\.conf$|\\.nginx$"
|
filename: "nginx.*\\.conf$|\\.nginx$"
|
||||||
signature: "^(server|upstream)[a-z ]*\\{$"
|
header: "^(server|upstream)[a-z ]*\\{$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- preproc: "\\b(events|server|http|location|upstream)[[:space:]]*\\{"
|
- preproc: "\\b(events|server|http|location|upstream)[[:space:]]*\\{"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: patch
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.(patch|diff)$"
|
filename: "\\.(patch|diff)$"
|
||||||
signature: "^diff"
|
header: "^diff"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- brightgreen: "^\\+.*"
|
- brightgreen: "^\\+.*"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: perl
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.p[lmp]$"
|
filename: "\\.p[lmp]$"
|
||||||
signature: "^#!.*/(env +)?perl( |$)"
|
header: "^#!.*/(env +)?perl( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|homp|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\\b|\\b(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\\b|\\b(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|say|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\\b|\\b(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\\b|\\b(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b"
|
- type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|homp|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\\b|\\b(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\\b|\\b(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|say|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\\b|\\b(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\\b|\\b(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: python2
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.py2$"
|
filename: "\\.py2$"
|
||||||
signature: "^#!.*/(env +)?python2$"
|
header: "^#!.*/(env +)?python2$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: python
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.py(3)?$"
|
filename: "\\.py(3)?$"
|
||||||
signature: "^#!.*/(env +)?python(3)?$"
|
header: "^#!.*/(env +)?python(3)?$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# built-in objects
|
# built-in objects
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: ruby
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.(rb|rake|gemspec)$|^(.*[\\/])?(Gemfile|config.ru|Rakefile|Capfile|Vagrantfile|Guardfile|Appfile|Fastfile|Pluginfile|Podfile|\\.?[Bb]rewfile)$"
|
filename: "\\.(rb|rake|gemspec)$|^(.*[\\/])?(Gemfile|config.ru|Rakefile|Capfile|Vagrantfile|Guardfile|Appfile|Fastfile|Pluginfile|Podfile|\\.?[Bb]rewfile)$"
|
||||||
signature: "^#!.*/(env +)?ruby( |$)"
|
header: "^#!.*/(env +)?ruby( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- comment.bright:
|
- comment.bright:
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: sage
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.sage$"
|
filename: "\\.sage$"
|
||||||
signature: "^#!.*/(env +)?sage( |$)"
|
header: "^#!.*/(env +)?sage( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: sed
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.sed$"
|
filename: "\\.sed$"
|
||||||
signature: "^#!.*bin/(env +)?sed( |$)"
|
header: "^#!.*bin/(env +)?sed( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- symbol.operator: "[|^$.*+]"
|
- symbol.operator: "[|^$.*+]"
|
||||||
|
|
|
@ -24,7 +24,7 @@ filetype: shell
|
||||||
# * bash-fc. (followed by a random string)
|
# * bash-fc. (followed by a random string)
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.(sh|bash|ash|ebuild)$|(\\.bash(rc|_aliases|_functions|_profile)|\\.?profile|Pkgfile|pkgmk\\.conf|rc\\.conf|PKGBUILD|APKBUILD)$|bash-fc\\.)"
|
filename: "(\\.(sh|bash|ash|ebuild)$|(\\.bash(rc|_aliases|_functions|_profile)|\\.?profile|Pkgfile|pkgmk\\.conf|rc\\.conf|PKGBUILD|APKBUILD)$|bash-fc\\.)"
|
||||||
signature: "^#!.*/(env +)?(ba)?(a)?(mk)?sh( |$)"
|
header: "^#!.*/(env +)?(ba)?(a)?(mk)?sh( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# Numbers
|
# Numbers
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: systemd
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.(service|socket|timer)$"
|
filename: "\\.(service|socket|timer)$"
|
||||||
signature: "^\\[Unit\\]$"
|
header: "^\\[Unit\\]$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- statement: "^(Accept|After|Alias|AllowIsolate|Also|ANSI_COLOR|_AUDIT_LOGINUID|_AUDIT_SESSION|Backlog|Before|BindIPv6Only|BindsTo|BindToDevice|BlockIOReadBandwidth|BlockIOWeight|BlockIOWriteBandwidth|_BOOT_ID|Broadcast|BUG_REPORT_URL|BusName|Capabilities|CapabilityBoundingSet|CHASSIS|cipher|class|_CMDLINE|CODE_FILE|CODE_FUNC|CODE_LINE|_COMM|Compress|ConditionACPower|ConditionCapability|ConditionDirectoryNotEmpty|ConditionFileIsExecutable|ConditionFileNotEmpty|ConditionHost|ConditionKernelCommandLine|ConditionNull|ConditionPathExists|ConditionPathExistsGlob|ConditionPathIsDirectory|ConditionPathIsMountPoint|ConditionPathIsReadWrite|ConditionPathIsSymbolicLink|ConditionSecurity|ConditionVirtualization|Conflicts|ControlGroup|ControlGroupAttribute|ControlGroupModify|ControlGroupPersistent|controllers|Controllers|CPE_NAME|CPUAffinity|CPUSchedulingPolicy|CPUSchedulingPriority|CPUSchedulingResetOnFork|CPUShares|CrashChVT|CrashShell|__CURSOR|debug|DefaultControllers|DefaultDependencies|DefaultLimitAS|DefaultLimitCORE|DefaultLimitCPU|DefaultLimitDATA|DefaultLimitFSIZE|DefaultLimitLOCKS|DefaultLimitMEMLOCK|DefaultLimitMSGQUEUE|DefaultLimitNICE|DefaultLimitNOFILE|DefaultLimitNPROC|DefaultLimitRSS|DefaultLimitRTPRIO|DefaultLimitRTTIME|DefaultLimitSIGPENDING|DefaultLimitSTACK|DefaultStandardError|DefaultStandardOutput|Description|DeviceAllow|DeviceDeny|DirectoryMode|DirectoryNotEmpty|Documentation|DumpCore|entropy|Environment|EnvironmentFile|ERRNO|event_timeout|_EXE|ExecReload|ExecStart|ExecStartPost|ExecStartPre|ExecStop|ExecStopPost|ExecStopPre|filter|FONT|FONT_MAP|FONT_UNIMAP|ForwardToConsole|ForwardToKMsg|ForwardToSyslog|FreeBind|freq|FsckPassNo|fstab|_GID|Group|GuessMainPID|HandleHibernateKey|HandleLidSwitch|HandlePowerKey|HandleSuspendKey|hash|HibernateKeyIgnoreInhibited|HOME_URL|_HOSTNAME|ICON_NAME|ID|IdleAction|IdleActionSec|ID_LIKE|ID_MODEL|ID_MODEL_FROM_DATABASE|IgnoreOnIsolate|IgnoreOnSnapshot|IgnoreSIGPIPE|InaccessibleDirectories|InhibitDelayMaxSec|init|IOSchedulingClass|IOSchedulingPriority|IPTOS|IPTTL|JobTimeoutSec|JoinControllers|KeepAlive|KEYMAP|KEYMAP_TOGGLE|KillExcludeUsers|KillMode|KillOnlyUsers|KillSignal|KillUserProcesses|LidSwitchIgnoreInhibited|LimitAS|LimitCORE|LimitCPU|LimitDATA|LimitFSIZE|LimitLOCKS|LimitMEMLOCK|LimitMSGQUEUE|LimitNICE|LimitNOFILE|LimitNPROC|LimitRSS|LimitRTPRIO|LimitRTTIME|LimitSIGPENDING|LimitSTACK|link_priority|valueListenDatagram|ListenFIFO|ListenMessageQueue|ListenNetlink|ListenSequentialPacket|ListenSpecial|ListenStream|LogColor|LogLevel|LogLocation|LogTarget|luks|_MACHINE_ID|MakeDirectory|Mark|MaxConnections|MaxFileSec|MaxLevelConsole|MaxLevelKMsg|MaxLevelStore|MaxLevelSyslog|MaxRetentionSec|MemoryLimit|MemorySoftLimit|MESSAGE|MESSAGE_ID|MessageQueueMaxMessages|MessageQueueMessageSize|__MONOTONIC_TIMESTAMP|MountFlags|NAME|NAutoVTs|Nice|NonBlocking|NoNewPrivileges|NotifyAccess|OnActiveSec|OnBootSec|OnCalendar|OnFailure|OnFailureIsolate|OnStartupSec|OnUnitActiveSec|OnUnitInactiveSec|OOMScoreAdjust|Options|output|PAMName|PartOf|PassCredentials|PassSecurity|PathChanged|PathExists|PathExistsGlob|PathModified|PermissionsStartOnly|_PID|PIDFile|PipeSize|PowerKeyIgnoreInhibited|PRETTY_HOSTNAME|PRETTY_NAME|Priority|PRIORITY|PrivateNetwork|PrivateTmp|PropagatesReloadTo|pss|RateLimitBurst|RateLimitInterval|ReadOnlyDirectories|ReadWriteDirectories|__REALTIME_TIMESTAMP|ReceiveBuffer|RefuseManualStart|RefuseManualStop|rel|ReloadPropagatedFrom|RemainAfterExit|RequiredBy|Requires|RequiresMountsFor|RequiresOverridable|Requisite|RequisiteOverridable|ReserveVT|ResetControllers|Restart|RestartPreventExitStatus|RestartSec|RootDirectory|RootDirectoryStartOnly|RuntimeKeepFree|RuntimeMaxFileSize|RuntimeMaxUse|RuntimeWatchdogSec|samples|scale_x|scale_y|Seal|SecureBits|_SELINUX_CONTEXT|SendBuffer|SendSIGKILL|Service|ShowStatus|ShutdownWatchdogSec|size|SmackLabel|SmackLabelIPIn|SmackLabelIPOut|SocketMode|Sockets|SourcePath|_SOURCE_REALTIME_TIMESTAMP|SplitMode|StandardError|StandardInput|StandardOutput|StartLimitAction|StartLimitBurst|StartLimitInterval|static_node|StopWhenUnneeded|Storage|string_escape|none|replaceSuccessExitStatus|SupplementaryGroups|SUPPORT_URL|SuspendKeyIgnoreInhibited|SyslogFacility|SYSLOG_FACILITY|SyslogIdentifier|SYSLOG_IDENTIFIER|SyslogLevel|SyslogLevelPrefix|SYSLOG_PID|SystemCallFilter|SYSTEMD_ALIAS|_SYSTEMD_CGROUP|_SYSTEMD_OWNER_UID|SYSTEMD_READY|_SYSTEMD_SESSION|_SYSTEMD_UNIT|_SYSTEMD_USER_UNIT|SYSTEMD_WANTS|SystemKeepFree|SystemMaxFileSize|SystemMaxUse|SysVStartPriority|TCPCongestion|TCPWrapName|timeout|TimeoutSec|TimeoutStartSec|TimeoutStopSec|TimerSlackNSec|Transparent|_TRANSPORT|tries|TTYPath|TTYReset|TTYVHangup|TTYVTDisallocate|Type|_UID|UMask|Unit|User|UtmpIdentifier|VERSION|VERSION_ID|WantedBy|Wants|WatchdogSec|What|Where|WorkingDirectory)="
|
- statement: "^(Accept|After|Alias|AllowIsolate|Also|ANSI_COLOR|_AUDIT_LOGINUID|_AUDIT_SESSION|Backlog|Before|BindIPv6Only|BindsTo|BindToDevice|BlockIOReadBandwidth|BlockIOWeight|BlockIOWriteBandwidth|_BOOT_ID|Broadcast|BUG_REPORT_URL|BusName|Capabilities|CapabilityBoundingSet|CHASSIS|cipher|class|_CMDLINE|CODE_FILE|CODE_FUNC|CODE_LINE|_COMM|Compress|ConditionACPower|ConditionCapability|ConditionDirectoryNotEmpty|ConditionFileIsExecutable|ConditionFileNotEmpty|ConditionHost|ConditionKernelCommandLine|ConditionNull|ConditionPathExists|ConditionPathExistsGlob|ConditionPathIsDirectory|ConditionPathIsMountPoint|ConditionPathIsReadWrite|ConditionPathIsSymbolicLink|ConditionSecurity|ConditionVirtualization|Conflicts|ControlGroup|ControlGroupAttribute|ControlGroupModify|ControlGroupPersistent|controllers|Controllers|CPE_NAME|CPUAffinity|CPUSchedulingPolicy|CPUSchedulingPriority|CPUSchedulingResetOnFork|CPUShares|CrashChVT|CrashShell|__CURSOR|debug|DefaultControllers|DefaultDependencies|DefaultLimitAS|DefaultLimitCORE|DefaultLimitCPU|DefaultLimitDATA|DefaultLimitFSIZE|DefaultLimitLOCKS|DefaultLimitMEMLOCK|DefaultLimitMSGQUEUE|DefaultLimitNICE|DefaultLimitNOFILE|DefaultLimitNPROC|DefaultLimitRSS|DefaultLimitRTPRIO|DefaultLimitRTTIME|DefaultLimitSIGPENDING|DefaultLimitSTACK|DefaultStandardError|DefaultStandardOutput|Description|DeviceAllow|DeviceDeny|DirectoryMode|DirectoryNotEmpty|Documentation|DumpCore|entropy|Environment|EnvironmentFile|ERRNO|event_timeout|_EXE|ExecReload|ExecStart|ExecStartPost|ExecStartPre|ExecStop|ExecStopPost|ExecStopPre|filter|FONT|FONT_MAP|FONT_UNIMAP|ForwardToConsole|ForwardToKMsg|ForwardToSyslog|FreeBind|freq|FsckPassNo|fstab|_GID|Group|GuessMainPID|HandleHibernateKey|HandleLidSwitch|HandlePowerKey|HandleSuspendKey|hash|HibernateKeyIgnoreInhibited|HOME_URL|_HOSTNAME|ICON_NAME|ID|IdleAction|IdleActionSec|ID_LIKE|ID_MODEL|ID_MODEL_FROM_DATABASE|IgnoreOnIsolate|IgnoreOnSnapshot|IgnoreSIGPIPE|InaccessibleDirectories|InhibitDelayMaxSec|init|IOSchedulingClass|IOSchedulingPriority|IPTOS|IPTTL|JobTimeoutSec|JoinControllers|KeepAlive|KEYMAP|KEYMAP_TOGGLE|KillExcludeUsers|KillMode|KillOnlyUsers|KillSignal|KillUserProcesses|LidSwitchIgnoreInhibited|LimitAS|LimitCORE|LimitCPU|LimitDATA|LimitFSIZE|LimitLOCKS|LimitMEMLOCK|LimitMSGQUEUE|LimitNICE|LimitNOFILE|LimitNPROC|LimitRSS|LimitRTPRIO|LimitRTTIME|LimitSIGPENDING|LimitSTACK|link_priority|valueListenDatagram|ListenFIFO|ListenMessageQueue|ListenNetlink|ListenSequentialPacket|ListenSpecial|ListenStream|LogColor|LogLevel|LogLocation|LogTarget|luks|_MACHINE_ID|MakeDirectory|Mark|MaxConnections|MaxFileSec|MaxLevelConsole|MaxLevelKMsg|MaxLevelStore|MaxLevelSyslog|MaxRetentionSec|MemoryLimit|MemorySoftLimit|MESSAGE|MESSAGE_ID|MessageQueueMaxMessages|MessageQueueMessageSize|__MONOTONIC_TIMESTAMP|MountFlags|NAME|NAutoVTs|Nice|NonBlocking|NoNewPrivileges|NotifyAccess|OnActiveSec|OnBootSec|OnCalendar|OnFailure|OnFailureIsolate|OnStartupSec|OnUnitActiveSec|OnUnitInactiveSec|OOMScoreAdjust|Options|output|PAMName|PartOf|PassCredentials|PassSecurity|PathChanged|PathExists|PathExistsGlob|PathModified|PermissionsStartOnly|_PID|PIDFile|PipeSize|PowerKeyIgnoreInhibited|PRETTY_HOSTNAME|PRETTY_NAME|Priority|PRIORITY|PrivateNetwork|PrivateTmp|PropagatesReloadTo|pss|RateLimitBurst|RateLimitInterval|ReadOnlyDirectories|ReadWriteDirectories|__REALTIME_TIMESTAMP|ReceiveBuffer|RefuseManualStart|RefuseManualStop|rel|ReloadPropagatedFrom|RemainAfterExit|RequiredBy|Requires|RequiresMountsFor|RequiresOverridable|Requisite|RequisiteOverridable|ReserveVT|ResetControllers|Restart|RestartPreventExitStatus|RestartSec|RootDirectory|RootDirectoryStartOnly|RuntimeKeepFree|RuntimeMaxFileSize|RuntimeMaxUse|RuntimeWatchdogSec|samples|scale_x|scale_y|Seal|SecureBits|_SELINUX_CONTEXT|SendBuffer|SendSIGKILL|Service|ShowStatus|ShutdownWatchdogSec|size|SmackLabel|SmackLabelIPIn|SmackLabelIPOut|SocketMode|Sockets|SourcePath|_SOURCE_REALTIME_TIMESTAMP|SplitMode|StandardError|StandardInput|StandardOutput|StartLimitAction|StartLimitBurst|StartLimitInterval|static_node|StopWhenUnneeded|Storage|string_escape|none|replaceSuccessExitStatus|SupplementaryGroups|SUPPORT_URL|SuspendKeyIgnoreInhibited|SyslogFacility|SYSLOG_FACILITY|SyslogIdentifier|SYSLOG_IDENTIFIER|SyslogLevel|SyslogLevelPrefix|SYSLOG_PID|SystemCallFilter|SYSTEMD_ALIAS|_SYSTEMD_CGROUP|_SYSTEMD_OWNER_UID|SYSTEMD_READY|_SYSTEMD_SESSION|_SYSTEMD_UNIT|_SYSTEMD_USER_UNIT|SYSTEMD_WANTS|SystemKeepFree|SystemMaxFileSize|SystemMaxUse|SysVStartPriority|TCPCongestion|TCPWrapName|timeout|TimeoutSec|TimeoutStartSec|TimeoutStopSec|TimerSlackNSec|Transparent|_TRANSPORT|tries|TTYPath|TTYReset|TTYVHangup|TTYVTDisallocate|Type|_UID|UMask|Unit|User|UtmpIdentifier|VERSION|VERSION_ID|WantedBy|Wants|WatchdogSec|What|Where|WorkingDirectory)="
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: tcl
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.tcl$"
|
filename: "\\.tcl$"
|
||||||
signature: "^#!.*/(env +)?tclsh( |$)"
|
header: "^#!.*/(env +)?tclsh( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- statement: "\\b(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|else|elseif|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\\b"
|
- statement: "\\b(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|else|elseif|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\\b"
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: xml
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.(xml|sgml?|rng|svg|plist)$"
|
filename: "\\.(xml|sgml?|rng|svg|plist)$"
|
||||||
signature: "<\\?xml.*\\?>"
|
header: "<\\?xml.*\\?>"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- preproc:
|
- preproc:
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: yaml
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.ya?ml$"
|
filename: "\\.ya?ml$"
|
||||||
signature: "%YAML"
|
header: "%YAML"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- type: "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
|
- type: "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
|
||||||
|
|
|
@ -2,7 +2,7 @@ filetype: zsh
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
|
filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
|
||||||
signature: "^#!.*/(env +)?zsh( |$)"
|
header: "^#!.*/(env +)?zsh( |$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
## Numbers
|
## Numbers
|
||||||
|
|
Loading…
Reference in a new issue