From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: trunk r114534: Get Ruby's SMIE code to pass the test suite. Date: Tue, 22 Oct 2013 02:30:05 +0400 Message-ID: <5265AAED.5030202@yandex.ru> References: <87eh7z1c8u.fsf@yandex.ru> <87d2nijcx8.fsf@yandex.ru> <5264C654.3010506@yandex.ru> <877gd6ogix.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 1382394628 19324 80.91.229.3 (21 Oct 2013 22:30:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2013 22:30:28 +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 Oct 22 00:30:32 2013 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 1VYNzc-00013n-1C for ged-emacs-devel@m.gmane.org; Tue, 22 Oct 2013 00:30:32 +0200 Original-Received: from localhost ([::1]:42118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYNzb-0003GN-Fa for ged-emacs-devel@m.gmane.org; Mon, 21 Oct 2013 18:30:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYNzN-0003G2-Qd for emacs-devel@gnu.org; Mon, 21 Oct 2013 18:30:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYNzF-0007sv-DR for emacs-devel@gnu.org; Mon, 21 Oct 2013 18:30:17 -0400 Original-Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]:56932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYNzF-0007so-7S for emacs-devel@gnu.org; Mon, 21 Oct 2013 18:30:09 -0400 Original-Received: by mail-ea0-f174.google.com with SMTP id z15so3772577ead.19 for ; Mon, 21 Oct 2013 15:30:08 -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=oN2JbpGjhRIASxUlAW9Cq8t08A1OaKrThgUNWNJ3j6g=; b=QADZOrDtHcK417GAF/R8+48Ucmku2RpAh/d86h/nwb2MfKMsgZtyHTovhU8suuLGqM yJ5H1qWWC9wRvSVakJmcOdjoRyfh9gh8SPL6P4lKwayk5NWf9WFuoeKvHmpE/VSzJv11 EhYJaHsjUOe3F/k6EUgoQ2z+rwhBVQ5ZTu3L4WB9AaMY9qfFz697mPSlhFA5BByNz9Rr ntUovch+G4p0lYiiQhF1zj3J389WDT66Bn7Pq1YEXbVe6UZBZM+ydEm6Kr6MGVgiqQDD vo43QuuvhfUSZ/rT5a2Alk+FxDH///98+12UgmLib1202IYWlxG5CpfsCUOhb/jWQq3T B9+w== X-Received: by 10.14.207.132 with SMTP id n4mr99136eeo.102.1382394608296; Mon, 21 Oct 2013 15:30:08 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id r48sm48862055eev.14.2013.10.21.15.30.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Oct 2013 15:30:07 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164441 Archived-At: On 21.10.2013 20:46, Stefan Monnier wrote: >>> Maybe change the tokenizer so that a ".qux" *at smie-bolp* is tokenized >>> as "." and "qux"? >> That will probably break the following modified example: >> class C >> def foo >> self >> .end >> D.new >> .class >> end >> end > > Yes, the problem is that the set of desired indentation does not match > the structure of a fixed parsing. So, some of the differences need to > be handled in ad-hoc ways in the ruby-smie-rules function. > > E.g. for (:before . ".") we'd have to look at the previous token and if > it's of the form "foo.bar", then manually align with the "." of > "foo.bar". Indentation is not the only problem there. Tokenizing ".end" as [".", "end"] also breaks sexp movement and (for example) `smie--matching-block-data'. The dot concatenation logic is the result of you fixing that in revision 114545. >> But I guess we can make the tokenizer both return "." as a separate >> token and include it in the token that goes after it. > > I'm not sure I understand exactly what you're suggesting, but I'd > venture to say that you can't do that. I don't see why not. I've installed a patch along these lines in 114738, and it fixes the existing examples. Unfortunately, it broke the more complex situations: foo do bar .tee end def bar foo .baz end ...apparently because (goto-char (cadr (smie-indent--parent))), when called before "." in these examples, brings point to the end of the first line, and so (smie-rule-parent ruby-indent-level) returns a surprising result. Any suggestions what to do about that?