mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-17 22:37:10 +09:00
Merge branch 'master' into patch-1
This commit is contained in:
@@ -64,5 +64,4 @@ Here is a list of the files that have been converted to properly use colorscheme
|
||||
|
||||
# License
|
||||
|
||||
Because the nano syntax files I have modified are distributed under the GNU GPLv3 license, these files are also distributed
|
||||
under that license. See [LICENSE](LICENSE).
|
||||
See [LICENSE](LICENSE).
|
||||
|
||||
58
runtime/syntax/bat.yaml
Normal file
58
runtime/syntax/bat.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
filetype: batch
|
||||
|
||||
detect:
|
||||
filename: "(\\.bat$)"
|
||||
# header: ""
|
||||
|
||||
rules:
|
||||
# Numbers
|
||||
- constant.number: "\\b[0-9]+\\b"
|
||||
# Brackets and symbols
|
||||
- special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
|
||||
# Conditionals and control flow
|
||||
# note (?i) means case insensitive match
|
||||
- type: "\\b(?i)(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|then|until|while)\\b"
|
||||
- type: "\\b(?i)(equ|neq|lss|leq|gtr|geq|on|off)\\b"
|
||||
- type: "\\b(?i)(goto|for|in|do|call|exit|not|exist|errorlevel|defined)\\b"
|
||||
- type: "\\b(?i)(prn|nul|lpt3|lpt2|lpt1|con|com4|com3|com2|com1|aux)\\b"
|
||||
# keywords
|
||||
- statement: "\\b(?i)(adprep|append|arp|assoc|at|atmadm|attrib|auditpol|autochk|autoconv|autofmt|bcdboot|bcdedit|bdehdcfg|bitsadmin|bootcfg|break|brea)\\b"
|
||||
- statement: "\\b(?i)(cacls|cd|certreq|certutil|chcp|change|choice|cipher|chdir|chkdsk|chkntfs|chglogon|chgport|chgusr|clip|cls|clscluadmin|cluster|cmd|cmdkey|cmstp|color)\\b"
|
||||
- statement: "\\b(?i)(comp|compact|convert|copy|cprofile|cscript|csvde|date|dcdiag|dcgpofix|dcpromo|defra|del|dfscmd|dfsdiag|dfsrmig|diantz|dir|dirquota|diskcomp|diskcopy|diskpart|diskperf|diskraid|diskshadow|dispdiag|doin|dnscmd|doskey|driverquery|dsacls|dsadd|dsamain|dsdbutil|dsget|dsmgmt|dsmod|dsmove|dsquery|dsrm)\\b"
|
||||
- statement: "\\b(?i)(echo|edit|endlocal|erase|esentutl|eventcreate|eventquery|eventtriggers|evntcmd|expand|extract)\\b"
|
||||
- statement: "\\b(?i)(fc|filescrn|find|findstr|finger|flattemp|fonde|forfiles|format|freedisk|fs|fsutil|ftp|ftype|fveupdate|getmac|gettype|gpfixup|gpresult|gpupdate|graftabl)\\b"
|
||||
- statement: "\\b(?i)(hashgen|hep|help|helpctr|hostname|icacls|iisreset|inuse|ipconfig|ipxroute|irftp|ismserv|jetpack|keyb|klist|ksetup|ktmutil|ktpass|label|ldifd|ldp|lodctr|logman|logoff|lpq|lpr|macfile)\\b"
|
||||
- statement: "\\b(?i)(makecab|manage-bde|mapadmin|md|mkdir|mklink|mmc|mode|more|mount|mountvol|move|mqbup|mqsvc|mqtgsvc|msdt|msg|msiexec|msinfo32|mstsc|nbtstat|net computer|net group)\\b"
|
||||
- statement: "\\b(?i)(net localgroup|net print|net session|net share|net start|net stop|net use|net user|net view|net|netcfg|netdiag|netdom|netsh|netstat|nfsadmin|nfsshare|nfsstat|nlb)\\b"
|
||||
- statement: "\\b(?i)(nlbmgr|nltest|nslookup|ntackup|ntcmdprompt|ntdsutil|ntfrsutl|openfiles|pagefileconfig|path|pathping|pause|pbadmin|pentnt|perfmon|ping|pnpunatten|pnputil|popd)\\b"
|
||||
- statement: "\\b(?i)(powercfg|powershell|powershell_ise|print|prncnfg|prndrvr|prnjobs|prnmngr|prnport|prnqctl|prompt|pubprn|pushd|pushprinterconnections|pwlauncher|qappsrv|qprocess)\\b"
|
||||
- statement: "\\b(?i)(query|quser|qwinsta|rasdial|rcp|rd|rdpsign|regentc|recover|redircmp|redirusr|reg|regini|regsvr32|relog|ren|rename|rendom|repadmin|repair-bde|replace|reset|restore)\\b"
|
||||
- statement: "\\b(?i)(rxec|risetup|rmdir|robocopy|route|rpcinfo|rpcping|rsh|runas|rundll32|rwinsta|scp|sc|setlocal|session|schtasks|scwcmd|secedit|serverceipoptin|servrmanagercmd|serverweroptin|set|setspn)\\b"
|
||||
- statement: "\\b(?i)(setx|sfc|shadow|shift|showmount|shutdown|sort|ssh|start|storrept|subst|sxstrace|ysocmgr|systeminfo|takeown|tapicfg|taskkill|tasklist|tcmsetup|telnet|tftp|time)\\b"
|
||||
- statement: "\\b(?i)(timeout|title|tlntadmn|tpmvscmgr|tpmvscmgr|tacerpt|tracert|tree|tscon|tsdiscon|tsecimp|tskill|tsprof|type|typeperf|tzutil|uddiconfig|umount|unlodctr|ver|verify)\\b"
|
||||
- statement: "\\b(?i)(verifier|verif|vol|vssadmin|w32tm|waitfor|wbadmin|wdsutil|wecutil|wevtutil|where|whoami|winnt|winnt32|winpop|winrm|winrs|winsat|wlbs|mic|wscript|xcopy)\\b"
|
||||
# / Flags
|
||||
- constant: "(/\\w+)"
|
||||
# Variables
|
||||
- special: "(%%\\w+)"
|
||||
- special: "(%\\w+%)"
|
||||
# Conditional flags
|
||||
- type: "--[a-z-]+"
|
||||
- type: "\\ -[a-z]+"
|
||||
|
||||
- identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
|
||||
- identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
|
||||
# "" String
|
||||
- constant.string:
|
||||
start: \"
|
||||
end: \"
|
||||
skip: \.
|
||||
rules:
|
||||
- constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
|
||||
- constant.unicode: \\u\{[[:xdigit:]]+}
|
||||
# '' string
|
||||
- constant.string: "(\\'.+\\')"
|
||||
# rem as comment
|
||||
- comment.rem: "(?i)(rem\\s.*)"
|
||||
# :: as comment
|
||||
- comment.rem: "(?i)(\\:\\:\\s.*)"
|
||||
@@ -36,7 +36,11 @@ rules:
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- special: "#\\{[^}]*\\}"
|
||||
- symbol.brackets:
|
||||
start: "#\\{"
|
||||
end: "\\}"
|
||||
rules:
|
||||
- default: ".*"
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
|
||||
17
runtime/syntax/godoc.yaml
Normal file
17
runtime/syntax/godoc.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# godoc
|
||||
# example: go doc -all | micro
|
||||
|
||||
filetype: godoc
|
||||
|
||||
detect:
|
||||
filename: "\\.godoc$"
|
||||
header: package.*import
|
||||
|
||||
rules:
|
||||
- preproc: "^[^ ].*"
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
@@ -18,9 +18,13 @@ rules:
|
||||
|
||||
- symbol.tag: "<|>"
|
||||
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
||||
- comment: "<!--.+?-->"
|
||||
- preproc: "<!DOCTYPE.+?>"
|
||||
|
||||
- comment:
|
||||
start: "<!--"
|
||||
end: "-->"
|
||||
rules: []
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
|
||||
@@ -8,7 +8,8 @@ rules:
|
||||
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
|
||||
- constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
|
||||
- constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
|
||||
- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
|
||||
#- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
|
||||
# ^ this is not correct usage of the identifier color
|
||||
- symbol.brackets: "(\\{|\\})"
|
||||
- symbol.brackets: "(\\(|\\))"
|
||||
- symbol.brackets: "(\\[|\\])"
|
||||
@@ -22,16 +23,21 @@ rules:
|
||||
- statement: "\\b(set|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
|
||||
# reserved but unassigned
|
||||
- error: "\\b(enum|implements|interface|package|private|protected|public|TODO)"
|
||||
- constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b"
|
||||
- constant: "\\b(null|undefined|NaN)\\b"
|
||||
- constant: "\\b(true|false)\\b"
|
||||
- type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Generator|Map|Math)\\b"
|
||||
- type: "\\b(Number|Object|Promise|Proxy|Reflect|RegExp|Set|String|Symbol|WeakMap|WeakSet)\\b"
|
||||
- type: "\\b(BigInt64Array|BigUint64Array|Float32Array|Float64Array|Int16Array)\\b"
|
||||
- type: "\\b(Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\\b"
|
||||
|
||||
# - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
|
||||
- constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
|
||||
- comment: "^#!.*/(env +)?node( |$)"
|
||||
|
||||
- identifier: "\\b(alert|decodeURI|decodeURIComponent|document|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape|uneval|window)\\b"
|
||||
- identifier: "\\b(Intl|WebAssembly)\\b"
|
||||
- identifier: "\\b(Arguments)\\b"
|
||||
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
|
||||
19
runtime/syntax/jinja2.yaml
Normal file
19
runtime/syntax/jinja2.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
filetype: jinja2
|
||||
|
||||
rules:
|
||||
- include: "html"
|
||||
- special: "({{|}}|{%-?|-?%})"
|
||||
- default:
|
||||
start: "({%-?|{{)"
|
||||
end: "(-?%}|}})"
|
||||
limit-group: special
|
||||
rules:
|
||||
- include: "python"
|
||||
- statement: "\\b(ignore missing|with(out)? context|block|call|endblock|endcall|endfilter|endfor|endmacro|endraw|endset|extends|filter|for|include|macro|raw|recursive|scoped|set)\\b"
|
||||
- identifier.builtinfunc: "\\b(attr|batch|capitalize|center|count|d|default|dictsort|e|escape|filesizeformat|first|forceescape|groupby|indent|join|last|length|lower|pprint|random|reject|rejectattr|replace|reverse|safe|select|selectattr|striptags|title|tojson|trim|truncate|unique|upper|urlencode|urlize|wordcount|wordwrap|xmlattr)\\b"
|
||||
- identifier.builtintest: "\\b(callable|defined|divisibleby|eq|equalto|escaped|even|ge|gt|iterable|le|lower|lt|mapping|ne|none|number|odd|sameas|sequence|string|undefined|upper)\\b"
|
||||
- identifier.defaultglobal: "\\b(lipsum|cycler|joiner|namespace)\\b"
|
||||
- comment:
|
||||
start: "{#"
|
||||
end: "#}"
|
||||
rules: []
|
||||
@@ -13,11 +13,11 @@ rules:
|
||||
# definitions
|
||||
- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
|
||||
# keywords
|
||||
- statement: "\\b(begin|break|catch|continue|function|elseif|struct|else|end|finally|for|global|local|const|if|include|import|using|require|macro|println|return|try|type|while|module)\\b"
|
||||
- statement: "\\b(begin|break|catch|continue|function|elseif|struct|else|end|finally|for|global|local|let|const|if|import|using|macro|println|return|try|while|module)\\b"
|
||||
# decorators
|
||||
- identifier.macro: "@[A-Za-z0-9_]+"
|
||||
# operators
|
||||
- symbol.operator: "[-+*/|=%<>&~^]|\\b(and|not|or|is|in)\\b"
|
||||
- symbol.operator: "[-+*/|=%<>&~^]|\\b(isa|in)\\b"
|
||||
# parentheses
|
||||
- symbol.brackets: "([(){}]|\\[|\\])"
|
||||
# numbers
|
||||
|
||||
74
runtime/syntax/make_headers.go
Normal file
74
runtime/syntax/make_headers.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type HeaderYaml struct {
|
||||
FileType string `yaml:"filetype"`
|
||||
Detect struct {
|
||||
FNameRgx string `yaml:"filename"`
|
||||
HeaderRgx string `yaml:"header"`
|
||||
} `yaml:"detect"`
|
||||
}
|
||||
|
||||
type Header struct {
|
||||
FileType string
|
||||
FNameRgx string
|
||||
HeaderRgx string
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) > 1 {
|
||||
os.Chdir(os.Args[1])
|
||||
}
|
||||
files, _ := ioutil.ReadDir(".")
|
||||
for _, f := range files {
|
||||
fname := f.Name()
|
||||
if strings.HasSuffix(fname, ".yaml") {
|
||||
convert(fname[:len(fname)-5])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func convert(name string) {
|
||||
filename := name + ".yaml"
|
||||
var hdr HeaderYaml
|
||||
source, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = yaml.Unmarshal(source, &hdr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
encode(name, hdr)
|
||||
}
|
||||
|
||||
func encode(name string, c HeaderYaml) {
|
||||
f, _ := os.Create(name + ".hdr")
|
||||
f.WriteString(c.FileType + "\n")
|
||||
f.WriteString(c.Detect.FNameRgx + "\n")
|
||||
f.WriteString(c.Detect.HeaderRgx + "\n")
|
||||
f.Close()
|
||||
}
|
||||
|
||||
func decode(name string) Header {
|
||||
start := time.Now()
|
||||
data, _ := ioutil.ReadFile(name + ".hdr")
|
||||
strs := bytes.Split(data, []byte{'\n'})
|
||||
var hdr Header
|
||||
hdr.FileType = string(strs[0])
|
||||
hdr.FNameRgx = string(strs[1])
|
||||
hdr.HeaderRgx = string(strs[2])
|
||||
fmt.Printf("took %v\n", time.Since(start))
|
||||
|
||||
return hdr
|
||||
}
|
||||
23
runtime/syntax/mc.yaml
Normal file
23
runtime/syntax/mc.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# sendmail config files
|
||||
|
||||
filetype: mc
|
||||
|
||||
detect:
|
||||
filename: "\\.mc$"
|
||||
|
||||
rules:
|
||||
- statement: "^(divert|VERSIONID|OSTYPE|DOMAIN|FEATURE|define)"
|
||||
- statement: "^(DAEMON_OPTIONS|MAILER)"
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
- comment:
|
||||
start: "dnl"
|
||||
end: "$"
|
||||
rules: []
|
||||
- constant.string:
|
||||
start: "`"
|
||||
end: "'"
|
||||
rules: []
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
filetype: nim
|
||||
|
||||
detect:
|
||||
filename: "\\.nim$|\\.nims$|nim.cfg"
|
||||
filename: "\\.nims?$|nim.cfg"
|
||||
|
||||
rules:
|
||||
- preproc: "[\\{\\|]\\b(atom|lit|sym|ident|call|lvalue|sideeffect|nosideeffect|param|genericparam|module|type|let|var|const|result|proc|method|iterator|converter|macro|template|field|enumfield|forvar|label|nk[a-zA-Z]+|alias|noalias)\\b[\\}\\|]"
|
||||
|
||||
40
runtime/syntax/proto.yaml
Normal file
40
runtime/syntax/proto.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
filetype: proto
|
||||
|
||||
detect:
|
||||
filename: "(\\.(proto)$$)"
|
||||
|
||||
rules:
|
||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||
- type: "\\b(int(8|16|32|64))|string|bytes|repeated|bool|required|map|optional|oneof|union\\b"
|
||||
- statement: "\\b(import|service|enum|syntax|package|option|message|rpc|returns|extensions|to)\\b"
|
||||
- constant: "'\\\\(([0-3]?[0-7]{1,2}))'"
|
||||
- constant: "'\\\\x[0-9A-Fa-f]{1,2}'"
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "'"
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- preproc: "..+"
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
@@ -1,26 +1,68 @@
|
||||
filetype: ruby
|
||||
|
||||
detect:
|
||||
filename: "\\.rb$|\\.gemspec$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
|
||||
filename: "\\.(rb|rake|gemspec)$|^(Gemfile|config.ru|Rakefile|Capfile|Vagrantfile|Guardfile)$"
|
||||
header: "^#!.*/(env +)?ruby( |$)"
|
||||
|
||||
rules:
|
||||
- statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\b"
|
||||
- comment.bright:
|
||||
start: "##"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(XXX|TODO|FIXME|BUG|\\?\\?\\?)"
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(XXX|TODO|FIXME|BUG|\\?\\?\\?)"
|
||||
|
||||
- statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|for|if|in|module|next|nil|not|or|private|protected|public|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\\b"
|
||||
- constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
|
||||
- constant.number: "\\b[0-9]+\\b"
|
||||
- constant.number: "(?i)\\b0x[0-9a-f][0-9a-f_]*\\b"
|
||||
- constant.number: "(?i)\\b0b[01][01_]*\\b"
|
||||
- constant.number: "(?i)\\b[0-9][0-9_]*(['.'][0-9_]+)?(e[\\-]?[0-9_]+)?\\b"
|
||||
# Ruby "Symbols"
|
||||
- constant: "(i?)([ ]|^):[0-9A-Z_]+\\b"
|
||||
- constant: "\\b(__FILE__|__LINE__)\\b"
|
||||
- constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
|
||||
- constant.string: "`[^`]*`|%x\\{[^}]*\\}"
|
||||
- constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
|
||||
- special: "#\\{[^}]*\\}"
|
||||
- constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
|
||||
- comment: "#[^{].*$|#$"
|
||||
- comment.bright: "##[^{].*$|##$"
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "'"
|
||||
skip: "\\\\."
|
||||
rules: []
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- symbol.brackets:
|
||||
start: "#\\{"
|
||||
end: "\\}"
|
||||
rules:
|
||||
- default: ".*"
|
||||
|
||||
- constant.string.exec:
|
||||
start: "`"
|
||||
end: "`"
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- symbol.brackets:
|
||||
start: "#\\{"
|
||||
end: "\\}"
|
||||
rules:
|
||||
- default: ".*"
|
||||
|
||||
- constant.string: "%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
|
||||
- constant.string: "%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
|
||||
- constant.string.exec: "%[x]\\{[^}]*\\}|%[x]\\([^)]*\\)|%[x]<[^>]*>|%[x]\\[[^]]*\\]|%[x]\\$[^$]*\\$|%[x]\\^[^^]*\\^|%[x]![^!]*!"
|
||||
- constant.bool: "\\b(true|false|nil|TRUE|FALSE|NIL)\\b"
|
||||
- symbol.operator: "[-+/*=<>!~%&|^]|\\b:"
|
||||
- symbol.brackets: "([(){}]|\\[|\\])"
|
||||
- constant.macro:
|
||||
start: "<<-?'?EOT'?"
|
||||
end: "^EOT"
|
||||
rules: []
|
||||
|
||||
- todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
|
||||
- preproc.shebang: "^#!.+?( |$)"
|
||||
|
||||
27
runtime/syntax/svelte.yaml
Normal file
27
runtime/syntax/svelte.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
filetype: svelte
|
||||
|
||||
detect:
|
||||
filename: "\\.svelte$"
|
||||
|
||||
rules:
|
||||
- default:
|
||||
start: "<script>"
|
||||
end: "</script>"
|
||||
rules:
|
||||
- include: "javascript"
|
||||
|
||||
- default:
|
||||
start: "<script lang=\"ts\">"
|
||||
end: "</script>"
|
||||
rules:
|
||||
- include: "typescript"
|
||||
- default:
|
||||
start: "<style.*?>"
|
||||
end: "</style.*?>"
|
||||
rules:
|
||||
- include: "css"
|
||||
- default:
|
||||
start: "^"
|
||||
end: "$"
|
||||
rules:
|
||||
- include: "html5"
|
||||
@@ -20,9 +20,10 @@ rules:
|
||||
- special: "[&\\\\]"
|
||||
# macros
|
||||
- statement: "\\\\@?[a-zA-Z_]+"
|
||||
- statement: "\\\\%"
|
||||
# comments
|
||||
- comment:
|
||||
start: "%"
|
||||
start: "[^\\\\]%"
|
||||
end: "$"
|
||||
rules: []
|
||||
- comment:
|
||||
|
||||
85
runtime/syntax/v.yaml
Normal file
85
runtime/syntax/v.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
filetype: v
|
||||
|
||||
detect:
|
||||
filename: "\\.v$"
|
||||
|
||||
rules:
|
||||
# Conditionals and control flow
|
||||
- keywords: "\\b(import|go|defer)\\b"
|
||||
- special: "\\b(or|break|continue|match|case|goto|return|none)\\b"
|
||||
- function: "\\b(fn)\\b"
|
||||
- main_function: "\\b(fn main\\(\\))"
|
||||
- optionals: "\\b(none|error\\()"
|
||||
- statement: "\\b(if|else|for|match)\\b"
|
||||
- assert: "\\b(assert)\\b"
|
||||
- symbol.operator: "\\b([-+/*=<>!~%&|^])\\b"
|
||||
- symbol.operator: "\\b(:=)\\b"
|
||||
- symbol.operator: "\\b(\\|\\|)\b"
|
||||
- symbol.operator: "\\b(\\&\\&)\\b"
|
||||
|
||||
- compile_if: "\\b(\\$if|\\$else)\\b"
|
||||
- oses: "\\b(mac|macos|linux|windows|freebsd|openbsd|netbsd|dragonfly|js|android|solaris|haiku)\\b"
|
||||
|
||||
# Types
|
||||
- symbol: "(,|\\.)"
|
||||
- btype: "\\b(bool)\\b"
|
||||
- ztype: "\\b(char|byte)\\b"
|
||||
- itype: "\\b(int|i(8|16|64)|u(8|16|32|64))\\b"
|
||||
- ftype: "\\b(f(32|64))\\b"
|
||||
- ptype: "\\b(uintptr|charptr|byteptr|voidptr)\\b"
|
||||
- atype: "\\b(array)\\b"
|
||||
- stype: "\\b(string|ustring)\\b"
|
||||
- mtype: "\\b(map)\\b"
|
||||
- type.keyword: "\\b(pub|mut|struct|enum|interface|module|type|const)\\b"
|
||||
- constant.bool: "\\b(true|false)\\b"
|
||||
|
||||
# Brackets
|
||||
- symbol.brackets: "(\\{|\\})"
|
||||
- symbol.brackets: "(\\(|\\))"
|
||||
- symbol.brackets: "(\\[|\\])"
|
||||
|
||||
# Numbers and strings
|
||||
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "%."
|
||||
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
|
||||
- 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: "'"
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- error: "..+"
|
||||
- constant.specialChar: "%."
|
||||
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
|
||||
- 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: "`"
|
||||
rules: []
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- function.attribute:
|
||||
start: "^\\["
|
||||
end: "\\]$"
|
||||
rules:
|
||||
- known: "\\b(deprecated|inline|typedef|if)\\b"
|
||||
|
||||
60
runtime/syntax/verilog.yaml
Normal file
60
runtime/syntax/verilog.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
filetype: verilog
|
||||
|
||||
detect:
|
||||
filename: "\\.(vh|sv|svh)$"
|
||||
|
||||
rules:
|
||||
- preproc: "\\b(module|package|program|endmodule|endpackage|endprogram)\\b"
|
||||
- type.keyword: "\\b(task|interface|class|endtask|endinterface|endclass)\\b"
|
||||
# builtin functions like $display
|
||||
- special: "\\$[0-9A-Za-z_]+"
|
||||
|
||||
# Verilog keywords
|
||||
- statement: "\\b(always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config)\\b"
|
||||
- statement: "\\b(deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate)\\b"
|
||||
- statement: "\\b(endprimitive|endspecify|endtable|event|for|force|forever|fork|function|generate)\\b"
|
||||
- statement: "\\b(genvar|highz0|highz1|if|iff|ifnone|incdir|include|initial|input|instance|join)\\b"
|
||||
- statement: "\\b(large|liblist|library|localparam|macromodule|medium|nand|negedge|nmos|nor|noshowcancelled)\\b"
|
||||
- statement: "\\b(not|notif0|notif1|null|or|output|parameter|pmos|posedge|primitive|pull0|pull1|pulldown|pullup)\\b"
|
||||
- statement: "\\b(pulsestyle_onevent|pulsestyle_ondetect|rcmos|realtime|reg|release|repeat|rnmos|rpmos|rtran)\\b"
|
||||
- statement: "\\b(rtranif0|rtranif1|scalared|showcancelled|small|specify|specparam|strong0|strong1|supply0)\\b"
|
||||
- statement: "\\b(supply1|table|time|tran|tranif0|tranif1|tri0|tri1|triand|trior|trireg|use|uwire)\\b"
|
||||
- statement: "\\b(vectored|wait|wand|weak0|weak1|while|wor|xnor|xor)\\b"
|
||||
|
||||
# SystemVerilog keywords
|
||||
- statement: "\\b(alias|always_comb|always_ff|always_latch|assert|assume|before|bind|bins|binsof|break)\\b"
|
||||
- statement: "\\b(chandle|clocking|const|constraint|context|continue|cover|covergroup|coverpoint|cross|dist|do)\\b"
|
||||
- statement: "\\b(endclocking|endgroup|endproperty|endsequence|enum)\\b"
|
||||
- statement: "\\b(expect|export|extends|extern|final|first_match|foreach|forkjoin|ignore_bins|illegal_bins|import)\\b"
|
||||
- statement: "\\b(inside|intersect|join_any|join_none|local|longint|matches|modport|new)\\b"
|
||||
- statement: "\\b(packed|priority|property|protected|pure|rand|randc|randcase|randsequence|ref|return)\\b"
|
||||
- statement: "\\b(sequence|solve|static|struct|super|tagged|this|throughout|timeprecision)\\b"
|
||||
- statement: "\\b(timeunit|type|typedef|union|unique|virtual|wait_order|wildcard|with|within)\\b"
|
||||
|
||||
# types
|
||||
- type.keyword: "\\b(int|integer|logic|wire|tri|unsigned|signed|inout|var|shortint|shortreal|real|void|string|bit|byte)\\b"
|
||||
|
||||
# constants
|
||||
- constant.number: "\\b[0-9]+\\b"
|
||||
- constant.number: "\\b'[su]?[dboh][0-9xzXZa-fA-F]+\\b"
|
||||
# .asdf(...) argument syntax
|
||||
- special: "\\.((\\*)|([A-Za-z][A-Za-z0-9_]*))"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
@@ -24,7 +24,7 @@ rules:
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.comment:
|
||||
- comment:
|
||||
start: "\""
|
||||
end: "$"
|
||||
rules: []
|
||||
|
||||
@@ -11,14 +11,20 @@ rules:
|
||||
- include: "html5"
|
||||
|
||||
- default:
|
||||
start: "<script.*?>"
|
||||
end: "</script.*?>"
|
||||
start: "<script>"
|
||||
end: "</script>"
|
||||
rules:
|
||||
- include: "javascript"
|
||||
|
||||
- default:
|
||||
start: "<script[ ]+lang=(\"ts\"|'ts')>"
|
||||
end: "</script>"
|
||||
rules:
|
||||
- include: "typescript"
|
||||
|
||||
- default:
|
||||
start: "<style.*?>"
|
||||
end: "</style.*?>"
|
||||
rules:
|
||||
- include: "css"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user