From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22241: 25.0.50; etags Ruby parser problems Date: Sat, 23 Jan 2016 20:59:00 +0200 Message-ID: <83oacc3yx7.fsf@gnu.org> References: <86r3i9hnbt.fsf@yandex.ru> <83si1o45g1.fsf@gnu.org> <56A3C53D.1050408@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453575562 12763 80.91.229.3 (23 Jan 2016 18:59:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Jan 2016 18:59:22 +0000 (UTC) Cc: 22241@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 23 19:59:11 2016 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 1aN3Ow-000871-0d for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Jan 2016 19:59:10 +0100 Original-Received: from localhost ([::1]:58265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN3Ov-00076D-6J for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Jan 2016 13:59:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN3Or-000762-KO for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2016 13:59:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aN3Oo-0000VR-CT for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2016 13:59:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN3Oo-0000VN-8c for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2016 13:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aN3Oo-0004FY-1j for bug-gnu-emacs@gnu.org; Sat, 23 Jan 2016 13:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Jan 2016 18:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22241 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22241-submit@debbugs.gnu.org id=B22241.145357553116319 (code B ref 22241); Sat, 23 Jan 2016 18:59:02 +0000 Original-Received: (at 22241) by debbugs.gnu.org; 23 Jan 2016 18:58:51 +0000 Original-Received: from localhost ([127.0.0.1]:60794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aN3Od-0004F9-CB for submit@debbugs.gnu.org; Sat, 23 Jan 2016 13:58:51 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39007) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aN3Ob-0004Ex-Jn for 22241@debbugs.gnu.org; Sat, 23 Jan 2016 13:58:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aN3OT-0000UP-93 for 22241@debbugs.gnu.org; Sat, 23 Jan 2016 13:58:44 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aN3OT-0000UL-64; Sat, 23 Jan 2016 13:58:41 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3434 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aN3OS-0001f7-FB; Sat, 23 Jan 2016 13:58:40 -0500 In-reply-to: <56A3C53D.1050408@yandex.ru> (message from Dmitry Gutov on Sat, 23 Jan 2016 21:23:57 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:111896 Archived-At: > Cc: 22241@debbugs.gnu.org > From: Dmitry Gutov > Date: Sat, 23 Jan 2016 21:23:57 +0300 > > On 01/23/2016 07:38 PM, Eli Zaretskii wrote: > > > I don't speak Ruby. So please give a more detailed spec for the > > features you want added. I wrote some questions below, but I'm quite > > sure there are more questions I should ask, but don't know about. So > > please provide as complete specification for each feature as you > > possibly can, TIA. > > There's no actual up-to-date language spec, and when in doubt, I fire up > the REPL and try things out (and forget many of the results afterwards). > So there's no "detailed spec" in my head. Let me just try my best > answering your questions, for now. Thanks. I have a couple of follow-ups. > >> - Constants are not indexed. > > > > What is the full syntax of a "constant"? Is it just > > > > IDENTIFIER "=" INTEGER-NUMBER > > Pretty much. IDENTIFIER should be ALL_CAPS, or CamelCase, with > underscores allowed. > > INTEGER-NUMBER should be just EXPRESSION, because it can be any > expression, possibly a multiline one. So I guess I will leave constants out for now: etags has no notion of expressions. > >> - "class << self" blocks are given a separate entry. > > > > What should be done instead? Can't a class be named "<<"? > > A class cannot be named "<<". You should not add that line to the index, > but record that the method definitions inside the following scope are > defined on the current class or module. Is the telltale part "<<" or "self" (or both)? If it's "<<", then are there other such tokens that "invalidate" a class? > > How to know when a module's or a class's scope ends? Is it enough to > > count "end" lines? > > Hmm, maybe? I'm guessing etags doesn't really handle heredoc syntax, or > multiline strings defined with percent literals (examples here: > https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#.22Here_document.22_notation) > > The result shouldn't be too bad if you do that, anyway. Except: > > > Can I assume that "end" will always appear by > > itself on a line? > > Unfortunately, no. It can also be on the same line, after a semicolon > (or on any other line, I suppose, but nobody writes Ruby like that). > Examples: > > class SpecialError < StandardError; end > > or > > class MyStruct < Struct.new(:a, :b, :c); end Looks complicated, but I will look into this. I hope no identifier can be named "end", as in def foo bar = end end ? > >> A > >> A::B > >> A::B::ABC > >> A::B#foo! > >> A::B.bar? > >> A::B.qux= > > > > Why did 'foo!' get a '#' instead of a '.', as for '_bar'? > > It's common to use '#' in the qualified names of instance methods What part of the source makes 'foo!' an instance method? > > Why did 'bar' and 'tee' git a '=' appended? > > Because 'attr_writer :bar' effectively expands to > > def bar=(val) > @bar = val > end > > and 'attr_accessor :tee' expands into > > def tee > @tee > end > > def tee=(val) > @tee = val > end So you are saying that attr_writer and attr_accessor cause the '=' to be appended? Thanks.