summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-01-16 18:31:16 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-01-16 19:48:29 +0100
commit21cfa9a7405f78f424c869e592d21ebdaf379803 (patch)
tree1a0dad499a4197c0a8522401bd93d07987dc2374 /src
parenta4b1c0c704d082a70fe68b3a97a9c03416f63ccf (diff)
src: use ':' instead of '=>' in dictionaries
Replace => by : to make it easier for most shell users, as > implies a redirection, let's avoid possible confusion that may result if you forget to escape it. This works fine if you don't forget to add space between the key and the value. If you forget to add the space, depending on the case, the scanner may recognize it correctly or process it as a string. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/expression.c2
-rw-r--r--src/parser.y7
-rw-r--r--src/rule.c2
-rw-r--r--src/scanner.l1
4 files changed, 5 insertions, 7 deletions
diff --git a/src/expression.c b/src/expression.c
index a12133c8..c8566224 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -644,7 +644,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 d4a79291..5cd8ef67 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -150,7 +150,6 @@ static void location_update(struct location *loc, struct location *rhs, int n)
%token ASTERISK "*"
%token DASH "-"
%token AT "@"
-%token ARROW "=>"
%token VMAP "vmap"
%token INCLUDE "include"
@@ -751,7 +750,7 @@ map_block : /* empty */ { $$ = $<set>-1; }
| map_block common_block
| map_block stmt_seperator
| map_block TYPE
- identifier ARROW identifier
+ identifier COLON identifier
stmt_seperator
{
$1->keytype = datatype_lookup_byname($3);
@@ -1243,11 +1242,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 COLON concat_expr opt_newline
{
$$ = mapping_expr_alloc(&@$, $2, $4);
}
- | opt_newline map_lhs_expr ARROW verdict_expr opt_newline
+ | opt_newline map_lhs_expr COLON verdict_expr opt_newline
{
$$ = mapping_expr_alloc(&@$, $2, $4);
}
diff --git a/src/rule.c b/src/rule.c
index ec8b6a48..04dd6c77 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 936c035e..25fbc610 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -221,7 +221,6 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"@" { return AT; }
"$" { return '$'; }
"=" { return '='; }
-"=>" { return ARROW; }
"vmap" { return VMAP; }
"include" { return INCLUDE; }