trafgen: parser: add possibility for negative numbers
authorDaniel Borkmann <dborkman@redhat.com>
Mon, 25 Mar 2013 19:27:23 +0000 (25 20:27 +0100)
committerDaniel Borkmann <dborkman@redhat.com>
Mon, 25 Mar 2013 19:27:23 +0000 (25 20:27 +0100)
The previous commit reduced it, so now we allow it within cX() containers
in order to negate a result, if someone needs that.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen_parser.y

index b0e7e33..37c9a15 100644 (file)
@@ -431,6 +431,8 @@ expression
                { $$ = $1 << $4; }
        | expression '>' '>' expression
                { $$ = $1 >> $4; }
+       | '-' expression
+               { $$ = -1 * $2; }
        | '(' expression ')'
                { $$ = $2;}
        ;