]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/routeros.js
1 /*! `routeros` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= ( function () {
6 Language: MikroTik RouterOS script
7 Author: Ivan Dementev <ivan_div@mail.ru>
8 Description: Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurrence
9 Website: https://wiki.mikrotik.com/wiki/Manual:Scripting
13 // Colors from RouterOS terminal:
17 // light-brown - #9A9900
19 function routeros ( hljs
) {
20 const STATEMENTS
= 'foreach do while for if from to step else on-error and or not in' ;
22 // Global commands: Every global command should start with ":" token, otherwise it will be treated as variable.
23 const GLOBAL_COMMANDS
= 'global local beep delay put len typeof pick log time set find environment terminal error execute parse resolve toarray tobool toid toip toip6 tonum tostr totime' ;
25 // Common commands: Following commands available from most sub-menus:
26 const COMMON_COMMANDS
= 'add remove enable disable set get print export edit find run debug error info warning' ;
28 const LITERALS
= 'true false yes no nothing nil null' ;
30 const OBJECTS
= 'traffic-flow traffic-generator firewall scheduler aaa accounting address-list address align area bandwidth-server bfd bgp bridge client clock community config connection console customer default dhcp-client dhcp-server discovery dns e-mail ethernet filter firmware gps graphing group hardware health hotspot identity igmp-proxy incoming instance interface ip ipsec ipv6 irq l2tp-server lcd ldp logging mac-server mac-winbox mangle manual mirror mme mpls nat nd neighbor network note ntp ospf ospf-v3 ovpn-server page peer pim ping policy pool port ppp pppoe-client pptp-server prefix profile proposal proxy queue radius resource rip ripng route routing screen script security-profiles server service service-port settings shares smb sms sniffer snmp snooper socks sstp-server system tool tracking type upgrade upnp user-manager users user vlan secret vrrp watchdog web-access wireless pptp pppoe lan wan layer7-protocol lease simple raw' ;
33 className : 'variable' ,
35 { begin : /\$[\w\d#@][\w\d_]*/ },
36 { begin : /\$\{(.*?)\}/ }
40 const QUOTE_STRING
= {
45 hljs
. BACKSLASH_ESCAPE
,
48 className : 'variable' ,
51 contains : [ hljs
. BACKSLASH_ESCAPE
]
63 name : 'MikroTik RouterOS script' ,
64 aliases : [ 'mikrotik' ],
65 case_insensitive : true ,
69 keyword : STATEMENTS
+ ' :' + STATEMENTS
. split ( ' ' ). join ( ' :' ) + ' :' + GLOBAL_COMMANDS
. split ( ' ' ). join ( ' :' )
89 hljs
. COMMENT ( '^#' , '$' ),
95 // > is to avoid matches with => in other grammars
96 begin : /[\w-]+=([^\s{}[\]()>]+)/ ,
101 className : 'attribute' ,
106 endsWithParent : true ,
113 className : 'literal' ,
114 begin : ' \\ b(' + LITERALS
. split ( ' ' ). join ( '|' ) + ') \\ b'
117 // Do not format unclassified values. Needed to exclude highlighting of values as built_in.
118 begin : /("[^"]*"|[^\s{}[\]]+)/ }
121 // IPv4 addresses and subnets
124 {begin: IPADDR_wBITMASK+'(,'+IPADDR_wBITMASK+')*'}, //192.168.0.0/24,1.2.3.0/24
125 {begin: IPADDR+'-'+IPADDR}, // 192.168.0.1-192.168.0.3
126 {begin: IPADDR+'(,'+IPADDR+')*'}, // 192.168.0.1,192.168.0.34,192.168.24.1,192.168.0.1
130 // MAC addresses and DHCP Client IDs
132 begin: /\b(1:)?([0-9A-Fa-f]{1,2}[:-]){5}([0-9A-Fa-f]){1,2}\b/,
142 begin : /\*[0-9a-fA-F]+/
145 begin : ' \\ b(' + COMMON_COMMANDS
. split ( ' ' ). join ( '|' ) + ')([ \\ s[( \\ ]|])' ,
149 className : 'built_in' , // 'function',
155 className : 'built_in' ,
157 { begin : '( \\ . \\ ./|/| \\ s)((' + OBJECTS
. split ( ' ' ). join ( '|' ) + ');? \\ s)+' },
172 export default hljsGrammar
;