filetype: nftables

detect:
    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|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.operator: "[<>.&|^!=:;,@]|\\b(and|ge|gt|le|lt|or|xor)\\b"
    - constant.string:
        start: "\""
        end: "\""
        rules: []
      # 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):?"
