diff options
author | rsc <devnull@localhost> | 2006-02-14 19:42:28 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-02-14 19:42:28 +0000 |
commit | a38a183626848f897085b4d2e54dad6d39146948 (patch) | |
tree | 208277c8824b8db08878f5f5d65fb1e484099ead /src/cmd/ip/snoopy/filter.y | |
parent | 2eef1fa31676e58b0038f1c02dcc8df5e23149e6 (diff) | |
download | plan9port-a38a183626848f897085b4d2e54dad6d39146948.tar.gz plan9port-a38a183626848f897085b4d2e54dad6d39146948.tar.bz2 plan9port-a38a183626848f897085b4d2e54dad6d39146948.zip |
fixes
Diffstat (limited to 'src/cmd/ip/snoopy/filter.y')
-rwxr-xr-x | src/cmd/ip/snoopy/filter.y | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/cmd/ip/snoopy/filter.y b/src/cmd/ip/snoopy/filter.y index d34bfc7c..10b6ddef 100755 --- a/src/cmd/ip/snoopy/filter.y +++ b/src/cmd/ip/snoopy/filter.y @@ -12,6 +12,7 @@ char *yyend; /* end of buffer to be parsed */ %term LOR %term LAND %term WORD +%term NE %right '!' %left '|' %left '&' @@ -27,6 +28,14 @@ expr : WORD { $$ = $1; } | WORD '=' WORD { $2->l = $1; $2->r = $3; $$ = $2; } + | WORD NE WORD + { $2->l = newfilter(); + $2->l->op = '='; + $2->l->l = $1; + $2->l->r = $3; + $2->op = '!'; + $$ = $2; + } | WORD '(' expr ')' { $1->l = $3; free($2); free($4); $$ = $1; } | '(' expr ')' @@ -84,17 +93,18 @@ yylex(void) } yylp++; - if(*yylp == c) - switch(c){ - case '&': - c = LAND; - yylp++; - break; - case '|': - c = LOR; - yylp++; - break; - } + if(c == '!' && *yylp == '='){ + c = NE; + yylp++; + } + else if(c == '&' && *yylp == '&'){ + c = LAND; + yylp++; + } + else if(c == '|' && *yylp == '|'){ + c = LOR; + yylp++; + } yylval->op = c; return c; } @@ -103,5 +113,6 @@ void yyerror(char *e) { USED(e); +// longjmp(errjmp, 1); sysfatal("error parsing filter"); } |