From owner-freebsd-hackers Mon Dec 2 11:00:49 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA05796 for hackers-outgoing; Mon, 2 Dec 1996 11:00:49 -0800 (PST) Received: from agora.rdrop.com (root@agora.rdrop.com [199.2.210.241]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id LAA05790 for ; Mon, 2 Dec 1996 11:00:47 -0800 (PST) Received: from phaeton.artisoft.com by agora.rdrop.com with smtp (Smail3.1.29.1 #17) id m0vUdbf-0008tnC; Mon, 2 Dec 96 11:00 PST Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id LAA10927; Mon, 2 Dec 1996 11:35:37 -0700 From: Terry Lambert Message-Id: <199612021835.LAA10927@phaeton.artisoft.com> Subject: Re: Lex/Yacc question To: mbarkah@hemi.com (Ade Barkah) Date: Mon, 2 Dec 1996 11:35:37 -0700 (MST) Cc: terry@lambert.org, hackers@freebsd.org In-Reply-To: <199612020756.AAA17064@hemi.com> from "Ade Barkah" at Dec 2, 96 00:56:12 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > Terry Lambert wrote: > > > [\r\n] { > > BEGIN INITIAL; > > return HELO_END; > > } > > > > The use of a "HELO_END" token lets us recognize the end of the statement > > for a partial statement (HELO STR_DOMAIN HELO_END is otherwise ambiguous). > > You can also avoid states if you want to... for example, in your rfc821.l: [ ... ] > | command: /* nothing*/ > | | command incomplete_helo > | | command helo_command > | { yyerrok; } > | ; [ ... ] I found in implementation for an interactive parser, this tends to fail. Specifically, using the "-i" option to get a case insensitive parser (instead of specifying [Hh][Ee][Ll][Oo]) results in your string that you assemble from '.' returns coming back case converted. I actually though this was bad from several perspectives, not only for the adulteration of the "name@domain.com (Long Name)" and the "Long Name " "Long Name" strings (which is bad enough by itself), but that state can not be avoided entirely. Specifically, there is an 821->822 provision for "X-authentication-warning:" and for "Apparently-To:" based on the HELO state and the "RCPT TO:", respectively. There is also an exclusive state requirement for mail content processing (un-byte-stuffing leading '.' characters, etc.). I found that in practice, the state machine would hang until the next command (shift/reduce conflict) when using a command that was a prefix of another command. One caveat: I am using the 'lex' compatability mode (except for the "-i", which is flex specific), so your mileage may vary... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.