netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC nft PATCH] syntax: replace '=>' with '=:'
@ 2014-01-12 19:41 Arturo Borrero Gonzalez
  2014-01-12 20:17 ` Patrick McHardy
  0 siblings, 1 reply; 7+ messages in thread
From: Arturo Borrero Gonzalez @ 2014-01-12 19:41 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

Almost all shell uses the '>' character as a key for redirecting
stdout/stderr to a file.
So, using it in the syntax means that the administrator is forced to scape the
character, or look for other workaround.

With this patch, '=>' is replaced with '=:', thus avoiding such situation.

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 src/expression.c |    2 +-
 src/parser.y     |    7 ++++---
 src/rule.c       |    2 +-
 src/scanner.l    |    1 +
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/expression.c b/src/expression.c
index 71154cc..b9df9ac 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -642,7 +642,7 @@ struct expr *set_expr_alloc(const struct location *loc)
 static void mapping_expr_print(const struct expr *expr)
 {
 	expr_print(expr->left);
-	printf(" => ");
+	printf(" =: ");
 	expr_print(expr->right);
 }
 
diff --git a/src/parser.y b/src/parser.y
index 26e71e3..577aba1 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -150,6 +150,7 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 %token DASH			"-"
 %token AT			"@"
 %token ARROW			"=>"
+%token MAP_SIGN			"=:"
 %token VMAP			"vmap"
 
 %token INCLUDE			"include"
@@ -751,7 +752,7 @@ map_block		:	/* empty */	{ $$ = $<set>-1; }
 			|	map_block	common_block
 			|	map_block	stmt_seperator
 			|	map_block	TYPE
-						identifier	ARROW	identifier
+						identifier	MAP_SIGN	identifier
 						stmt_seperator
 			{
 				$1->keytype = datatype_lookup_byname($3);
@@ -1243,11 +1244,11 @@ set_list_member_expr	:	opt_newline	expr	opt_newline
 			{
 				$$ = $2;
 			}
-			|	opt_newline	map_lhs_expr	ARROW	concat_expr	opt_newline
+			|	opt_newline	map_lhs_expr	MAP_SIGN	concat_expr	opt_newline
 			{
 				$$ = mapping_expr_alloc(&@$, $2, $4);
 			}
-			|	opt_newline	map_lhs_expr	ARROW	verdict_expr	opt_newline
+			|	opt_newline	map_lhs_expr	MAP_SIGN	verdict_expr	opt_newline
 			{
 				$$ = mapping_expr_alloc(&@$, $2, $4);
 			}
diff --git a/src/rule.c b/src/rule.c
index ec8b6a4..b593624 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -96,7 +96,7 @@ void set_print(const struct set *set)
 
 	printf("\t\ttype %s", set->keytype->name);
 	if (set->flags & SET_F_MAP)
-		printf(" => %s", set->datatype->name);
+		printf(" =: %s", set->datatype->name);
 	printf("\n");
 
 	if (set->flags & SET_F_ANONYMOUS)
diff --git a/src/scanner.l b/src/scanner.l
index cee6aa6..14470cf 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -210,6 +210,7 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 "$"			{ return '$'; }
 "="			{ return '='; }
 "=>"			{ return ARROW; }
+"=:"			{ return MAP_SIGN; }
 "vmap"			{ return VMAP; }
 
 "include"		{ return INCLUDE; }


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

end of thread, other threads:[~2014-01-13 10:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-12 19:41 [RFC nft PATCH] syntax: replace '=>' with '=:' Arturo Borrero Gonzalez
2014-01-12 20:17 ` Patrick McHardy
2014-01-12 20:28   ` Arturo Borrero Gonzalez
2014-01-12 21:24     ` Patrick McHardy
2014-01-12 21:47       ` Arturo Borrero Gonzalez
2014-01-12 21:55         ` Patrick McHardy
2014-01-13 10:44           ` Pablo Neira Ayuso

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).