diff --git a/runtime/syntax/nftables.yaml b/runtime/syntax/nftables.yaml index a477fadec..30b90e1d9 100644 --- a/runtime/syntax/nftables.yaml +++ b/runtime/syntax/nftables.yaml @@ -6,14 +6,23 @@ detect: 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" + - type: "\\b(ether|inet|i(cm)?p(x|(v?(4|6))?)|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" - preproc: "\\b(add|define|flush|include|delete)\\b" - - symbol: "[-=/:;,@]" + - symbol: "([-=/:;,@]|[!=])" - symbol.operator: "[<>.&|^!]|\\b(and|ge|gt|le|lt|or|xor)\\b" - constant.string: '([\"]{1})(.*)([\"]{1})' + - constant.string: + start: "(['\"])" + end: "(['\"])" + # Integer Constants + - constant.number: "(\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)([Uu][Ll]?[Ll]?|[Ll][Ll]?[Uu]?)?\\b)" + # Decimal Floating Constants + - constant.number: "(\\b(([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)[FfLl]?\\b)" + # Hexadecimal Floating Constants + - constant.number: "(\\b0[Xx]([0-9A-Za-z]*[.][0-9A-Za-z]+|[0-9A-Za-z]+[.][0-9A-Za-z]*)[Pp][+-]?[0-9]+[FfLl]?\\b)" - identifier.var: "[$@][a-zA-Z_.][a-zA-Z0-9_/.-]*" - comment: "(^|[[:space:]])#([^{].*)?$" - indent-char.whitespace: "[[:space:]]+$"