From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Serghei Iakovlev Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: bnf-mode Date: Sun, 05 May 2019 18:01:52 +0300 Message-ID: <8736lt3py7.fsf@gmail.com> References: <23ebbedf-5474-bbbd-47d2-3404f47f7a23@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="191319"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 05 17:02:09 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNIeV-000ncv-EI for ged-emacs-devel@m.gmane.org; Sun, 05 May 2019 17:02:07 +0200 Original-Received: from localhost ([127.0.0.1]:42245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNIeU-0006pH-Ev for ged-emacs-devel@m.gmane.org; Sun, 05 May 2019 11:02:06 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNIeM-0006l2-0e for emacs-devel@gnu.org; Sun, 05 May 2019 11:01:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNIeK-0007Wo-Rb for emacs-devel@gnu.org; Sun, 05 May 2019 11:01:57 -0400 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:41267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNIeK-0007WW-LV for emacs-devel@gnu.org; Sun, 05 May 2019 11:01:56 -0400 Original-Received: by mail-wr1-x436.google.com with SMTP id c12so13969014wrt.8 for ; Sun, 05 May 2019 08:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-transfer-encoding; bh=7k8YXytWtk0p7kRWUVwA9bYom6tEoGlEco4UcJGRP6Y=; b=BKXXUEh71oYMsvcHuLEd9mMwJQmbBrxEonRxRjpDB8+RtrlpfDsB6L3tZ+KwFtTVVS X3zT6bZmPxP2oELBbd/iiL6Aq4ava+TG5AzATHsg1Gpdd9mXSgUJ2FoIazcxZYCUMhcB 1JiO48DcwGkJ5d+7kcs1HT2eWmidNAdn82Sn5jDGPnraRWhoBYlpA7KkCCCzmXLBtpRf vaMkyoSdS/hTv/nty+tt8Im6GbFl1TYAN7k6F5VHrtDwkNmoFXu0GHQF0YjWmkWE8ITR izAqmyZBuCzlap2L94j51gORhsLYbMBev45GG7xiAnVMPVWn2AnxZRDeozd1PQBIytKT 1wcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=7k8YXytWtk0p7kRWUVwA9bYom6tEoGlEco4UcJGRP6Y=; b=UNTAknGhzXnSvufAfU/KADTeC8Q7mYFSDnQYnBZeXaYHMLeuhFLdfrt41Ny/60pxM4 qVnq7qGAix0C8n+Rh2EY5EOw2YJ3PmnOx4FGs2WpZlGGLsLSy6xSdYPkcrkVGO/zUHge wilp2PEiCepEblBohWdzBnxX8REl0Jk6gioKkDhnNfvUoc+T7Vh/mqJBGn5ys4mqQzmp KV8PTjBcYaJmBBG5twAIKWZlEA9DoLymxlTxu6BxGC7x/S7icLIUotbfFWu/Yvd4/J6u jK7vbj306b1v4aWhEqPYGrPAqtrAFfxRfX5pBqO7doKoeCbNFWSljYTEyjYAIBqSn+5E gU+Q== X-Gm-Message-State: APjAAAVxo0MyXMAHvLR2Enqh2EsyhcHSXa37YU3WWZo9QRj13IdkiFa8 VJt34+I/98W4CZBPY3cF6Z41sgRlei5Mvg== X-Google-Smtp-Source: APXvYqxrZK4+YZAtdjkFFtHfHkEpLewtCFUOyIzzn7T4jQ+B+Tr6awyE6JoLrza/jwdOm0OXWJYRIQ== X-Received: by 2002:a5d:4985:: with SMTP id r5mr10107212wrq.37.1557068515098; Sun, 05 May 2019 08:01:55 -0700 (PDT) Original-Received: from Legion ([195.33.224.106]) by smtp.gmail.com with ESMTPSA id u11sm13754662wmu.15.2019.05.05.08.01.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 May 2019 08:01:54 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 04 May 2019 14:35:21 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236176 Archived-At: I apologize for the possible duplication of this reply. I sent it by mistake to my personal Stefan address. Hello Stefan, Thank you for the review. I've removed wrongly used (and documented) `syntax-propertize-function' funcall. Thank you for clarifying it out. As for the question: BNF is a notation technique for context free grammars, often used to describe the syntax of languages used in computing, such as programming languages, document formats, instruction sets and communication protocols. And I have to say than Bison is not BNF. Probable you're meant yacc, which is from 197x. However BNF is designed (in 1959) to create formal grammars in a formal language, what is not a subject area for yacc or bison. Yes, yacc, antlr, bison, META II, etc. All they use a dialect slightly reminiscent of BNF, but the do not use pure BNF grammar. In addition, they don't use a formal language. I've updated the code in the repository but still not sure what exactly should I attach on this reply. Best regards, Serghei Stefan Monnier writes: >> I created a major mode for editing BNF grammars [1] and would like to >> add this package to the ELPA [2].=C2=A0 Currently it provides basic synt= ax >> and font-locking for BNF files.=C2=A0 BNF notation is supported exactly >> form as it was first announced in the ALGOL 60 report.=C2=A0 EBNF and AB= NF >> are not supported but in my plans for the near future. > > In what kind of circumstances would this be used? > I've seen BNF-like syntax used by various tools (like bison and > friends, for example), but never with this particular syntax. > > ;; Basically `syntax-propertize-function' is a construct which belongs > ;; to `font-lock'. > > No. It's used by font-lock (as well as various other things), but it > does not belong to it. > > ;; But correct indentation depends on > ;; syntax properties of the text, and that should ideally be > ;; independent of font-lock being activated or not. > > Which is why syntax-propertize was created (as opposed to the previous > font-lock-syntactic-keywords, which *did* belong to font-lock and > suffered from the problem you describe). > > ;; For `bnf-mode', this means that with `font-lock' disabled, we wont > ;; have our syntax properties set correctly, and indentation will > ;; suffer. > > That's not true. > > ;; To patch our way around this, we issue a `syntax-propertize' call > ;; manually, `font-lock' enabled or not. > (with-silent-modifications > (when bnf-mode-algol-comments-style > (funcall syntax-propertize-function (point-min) (point-max)))) >=20=20=20=20=20=20=20=20=20 > Don't do that: syntax-propertize-function will be called when needed > (e.g. by indent-according-to-mode). > > > Stefan > >