Skip to content

Commit 97b5e35

Browse files
Nftables improvements (zyedidia#3517)
1 parent 29dc892 commit 97b5e35

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

runtime/syntax/nftables.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
filetype: nftables
22

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

0 commit comments

Comments
 (0)