From df2e3ba721e365dbcad1e7b0986bc557327c587f Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 26 Oct 2012 14:58:16 +2000 Subject: [PATCH] Re: [PATCH v5 2/9] parse-time-string: add a date/time parser to notmuch --- db/f235d0a66c23c5fea0a8f78ff756a507d4ff83 | 108 ++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 db/f235d0a66c23c5fea0a8f78ff756a507d4ff83 diff --git a/db/f235d0a66c23c5fea0a8f78ff756a507d4ff83 b/db/f235d0a66c23c5fea0a8f78ff756a507d4ff83 new file mode 100644 index 000000000..a6591df92 --- /dev/null +++ b/db/f235d0a66c23c5fea0a8f78ff756a507d4ff83 @@ -0,0 +1,108 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 9F864431FCB + for ; Thu, 25 Oct 2012 11:58:20 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id Zd8ZJHWfDQc7 for ; + Thu, 25 Oct 2012 11:58:20 -0700 (PDT) +Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU + [18.7.68.36]) + by olra.theworths.org (Postfix) with ESMTP id 15149431FAE + for ; Thu, 25 Oct 2012 11:58:20 -0700 (PDT) +X-AuditID: 12074424-b7fce6d000000925-18-50898bcb02c7 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP + id 96.F9.02341.BCB89805; Thu, 25 Oct 2012 14:58:19 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q9PIwIia012687; + Thu, 25 Oct 2012 14:58:19 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q9PIwGQ9019986 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 25 Oct 2012 14:58:18 -0400 (EDT) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1TRSdE-0004NP-Iu; Thu, 25 Oct 2012 14:58:16 -0400 +Date: Thu, 25 Oct 2012 14:58:16 -0400 +From: Austin Clements +To: Jani Nikula +Subject: Re: [PATCH v5 2/9] parse-time-string: add a date/time parser to + notmuch +Message-ID: <20121025185816.GX14861@mit.edu> +References: + + <20121022081444.GM14861@mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20121022081444.GM14861@mit.edu> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hRV1j3d3RlgsP+PpkXTdGeL6zdnMjsw + edy6/5rd49mqW8wBTFFcNimpOZllqUX6dglcGV39DcwF13grZs3ewNrA+Jeri5GTQ0LARGLq + hT2sELaYxIV769m6GLk4hAT2MUocPPaQGcLZwCixYe4ZFgjnJJNE/85fbCAtQgJLGCVubhUH + sVkEVCVWNL1lB7HZBDQktu1fzghiiwgoSmw+uR/MZhaQlvj2u5kJxBYWCJL49f4uC4jNK6Aj + 8an9JDvEgoWMErc2tbFCJAQlTs58wgLRrCVx499LoGYOsEHL/3GAhDkFdCVWTm0AKxEVUJGY + cnIb2wRGoVlIumch6Z6F0L2AkXkVo2xKbpVubmJmTnFqsm5xcmJeXmqRrrlebmaJXmpK6SZG + UFizu6jsYGw+pHSIUYCDUYmHNyKlM0CINbGsuDL3EKMkB5OSKO+CWqAQX1J+SmVGYnFGfFFp + TmrxIUYJDmYlEd7jxUA53pTEyqrUonyYlDQHi5I47/WUm/5CAumJJanZqakFqUUwWRkODiUJ + 3uWtQI2CRanpqRVpmTklCGkmDk6Q4TxAw++B1PAWFyTmFmemQ+RPMSpKifPOBkkIgCQySvPg + emFp5xWjONArwrzbQap4gCkLrvsV0GAmoMFirGCDSxIRUlINjDuCJ20Q1Ck2/Pbt15x7q7rF + Z+5NEb21cdOnNWVitj77eo5sDHg5bzlDZOD78/K8GQtDZX7P1X+U9DHDy271h7XsXK/mFX7I + OT1h/8X+D9uPhTJtahd4WCirYPFx7pYzrR+tC9KsX1ScX/Ph0VNd4xOTXmYnbWi/3fHs3nv+ + 2h3JU3wlFyY+kl2lxFKckWioxVxUnAgAV/o5exYDAAA= +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 25 Oct 2012 18:58:20 -0000 + +Quoth myself on Oct 22 at 4:14 am: +> Overall this looks pretty good to me, and I must say, this parser is +> amazingly flexible and copes well with a remarkably hostile grammar. +> +> A lot of little comments below (sorry if any of this ground has +> already been covered in the previous four versions). +> +> I do have one broad comment. While I'm all for ad hoc parsers for ad +> hoc grammars like dates, there is one piece of the literature I think +> this parser suffers for by ignoring: tokenizing. I think it would +> simplify a lot of this code if it did a tokenizing pass before the +> parsing pass. It doesn't have to be a serious tokenizer with +> streaming and keywords and token types and junk; just something that +> first splits the input into substrings, possibly just non-overlapping +> matches of [[:digit:]]+|[[:alpha:]]+|[-+:/.]. This would simplify the +> handling of postponed numbers because, with trivial lookahead in the +> token stream, you wouldn't have to postpone them. Likewise, it would +> eliminate last_field. It would simplify keyword matching because you +> wouldn't have to worry about matching substrings (I spent a long time +> staring at that code before I figured out what it would and wouldn't +> accept). Most important, I think it would make the parser more +> predictable for users; for example, the parser currently accepts +> things like "saturtoday" because it's aggressively single-pass. + +I should add that I am not at all opposed to this patch as it is +currently designed. We need a date parser. My comment about +separating tokenization is just a way that this code could probably be +simplified if someone were so inclined or if simplifying the code +would help it pass any hurdles. -- 2.26.2