From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GnPoKKSBsGCIQQAAgWs5BA (envelope-from ) for ; Fri, 28 May 2021 07:37:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CPoGJKSBsGBFewAAB5/wlQ (envelope-from ) for ; Fri, 28 May 2021 05:37:40 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F2A8B1D647 for ; Fri, 28 May 2021 07:37:39 +0200 (CEST) Received: from localhost ([::1]:55840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmVBj-00020I-2o for larch@yhetil.org; Fri, 28 May 2021 01:37:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmVB8-0001zt-SS for emacs-orgmode@gnu.org; Fri, 28 May 2021 01:37:02 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:37493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmVB7-0003fl-5A for emacs-orgmode@gnu.org; Fri, 28 May 2021 01:37:02 -0400 Received: by mail-wm1-x330.google.com with SMTP id f20-20020a05600c4e94b0290181f6edda88so3834155wmq.2 for ; Thu, 27 May 2021 22:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=MmFcqhMq2FsK/AN5w2nSM3XWKp2k9sktj1LR81pJVfU=; b=K5wgKSNCalKUVzGBRe5eZ2kKE4pYrK8xwi5mCL5IEFLty5fDiD1mbRqhzD1ckman1K /QmDGitGlpYVQUtFoqWXNdaArYmoZGDQboj7577RS0ED9/FHiXBQESRh1jzOFdAkx4HH BcYZ4kXrfvMk2pK4lTvzXij+8CbwcD1pybvtK5pZR2gdj4e74ut0JWm94ZUzLSeW+vHW 0IjEPy8etCS77T4tIAC+6Z5wQWtPqgQrnLBl633s/lR8Sun3i/au5VnIutniL8/r9eFu awX4yt8jKpuFC9bWju/OtG7nVUJ4yC5miRLjmxNsClWL4qqSgjh6v99wtzgsdtX1BFlD cbMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=MmFcqhMq2FsK/AN5w2nSM3XWKp2k9sktj1LR81pJVfU=; b=sgaDuq2rr387mkK4G+8PpCtPg1fjvWpEg1fshvkJp5WaCME6v+0m2pIUY8A5cOFMs2 PXrIOmbqppT3S92HLhpi5zE7R0R1YEUKMFriPnWYmE2ibhFAhNLJ+r0L5U+xqVOhfDC/ 3qHFVnvNCJ3GpfYxs2xr3KOmnsNdd9tMlZuywLkI8r/OLX4Dm7cEz1GsrlqjPoVJ6RVs 2s+eHjbsCB3r8dRrdJqp9cj4zMq9RFibhccF1KmpQofARL7qpl8fBEjlZQswIVcCfWH4 5m+JYelwMvc8eXgVaDNIlNT2Dc2cf3XTLt2FQY0K9c4Z+PYCUX/h0m1qmZGFB7h49U67 jMJA== X-Gm-Message-State: AOAM532lm3xJEbZilYCknjCDKATxBoG0+xWjUmtFQwaqbhKLiihD24Sc F42oBUV8RmzrIcAUQDWAFPxMt9tdd8jDelD70kcji9QbeC0= X-Google-Smtp-Source: ABdhPJyKqUjhVRKPppg5CPGsZX4qwDND5cJrHVsNVDe0v+7gGkRzbNww5WbQiKSzXvt/lQVwZUmzASovIS8KaOrNwCg= X-Received: by 2002:a7b:ce0d:: with SMTP id m13mr11308460wmc.90.1622180218690; Thu, 27 May 2021 22:36:58 -0700 (PDT) MIME-Version: 1.0 References: <87tumvdno3.fsf@gmail.com> <87eedw5s0c.fsf@gmail.com> <87o8czksaq.fsf@gmail.com> <87lf83kphd.fsf@gmail.com> <87tumqaj6h.fsf@nicolasgoaziou.fr> <87lf81y4e9.fsf@localhost> <87bl8wyhun.fsf@localhost> In-Reply-To: From: Tom Gillespie Date: Thu, 27 May 2021 22:36:47 -0700 Message-ID: Subject: Re: Empty headline titles unsupported: Bug? To: emacs-orgmode Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=tgbugs@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622180260; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=MmFcqhMq2FsK/AN5w2nSM3XWKp2k9sktj1LR81pJVfU=; b=WGgfte7vN/EDFWQeu269jmPgaeWUKu49G4dKYr1yPfxAhg588VanuSfKxK904acfrJkSx8 uwX+Rq0YNCkxAgQNt7ND+CLGFB1W6h0y9exon1tez1EUXQxqPQStH/Y6fQcKwaBO4U4EVi AHPsyxRmzKUkmxk6KoxDWYgWCssNveuAlSUnat6OxyqnZMAaLtosEzCXXFam/WNTcRURwP 4b1AnjRBN+q/KBb3uvBCDcjVpf2t/W5mmttuyjW9Y/sOWRCBPiA2XN1Al2aJuiMUPRRnHU 9IzBvGLxq6QWQEjYxrRMF87mit/OQxQG9dHjgjJdrCh7p8SKH2UfbpCKtYE+Cg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622180260; a=rsa-sha256; cv=none; b=QiryY2YE5B5aPrSTpCUq03X6FqLRqQCUwzqSrY43toek2OBcHUgk3983ZRwDFSDrkiF2OZ 5aosGJmtCjYxILM9OIECGnn+JNYo9/5gL9tFJ6/Plk8qG6iUSDrec6OVCoLztwvXyYoGnd xADd0B+iu24nZjKFDoaahXph0CXsNILzdfHtgqVv24tOEyoNp/OnEPnKN5HzT95e2Fth+U 9U/r83zo3o/1Zmh275P62YThIsfZlHlf/mmxnYVASZOJEvPrKQHI+fb3jhOA0/g122Ulg7 E+T/A35lLfmSE0AHluMSY1mYDcDipaXWPGo3uxeCghiFCTQZ2GwQxs4M3PpfdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=K5wgKSNC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=K5wgKSNC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: F2A8B1D647 X-Spam-Score: -2.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: VWt49yf6HOcp Hi all, Here is the 4th (or so) iteration of the grammar for titles that I think deals with most of the issues in this thread along with a bunch of nasty test cases. The previous attempts can be inspected in the git history, but long story short, it is extremely hard to find a grammar that follows the principle of least surprise and you have to use the tokenizer to ensure that the tags pattern always parses as such so that tags don't magically switch to being the title when you remove the rest of the contents of the title. The final example L1648-L1665 shows many of the things that should parse as tags and do with this tokenizer/grammar combination. The key to dealing with the ambiguity of empty title and tags vs something that looks like tags but parses as a title (which is surprising) is to use the tokenizer to greedily recognize tags at the end of the line. This ensures that the tags pattern at the end of the line always parses as tags and doesn't switch just because the title is empty. Happy to elaborate. Best, Tom https://github.com/tgbugs/laundry/blob/next/laundry/heading.rkt https://github.com/tgbugs/laundry/blob/971cf35683cd60156868c12b070c2dd9e19d8d06/laundry/tokenizer.rkt#L98-L140 https://github.com/tgbugs/laundry/blob/971cf35683cd60156868c12b070c2dd9e19d8d06/laundry/test.rkt#L326-L367 https://github.com/tgbugs/laundry/blob/971cf35683cd60156868c12b070c2dd9e19d8d06/laundry/test.rkt#L400-L558 https://github.com/tgbugs/laundry/blob/971cf35683cd60156868c12b070c2dd9e19d8d06/laundry/test.rkt#L1298-L1369 https://github.com/tgbugs/laundry/blob/971cf35683cd60156868c12b070c2dd9e19d8d06/laundry/test.rkt#L1371-L1419 https://github.com/tgbugs/laundry/blob/971cf35683cd60156868c12b070c2dd9e19d8d06/laundry/test.rkt#L1648-L1665