From a729b55fc46e3321c46ee4a963ca62fa3ab0ad84 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Mon, 17 Sep 2012 18:54:23 +0300 Subject: [PATCH] Re: [PATCH v3 2/9] parse-time-string: add a date/time parser to notmuch --- 19/3cf5fe140f351326fc3bee1bdcf13da8e279b2 | 122 ++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 19/3cf5fe140f351326fc3bee1bdcf13da8e279b2 diff --git a/19/3cf5fe140f351326fc3bee1bdcf13da8e279b2 b/19/3cf5fe140f351326fc3bee1bdcf13da8e279b2 new file mode 100644 index 000000000..9967d9095 --- /dev/null +++ b/19/3cf5fe140f351326fc3bee1bdcf13da8e279b2 @@ -0,0 +1,122 @@ +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 621DC431FAF + for ; Mon, 17 Sep 2012 08:54:32 -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 3I74WdyBVlQI for ; + Mon, 17 Sep 2012 08:54:31 -0700 (PDT) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A1281431FAE + for ; Mon, 17 Sep 2012 08:54:31 -0700 (PDT) +Received: by lbbgk1 with SMTP id gk1so4675913lbb.26 + for ; Mon, 17 Sep 2012 08:54:30 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type:content-transfer-encoding + :x-gm-message-state; + bh=uR+CqFNrJVDPEG8kHiGmPHHZLW0aii0j00gulon9zQo=; + b=eh+ArTf/JVlbNH/4sGW/F3id6Tj4oiPtyskce68GxVWBLS3AAiMLR/plcps9J72IaG + E/I3NqjB2MFVeYE0N9W3T7eLF0WW+x8aHTznmootDn228ltEcEhXoO0HBLoXRLTz5QNI + q7jRfE/HcydpJld955AzibPtUwTtwqX9+9mlHbpBxlLnpJhsxawRpL/Y6GzOY8+INskA + QpC424zT1JDp1btkubbV0Wt/T3zi7xkKCf5e3/GVIncX33irc5ijgweGMgJdUHwGRUIK + hC9uMTPocKsFzz0v0Hz8G/OiE6uf7uc4p05B5UZV/y1MOad3aMISRQ/HpuEWDOfTsQvG + JXEQ== +Received: by 10.112.24.233 with SMTP id x9mr3461893lbf.76.1347897270076; + Mon, 17 Sep 2012 08:54:30 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id gt19sm3056351lab.8.2012.09.17.08.54.26 + (version=SSLv3 cipher=OTHER); Mon, 17 Sep 2012 08:54:27 -0700 (PDT) +From: Jani Nikula +To: Michal Nazarewicz , notmuch@notmuchmail.org, + David Bremner +Subject: Re: [PATCH v3 2/9] parse-time-string: add a date/time parser to + notmuch +In-Reply-To: +References: + <89741ec9a9687fca8b30aa1a4877392d355dd3ce.1347484177.git.jani@nikula.org> + <878vcerurc.fsf@nikula.org> + +User-Agent: Notmuch/0.14+29~g77c762c (http://notmuchmail.org) Emacs/23.3.1 + (i686-pc-linux-gnu) +Date: Mon, 17 Sep 2012 18:54:23 +0300 +Message-ID: <87wqzsfxw0.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +X-Gm-Message-State: + ALoCoQmr/KIibUSRlVqTXYkNPc+1DF46w3OMiF5AmOGJR+7A7+0tcfViMEPyPuRlpmGFoAbeCW8E +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: Mon, 17 Sep 2012 15:54:32 -0000 + +On Mon, 17 Sep 2012, Michal Nazarewicz wrote: +> Bison can do a lot of weird stuff including modifying how lexer +> interpretes tokens even while parsing given grammar rule. + +I'll just have to take your word for it. + +> I'm sorry. I sometime tend to go into extremes with my statements, so +> yes, the =E2=80=9Ctotally unreadable=E2=80=9D was a over statement on my = +part. + +Okay. + +> My point was however that parsing is a solved problem, and for +> non-trivial parsers one needs to ask herself whether it's worth trying +> to implement the logic, or maybe using a parser generator is just +> simpler. + +If there's something non-trivial about parsing dates and times, it's not +the actual parsing. It's not a well defined grammar. And judging by the +number of date parsers available that would be suitable for notmuch, as +a library, parsing dates is not a solved problem. + +> And in this particular case, my feeling is that bison is easier to read +> and modify. +> +> To add some merit to my statement, I attach a bison parser. + +And there are people out there writing compilers without a parser +generator... [1] But using a parser generator or not is really not the +issue here, whichever has more merit. The issue is adding suitable date +range queries to notmuch. + +I have submitted patches to do just that. I don't intend to rework them +much anymore. It's always interesting in the beginning, but adding the +last bits of polish and fixing the corner cases can get a bit +tedious. You know how it is. At this point, I'd just like to have the +feature in notmuch. + +So I don't know. I guess I want to say, please submit patches to add the +feature, with polish, and not to prove a point, damnit. I have no issues +with promoting whichever approach is the best in the end. + + +BR, +Jani. + + +[1] http://git.kernel.org/?p=3Ddevel/sparse/sparse.git -- 2.26.2