From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "andy22286@gmail.com" Newsgroups: gmane.emacs.devel Subject: Re: Emacs-devel Digest, Vol 148, Issue 12 Date: Tue, 7 Jun 2016 15:01:47 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113d433e3e99710534b4d3c0 X-Trace: ger.gmane.org 1465326304 21994 80.91.229.3 (7 Jun 2016 19:05:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jun 2016 19:05:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 07 21:05:03 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bAMGZ-0000Fs-Q5 for ged-emacs-devel@m.gmane.org; Tue, 07 Jun 2016 21:02:20 +0200 Original-Received: from localhost ([::1]:52505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAMGZ-0008Bb-26 for ged-emacs-devel@m.gmane.org; Tue, 07 Jun 2016 15:02:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAMGP-0008BN-8n for emacs-devel@gnu.org; Tue, 07 Jun 2016 15:02:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAMGN-0001iW-3U for emacs-devel@gnu.org; Tue, 07 Jun 2016 15:02:08 -0400 Original-Received: from mail-oi0-x233.google.com ([2607:f8b0:4003:c06::233]:33430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAMGM-0001iS-UB for emacs-devel@gnu.org; Tue, 07 Jun 2016 15:02:07 -0400 Original-Received: by mail-oi0-x233.google.com with SMTP id k23so292177556oih.0 for ; Tue, 07 Jun 2016 12:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Bg2laRlYa88SbWIDCwGtNoEOKNZtbjIA3aH6YBkMKQg=; b=s6/WIiLkvBaZIw3pXqxPN8Dw04ElOa1lgMCN0NgeH7m3vYRTMiJmJZaiJHC7MudJ7R qBui06HbvCUWB0lnxclAI/hyRrtH8LZjMhasaLj5aDNj3xgjJjnxr+5a/pOdODvVwubK 3XyniMBuCyojEwhi0SzDJuf6IWZGz8QZeQkPw/lXqkpmhWdlPD93zCmqIsDLewDHQ/s6 cnckNY4rFtZ269+SI1fnPLTnve9bwgPjZWbxbuampV6YCNURG03tT3Rw9VbhnHhud0nS EQchQv21t7mOK4Vae2BQULxuq4bgxORXy+0LROlDJfcCy2M5rtVfYrSQcu2jA+Xh42wX W3cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Bg2laRlYa88SbWIDCwGtNoEOKNZtbjIA3aH6YBkMKQg=; b=GF7kYlRVjtSPdlgFwsUnSBfunxom6hQl12xv+fz8hDcEIBFcMyHkbkvBT2i5XBM52H 0OFhOjO+hBCY7pteu1QIIqpyy8u5uItx4oKT4gOG/UYJo5QFrLz20u0BHO0tjzMSjGzQ COtdUzKEmkBTHjfx2poTak2wHmd5mFSVRdPzeiD46k6tS/Ydf0McxYIccbCJAdDCfcKU UqbPz57lTR5ogLzzbVux2XOxRkgiKk0iOVEYg8do3+c488OK4gkGGRQiGjmBiAOWTOX5 Qjbd2Wm+GQk+zfzvDv115Yn1Pyk4MguaMCEF3Fhn8WwHzS9RmtK9HZ83nJtOJAJb2pqK vS7w== X-Gm-Message-State: ALyK8tI1blBpQikZy9zQoare0oliCOYNbF5ghtwi+Z4TKl2JYYvnIyx3u/nOLlLNZtbvIxAqkvmhqIvdsIB+7g== X-Received: by 10.202.52.85 with SMTP id b82mr590431oia.158.1465326126404; Tue, 07 Jun 2016 12:02:06 -0700 (PDT) Original-Received: by 10.202.239.130 with HTTP; Tue, 7 Jun 2016 12:01:47 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::233 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:204226 Archived-At: --001a113d433e3e99710534b4d3c0 Content-Type: text/plain; charset=UTF-8 Thank you for the answers. You are right about the interaction with sml-mode. I just tried reloading the file and then restarting the derived minor mode manually (M-x my-sml-mode), and the problem is gone. On Tue, Jun 7, 2016 at 2:59 PM, Stefan Monnier wrote: > > (require 'smie) > > (defconst sml-smie-grammar > > (smie-prec2->grammar > > (smie-bnf->prec2 > > '((exp > > (var) > > ("local" exp "in" exp "end")) > > (var)) > > ))) > > (defun sml-smie-rules (kind token) > > (pcase (cons kind token) > > (`(:elem . basic) 4) > > (`(:elem . args) 2) > > )) > > (define-derived-mode my-sml-mode sml-mode "My SML" > > (smie-setup > > sml-smie-grammar > > #'sml-smie-rules)) > > > > indented test.sml: > > > > local > > local > > a > > in > > a > > end > > in > > a > > end > > Hmm... this seems to be clearly an interaction with sml-mode. > > I just tried it with my local copy of sml-mode (straight from elpa.git) > and don't see the above indentation behavior. I also tried it after > replacing `sml-mode' with `prog-mode' as the parent, and that doesn't > show the problematic behavior either. > > > Does the equivalent S-expression representing the parse tree have > terminals > > in order, or are they moved to the front - i.e. does 1 + 2 for grammar > > (number "+" number) become (1 + 2) or (+ 1 2)? > > The tree is never created, so the question doesn't really have an answer. > The grammar is only used for navigation (e.g. to jump over the "+ 2 * z" > in "x + 2 * z + y" when moving forward). > > > What does smie-rule-parent-p use to determine the parent of a token? Is > it > > the first token above the S-expression the current token is contained in, > > e.g. in ("a" "b" ("c" "d" "e") "f"), the parent of "d" is "b"? > > I think it would be "c". > > > Stefan > --001a113d433e3e99710534b4d3c0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you for the answers.=C2=A0 You are right about the i= nteraction with sml-mode.=C2=A0 I just tried reloading the file and then re= starting the derived minor mode manually (M-x my-sml-mode), and the problem= is gone.

On= Tue, Jun 7, 2016 at 2:59 PM, Stefan Monnier <monnier@iro.umontrea= l.ca> wrote:
> (require 'smie)
> (defconst sml-smie-grammar
>=C2=A0 =C2=A0(smie-prec2->grammar
>=C2=A0 =C2=A0 (smie-bnf->prec2
>=C2=A0 =C2=A0 =C2=A0'((exp
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (var)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ("local" exp "in" exp &= quot;end"))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(var))
>=C2=A0 =C2=A0 )))
> (defun sml-smie-rules (kind token)
>=C2=A0 =C2=A0(pcase (cons kind token)
>=C2=A0 =C2=A0 =C2=A0(`(:elem . basic) 4)
>=C2=A0 =C2=A0 =C2=A0(`(:elem . args) 2)
>=C2=A0 =C2=A0 =C2=A0))
> (define-derived-mode my-sml-mode sml-mode "My SML"
>=C2=A0 =C2=A0(smie-setup
>=C2=A0 =C2=A0 sml-smie-grammar
>=C2=A0 =C2=A0 #'sml-smie-rules))
>
> indented test.sml:
>
> local
>=C2=A0 =C2=A0local
>=C2=A0 =C2=A0a
> in
>=C2=A0 =C2=A0 =C2=A0a
> end
> in
>=C2=A0 =C2=A0 =C2=A0a
> end

Hmm... this seems to be clearly an interaction with sml-mode.
I just tried it with my local copy of sml-mode (straight from elpa.git)
and don't see the above indentation behavior.=C2=A0 I also tried it aft= er
replacing `sml-mode' with `prog-mode' as the parent, and that doesn= 't
show the problematic behavior either.

> Does the equivalent S-expression representing the parse tree have term= inals
> in order, or are they moved to the front - i.e. does 1 + 2 for grammar=
> (number "+" number) become (1 + 2) or (+ 1 2)?

The tree is never created, so the question doesn't really have a= n answer.
The grammar is only used for navigation (e.g. to jump over the "+ 2 * = z"
in "x + 2 * z + y" when moving forward).

> What does smie-rule-parent-p use to determine the parent of a token?= =C2=A0 Is it
> the first token above the S-expression the current token is contained = in,
> e.g. in ("a" "b" ("c" "d" &quo= t;e") "f"), the parent of "d" is "b"?
I think it would be "c".


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--001a113d433e3e99710534b4d3c0--