1 |
- {"ast":null,"code":"/*\nLanguage: MikroTik RouterOS script\nAuthor: Ivan Dementev <ivan_div@mail.ru>\nDescription: Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurrence\nWebsite: https://wiki.mikrotik.com/wiki/Manual:Scripting\nCategory: scripting\n*/\n\n// Colors from RouterOS terminal:\n// green - #0E9A00\n// teal - #0C9A9A\n// purple - #99069A\n// light-brown - #9A9900\n\nfunction routeros(hljs) {\n const STATEMENTS = 'foreach do while for if from to step else on-error and or not in';\n\n // Global commands: Every global command should start with \":\" token, otherwise it will be treated as variable.\n 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';\n\n // Common commands: Following commands available from most sub-menus:\n const COMMON_COMMANDS = 'add remove enable disable set get print export edit find run debug error info warning';\n const LITERALS = 'true false yes no nothing nil null';\n 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';\n const VAR = {\n className: 'variable',\n variants: [{\n begin: /\\$[\\w\\d#@][\\w\\d_]*/\n }, {\n begin: /\\$\\{(.*?)\\}/\n }]\n };\n const QUOTE_STRING = {\n className: 'string',\n begin: /\"/,\n end: /\"/,\n contains: [hljs.BACKSLASH_ESCAPE, VAR, {\n className: 'variable',\n begin: /\\$\\(/,\n end: /\\)/,\n contains: [hljs.BACKSLASH_ESCAPE]\n }]\n };\n const APOS_STRING = {\n className: 'string',\n begin: /'/,\n end: /'/\n };\n return {\n name: 'MikroTik RouterOS script',\n aliases: ['mikrotik'],\n case_insensitive: true,\n keywords: {\n $pattern: /:?[\\w-]+/,\n literal: LITERALS,\n keyword: STATEMENTS + ' :' + STATEMENTS.split(' ').join(' :') + ' :' + GLOBAL_COMMANDS.split(' ').join(' :')\n },\n contains: [{\n // illegal syntax\n variants: [{\n // -- comment\n begin: /\\/\\*/,\n end: /\\*\\//\n }, {\n // Stan comment\n begin: /\\/\\//,\n end: /$/\n }, {\n // HTML tags\n begin: /<\\//,\n end: />/\n }],\n illegal: /./\n }, hljs.COMMENT('^#', '$'), QUOTE_STRING, APOS_STRING, VAR,\n // attribute=value\n {\n // > is to avoid matches with => in other grammars\n begin: /[\\w-]+=([^\\s{}[\\]()>]+)/,\n relevance: 0,\n returnBegin: true,\n contains: [{\n className: 'attribute',\n begin: /[^=]+/\n }, {\n begin: /=/,\n endsWithParent: true,\n relevance: 0,\n contains: [QUOTE_STRING, APOS_STRING, VAR, {\n className: 'literal',\n begin: '\\\\b(' + LITERALS.split(' ').join('|') + ')\\\\b'\n }, {\n // Do not format unclassified values. Needed to exclude highlighting of values as built_in.\n begin: /(\"[^\"]*\"|[^\\s{}[\\]]+)/\n }\n /*\n {\n // IPv4 addresses and subnets\n className: 'number',\n variants: [\n {begin: IPADDR_wBITMASK+'(,'+IPADDR_wBITMASK+')*'}, //192.168.0.0/24,1.2.3.0/24\n {begin: IPADDR+'-'+IPADDR}, // 192.168.0.1-192.168.0.3\n {begin: IPADDR+'(,'+IPADDR+')*'}, // 192.168.0.1,192.168.0.34,192.168.24.1,192.168.0.1\n ]\n },\n {\n // MAC addresses and DHCP Client IDs\n className: 'number',\n begin: /\\b(1:)?([0-9A-Fa-f]{1,2}[:-]){5}([0-9A-Fa-f]){1,2}\\b/,\n },\n */]\n }]\n }, {\n // HEX values\n className: 'number',\n begin: /\\*[0-9a-fA-F]+/\n }, {\n begin: '\\\\b(' + COMMON_COMMANDS.split(' ').join('|') + ')([\\\\s[(\\\\]|])',\n returnBegin: true,\n contains: [{\n className: 'built_in',\n // 'function',\n begin: /\\w+/\n }]\n }, {\n className: 'built_in',\n variants: [{\n begin: '(\\\\.\\\\./|/|\\\\s)((' + OBJECTS.split(' ').join('|') + ');?\\\\s)+'\n }, {\n begin: /\\.\\./,\n relevance: 0\n }]\n }]\n };\n}\nmodule.exports = routeros;","map":{"version":3,"names":["routeros","hljs","STATEMENTS","GLOBAL_COMMANDS","COMMON_COMMANDS","LITERALS","OBJECTS","VAR","className","variants","begin","QUOTE_STRING","end","contains","BACKSLASH_ESCAPE","APOS_STRING","name","aliases","case_insensitive","keywords","$pattern","literal","keyword","split","join","illegal","COMMENT","relevance","returnBegin","endsWithParent","module","exports"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/highlight.js/lib/languages/routeros.js"],"sourcesContent":["/*\nLanguage: MikroTik RouterOS script\nAuthor: Ivan Dementev <ivan_div@mail.ru>\nDescription: Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurrence\nWebsite: https://wiki.mikrotik.com/wiki/Manual:Scripting\nCategory: scripting\n*/\n\n// Colors from RouterOS terminal:\n// green - #0E9A00\n// teal - #0C9A9A\n// purple - #99069A\n// light-brown - #9A9900\n\nfunction routeros(hljs) {\n const STATEMENTS = 'foreach do while for if from to step else on-error and or not in';\n\n // Global commands: Every global command should start with \":\" token, otherwise it will be treated as variable.\n 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';\n\n // Common commands: Following commands available from most sub-menus:\n const COMMON_COMMANDS = 'add remove enable disable set get print export edit find run debug error info warning';\n\n const LITERALS = 'true false yes no nothing nil null';\n\n 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';\n\n const VAR = {\n className: 'variable',\n variants: [\n { begin: /\\$[\\w\\d#@][\\w\\d_]*/ },\n { begin: /\\$\\{(.*?)\\}/ }\n ]\n };\n\n const QUOTE_STRING = {\n className: 'string',\n begin: /\"/,\n end: /\"/,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n VAR,\n {\n className: 'variable',\n begin: /\\$\\(/,\n end: /\\)/,\n contains: [ hljs.BACKSLASH_ESCAPE ]\n }\n ]\n };\n\n const APOS_STRING = {\n className: 'string',\n begin: /'/,\n end: /'/\n };\n\n return {\n name: 'MikroTik RouterOS script',\n aliases: [ 'mikrotik' ],\n case_insensitive: true,\n keywords: {\n $pattern: /:?[\\w-]+/,\n literal: LITERALS,\n keyword: STATEMENTS + ' :' + STATEMENTS.split(' ').join(' :') + ' :' + GLOBAL_COMMANDS.split(' ').join(' :')\n },\n contains: [\n { // illegal syntax\n variants: [\n { // -- comment\n begin: /\\/\\*/,\n end: /\\*\\//\n },\n { // Stan comment\n begin: /\\/\\//,\n end: /$/\n },\n { // HTML tags\n begin: /<\\//,\n end: />/\n }\n ],\n illegal: /./\n },\n hljs.COMMENT('^#', '$'),\n QUOTE_STRING,\n APOS_STRING,\n VAR,\n // attribute=value\n {\n // > is to avoid matches with => in other grammars\n begin: /[\\w-]+=([^\\s{}[\\]()>]+)/,\n relevance: 0,\n returnBegin: true,\n contains: [\n {\n className: 'attribute',\n begin: /[^=]+/\n },\n {\n begin: /=/,\n endsWithParent: true,\n relevance: 0,\n contains: [\n QUOTE_STRING,\n APOS_STRING,\n VAR,\n {\n className: 'literal',\n begin: '\\\\b(' + LITERALS.split(' ').join('|') + ')\\\\b'\n },\n {\n // Do not format unclassified values. Needed to exclude highlighting of values as built_in.\n begin: /(\"[^\"]*\"|[^\\s{}[\\]]+)/ }\n /*\n {\n // IPv4 addresses and subnets\n className: 'number',\n variants: [\n {begin: IPADDR_wBITMASK+'(,'+IPADDR_wBITMASK+')*'}, //192.168.0.0/24,1.2.3.0/24\n {begin: IPADDR+'-'+IPADDR}, // 192.168.0.1-192.168.0.3\n {begin: IPADDR+'(,'+IPADDR+')*'}, // 192.168.0.1,192.168.0.34,192.168.24.1,192.168.0.1\n ]\n },\n {\n // MAC addresses and DHCP Client IDs\n className: 'number',\n begin: /\\b(1:)?([0-9A-Fa-f]{1,2}[:-]){5}([0-9A-Fa-f]){1,2}\\b/,\n },\n */\n ]\n }\n ]\n },\n {\n // HEX values\n className: 'number',\n begin: /\\*[0-9a-fA-F]+/\n },\n {\n begin: '\\\\b(' + COMMON_COMMANDS.split(' ').join('|') + ')([\\\\s[(\\\\]|])',\n returnBegin: true,\n contains: [\n {\n className: 'built_in', // 'function',\n begin: /\\w+/\n }\n ]\n },\n {\n className: 'built_in',\n variants: [\n { begin: '(\\\\.\\\\./|/|\\\\s)((' + OBJECTS.split(' ').join('|') + ');?\\\\s)+' },\n {\n begin: /\\.\\./,\n relevance: 0\n }\n ]\n }\n ]\n };\n}\n\nmodule.exports = routeros;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQA,CAACC,IAAI,EAAE;EACtB,MAAMC,UAAU,GAAG,kEAAkE;;EAErF;EACA,MAAMC,eAAe,GAAG,kKAAkK;;EAE1L;EACA,MAAMC,eAAe,GAAG,uFAAuF;EAE/G,MAAMC,QAAQ,GAAG,oCAAoC;EAErD,MAAMC,OAAO,GAAG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