updated nftables.yml syntax highlighing

This commit is contained in:
theredcmdcraft 2025-06-15 17:13:09 +02:00
parent 5eddf5b85d
commit fb845dedbb
No known key found for this signature in database
GPG Key ID: 1866E44F30D876CF

View File

@ -1,20 +1,31 @@
filetype: nftables
detect:
filename: "nftables.conf$"
filename: "(nftables\\.(conf|rules)$|nftables(\\.rules)?\\.d/)"
header: "^(#!.*/(env +)?nft( |$)|flush +ruleset)"
rules:
- type: "\\b(chain|counter|map|rule|ruleset|set|table)\\b"
- type: "\\b(ether|icmp|icmpv6|icmpx|inet|ip|ip6|ipv4|ipv6|tcp|udp)\\b"
- special: "\\b(elements|hook|policy|priority|type)\\b"
- identifier: "\\b(ct|iif|iifname|meta|oif|oifname|th)\\b"
- statement: "\\b(accept|drop|goto|jump|log|masquerade|reject)\\b"
- type: "\\b(ether|inet|i(cm)?p(x|(v?(4|6))?)|tcp|udp|8021q)\\b"
- special: "\\b(element(s)?|hook|policy|priority|type|state)\\b"
- identifier: "\\b(ct|iif|iifname|meta|oif|oifname|th|dport|sport|saddr|daddr|l4proto)\\b"
- statement: "\\b(accept|drop|goto|jump|log|masquerade|reject|limit|queue)\\b"
- preproc: "\\b(add|define|flush|include|delete)\\b"
- symbol: "[-=/:;,@]"
- symbol.operator: "[<>.&|^!]|\\b(and|ge|gt|le|lt|or|xor)\\b"
- constant.string: '([\"]{1})(.*)([\"]{1})'
- symbol.operator: "[<>.&|^!=:;,@]|\\b(and|ge|gt|le|lt|or|xor)\\b"
# string constants
- constant.string: '([\+\-\*/][\"]{1})(.*)([\"]{1})'
- constant.string:
start: "\""
end: "\""
# Integer Constants
- constant.number: "\\b([0-9]+)\\b"
- constant.number: "\\b(0x[0-9a-fA-F]+)\\b"
- identifier.var: "[$@][a-zA-Z_.][a-zA-Z0-9_/.-]*"
- comment: "(^|[[:space:]])#([^{].*)?$"
- indent-char.whitespace: "[[:space:]]+$"
- indent-char: " + +| + +"
- comment:
start: "#"
end: "$"
rules:
- todo: "(TODO|FIXME):?"