netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Yet another Syntax Highlighter for NFTABLES
       [not found] <744a8f97-e72c-4a7c-b2f2-a121f0019778.ref@sbcglobal.net>
@ 2025-03-07 16:57 ` S Egbert
  2025-03-07 18:22   ` tcp_hdr_kind_and_field window COUNT vs. tcp_hdr_option_type window LENGTH S Egbert
  0 siblings, 1 reply; 2+ messages in thread
From: S Egbert @ 2025-03-07 16:57 UTC (permalink / raw)
  To: netfilter

Want syntax highlighting of your nftables?

I might be able to help.  I want to help.  I might be able to deliver as 
   this is 3-year in the making (on-and-off).

Link below is an animated GIF of an edit session that is perusing over 
13,000 unique lines of nftables commands, statements, expressions and 
actions:

https://github.com/egberts/vim-nftables/blob/master/test/nftables.gif



Installation (suitable for offline/closed-network install):

https://github.com/egberts/vim-nftables/blob/master/INSTALL.md



README

https://github.com/egberts/vim-nftables/blob/master/INSTALL.md



90-95% done.  Could use a tiny bit more fleshing out notably within the 
`stmt` parse tree.  Only requirement is a mastery of Vimscript/VimL 
programming.  I find this not easy despite my mastery of this.

Please don't roast me.  :-)

Enjoy.

S. Egbert

^ permalink raw reply	[flat|nested] 2+ messages in thread

* tcp_hdr_kind_and_field window COUNT vs. tcp_hdr_option_type window LENGTH
  2025-03-07 16:57 ` Yet another Syntax Highlighter for NFTABLES S Egbert
@ 2025-03-07 18:22   ` S Egbert
  0 siblings, 0 replies; 2+ messages in thread
From: S Egbert @ 2025-03-07 18:22 UTC (permalink / raw)
  To: netfilter

After a complete constructing the EBNF of nftables (needed by TextMate, 
LSP, and Vim syntax highlight), I notice many repeatedly overlaps of 
syntaxes within the parser_bison.y.

One example of such a overlap pair:


All within the tcp_hdr_option_kind_and_field, the Bison parse tree 
offers different pathways to the "same?" following `nft` expression:

     tcp option window LENGTH
and
     tcp option window COUNT


For 'tcp options window LENGTH', the Bison pathway is:

   tcp_hdr_option_kind_and_field->tcp_hdr_option_type->WINDOW->LENGTH


For 'tcp option window COUNT', the Bison pathway is:

   tcp_hdr_option_kind_and_field->WINDOW->tcpopt_field_window->COUNT


Is this intentional overlap? Or did I overlook some hidden feature(s) 
surrounding LENGTH and COUNT?



The Railroad diagram for latest 'tcp_hdr_expr' is only XHTML-viewable 
via a web browser 'file:///' from your hard drive (GitHub defangs 
[X]HTML; SVG is too big, PNG is too squishy):

  
https://github.com/egberts/vim-nftables/blob/master/doc/nftables-railroad-chart.xhtml


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-07 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <744a8f97-e72c-4a7c-b2f2-a121f0019778.ref@sbcglobal.net>
2025-03-07 16:57 ` Yet another Syntax Highlighter for NFTABLES S Egbert
2025-03-07 18:22   ` tcp_hdr_kind_and_field window COUNT vs. tcp_hdr_option_type window LENGTH S Egbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).