From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn_Lindqvist?= Newsgroups: gmane.emacs.help Subject: Re: SMIE examples or guides Date: Wed, 29 Jun 2016 18:48:32 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1467218964 26717 80.91.229.3 (29 Jun 2016 16:49:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Jun 2016 16:49:24 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 29 18:49:23 2016 Return-path: Envelope-to: geh-help-gnu-emacs@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 1bIIfw-0002Of-P2 for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Jun 2016 18:49:20 +0200 Original-Received: from localhost ([::1]:45030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIIfw-0001ge-0w for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Jun 2016 12:49:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIIfD-0001fu-NX for help-gnu-emacs@gnu.org; Wed, 29 Jun 2016 12:48:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIIfC-0004Vi-Mh for help-gnu-emacs@gnu.org; Wed, 29 Jun 2016 12:48:35 -0400 Original-Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:36143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIIfC-0004VR-Fk for help-gnu-emacs@gnu.org; Wed, 29 Jun 2016 12:48:34 -0400 Original-Received: by mail-wm0-x22f.google.com with SMTP id f126so189301202wma.1 for ; Wed, 29 Jun 2016 09:48:34 -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:content-transfer-encoding; bh=q29hw8kgl5fWZhwVLNVSPH8NVCaNZsFdPn7ZLpIhBEQ=; b=VToBfyLd5ETbwPmcgOobWq3VFD7g35C5hMG4lwxgJNxN8hszZJxs30nECIvYY31Prb c2uk+ULGozwP+f1bWfhHewFWNLrQrQ6fHYgfjgAJM4XFUfjlu+m9SlPPe6VIhdRckSPa +B9EZEEk7JxpHlKC4BzQw0tlVI6QjaSXF3Yw7PMmwiMLh+WrU+TPag5WQHWwRQxXPFso SkSRL3ut7IWnrud+Mt2g7klptNaVY5DOSCz9fZCLBVXfZE1XUHsZDT4gOptPjtgBc4Ff WaRtr0u7VjgLxkhM/AAfLm2lGS6J+T3htchQj1nHMCzBpF0sShQkWDzv2elaQAqHy6fx Q2Xg== 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:content-transfer-encoding; bh=q29hw8kgl5fWZhwVLNVSPH8NVCaNZsFdPn7ZLpIhBEQ=; b=OJn4W1WSkPf2mjUx38qcogr3MHCsBHY4uzrkjgbcaAQTfp93gm8oFivi31VPHjttDb Q1WgrLfszaCiHktYgUl/7bTNXeNx21nY0ZfF64g5mCC36cC84mCI151hl2Rzziv2V75l VOPsw/+aHC/A7/N8/tsrlWm3YaNEM1O+IZakAnGb8D68ZqEeGjlV0G4h0kggBKHdWZ09 2z5cqU8BRyi4c3NkgY961qHS+GNj5HpDAYbU2TFDcX3lzvb9EJscVSnx2tHFF6QASl1y oFe35IJn7F4b53MxuIGpJywmWoXDwMA8NuYyd+ATUi3XBPzBkjQJHgmKEa82J5tFZbRE BHBw== X-Gm-Message-State: ALyK8tJGK4SchSo9f8djW8WAl1R9SGxmW8q066kzF0Cv57+8CNpwAeWd/qvV1IxzyMD44OchhksXBC3YJnuz7w== X-Received: by 10.194.55.234 with SMTP id v10mr10457894wjp.64.1467218913622; Wed, 29 Jun 2016 09:48:33 -0700 (PDT) Original-Received: by 10.194.45.202 with HTTP; Wed, 29 Jun 2016 09:48:32 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22f X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110660 Archived-At: I got it to work almost by experimenting with your suggestions. But it appears to do some kind of automatic aligning I don't want: HELLO one two three BYE That should instead have been: HELLO one two three BYE My language is not newline-significant. 2016-06-29 9:37 GMT+02:00 Stefan Monnier : >> HELLO >> HELLO foo BYE >> HELLO >> bla >> net >> neat >> BYE >> text more >> more >> BYE > > That's expected: the third HELLO...BYE is indented as an argument of > the first. Similarly to: > > (table->method) > (arg1, > arg2 > ) > > [ Read the above, thinking that "(" is like HELLO and ")" is like > "BYE". ] > > Similarly, "net" and "neat" are treated as arguments to "bla". > > A quick fix to that part would be to add an indentation rule along the > lines of > > (`(:elem . arg) 0) > > or alternatively > > (`(:list-intro . ,_) t) > > Tho, if your language makes newlines significant (i.e. "bla\nnet" is not > equivalent to "bla net"), then you might be better off changing the > tokenizer (by providing appropriate :forward-token and :backward-token > arguments to `smie-setup') so as to return an actual token for every > newline encountered, after which you can add corresponding rules to > the grammar. > >> HELLO >> bla >> net >> neat >> BYE > > To get the BYE indented this way, a quick-fix could be to add a rule > like > > (`(:before . "BYE") 4) > > > -- Stefan > > --=20 mvh/best regards Bj=C3=B6rn Lindqvist