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: Tue, 15 Oct 2013 04:23:50 +0300 Message-ID: <525C9926.9030202@yandex.ru> References: <87a9icobbl.fsf@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 1381800316 25417 80.91.229.3 (15 Oct 2013 01:25:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Oct 2013 01:25:16 +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 Tue Oct 15 03:25:19 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 1VVtNu-0000Hh-QV for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Oct 2013 03:25:19 +0200 Original-Received: from localhost ([::1]:39321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVtNu-0001T5-BG for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Oct 2013 21:25:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVtNl-0001Sl-6v for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 21:25:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVtNf-0000Mq-Bj for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 21:25:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVtNf-0000M7-8T for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 21:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VVtNe-0001ga-Fx for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2013 21:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Oct 2013 01:25:02 +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.13818002436401 (code B ref 15594); Tue, 15 Oct 2013 01:25:02 +0000 Original-Received: (at 15594) by debbugs.gnu.org; 15 Oct 2013 01:24:03 +0000 Original-Received: from localhost ([127.0.0.1]:49576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVtMg-0001f9-FU for submit@debbugs.gnu.org; Mon, 14 Oct 2013 21:24:02 -0400 Original-Received: from mail-ee0-f52.google.com ([74.125.83.52]:57163) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVtMd-0001eV-Qq for 15594@debbugs.gnu.org; Mon, 14 Oct 2013 21:24:00 -0400 Original-Received: by mail-ee0-f52.google.com with SMTP id c41so3765279eek.11 for <15594@debbugs.gnu.org>; Mon, 14 Oct 2013 18:23:54 -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=/p8OGEVHIFWFtQconBaCKjZAwxSVCSrQsss+4ICOSB8=; b=Ua0weSIwShAPYHynzs6gSInYwgwg+Zrqw8aG+ucHkbbmkNluTNTvLYvZc4WSHUU6Vv 1DcndhcdH1ieMCS+pNPblQd9KmaUiNcHbA3pB19pheWdawAA7ysxM3ChU8eIfZsO9v1q VNv9oZNmSvrfGe+ZnrEOdOJh++rNxpHPWkiSKbYKI0Fr/3aT8AnyiGivSzRzNj5oqEov qFazMKMIi3HZ0P7Ds38puZrQKOzd7Qs/t4B14krGxDBzAH3DUEdj7LE+UMNHtSEMkwOT LTkNapLxKOnrdJmNq91SklphRIYmXG3Uh3gtDX6FAPGTJYI7/WJtfWqsVe44zcOzvL/B AlfQ== X-Received: by 10.14.216.136 with SMTP id g8mr166284eep.61.1381800233959; Mon, 14 Oct 2013 18:23:53 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id d8sm159969549eeh.8.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Oct 2013 18:23:53 -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:79254 Archived-At: On 14.10.2013 16:44, Stefan Monnier wrote: >> So basically, I think we'd like to check if the token following POS is >> either not "special", or if it is, it begins an expression. Can we do >> that? > > ...(+) But it'll be more difficult to handle >...(++) > since there's no space to use as "implicit method call infix operator". No, space is significant(++), I'm not suggesting to revert the addition of the " @ " token. But we need a better predicate in `ruby-smie--args-separator-p' to check that the thing after POS is probably an argument. "Starts with a word character" is too narrow. > (+) I don't see anything that would stop us. How would that look? (unless (member (save-excursion (ruby-smie--forward-token) '("]" "}" "end" "+" "-" "?" ":" ...))) ? Can we extract the "prohibited" list from the already defined grammar? 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"? (++) > method(arg1), > arg2 > or > method{arg1}, > arg2 > Both examples would result in syntax errors. The second one doubly so, since the first arg there is not a hash, but a block, and a block can only come after all other arguments. Even if the first argument were {:a => 1, :b => 2}, actually, it won't work because "{" in this position is parsed as the beginning of a block (that means one of the examples I added is wrong, sorry!). 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 > +# Shouldn't "bar" be aligned with "foo"? --Stef > if foo && > bar > end Maybe. Either option would be better than the current behavior. I've picked this one because the old engine indents it like so, and additional indentation of 2 (compared to the if body) would likely be more useful that 1, when reading the code. > +# Shouldn't "arg2" be aligned with "!" rather than with "arg1"? --Stef > method !arg1, > arg2 Yes, sorry. Fixed, and added a couple of new examples, like usual.