From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: krisajenkins@gmail.com Newsgroups: gmane.emacs.help Subject: SMIE & transpose-sexps Date: Thu, 27 Feb 2014 03:54:06 -0800 (PST) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1393519554 21453 80.91.229.3 (27 Feb 2014 16:45:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Feb 2014 16:45:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 27 17:46:03 2014 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 1WJ45y-0006za-GR for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Feb 2014 17:46:02 +0100 Original-Received: from localhost ([::1]:46823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ45y-0006RT-5L for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Feb 2014 11:46:02 -0500 X-Received: by 10.58.151.98 with SMTP id up2mr5377626veb.14.1393502046838; Thu, 27 Feb 2014 03:54:06 -0800 (PST) X-Received: by 10.140.91.72 with SMTP id y66mr23585qgd.23.1393502046815; Thu, 27 Feb 2014 03:54:06 -0800 (PST) Original-Path: usenet.stanford.edu!hw13no5763qab.1!news-out.google.com!dr7ni7699qab.1!nntp.google.com!w5no1428808qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=86.163.222.41; posting-account=3M1tPgoAAAD0Bu3sbPetWcMZf2qHID27 Original-NNTP-Posting-Host: 86.163.222.41 User-Agent: G2/1.0 Injection-Date: Thu, 27 Feb 2014 11:54:06 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:203944 X-Mailman-Approved-At: Thu, 27 Feb 2014 11:45:51 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96215 Archived-At: Hi, I'm trying to wrap my head around SMIE, and I think I'm stumbling on something I thought would be pretty basic. I'm hoping someone can help... I've written some simple rules like this: (defconst my-grammar (smie-prec2->grammar (smie-precs->prec2 '((assoc "=") (assoc "AND"))))) And I'm trying it out with a simple string like this: a = b AND c = d My (perhaps naive) assumption was that, with that enabled I could call: a |= b AND c = d M-x transpose-sexps => b |= a AND c = d And: a = b AND| c = d M-x transpose-sexps => c = d AND| a = b And that this would be both jolly useful in itself, and proof that I'd set up the parsing rules correctly. But it doesn't work, and I have no idea why. I do know that if I switch either token to a comma, it works for that token. Does anyone know where I'm going wrong? Is what I'm trying to do even possible*? And if it's not possible, is there any other way to verify the parse tree, before I start trying to indent it? Thanks, Kris * This line from the docs makes me believe it is: "For example, if the provided grammar is precise enough, transpose-sexps can correctly transpose the two arguments of a + operator, taking into account the precedence rules of the language."