mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-28 22:08:12 +09:00
Merge branch 'master' into highlight-nimscript
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.*)"
|
||||
@@ -27,6 +27,7 @@ rules:
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "'"
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
# Keywords
|
||||
|
||||
38
runtime/syntax/elm.yaml
Normal file
38
runtime/syntax/elm.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
filetype: elm
|
||||
|
||||
detect:
|
||||
filename: "\\.elm$"
|
||||
|
||||
rules:
|
||||
- statement: "\\b(as|alias|case|else|exposing|if|import|in|let|module|of|port|then|type|)\\b"
|
||||
- statement: "(\\=|\\:|\\->)"
|
||||
- type: "\\b([A-Z][A-Za-z\\d]*)\\b"
|
||||
- identifier: "^([a-z][A-Za-z\\d]*)\\b"
|
||||
- constant.string:
|
||||
start: "\"\"\""
|
||||
end: "\"\"\""
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- 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):?"
|
||||
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):?"
|
||||
@@ -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: "(\\[|\\])"
|
||||
@@ -20,15 +21,20 @@ rules:
|
||||
- statement: "\\b(for|function|class|extends|get|if|import|from|in|of|instanceof|let|new|return|set)\\b"
|
||||
- statement: "\\b(super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
|
||||
# reserved but unassigned
|
||||
- error: "\\b(enum|implements|interface|package|private|protected|public)"
|
||||
- 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|Math)\\b"
|
||||
- type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math|Map|Set|WeakMap|WeakSet)\\b"
|
||||
- type: "\\b(Number|Object|RegExp|String)\\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,17 +13,17 @@ 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
|
||||
- constant.number: "\\b[0-9]+\\b"
|
||||
- constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*)\\b"
|
||||
|
||||
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
|
||||
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^']){1}'"
|
||||
|
||||
- constant.string:
|
||||
start: "\"\"\""
|
||||
|
||||
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: "\\.nims?$"
|
||||
detect:
|
||||
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):?"
|
||||
@@ -6,11 +6,11 @@ detect:
|
||||
|
||||
rules:
|
||||
# built-in objects
|
||||
- constant: "\\b(None|self|True|False)\\b"
|
||||
- constant: "\\b(Ellipsis|None|self|True|False)\\b"
|
||||
# built-in attributes
|
||||
- constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b"
|
||||
# built-in functions
|
||||
- identifier: "\\b(abs|all|any|ascii|bin|callable|chr|compile|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b"
|
||||
- identifier: "\\b(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|nonlocal|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b"
|
||||
# special method names
|
||||
- identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b"
|
||||
# types
|
||||
@@ -18,7 +18,7 @@ rules:
|
||||
# definitions
|
||||
- identifier: "def [a-zA-Z_0-9]+"
|
||||
# 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|await|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
|
||||
- brightgreen: "@.*[(]"
|
||||
# operators
|
||||
|
||||
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: []
|
||||
|
||||
30
runtime/syntax/vue.yaml
Normal file
30
runtime/syntax/vue.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
filetype: vue
|
||||
|
||||
detect:
|
||||
filename: "\\.vue$"
|
||||
|
||||
rules:
|
||||
- default:
|
||||
start: "<template.*?>"
|
||||
end: "</template.*?>"
|
||||
rules:
|
||||
- include: "html5"
|
||||
|
||||
- default:
|
||||
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"
|
||||
|
||||
37
runtime/syntax/zig.yaml
Normal file
37
runtime/syntax/zig.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
filetype: zig
|
||||
|
||||
detect:
|
||||
filename: "\\.zig$"
|
||||
|
||||
rules:
|
||||
# function definition
|
||||
- identifier: "fn [a-z0-9_]+"
|
||||
# Reserved words
|
||||
- statement: "\\b(align|and|allowzero|anyerror|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|false|fn|for|if|inline|nakedcc|noalias|null|or|orelse|packed|promise|pub|resume|return|linksection|stdcallcc|struct|suspend|switch|test|threadlocal|true|try|undefined|union|unreachable|use|var|volatile|while)\\b"
|
||||
# builtin functions
|
||||
- special: "@+[a-z_]+"
|
||||
# Constants
|
||||
- constant: "[A-Z][A-Z_]+([0-9]+)?"
|
||||
# Numbers (hexadecimal + decimal)
|
||||
- constant.number: "\\b(0x[A-F0-9]+|[0-9]+)\\b"
|
||||
# Primitive Types / Derived Data Types
|
||||
- type: "([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "\""
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
Reference in New Issue
Block a user