Support initial batch of languages

This commit is contained in:
2025-06-14 13:35:39 -04:00
parent 34373e04d7
commit d68a3e73b3
47 changed files with 668 additions and 184 deletions
@@ -1,4 +1,10 @@
filetype: asm
//go:build stxAsm || stxAll
package syntax
func init() {
syntaxMap["asm"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: asm
detect:
filename: "\\.(S|s|asm)$"
@@ -106,5 +112,6 @@ rules:
start: ";"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
+52
View File
@@ -0,0 +1,52 @@
//go:build stxBash || stxAll
package syntax
func init() {
syntaxMap["bash"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: shell
detect:
filename: "(\\.sh$|\\.bash|\\.bashrc|bashrc|\\.bash_aliases|bash_aliases|\\.bash_functions|bash_functions|\\.bash_profile|bash_profile|Pkgfile|pkgmk.conf|profile|rc.conf|PKGBUILD|.ebuild\\$|APKBUILD)"
header: "^#!.*/(env +)?(ba)?sh( |$)"
rules:
# Numbers
- constant.number: "\\b[0-9]+\\b"
# Conditionals and control flow
- statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
# Shell commands
- type: "\\b(cd|echo|export|let|set|umask|unset)\\b"
# Common linux commands
- type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar|ping|traceroute|service|dpkg|apt|apt-get|apt-cache|aptitude|dpkg-buildpackage|yum)\\b"
# Coreutils commands
- type: "\\b(which|sudo|base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|(l)?dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
- identifier.var: "(^([[:space:]]+)?[A-Za-z0-9_]+)"
- special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|` + "`" + `|\\\\|\\$|<|>|!|=|&|\\|)"
# Conditional flags
- statement: "--[a-z-]+"
- statement: "\\ -[a-z]+"
- identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
- identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
- symbol.brackets: "(\\[|\\]|\\{|\\}|[()])"
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
rules: []
- comment:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
+10 -3
View File
@@ -1,4 +1,10 @@
filetype: c
//go:build stxC || stxAll
package syntax
func init() {
syntaxMap["c"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: c
detect:
filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
@@ -52,5 +58,6 @@ rules:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: caddyfile
//go:build stxCaddyfile || stxAll
package syntax
func init() {
syntaxMap["caddyfile"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: caddyfile
detect:
filename: "Caddyfile"
@@ -19,5 +25,6 @@ rules:
- comment:
start: "#"
end: "$"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: cmake
//go:build stxCmake || stxAll
package syntax
func init() {
syntaxMap["cmake"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: cmake
detect:
filename: "(CMakeLists\\.txt|\\.cmake)$"
@@ -38,5 +44,6 @@ rules:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: c++
//go:build stxCpp || stxAll
package syntax
func init() {
syntaxMap["cpp"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: c++
detect:
filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
@@ -51,5 +57,6 @@ rules:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: csharp
//go:build stxCsharp || stxAll
package syntax
func init() {
syntaxMap["csharp"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: csharp
detect:
filename: "\\.cs$"
@@ -47,5 +53,6 @@ rules:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: css
//go:build stxCss || stxAll
package syntax
func init() {
syntaxMap["css"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: css
detect:
filename: "\\.(css|scss)$"
@@ -40,5 +46,6 @@ rules:
start: "\\/\\*"
end: "\\*\\/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
+12 -5
View File
@@ -1,4 +1,10 @@
filetype: d
//go:build stxD || stxAll
package syntax
func init() {
syntaxMap["d"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: d
detect:
filename: "\\.(d(i|d)?)$"
@@ -63,8 +69,8 @@ rules:
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "`"
end: "`"
start: "` + "`" + `"
end: "` + "`" + `"
rules:
- constant.specialChar: "\\\\."
# HexString
@@ -116,5 +122,6 @@ rules:
- comment:
start: "/\\+"
end: "\\+/"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: dart
//go:build stxDart || stxAll
package syntax
func init() {
syntaxMap["dart"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: dart
detect:
filename: "\\.dart$"
@@ -42,5 +48,6 @@ rules:
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.specialChar: "\\\\."`)
}}
}
@@ -1,4 +1,10 @@
filetype: diff
//go:build stxDiff || stxAll
package syntax
func init() {
syntaxMap["diff"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: diff
detect:
filename: "\\.diff$"
@@ -9,4 +15,6 @@ rules:
- statement: "(^---.*)"
- type: "(^@@.*)"
- constant.number: "(^\\+.*)"
- preproc: "(^-.*)"
- preproc: "(^-.*)"`)
}}
}
@@ -1,4 +1,10 @@
filetype: dockerfile
//go:build stxDockerfile || stxAll
package syntax
func init() {
syntaxMap["dockerfile"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: dockerfile
detect:
filename: "(Dockerfile[^/]*$|\\.dockerfile$)"
@@ -32,5 +38,6 @@ rules:
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.specialChar: "\\\\."`)
}}
}
@@ -1,4 +1,10 @@
filetype: fish
//go:build stxFish || stxAll
package syntax
func init() {
syntaxMap["fish"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: fish
detect:
filename: "\\.fish$"
@@ -10,7 +16,7 @@ rules:
# Conditionals and control flow
- statement: "\\b(and|begin|break|case|continue|else|end|for|function|if|in|not|or|return|select|shift|switch|while)\\b"
- special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)"
- special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|` + "`" + `|\\\\|\\$|<|>|^|!|=|&|\\|)"
# Fish commands
- type: "\\b(bg|bind|block|breakpoint|builtin|cd|count|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set|set_color|source|status|string|trap|type|ulimit|umask|vared)\\b"
@@ -44,5 +50,6 @@ rules:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: fortran
//go:build stxFortran || stxAll
package syntax
func init() {
syntaxMap["fortran"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: fortran
detect:
filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
@@ -59,5 +65,6 @@ rules:
start: "!"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: gdscript
//go:build stxGdscript || stxAll
package syntax
func init() {
syntaxMap["gdscript"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: gdscript
detect:
filename: "\\.gd$"
@@ -59,13 +65,14 @@ rules:
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
- constant.string:
start: "`"
end: "`"
start: "` + "`" + `"
end: "` + "`" + `"
rules: []
- comment:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
+1 -2
View File
@@ -68,7 +68,6 @@ rules:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
`)
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: haskell
//go:build stxHaskell || stxAll
package syntax
func init() {
syntaxMap["haskell"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: haskell
detect:
filename: "\\.hs$"
@@ -47,4 +53,6 @@ rules:
rules:
- todo: "(TODO|XXX|FIXME):?"
- identifier.micro: "undefined"
- identifier.micro: "undefined"`)
}}
}
@@ -1,4 +1,10 @@
filetype: html
//go:build stxHtml || stxAll
package syntax
func init() {
syntaxMap["html"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: html
detect:
filename: "\\.htm[l]?$"
@@ -40,5 +46,6 @@ rules:
end: "</style.*?>"
limit-group: symbol.tag
rules:
- include: "css"
- include: "css"`)
}}
}
@@ -1,4 +1,10 @@
filetype: html5
//go:build stxHtml5 || stxAll
package syntax
func init() {
syntaxMap["html5"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: html5
detect:
filename: "\\.htm[l]?5$"
@@ -22,4 +28,6 @@ rules:
- symbol.tag: "<|>"
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
- comment: "<!--.+?-->"
- preproc: "<!DOCTYPE.+?>"
- preproc: "<!DOCTYPE.+?>"`)
}}
}
+1 -2
View File
@@ -17,7 +17,6 @@ rules:
- special: "^[[:space:]]*\\[.*\\]$"
- statement: "[=;]"
- comment: "(^|[[:space:]])#([^{].*)?$"
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
`)
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"`)
}}
}
@@ -1,4 +1,10 @@
filetype: ino
//go:build stxIno || stxAll
package syntax
func init() {
syntaxMap["ino"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: ino
detect:
filename: "\\.?ino$"
@@ -97,5 +103,6 @@ rules:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: java
//go:build stxJava || stxAll
package syntax
func init() {
syntaxMap["java"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: java
detect:
filename: "\\.java$"
@@ -33,5 +39,6 @@ rules:
- comment:
start: "/\\*"
end: "\\*/"
rules: []
rules: []`)
}}
}
+10 -3
View File
@@ -1,4 +1,10 @@
filetype: javascript
//go:build stxJs || stxAll
package syntax
func init() {
syntaxMap["js"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: javascript
detect:
filename: "\\.js$"
@@ -45,5 +51,6 @@ rules:
- comment:
start: "/\\*"
end: "\\*/"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: json
//go:build stxJson || stxAll
package syntax
func init() {
syntaxMap["json"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: json
detect:
filename: "\\.json$"
@@ -24,4 +30,6 @@ rules:
- constant.specialChar: "\\\\."
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"`)
}}
}
@@ -1,4 +1,10 @@
filetype: lisp
//go:build stxLisp || stxAll
package syntax
func init() {
syntaxMap["lisp"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: lisp
detect:
filename: "(emacs|zile)$|\\.(el|li?sp|scm|ss)$"
@@ -14,4 +20,6 @@ rules:
- constant.specialChar: "\\\\.?"
- comment: "(^|[[:space:]]);.*"
- indent-char.whitespace: "[[:space:]]+$"
- indent-char: " + +| + +"
- indent-char: " + +| + +"`)
}}
}
@@ -1,4 +1,10 @@
filetype: lua
//go:build stxLua || stxAll
package syntax
func init() {
syntaxMap["lua"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: lua
detect:
filename: "\\.lua$"
@@ -59,5 +65,6 @@ rules:
- comment:
start: "\\-\\-\\[\\["
end: "\\]\\]"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: makefile
//go:build stxMakefile || stxAll
package syntax
func init() {
syntaxMap["makefile"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: makefile
detect:
filename: "([Mm]akefile|\\.ma?k)$"
@@ -38,5 +44,6 @@ rules:
- comment:
start: "#"
end: "$"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: man
//go:build stxMan || stxAll
package syntax
func init() {
syntaxMap["man"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: man
detect:
filename: "\\.[1-9]x?$"
@@ -9,4 +15,6 @@ rules:
- brightred: "\\.(BR?|I[PR]?).*$"
- brightblue: "\\.(BR?|I[PR]?|PP)"
- brightwhite: "\\\\f[BIPR]"
- yellow: "\\.(br|DS|RS|RE|PD)"
- yellow: "\\.(br|DS|RS|RE|PD)"`)
}}
}
+67
View File
@@ -0,0 +1,67 @@
//go:build stxObjc || stxAll
package syntax
func init() {
syntaxMap["objc"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: objective-c
detect:
filename: "\\.(m|mm|h)$"
rules:
- type: "\\b(float|double|CGFloat|id|bool|BOOL|Boolean|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP|NS(U)?Integer)\\b"
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
- type: "\\b[A-Z][A-Z][[:alnum:]]*\\b"
- type: "\\b[A-Za-z0-9_]*_t\\b"
- type: "\\bdispatch_[a-zA-Z0-9_]*_t\\b"
- statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__|__unused|_Nonnull|_Nullable|__block|__builtin.*)"
- statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
- statement: "\\b(try|throw|catch|operator|new|delete)\\b"
- statement: "\\b(goto|continue|break|return)\\b"
- statement: "\\b(nonatomic|atomic|readonly|readwrite|strong|weak|assign)\\b"
- statement: "@(encode|end|interface|implementation|class|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)"
- preproc: "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma).*$"
- preproc: "__[A-Z0-9_]*__"
- special: "^[[:space:]]*[#|@][[:space:]]*(import|include)[[:space:]]*[\"|<].*\\/?[>|\"][[:space:]]*$"
- statement: "([.:;,+*|=!\\%\\[\\]]|<|>|/|-|&)"
- constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9A-F]+\\b)"
- constant: "(@\\[(\\\\.|[^\\]])*\\]|@\\{(\\\\.|[^\\}])*\\}|@\\((\\\\.|[^\\)])*\\))"
- constant: "\\b<(\\\\.[^\\>])*\\>\\b"
- constant: "\\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\\b"
- constant: "\\bk[[:alnum]]*\\b"
- constant.string: "'.'"
- constant.string:
start: "@\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
+34
View File
@@ -0,0 +1,34 @@
//go:build stxOcaml || stxAll
package syntax
func init() {
syntaxMap["ocaml"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: ocaml
detect:
filename: "\\.mli?$"
rules:
# Numbers
## Integers
### Binary
- constant.number: "-?0[bB][01][01_]*"
### Octal
- constant.number: "-?0[oO][0-7][0-7_]*"
### Decimal
- constant.number: "-?\\d[\\d_]*"
### Hexadecimal
- constant.number: "-?0[xX][0-9a-fA-F][0-9a-fA-F_]*"
## Real
### Decimal
- constant.number: "-?\\d[\\d_]*.\\d[\\d_]*([eE][+-]\\d[\\d_]*.\\d[\\d_]*)?"
### Hexadecimal
- constant.number: "-?0[xX][0-9a-fA-F][0-9a-fA-F_]*.[0-9a-fA-F][0-9a-fA-F_]*([pP][+-][0-9a-fA-F][0-9a-fA-F_]*.[0-9a-fA-F][0-9a-fA-F_]*)?"
# Comments
- comment:
start: "\\(\\*"
end: "\\*\\)"
rules: []`)
}}
}
+52
View File
@@ -0,0 +1,52 @@
//go:build stxPascal || stxAll
package syntax
func init() {
syntaxMap["pascal"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: pascal
detect:
filename: "\\.pas$"
rules:
- type: "\\b(?i:(string|ansistring|widestring|shortstring|char|ansichar|widechar|boolean|byte|shortint|word|smallint|longword|cardinal|longint|integer|int64|single|currency|double|extended))\\b"
- statement: "\\b(?i:(and|asm|array|begin|break|case|const|constructor|continue|destructor|div|do|downto|else|end|file|for|function|goto|if|implementation|in|inline|interface|label|mod|not|object|of|on|operator|or|packed|procedure|program|record|repeat|resourcestring|set|shl|shr|then|to|type|unit|until|uses|var|while|with|xor))\\b"
- statement: "\\b(?i:(as|class|dispose|except|exit|exports|finalization|finally|inherited|initialization|is|library|new|on|out|property|raise|self|threadvar|try))\\b"
- statement: "\\b(?i:(absolute|abstract|alias|assembler|cdecl|cppdecl|default|export|external|forward|generic|index|local|name|nostackframe|oldfpccall|override|pascal|private|protected|public|published|read|register|reintroduce|safecall|softfloat|specialize|stdcall|virtual|write))\\b"
- constant: "\\b(?i:(false|true|nil))\\b"
- special:
start: "asm"
end: "end"
rules: []
- constant.number: "\\$[0-9A-Fa-f]+"
- constant.number: "\\b[+-]?[0-9]+([.]?[0-9]+)?(?i:e[+-]?[0-9]+)?"
- constant.string:
start: "#[0-9]{1,}"
end: "$"
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- preproc:
start: "{\\$"
end: "}"
rules: []
- comment:
start: "//"
end: "$"
rules: []
- comment:
start: "\\(\\*"
end: "\\*\\)"
rules: []
- comment:
start: "({)(?:[^$])"
end: "}"
rules: []`)
}}
}
+34
View File
@@ -0,0 +1,34 @@
//go:build stxPerl || stxAll
package syntax
func init() {
syntaxMap["perl"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: perl
detect:
filename: "\\.p[lm]$"
header: "^#!.*/(env +)?perl( |$)"
rules:
- type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|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|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"
- statement: "\\b(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\\b"
- identifier:
start: "[$@%]"
end: "((?i) |[^0-9A-Z_]|-)"
rules: []
- constant.string: "\".*\"|qq\\|.*\\|"
- default: "[sm]/.*/"
- preproc:
start: "(^use| = new)"
end: ";"
rules: []
- comment: "#.*"
- identifier.macro:
start: "<< 'STOP'"
end: "STOP"
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: php
//go:build stxPhp || stxAll
package syntax
func init() {
syntaxMap["php"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: php
detect:
filename: "\\.php[2345s~]|\\.inc[2345s~]$"
@@ -47,4 +53,6 @@ rules:
- preproc: "<\\?(php|=)?"
- preproc: "\\?>"
- preproc: "<!DOCTYPE.+?>"
- preproc: "<!DOCTYPE.+?>"`)
}}
}
@@ -1,4 +1,10 @@
filename: python3
//go:build stxPython3 || stxAll
package syntax
func init() {
syntaxMap["python3"] = &lazySyntax{init: func() []byte {
return []byte(`filename: python3
detect:
filename: "\\.py3$"
@@ -55,5 +61,6 @@ rules:
- comment:
start: "#"
end: "$"
rules: []
rules: []`)
}}
}
+10 -2
View File
@@ -1,4 +1,10 @@
filetype: r
//go:build stxR || stxAll
package syntax
func init() {
syntaxMap["r"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: r
detect:
filename: "\\.(r|R)$"
@@ -9,4 +15,6 @@ rules:
- comment:
start: "#"
end: "$"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: ruby
//go:build stxRuby || stxAll
package syntax
func init() {
syntaxMap["ruby"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: ruby
detect:
filename: "\\.rb$|\\.ru|\\.rbx|\\.rake|\\.gemspec$|Gemfile|Rakefile|Capfile|Vagrantfile"
@@ -11,7 +17,7 @@ rules:
- constant: "(i?)([ ]|^):[0-9A-Z_]+\\b"
- constant: "\\b(__FILE__|__LINE__)\\b"
- constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
- constant.string: "`[^`]*`|%x\\{[^}]*\\}"
- constant.string: "` + "`" + `[^` + "`" + `]*` + "`" + `|%x\\{[^}]*\\}"
- constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
- special: "#\\{[^}]*\\}"
- constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
@@ -27,4 +33,6 @@ rules:
rules: []
- todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
- preproc.shebang: "^#!.+?( |$)"
- preproc.shebang: "^#!.+?( |$)"`)
}}
}
@@ -1,4 +1,10 @@
filetype: rust
//go:build stxRust || stxAll
package syntax
func init() {
syntaxMap["rust"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: rust
detect:
filename: "\\.rs$"
@@ -44,5 +50,6 @@ rules:
- special:
start: "#!\\["
end: "\\]"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: scala
//go:build stxScala || stxAll
package syntax
func init() {
syntaxMap["scala"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: scala
detect:
filename: "\\.scala$"
@@ -25,5 +31,6 @@ rules:
- comment:
start: "/\\*\\*"
end: "\\*/"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: swift
//go:build stxSwift || stxAll
package syntax
func init() {
syntaxMap["swift"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: swift
detect:
filename: "\\.swift$"
@@ -47,5 +53,6 @@ rules:
start: "/\\*\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: systemd
//go:build stxSystemd || stxAll
package syntax
func init() {
syntaxMap["systemd"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: systemd
detect:
filename: "\\.(service|socket)$"
@@ -13,4 +19,6 @@ rules:
- constant.bool: "\\b(true|false)\\b"
- comment: "(^|[[:space:]])#([^{].*)?$"
- indent-char.whitespace: "[[:space:]]+$"
- indent-char: " + +| + +"
- indent-char: " + +| + +"`)
}}
}
@@ -1,4 +1,10 @@
filetype: toml
//go:build stxToml || stxAll
package syntax
func init() {
syntaxMap["toml"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: toml
detect:
filename: "\\.toml"
@@ -29,8 +35,8 @@ rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "`"
end: "`"
start: "` + "`" + `"
end: "` + "`" + `"
rules:
- constant.specialChar: "\\\\."
@@ -38,5 +44,6 @@ rules:
start: "#"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- todo: "(TODO|XXX|FIXME):?"`)
}}
}
@@ -1,4 +1,10 @@
filetype: typescript
//go:build stxTs || stxAll
package syntax
func init() {
syntaxMap["ts"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: typescript
detect:
filename: "\\.ts$"
@@ -40,5 +46,6 @@ rules:
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.specialChar: "\\\\."`)
}}
}
@@ -1,4 +1,10 @@
filetype: xml
//go:build stxXml || stxAll
package syntax
func init() {
syntaxMap["xml"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: xml
detect:
filename: "\\.(xml|sgml?|rng|plist)$"
@@ -18,4 +24,6 @@ rules:
start: "<!--"
end: "-->"
rules: []
- special: "&[^;]*;"
- special: "&[^;]*;"`)
}}
}
@@ -1,4 +1,10 @@
filetype: yaml
//go:build stxYaml || stxAll
package syntax
func init() {
syntaxMap["yaml"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: yaml
detect:
filename: "\\.ya?ml$"
@@ -31,6 +37,6 @@ rules:
- comment:
start: "#"
end: "$"
rules: []
rules: []`)
}}
}
@@ -1,4 +1,10 @@
filetype: zsh
//go:build stxZsh || stxAll
package syntax
func init() {
syntaxMap["zsh"] = &lazySyntax{init: func() []byte {
return []byte(`filetype: zsh
detect:
filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
@@ -11,7 +17,7 @@ rules:
## Conditionals and control flow
- statement: "\\b(always|break|bye|case|continue|disown|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
- statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
- statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|` + "`" + `|\\\\|\\$|<|>|!|=|&|\\|)"
## Conditional flags
- special: "-[Ldefgruwx]\\b"
- special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
@@ -48,5 +54,6 @@ rules:
- comment:
start: "#"
end: "$"
rules: []
rules: []`)
}}
}
-1
View File
@@ -1 +0,0 @@
sh.yaml
-28
View File
@@ -1,28 +0,0 @@
filetype: c++
detect:
filename: "\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$"
rules:
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
- type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
- statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
- statement: "\\b(try|throw|catch|operator|new|delete)\\b"
- special: "\\b(goto|continue|break|return)\\b"
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
- constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}'"
- statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
- symbol.operator: "[.:;,+*|=!\\%]|<|>|/|-|&"
- symbol.brackets: "[(){}]|\\[|\\]"
- constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
- constant.bool: "\\b(true|false)\\b|NULL"
- constant.string: "\"(\\\\.|[^\"])*\""
- comment: "//.*"
- comment:
start: "/\\*"
end: "\\*/"
rules: []
- indent-char.whitespace: "[[:space:]]+$"