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#15874: 24.3.50; exit! not properly font-locked in ruby-mode Date: Fri, 06 Dec 2013 04:44:49 +0200 Message-ID: <87a9ge7l5q.fsf@yandex.ru> References: <8761r4bh8h.fsf@yandex.ru> <529FB799.3000203@yandex.ru> <529FF61B.4060709@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1386297972 3301 80.91.229.3 (6 Dec 2013 02:46:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Dec 2013 02:46:12 +0000 (UTC) Cc: 15874@debbugs.gnu.org, Bozhidar Batsov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 06 03:46:16 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 1VolQm-0001Io-Es for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Dec 2013 03:46:16 +0100 Original-Received: from localhost ([::1]:57049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VolQm-0002zZ-1t for geb-bug-gnu-emacs@m.gmane.org; Thu, 05 Dec 2013 21:46:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VolQe-0002zL-3A for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2013 21:46:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VolQY-0005Qw-HI for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2013 21:46:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VolQY-0005Qs-DE for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2013 21:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VolQX-00015Y-UM for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2013 21:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Dec 2013 02:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15874 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15874-submit@debbugs.gnu.org id=B15874.13862979044101 (code B ref 15874); Fri, 06 Dec 2013 02:46:01 +0000 Original-Received: (at 15874) by debbugs.gnu.org; 6 Dec 2013 02:45:04 +0000 Original-Received: from localhost ([127.0.0.1]:60898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VolPa-000143-B2 for submit@debbugs.gnu.org; Thu, 05 Dec 2013 21:45:03 -0500 Original-Received: from mail-ea0-f172.google.com ([209.85.215.172]:34701) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VolPX-00013O-JN for 15874@debbugs.gnu.org; Thu, 05 Dec 2013 21:45:00 -0500 Original-Received: by mail-ea0-f172.google.com with SMTP id q10so32384ead.3 for <15874@debbugs.gnu.org>; Thu, 05 Dec 2013 18:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=45stOJskn1fYo/ItRGAq2GZbyMW+FMVhReqp/wlx3mQ=; b=WUzergeY45d57I9q2HFgSHFGmte8XM2Sh+HB2pAVxMT6aNClcjocy1NlfdGTM51bmy HK+BHKnjHEquMjBc/Se+38eeYt9e93xBeqHJ59YXZkRRRy8o7hrnubM1WyrxIueQIFlw 5GBkT74lLuOjmN7jGCbGO3N+caTrhYvVboSVdL11pBcvkTuwdbC7xZwwjqi2E4fqIq1t tbMPz880EVlBsjiPQMAc3233XVQF+5hxD5wNzTvR4OPjuMnDx2LDIe2OV/LBV7v1Z2iT jPYjRHJT8PE54KoL31gddrQU/kyjEhcZ6mDP/FmAWFGqPW/zwgvfR6Dysl9gKmlDWaT4 ZRHw== X-Received: by 10.15.53.193 with SMTP id r41mr691887eew.2.1386297898742; Thu, 05 Dec 2013 18:44:58 -0800 (PST) Original-Received: from axl ([62.228.136.233]) by mx.google.com with ESMTPSA id j46sm112590970eew.18.2013.12.05.18.44.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Dec 2013 18:44:57 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Thu, 05 Dec 2013 14:02:53 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) 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:81485 Archived-At: Stefan Monnier writes: > The advantage is that it would also fix the sexp-movement operations. Two birds with one stone, yes. > I don't see why we'd need lookbehind. Not mandatory, just good for performance, AFAICT. Instead of maching all identifiers that look like methods and then finding out that most of them don't end with ? or ! anyway, it would be faster to scan the buffer for ? or !, and then look a bit back and see if the text before such a character resembles a method name. > We can use a regexp like "\\(?:\\sw\\|\\s_\\)\\([!?]\\)" and then place > the syntax-table property on the ? (or !) character. Yes, something like that. > I'd rather do something a bit more generic, then, like a \\S which can > take a set of syntaxes to exclude. Or maybe extend the [:foo:] > character classes to allow [:sw:], [:s_:], etc... so we could do > [^[:sw:][:s_:]]. That looks good, but, like you mentioned later, if we had a dedicated backslash-sequence, it could also transparently handle the EOB case. I guess, the question is, would it see much use. `regexp-opt' seems to be the primary use case to me. > It's not that big of a deal, tho. I doubt this would ever appear as > a noticeable slowdown. That may be true. > But you said that ! and ? are only allowed in method names. So somehow > Ruby's parser/lexer distinguishes the two cases. Would a reference to > a variable "foo?" simply always be parsed as "a reference to variable > foo?" which would later trigger an error because there's no such > variable (because there can't be any such variable)? Eh, I guess whenever it sees ? or ! at the end of the identifier, the parser goes with the assumption that it is a method call, because otherwise it would be a syntax error. IOW, we only have to worry about @instance and $global variables. irb(main):022:0* def a irb(main):023:1> 42 irb(main):024:1> end => nil irb(main):025:0> a?1:2 SyntaxError: (irb):25: syntax error, unexpected ':', expecting $end a?1:2 ^ from /home/gutov/.rbenv/versions/1.9.3-p429/bin/irb:12:in `
' irb(main):026:0> a = 5 => 5 irb(main):027:0> a?3:4 SyntaxError: (irb):27: syntax error, unexpected ':', expecting $end a?3:4 ^ from /home/gutov/.rbenv/versions/1.9.3-p429/bin/irb:12:in `
' irb(main):028:0> $abc? irb(main):029:0* 2 SyntaxError: (irb):29: syntax error, unexpected $end, expecting ':' from /home/gutov/.rbenv/versions/1.9.3-p429/bin/irb:12:in `
' irb(main):030:0> $abc = 6 => 6 irb(main):031:0> $abc?1:2 => 1