From 1bf8bb4b2751ef3d4007221cbe0e9bc39de34117 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 17 Feb 1997 04:15:48 +0000 Subject: Pull negation into the grammar, simplifying the lexer. svn path=/trunk/; revision=892 --- rcfile_l.l | 26 +++++++++----------------- rcfile_y.y | 26 +++++++++++++++++--------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/rcfile_l.l b/rcfile_l.l index a2fe2cbb..4b1d9603 100644 --- a/rcfile_l.l +++ b/rcfile_l.l @@ -17,8 +17,6 @@ int prc_lineno = 1; %o 5000 %a 4000 -WS [ \t]* - %% set { return SET; } @@ -55,21 +53,15 @@ to { return TO; } = { return MAP; } "*" { return WILDCARD; } -keep { yylval.flag = FLAG_TRUE; return KEEP; } -flush { yylval.flag = FLAG_TRUE; return FLUSH; } -fetchall { yylval.flag = FLAG_TRUE; return FETCHALL; } -rewrite { yylval.flag = FLAG_TRUE; return REWRITE; } -stripcr { yylval.flag = FLAG_TRUE; return STRIPCR; } -dns { yylval.flag = FLAG_TRUE; return DNS; } -received { yylval.flag = FLAG_TRUE; return RECEIVED; } - -no{WS}keep { yylval.flag = FLAG_FALSE; return KEEP; } -no{WS}flush { yylval.flag = FLAG_FALSE; return FLUSH; } -no{WS}fetchall { yylval.flag = FLAG_FALSE; return FETCHALL; } -no{WS}rewrite { yylval.flag = FLAG_FALSE; return REWRITE; } -no{WS}stripcr { yylval.flag = FLAG_FALSE; return REWRITE; } -no{WS}dns { yylval.flag = FLAG_FALSE; return DNS; } -no{WS}received { yylval.flag = FLAG_FALSE; return RECEIVED; } +no/.* { return NO;} + +keep { return KEEP; } +flush { return FLUSH; } +fetchall { return FETCHALL; } +rewrite { return REWRITE; } +stripcr { return STRIPCR; } +dns { return DNS; } +received { return RECEIVED; } limit { return LIMIT; } diff --git a/rcfile_y.y b/rcfile_y.y index 84c0d000..fdc295d5 100644 --- a/rcfile_y.y +++ b/rcfile_y.y @@ -36,7 +36,6 @@ static void user_reset(); %union { int proto; - int flag; int number; char *sval; } @@ -49,7 +48,7 @@ static void user_reset(); %token PROTO %token STRING %token NUMBER -%token KEEP FLUSH FETCHALL REWRITE STRIPCR DNS PORT RECEIVED +%token NO KEEP FLUSH FETCHALL REWRITE STRIPCR DNS PORT RECEIVED %% @@ -123,8 +122,10 @@ serv_option : AKA alias_list fprintf(stderr, "fetchmail: monitor option is only supported under Linux\n"); #endif /* linux */ } - | DNS {current.server.dns = $1;} - | RECEIVED {current.server.received = $1;} + | DNS {current.server.dns = FLAG_TRUE;} + | RECEIVED {current.server.received = FLAG_TRUE;} + | NO DNS {current.server.dns = FLAG_FALSE;} + | NO RECEIVED {current.server.received = FLAG_FALSE;} ; /* @@ -188,11 +189,18 @@ user_option : TO localnames HERE | MDA STRING {current.mda = xstrdup($2);} | PRECONNECT STRING {current.preconnect = xstrdup($2);} - | KEEP {current.keep = $1;} - | FLUSH {current.flush = $1;} - | FETCHALL {current.fetchall = $1;} - | REWRITE {current.rewrite = $1;} - | STRIPCR {current.stripcr = $1;} + | KEEP {current.keep = FLAG_TRUE;} + | FLUSH {current.flush = FLAG_TRUE;} + | FETCHALL {current.fetchall = FLAG_TRUE;} + | REWRITE {current.rewrite = FLAG_TRUE;} + | STRIPCR {current.stripcr = FLAG_TRUE;} + + | NO KEEP {current.keep = FLAG_FALSE;} + | NO FLUSH {current.flush = FLAG_FALSE;} + | NO FETCHALL {current.fetchall = FLAG_FALSE;} + | NO REWRITE {current.rewrite = FLAG_FALSE;} + | NO STRIPCR {current.stripcr = FLAG_FALSE;} + | LIMIT NUMBER {current.limit = $2;} | FETCHLIMIT NUMBER {current.fetchlimit = $2;} | BATCHLIMIT NUMBER {current.batchlimit = $2;} -- cgit v1.2.3