mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-08-28 04:46:30 -04:00
Support initial batch of languages
This commit is contained in:
@@ -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:
|
detect:
|
||||||
filename: "\\.(S|s|asm)$"
|
filename: "\\.(S|s|asm)$"
|
||||||
@@ -106,5 +112,6 @@ rules:
|
|||||||
start: ";"
|
start: ";"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules:
|
rules:
|
||||||
- todo: "(TODO|XXX|FIXME):?"
|
- todo: "(TODO|XXX|FIXME):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
filetype: c
|
//go:build stxC || stxAll
|
||||||
|
|
||||||
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["c"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: c
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
|
filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
|
||||||
header: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
header: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||||
- statement: "([a-zA-Z][a-zA-Z0-9_]*)[[:space:]]*\\("
|
- statement: "([a-zA-Z][a-zA-Z0-9_]*)[[:space:]]*\\("
|
||||||
- type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
- type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
||||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||||
@@ -22,7 +28,7 @@ rules:
|
|||||||
- statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
|
- statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
|
||||||
- statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
- statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||||
# Operator Color
|
# Operator Color
|
||||||
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
||||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||||
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
||||||
- constant.number: "NULL"
|
- constant.number: "NULL"
|
||||||
@@ -52,5 +58,6 @@ rules:
|
|||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "Caddyfile"
|
filename: "Caddyfile"
|
||||||
@@ -19,5 +25,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
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:
|
detect:
|
||||||
filename: "(CMakeLists\\.txt|\\.cmake)$"
|
filename: "(CMakeLists\\.txt|\\.cmake)$"
|
||||||
@@ -38,5 +44,6 @@ rules:
|
|||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules:
|
rules:
|
||||||
- todo: "(TODO|XXX|FIXME):?"
|
- todo: "(TODO|XXX|FIXME):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
filetype: c++
|
//go:build stxCpp || stxAll
|
||||||
|
|
||||||
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["cpp"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: c++
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
|
filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|
||||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
- 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(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"
|
- 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(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
|
||||||
@@ -19,7 +25,7 @@ rules:
|
|||||||
- statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
|
- statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
|
||||||
|
|
||||||
# Operator Color
|
# Operator Color
|
||||||
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
||||||
# Parenthetical Color
|
# Parenthetical Color
|
||||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||||
|
|
||||||
@@ -51,5 +57,6 @@ rules:
|
|||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.cs$"
|
filename: "\\.cs$"
|
||||||
@@ -47,5 +53,6 @@ rules:
|
|||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.(css|scss)$"
|
filename: "\\.(css|scss)$"
|
||||||
@@ -40,5 +46,6 @@ rules:
|
|||||||
start: "\\/\\*"
|
start: "\\/\\*"
|
||||||
end: "\\*\\/"
|
end: "\\*\\/"
|
||||||
rules:
|
rules:
|
||||||
- todo: "(TODO|XXX|FIXME):?"
|
- todo: "(TODO|XXX|FIXME):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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:
|
detect:
|
||||||
filename: "\\.(d(i|d)?)$"
|
filename: "\\.(d(i|d)?)$"
|
||||||
@@ -50,11 +56,11 @@ rules:
|
|||||||
- constant: "\\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\\b"
|
- constant: "\\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\\b"
|
||||||
# String literals
|
# String literals
|
||||||
# DoubleQuotedString
|
# DoubleQuotedString
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
skip: "\\\\."
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
# WysiwygString
|
# WysiwygString
|
||||||
- constant.string:
|
- constant.string:
|
||||||
@@ -63,8 +69,8 @@ rules:
|
|||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "`"
|
start: "` + "`" + `"
|
||||||
end: "`"
|
end: "` + "`" + `"
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
# HexString
|
# HexString
|
||||||
@@ -92,7 +98,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "q\"<"
|
start: "q\"<"
|
||||||
end: "q\">"
|
end: "q\">"
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "q\"[^({[<\"][^\"]*$"
|
start: "q\"[^({[<\"][^\"]*$"
|
||||||
@@ -105,7 +111,7 @@ rules:
|
|||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
# Comments
|
# Comments
|
||||||
- comment:
|
- comment:
|
||||||
start: "//"
|
start: "//"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []
|
||||||
@@ -116,5 +122,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "/\\+"
|
start: "/\\+"
|
||||||
end: "\\+/"
|
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:
|
detect:
|
||||||
filename: "\\.dart$"
|
filename: "\\.dart$"
|
||||||
@@ -42,5 +48,6 @@ rules:
|
|||||||
end: "'"
|
end: "'"
|
||||||
skip: "\\\\."
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: diff
|
//go:build stxDiff || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["diff"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: diff
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "\\.diff$"
|
filename: "\\.diff$"
|
||||||
header: "^((---.*)|(\\+\\+\\+.*))"
|
header: "^((---.*)|(\\+\\+\\+.*))"
|
||||||
|
|
||||||
@@ -9,4 +15,6 @@ rules:
|
|||||||
- statement: "(^---.*)"
|
- statement: "(^---.*)"
|
||||||
- type: "(^@@.*)"
|
- type: "(^@@.*)"
|
||||||
- constant.number: "(^\\+.*)"
|
- 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:
|
detect:
|
||||||
filename: "(Dockerfile[^/]*$|\\.dockerfile$)"
|
filename: "(Dockerfile[^/]*$|\\.dockerfile$)"
|
||||||
@@ -32,5 +38,6 @@ rules:
|
|||||||
end: "'"
|
end: "'"
|
||||||
skip: "\\\\."
|
skip: "\\\\."
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.fish$"
|
filename: "\\.fish$"
|
||||||
@@ -10,7 +16,7 @@ rules:
|
|||||||
|
|
||||||
# Conditionals and control flow
|
# 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"
|
- 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
|
# 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"
|
- 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: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
|
filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
|
||||||
@@ -14,16 +20,16 @@ rules:
|
|||||||
- type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b"
|
- type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b"
|
||||||
- type: "(?i)\\b(selected_real_kind|subroutine|status)\\b"
|
- type: "(?i)\\b(selected_real_kind|subroutine|status)\\b"
|
||||||
|
|
||||||
- constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b"
|
- constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b"
|
||||||
- constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b"
|
- constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b"
|
||||||
- constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b"
|
- constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b"
|
||||||
- constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b"
|
- constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b"
|
||||||
- constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b"
|
- constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b"
|
||||||
- constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b"
|
- constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b"
|
||||||
- constant: "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b"
|
- constant: "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b"
|
||||||
- constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b"
|
- constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b"
|
||||||
- constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b"
|
- constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b"
|
||||||
- constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b"
|
- constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b"
|
||||||
- constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b"
|
- constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b"
|
||||||
|
|
||||||
- statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b"
|
- statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b"
|
||||||
@@ -59,5 +65,6 @@ rules:
|
|||||||
start: "!"
|
start: "!"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.gd$"
|
filename: "\\.gd$"
|
||||||
@@ -15,9 +21,9 @@ rules:
|
|||||||
# types
|
# types
|
||||||
- type: "\\b(Vector2|Vector3)\\b"
|
- type: "\\b(Vector2|Vector3)\\b"
|
||||||
# definitions
|
# definitions
|
||||||
- identifier: "func [a-zA-Z_0-9]+"
|
- identifier: "func [a-zA-Z_0-9]+"
|
||||||
# keywords
|
# keywords
|
||||||
- statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|export|extends|for|func|if|in|map|not|onready|or|pass|return|signal|var|while|yield)\\b"
|
- statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|export|extends|for|func|if|in|map|not|onready|or|pass|return|signal|var|while|yield)\\b"
|
||||||
|
|
||||||
# decorators
|
# decorators
|
||||||
- special: "@.*[(]"
|
- special: "@.*[(]"
|
||||||
@@ -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.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "`"
|
start: "` + "`" + `"
|
||||||
end: "`"
|
end: "` + "`" + `"
|
||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules:
|
rules:
|
||||||
- todo: "(TODO|XXX|FIXME):?"
|
- todo: "(TODO|XXX|FIXME):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
+1
-2
@@ -68,7 +68,6 @@ rules:
|
|||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.hs$"
|
filename: "\\.hs$"
|
||||||
@@ -47,4 +53,6 @@ rules:
|
|||||||
rules:
|
rules:
|
||||||
- todo: "(TODO|XXX|FIXME):?"
|
- todo: "(TODO|XXX|FIXME):?"
|
||||||
|
|
||||||
- identifier.micro: "undefined"
|
- identifier.micro: "undefined"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: html
|
//go:build stxHtml || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["html"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: html
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "\\.htm[l]?$"
|
filename: "\\.htm[l]?$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
@@ -40,5 +46,6 @@ rules:
|
|||||||
end: "</style.*?>"
|
end: "</style.*?>"
|
||||||
limit-group: symbol.tag
|
limit-group: symbol.tag
|
||||||
rules:
|
rules:
|
||||||
- include: "css"
|
- include: "css"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: html5
|
//go:build stxHtml5 || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["html5"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: html5
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "\\.htm[l]?5$"
|
filename: "\\.htm[l]?5$"
|
||||||
header: "<!DOCTYPE html5>"
|
header: "<!DOCTYPE html5>"
|
||||||
|
|
||||||
@@ -22,4 +28,6 @@ rules:
|
|||||||
- symbol.tag: "<|>"
|
- symbol.tag: "<|>"
|
||||||
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
||||||
- comment: "<!--.+?-->"
|
- comment: "<!--.+?-->"
|
||||||
- preproc: "<!DOCTYPE.+?>"
|
- preproc: "<!DOCTYPE.+?>"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
+1
-2
@@ -17,7 +17,6 @@ rules:
|
|||||||
- special: "^[[:space:]]*\\[.*\\]$"
|
- special: "^[[:space:]]*\\[.*\\]$"
|
||||||
- statement: "[=;]"
|
- statement: "[=;]"
|
||||||
- comment: "(^|[[:space:]])#([^{].*)?$"
|
- comment: "(^|[[:space:]])#([^{].*)?$"
|
||||||
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
|
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"`)
|
||||||
`)
|
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
filetype: ino
|
//go:build stxIno || stxAll
|
||||||
|
|
||||||
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["ino"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: ino
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.?ino$"
|
filename: "\\.?ino$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||||
|
|
||||||
##
|
##
|
||||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||||
|
|
||||||
## Constants
|
## Constants
|
||||||
@@ -33,7 +39,7 @@ rules:
|
|||||||
- type: "\\b(boolean|byte|char|float|int|long|word)\\b"
|
- type: "\\b(boolean|byte|char|float|int|long|word)\\b"
|
||||||
|
|
||||||
## Control Structions
|
## Control Structions
|
||||||
- statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b"
|
- statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b"
|
||||||
- statement: "\\b(goto|continue|break|return)\\b"
|
- statement: "\\b(goto|continue|break|return)\\b"
|
||||||
|
|
||||||
## Math
|
## Math
|
||||||
@@ -66,7 +72,7 @@ rules:
|
|||||||
## Structure
|
## Structure
|
||||||
- identifier: "\\b(setup|loop)\\b"
|
- identifier: "\\b(setup|loop)\\b"
|
||||||
|
|
||||||
##
|
##
|
||||||
- statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
- statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
||||||
|
|
||||||
## GCC builtins
|
## GCC builtins
|
||||||
@@ -97,5 +103,6 @@ rules:
|
|||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.java$"
|
filename: "\\.java$"
|
||||||
@@ -33,5 +39,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules: []
|
rules: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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:
|
detect:
|
||||||
filename: "\\.js$"
|
filename: "\\.js$"
|
||||||
@@ -45,5 +51,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "/\\*"
|
start: "/\\*"
|
||||||
end: "\\*/"
|
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:
|
detect:
|
||||||
filename: "\\.json$"
|
filename: "\\.json$"
|
||||||
@@ -10,7 +16,7 @@ rules:
|
|||||||
- constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
|
- constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
|
||||||
- constant: "\\b(null)\\b"
|
- constant: "\\b(null)\\b"
|
||||||
- constant: "\\b(true|false)\\b"
|
- constant: "\\b(true|false)\\b"
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
skip: "\\\\."
|
skip: "\\\\."
|
||||||
@@ -24,4 +30,6 @@ rules:
|
|||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
|
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
|
||||||
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
|
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: lisp
|
//go:build stxLisp || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["lisp"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: lisp
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "(emacs|zile)$|\\.(el|li?sp|scm|ss)$"
|
filename: "(emacs|zile)$|\\.(el|li?sp|scm|ss)$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
@@ -14,4 +20,6 @@ rules:
|
|||||||
- constant.specialChar: "\\\\.?"
|
- constant.specialChar: "\\\\.?"
|
||||||
- comment: "(^|[[:space:]]);.*"
|
- comment: "(^|[[:space:]]);.*"
|
||||||
- indent-char.whitespace: "[[: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:
|
detect:
|
||||||
filename: "\\.lua$"
|
filename: "\\.lua$"
|
||||||
@@ -51,13 +57,14 @@ rules:
|
|||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
- comment:
|
- comment:
|
||||||
start: "\\-\\-"
|
start: "\\-\\-"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
- comment:
|
- comment:
|
||||||
start: "\\-\\-\\[\\["
|
start: "\\-\\-\\[\\["
|
||||||
end: "\\]\\]"
|
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:
|
detect:
|
||||||
filename: "([Mm]akefile|\\.ma?k)$"
|
filename: "([Mm]akefile|\\.ma?k)$"
|
||||||
@@ -38,5 +44,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: man
|
//go:build stxMan || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["man"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: man
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "\\.[1-9]x?$"
|
filename: "\\.[1-9]x?$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
@@ -9,4 +15,6 @@ rules:
|
|||||||
- brightred: "\\.(BR?|I[PR]?).*$"
|
- brightred: "\\.(BR?|I[PR]?).*$"
|
||||||
- brightblue: "\\.(BR?|I[PR]?|PP)"
|
- brightblue: "\\.(BR?|I[PR]?|PP)"
|
||||||
- brightwhite: "\\\\f[BIPR]"
|
- brightwhite: "\\\\f[BIPR]"
|
||||||
- yellow: "\\.(br|DS|RS|RE|PD)"
|
- yellow: "\\.(br|DS|RS|RE|PD)"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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,6 +1,12 @@
|
|||||||
filetype: php
|
//go:build stxPhp || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["php"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: php
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "\\.php[2345s~]|\\.inc[2345s~]$"
|
filename: "\\.php[2345s~]|\\.inc[2345s~]$"
|
||||||
header: "^(<\\?php)"
|
header: "^(<\\?php)"
|
||||||
|
|
||||||
@@ -47,4 +53,6 @@ rules:
|
|||||||
|
|
||||||
- preproc: "<\\?(php|=)?"
|
- preproc: "<\\?(php|=)?"
|
||||||
- preproc: "\\?>"
|
- 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:
|
detect:
|
||||||
filename: "\\.py3$"
|
filename: "\\.py3$"
|
||||||
@@ -16,9 +22,9 @@ rules:
|
|||||||
# types
|
# types
|
||||||
- type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b"
|
- type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b"
|
||||||
# definitions
|
# definitions
|
||||||
- identifier: "def [a-zA-Z_0-9]+"
|
- identifier: "def [a-zA-Z_0-9]+"
|
||||||
# keywords
|
# keywords
|
||||||
- statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b"
|
- statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b"
|
||||||
# decorators
|
# decorators
|
||||||
- brightgreen: "@.*[(]"
|
- brightgreen: "@.*[(]"
|
||||||
# operators
|
# operators
|
||||||
@@ -55,5 +61,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -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:
|
detect:
|
||||||
filename: "\\.(r|R)$"
|
filename: "\\.(r|R)$"
|
||||||
@@ -9,4 +15,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: ruby
|
//go:build stxRuby || stxAll
|
||||||
|
|
||||||
detect:
|
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"
|
filename: "\\.rb$|\\.ru|\\.rbx|\\.rake|\\.gemspec$|Gemfile|Rakefile|Capfile|Vagrantfile"
|
||||||
header: "^#!.*/(env +)?ruby( |$)"
|
header: "^#!.*/(env +)?ruby( |$)"
|
||||||
|
|
||||||
@@ -11,7 +17,7 @@ rules:
|
|||||||
- constant: "(i?)([ ]|^):[0-9A-Z_]+\\b"
|
- constant: "(i?)([ ]|^):[0-9A-Z_]+\\b"
|
||||||
- constant: "\\b(__FILE__|__LINE__)\\b"
|
- constant: "\\b(__FILE__|__LINE__)\\b"
|
||||||
- constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
|
- constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
|
||||||
- constant.string: "`[^`]*`|%x\\{[^}]*\\}"
|
- constant.string: "` + "`" + `[^` + "`" + `]*` + "`" + `|%x\\{[^}]*\\}"
|
||||||
- constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
|
- constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
|
||||||
- special: "#\\{[^}]*\\}"
|
- special: "#\\{[^}]*\\}"
|
||||||
- constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
|
- constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
|
||||||
@@ -27,4 +33,6 @@ rules:
|
|||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
- todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
|
- 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:
|
detect:
|
||||||
filename: "\\.rs$"
|
filename: "\\.rs$"
|
||||||
@@ -44,5 +50,6 @@ rules:
|
|||||||
- special:
|
- special:
|
||||||
start: "#!\\["
|
start: "#!\\["
|
||||||
end: "\\]"
|
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:
|
detect:
|
||||||
filename: "\\.scala$"
|
filename: "\\.scala$"
|
||||||
@@ -25,5 +31,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "/\\*\\*"
|
start: "/\\*\\*"
|
||||||
end: "\\*/"
|
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:
|
detect:
|
||||||
filename: "\\.swift$"
|
filename: "\\.swift$"
|
||||||
@@ -47,5 +53,6 @@ rules:
|
|||||||
start: "/\\*\\*"
|
start: "/\\*\\*"
|
||||||
end: "\\*/"
|
end: "\\*/"
|
||||||
rules:
|
rules:
|
||||||
- todo: "(TODO|XXX|FIXME):?"
|
- todo: "(TODO|XXX|FIXME):?"`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
filetype: systemd
|
//go:build stxSystemd || stxAll
|
||||||
|
|
||||||
detect:
|
package syntax
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
syntaxMap["systemd"] = &lazySyntax{init: func() []byte {
|
||||||
|
return []byte(`filetype: systemd
|
||||||
|
|
||||||
|
detect:
|
||||||
filename: "\\.(service|socket)$"
|
filename: "\\.(service|socket)$"
|
||||||
header: "^\\[Unit\\]$"
|
header: "^\\[Unit\\]$"
|
||||||
|
|
||||||
@@ -13,4 +19,6 @@ rules:
|
|||||||
- constant.bool: "\\b(true|false)\\b"
|
- constant.bool: "\\b(true|false)\\b"
|
||||||
- comment: "(^|[[:space:]])#([^{].*)?$"
|
- comment: "(^|[[:space:]])#([^{].*)?$"
|
||||||
- indent-char.whitespace: "[[: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:
|
detect:
|
||||||
filename: "\\.toml"
|
filename: "\\.toml"
|
||||||
@@ -29,8 +35,8 @@ rules:
|
|||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "`"
|
start: "` + "`" + `"
|
||||||
end: "`"
|
end: "` + "`" + `"
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
@@ -38,5 +44,6 @@ rules:
|
|||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.ts$"
|
filename: "\\.ts$"
|
||||||
@@ -40,5 +46,6 @@ rules:
|
|||||||
end: "'"
|
end: "'"
|
||||||
skip: "\\\\."
|
skip: "\\\\."
|
||||||
rules:
|
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:
|
detect:
|
||||||
filename: "\\.(xml|sgml?|rng|plist)$"
|
filename: "\\.(xml|sgml?|rng|plist)$"
|
||||||
@@ -14,8 +20,10 @@ rules:
|
|||||||
start: "<!DOCTYPE"
|
start: "<!DOCTYPE"
|
||||||
end: "[/]?>"
|
end: "[/]?>"
|
||||||
rules: []
|
rules: []
|
||||||
- comment:
|
- comment:
|
||||||
start: "<!--"
|
start: "<!--"
|
||||||
end: "-->"
|
end: "-->"
|
||||||
rules: []
|
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:
|
detect:
|
||||||
filename: "\\.ya?ml$"
|
filename: "\\.ya?ml$"
|
||||||
@@ -31,6 +37,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
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:
|
detect:
|
||||||
filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
|
filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
|
||||||
@@ -11,7 +17,7 @@ rules:
|
|||||||
## Conditionals and control flow
|
## 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: "\\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
|
## Conditional flags
|
||||||
- special: "-[Ldefgruwx]\\b"
|
- special: "-[Ldefgruwx]\\b"
|
||||||
- special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
|
- special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
|
||||||
@@ -48,5 +54,6 @@ rules:
|
|||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []`)
|
||||||
|
}}
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
sh.yaml
|
|
||||||
@@ -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:]]+$"
|
|
||||||
Reference in New Issue
Block a user