From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1316C1F5AE; Mon, 15 Jun 2020 06:21:15 +0000 (UTC) Date: Mon, 15 Jun 2020 06:21:14 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Parse::RecDescent dependency (was: IMAP server notes, maybe JMAP?) Message-ID: <20200615062114.GA19510@dcvr> References: <20200609113442.GA16856@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200609113442.GA16856@dcvr> List-Id: Eric Wong wrote: > I know there's also interest in getting search usable via an > HTTP(S) API, so maybe JMAP[1] is worth looking into since it > seems like an easier-to-implement take on IMAP; and both > have search. We already use JSON for manifest.js.gz... > > [1] https://lwn.net/Articles/680057/ - (a look at JMAP). > > GraphQL has also come up privately, but at a glance it seems to > suffer some of the same problems with IMAP in offering excessive > granularity and cache-unfriendliness. But anyways, I'm close > to having a pretty good read-only IMAP server. JMAP cannot be > any harder than IMAP right? :) > TODO: > > * Queries involving OR, NOT, and parentheses don't work, yet, > since Xapian's default query parser works differently than > the prefix (Polish) notation of IMAP. So I've been giving Parse::RecDescent a try and it seems like an acceptable dependency for IMAP (and possibly other) search query parsing if we need it. It's widely-packaged by distros with many dependents, including Inline::C and Mail::IMAPClient; so it's likely already installed. I've been aware of it since ~2004 but it's my first time actually writing code to use it. I also took a look at Regexp::Grammars, but it's unsupported on Perl 5.18.[0-3] (I'm not sure if any distros package those versions) and has fewer users. Perl 5.10 regexps already support recursive descent with (?...) and (?&name) but it seems like a pain to use and (?{ code }) behavior isn't very stable and IIRC a somewhat common source of bugs in Perl itself. I've also heard good things about Marpa, but it's not packaged for CentOS 7.x and FreeBSD is missing the latest release (or Debian is missing the stable release :x)