highlight-iptables.el 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. (require 'generic-x)
  2. (define-generic-mode 'iptables-mode
  3. '("#")
  4. '("-A" "-j" "!" "-i" "-o" "-s" "-d" "-p" "--mark" "--save-mark" "--set-mark" "-m" "--ctstate" "--icmp-type" "--dport" "--tproxy-mark"
  5. "--on-port"
  6. "--on-ip"
  7. "--uid-owner" "--gid-owner"
  8. "--to-ports" "--to-source" "--to-destination"
  9. "--state" "--reject-with"
  10. "--limit" "--limit-burst" "--log-prefix"
  11. )
  12. '(;("*" . 'font-lock-operator)
  13. (":" . 'font-lock-operator)
  14. ("*nat" . 'font-lock-warning-face)
  15. ("*filter" . 'font-lock-warning-face)
  16. ("*mangle" . 'font-lock-warning-face)
  17. ("*raw" . 'font-lock-warning-face)
  18. ("COMMIT" . 'font-lock-function-name-face)
  19. ("INPUT" . 'font-lock-function-name-face)
  20. ("FORWARD" . 'font-lock-function-name-face)
  21. ("OUTPUT" . 'font-lock-function-name-face)
  22. ("PREROUTING" . 'font-lock-function-name-face)
  23. ("POSTROUTING" . 'font-lock-function-name-face)
  24. ;
  25. ("ACCEPT" . 'font-lock-constant-face)
  26. ("DROP" . 'font-lock-constant-face)
  27. ("LOG" . 'font-lock-constant-face)
  28. ("TPROXY" . 'font-lock-constant-face)
  29. ("RETURN" . 'font-lock-constant-face)
  30. ("REJECT" . 'font-lock-constant-face)
  31. ("REDIRECT" . 'font-lock-constant-face)
  32. ("CONNMARK" . 'font-lock-constant-face)
  33. ;
  34. ("RELATED" . 'font-lock-doc-face)
  35. ("NEW" . 'font-lock-doc-face)
  36. ("ESTABLISHED" . 'font-lock-doc-face)
  37. ("INVALID" . 'font-lock-doc-face)
  38. )
  39. '("\\.rules$|rules\\.save|rules-save")
  40. nil
  41. "My IPTABLES highlighting mode"
  42. )