From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Date: Mon, 21 Oct 2013 10:02:38 +0400 Message-ID: <5264C37E.6080300@yandex.ru> References: <87a9icobbl.fsf@yandex.ru> <525C9926.9030202@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1382335397 28656 80.91.229.3 (21 Oct 2013 06:03:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2013 06:03:17 +0000 (UTC) Cc: 15594@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 21 08:03:18 2013 Return-path: Envelope-to: geb-bug-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 1VY8aD-0006Vf-OG for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Oct 2013 08:03:17 +0200 Original-Received: from localhost ([::1]:38576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY8aD-0000hf-DQ for geb-bug-gnu-emacs@m.gmane.org; Mon, 21 Oct 2013 02:03:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY8a4-0000hM-1T for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2013 02:03:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VY8Zy-00008Q-BC for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2013 02:03:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY8Zy-00008J-8Y for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2013 02:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VY8Zx-0001Ki-K6 for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2013 02:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2013 06:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13823353715101 (code B ref 15594); Mon, 21 Oct 2013 06:03:01 +0000 Original-Received: (at 15594) by debbugs.gnu.org; 21 Oct 2013 06:02:51 +0000 Original-Received: from localhost ([127.0.0.1]:59805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VY8Zn-0001KD-3y for submit@debbugs.gnu.org; Mon, 21 Oct 2013 02:02:51 -0400 Original-Received: from mail-ea0-f174.google.com ([209.85.215.174]:32840) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VY8Zl-0001Jz-5c for 15594@debbugs.gnu.org; Mon, 21 Oct 2013 02:02:49 -0400 Original-Received: by mail-ea0-f174.google.com with SMTP id z15so3241446ead.33 for <15594@debbugs.gnu.org>; Sun, 20 Oct 2013 23:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=YOagwMVHFpMW11o1q7j0JX30DQCUS5d7fGoDLf8sIp4=; b=XfHLUeub9tyU+yrGZ5OKBCSShnZuv8+l3L78PjeHES0P/6o4BjQsMtKG6ViLI2efz3 GyuWabQybisuvKFDiS4Odb5DgeG6dH1w1uCN3jFXb0ASh1Cxyf3XxTiJyjNoCRI/itud 3hyqMSLpl/A8+VCL2nRS4slxZsa4s6LOkkFeuetLq6+lK+o9XNRzhajco8eay6zQ9Lel apbxIuIKde0G2R9nEvORecTcfdbmBdlBLhpevSps/M3LDkF/xdNaPXgw0CjSjZzfSWI7 yMSwRl1StOXvYpS6HpbKn62F4NHsaFN2OfBFRW2jolZK/TEe02O3rIiudfasNcAGhhkO 00CQ== X-Received: by 10.15.45.135 with SMTP id b7mr170637eew.135.1382335363274; Sun, 20 Oct 2013 23:02:43 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id x47sm39442761eea.16.2013.10.20.23.02.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 20 Oct 2013 23:02:42 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79443 Archived-At: On 15.10.2013 07:31, Stefan Monnier wrote: >> How would that look? >> (unless (member (save-excursion (ruby-smie--forward-token) '("]" "}" "end" >> "+" "-" "?" ":" ...))) > > (looking-at "\\s)\\|\\s.") ? I guess this is better, but it has both false negatives (unary operators like -, ~ and !) and false positives (all non-opener keywords). >> Or should the check be more like "is the next token in `ruby-smie-grammar', >> and if yes, is its left priority more than ' @ 's right priority"? > > Calling ruby-smie--forward-token is a bit dangerous since that function > might itself be called from ruby-smie--forward-token. It might work, > but you'll have to think hard about why an inf-loop is not possible. Hopefully because both `ruby-smie--forward-token' and `ruby-smie--backward-token' would only call `ruby-smie--forward-token', and only when (> pos (point)), IOW there has to be some whitespace skipping done between the recursive calls. >> You've probably already found this, but on the off chance you haven't, >> here's its syntax in (incomplete, somewhat outdated, etc) BNF form: >> http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf > > Please add this URL in a comment somewhere near ruby-smie-grammar (for > example). Done. > Getting `foo' and `bar' aligned is just a matter of adding && to the set > of infix operators (i.e. completing the table of infix operators). > Getting `bar' to be indented one more than `foo' here but not in other > cases of "foo && \n bar" would require more work. Ok, let's go with the former for now.