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 <[email protected]>
---
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