]> git.ipfire.org Git - thirdparty/nftables.git/commit
datatype: misspell support with symbol table parser for error reporting
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 9 May 2023 15:46:52 +0000 (17:46 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 11 May 2023 16:18:29 +0000 (18:18 +0200)
commit8d586177b843af5e77f10e3f0c532341648582d0
tree6283fce979c399d335cfff8301eb2cafd8330ed0
parent686ab8b6996e154592a5fc16bd1e15e661201b2a
datatype: misspell support with symbol table parser for error reporting

Some datatypes provide a symbol table that is parsed as an integer.
Improve error reporting by using the misspell infrastructure, to provide
a hint to the user, whenever possible.

If base datatype, usually the integer datatype, fails to parse the
symbol, then try a fuzzy match on the symbol table to provide a hint
in case the user has mistype it.

For instance:

 test.nft:3:11-14: Error: Could not parse Differentiated Services Code Point expression; did you you mean `cs0`?
                 ip dscp ccs0
                         ^^^^

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/datatype.c