From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 2/2] typeof keyword
Date: Tue, 30 Jul 2019 16:37:32 +0200 [thread overview]
Message-ID: <20190730143732.2126-3-fw@strlen.de> (raw)
In-Reply-To: <20190730143732.2126-1-fw@strlen.de>
Allows to do this:
table filter {
set foo {
type typeof(osf name);
}
map bar {
type typeof(osf name) : typeof(meta mark);
}
map baz {
type typeof(osf name) : typeof(ct helper);
}
}
Problem is that listing such a table produces "type string" -- it
can't be restored.
Use in concatenations doesn't work either.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/parser_bison.y | 5 +++++
src/scanner.l | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 5771f9f7469e..bc0105673f38 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -191,6 +191,7 @@ int nft_lex(void *, void *, void *);
%token DEFINE "define"
%token REDEFINE "redefine"
%token UNDEFINE "undefine"
+%token TYPEOF "typeof"
%token FIB "fib"
@@ -1824,6 +1825,10 @@ data_type_atom_expr : type_identifier
dtype->size, NULL);
xfree($1);
}
+ | TYPEOF '(' primary_expr ')'
+ {
+ $$ = $3;
+ }
;
data_type_expr : data_type_atom_expr
diff --git a/src/scanner.l b/src/scanner.l
index c1adcbddbd73..cd563aa0ca1f 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -243,6 +243,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"define" { return DEFINE; }
"redefine" { return REDEFINE; }
"undefine" { return UNDEFINE; }
+"typeof" { return TYPEOF; }
"describe" { return DESCRIBE; }
--
2.21.0
prev parent reply other threads:[~2019-07-30 14:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 14:37 [RFC 0/2] typeof keyword, alternate patch Florian Westphal
2019-07-30 14:37 ` [PATCH 1/2] src: store expr, not dtype to track data in sets Florian Westphal
2019-07-31 13:02 ` Pablo Neira Ayuso
2019-07-31 13:10 ` Florian Westphal
2019-07-30 14:37 ` Florian Westphal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190730143732.2126-3-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).