codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: MikroTik RouterOS Script3" Maintainer: zainin <z@wintr.dev>4" Original Author: ndbjorne @ MikroTik forums5" Last Change: 2021 Nov 146 7" quit when a syntax file was already loaded8if exists("b:current_syntax")9 finish10endif11 12syn case ignore13 14syn iskeyword @,48-57,-15 16" comments17syn match routerosComment /^\s*\zs#.*/18 19" options submenus: /interface ether1 etc20syn match routerosSubMenu "\([a-z]\)\@<!/[a-zA-Z0-9-]*"21 22" variables are matched by looking at strings ending with "=", e.g. var=23syn match routerosVariable "[a-zA-Z0-9-/]*\(=\)\@="24syn match routerosVariable "$[a-zA-Z0-9-]*"25 26" colored for clarity27syn match routerosDelimiter "[,=]"28" match slash in CIDR notation (1.2.3.4/24, 2001:db8::/48, ::1/128)29syn match routerosDelimiter "\(\x\|:\)\@<=\/\(\d\)\@="30" dash in IP ranges31syn match routerosDelimiter "\(\x\|:\)\@<=-\(\x\|:\)\@="32 33" match service names after "set", like in original routeros syntax34syn match routerosService "\(set\)\@<=\s\(api-ssl\|api\|dns\|ftp\|http\|https\|pim\|ntp\|smb\|ssh\|telnet\|winbox\|www\|www-ssl\)"35 36" colors various interfaces37syn match routerosInterface "bridge\d\+\|ether\d\+\|wlan\d\+\|pppoe-\(out\|in\)\d\+"38 39syn keyword routerosBoolean yes no true false40 41syn keyword routerosConditional if42 43" operators44syn match routerosOperator " \zs[-+*<>=!~^&.,]\ze "45syn match routerosOperator "[<>!]="46syn match routerosOperator "<<\|>>"47syn match routerosOperator "[+-]\d\@="48 49syn keyword routerosOperator and or in50 51" commands52syn keyword routerosCommands beep delay put len typeof pick log time set find environment53syn keyword routerosCommands terminal error parse resolve toarray tobool toid toip toip654syn keyword routerosCommands tonum tostr totime add remove enable disable where get print55syn keyword routerosCommands export edit find append as-value brief detail count-only file56syn keyword routerosCommands follow follow-only from interval terse value-list without-paging57syn keyword routerosCommands return58 59" variable types60syn keyword routerosType global local61 62" loop keywords63syn keyword routerosRepeat do while for foreach64 65syn match routerosSpecial "[():[\]{|}]"66 67syn match routerosLineContinuation "\\$"68 69syn match routerosEscape "\\["\\nrt$?_abfv]" contained display70syn match routerosEscape "\\\x\x" contained display71 72syn region routerosString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=routerosEscape,routerosLineContinuation73 74hi link routerosComment Comment75hi link routerosSubMenu Function76hi link routerosVariable Identifier77hi link routerosDelimiter Operator78hi link routerosEscape Special79hi link routerosService Type80hi link routerosInterface Type81hi link routerosBoolean Boolean82hi link routerosConditional Conditional83hi link routerosOperator Operator84hi link routerosCommands Operator85hi link routerosType Type86hi link routerosRepeat Repeat87hi link routerosSpecial Delimiter88hi link routerosString String89hi link routerosLineContinuation Special90 91let b:current_syntax = "routeros"92 