annotate runtime/syntax/routeros.vim @ 26356:0884f2be6c2a v8.2.3709

patch 8.2.3709: Vim9: backtick expression expanded when not desired Commit: https://github.com/vim/vim/commit/fad2742d538123abb9b384a053fd581f2acf6bb0 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 30 21:58:19 2021 +0000 patch 8.2.3709: Vim9: backtick expression expanded when not desired Problem: Vim9: backtick expression expanded when not desired. Solution: Only expand a backtick expression for commands that expand their argument. Remove a few outdated TODO comments.
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Nov 2021 23:00:04 +0100
parents 624439a39432
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26148
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: MikroTik RouterOS Script
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: zainin <z@wintr.dev>
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Original Author: ndbjorne @ MikroTik forums
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Last Change: 2021 Nov 14
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " quit when a syntax file was already loaded
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 if exists("b:current_syntax")
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 finish
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 endif
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 syn case ignore
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 syn iskeyword @,48-57,-
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " comments
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 syn match routerosComment /^\s*\zs#.*/
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " options submenus: /interface ether1 etc
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 syn match routerosSubMenu "\([a-z]\)\@<!/[a-zA-Z0-9-]*"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 " variables are matched by looking at strings ending with "=", e.g. var=
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 syn match routerosVariable "[a-zA-Z0-9-/]*\(=\)\@="
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 syn match routerosVariable "$[a-zA-Z0-9-]*"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 " colored for clarity
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 syn match routerosDelimiter "[,=]"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " match slash in CIDR notation (1.2.3.4/24, 2001:db8::/48, ::1/128)
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 syn match routerosDelimiter "\(\x\|:\)\@<=\/\(\d\)\@="
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 " dash in IP ranges
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 syn match routerosDelimiter "\(\x\|:\)\@<=-\(\x\|:\)\@="
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " match service names after "set", like in original routeros syntax
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 syn match routerosService "\(set\)\@<=\s\(api-ssl\|api\|dns\|ftp\|http\|https\|pim\|ntp\|smb\|ssh\|telnet\|winbox\|www\|www-ssl\)"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 " colors various interfaces
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 syn match routerosInterface "bridge\d\+\|ether\d\+\|wlan\d\+\|pppoe-\(out\|in\)\d\+"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 syn keyword routerosBoolean yes no true false
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn keyword routerosConditional if
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 " operators
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn match routerosOperator " \zs[-+*<>=!~^&.,]\ze "
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 syn match routerosOperator "[<>!]="
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 syn match routerosOperator "<<\|>>"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 syn match routerosOperator "[+-]\d\@="
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 syn keyword routerosOperator and or in
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 " commands
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 syn keyword routerosCommands beep delay put len typeof pick log time set find environment
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 syn keyword routerosCommands terminal error parse resolve toarray tobool toid toip toip6
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 syn keyword routerosCommands tonum tostr totime add remove enable disable where get print
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 syn keyword routerosCommands export edit find append as-value brief detail count-only file
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 syn keyword routerosCommands follow follow-only from interval terse value-list without-paging
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 syn keyword routerosCommands return
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 " variable types
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 syn keyword routerosType global local
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 " loop keywords
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 syn keyword routerosRepeat do while for foreach
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 syn match routerosSpecial "[():[\]{|}]"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 syn match routerosLineContinuation "\\$"
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 syn match routerosEscape "\\["\\nrt$?_abfv]" contained display
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 syn match routerosEscape "\\\x\x" contained display
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 syn region routerosString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=routerosEscape,routerosLineContinuation
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 hi link routerosComment Comment
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 hi link routerosSubMenu Function
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 hi link routerosVariable Identifier
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 hi link routerosDelimiter Operator
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 hi link routerosEscape Special
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 hi link routerosService Type
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 hi link routerosInterface Type
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 hi link routerosBoolean Boolean
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 hi link routerosConditional Conditional
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 hi link routerosOperator Operator
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 hi link routerosCommands Operator
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 hi link routerosType Type
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 hi link routerosRepeat Repeat
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 hi link routerosSpecial Delimiter
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 hi link routerosString String
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 hi link routerosLineContinuation Special
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90
624439a39432 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 let b:current_syntax = "routeros"