From 21cfa9a7405f78f424c869e592d21ebdaf379803 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 16 Jan 2014 18:31:16 +0100 Subject: 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 --- src/expression.c | 2 +- src/parser.y | 7 +++---- src/rule.c | 2 +- src/scanner.l | 1 - 4 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') 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 */ { $$ = $-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; } -- cgit v1.2.3