From unknown Mon Aug 18 08:26:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22116: [PATCH] * etags.c: Add support for Ruby language. Resent-From: lu4nx Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2015 16:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 22116@debbugs.gnu.org Cc: lu4nx X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.144959248027570 (code B ref -1); Tue, 08 Dec 2015 16:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Dec 2015 16:34:40 +0000 Received: from localhost ([127.0.0.1]:43417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6LDr-0007Aa-2L for submit@debbugs.gnu.org; Tue, 08 Dec 2015 11:34:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45874) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6Fwk-0005KK-3t for submit@debbugs.gnu.org; Tue, 08 Dec 2015 05:56:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6Fwi-00017L-Qp for submit@debbugs.gnu.org; Tue, 08 Dec 2015 05:56:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Fwi-00017H-Ox for submit@debbugs.gnu.org; Tue, 08 Dec 2015 05:56:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Fwh-0001qE-Of for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 05:56:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6Fwe-00016A-HU for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 05:56:35 -0500 Received: from smtpproxy19.qq.com ([184.105.206.84]:44371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Fwe-00015i-9d for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 05:56:32 -0500 X-QQ-mid: Xesmtp11t1449572184t103t0122 Received: from lx-pc (unknown [182.138.102.86]) by esmtp4.qq.com (ESMTP) with id ; Tue, 08 Dec 2015 18:56:23 +0800 (CST) X-QQ-SSF: B1000000000000F0FF103F00000000Z X-QQ-FEAT: QX/rXDl9P1uGSSJSClE9xIv5li5QBuIVYLPV3ue0URbJH5fc3dchsAXODPMIo AhzzNbE7TaJqJ+1QlXkQu0QoPJtc3IIcxmBw6ElcGQIztCpuom377fQ84C3/F/LfhZ8Sls3 elDNI2CLXsOWhruanNtVH7tbVsz0jf6Zf1uBR4+Di8Wf1UyXWDboDv68P2RAFCmzlxajyc0 21zQeziIGF/s8ULGH4zkJ0cKJ0crZwSCwiSVXlcYmGoRAEXsKuP4tPnz54IjDuN4= X-QQ-GoodBg: 0 From: lu4nx Date: Tue, 8 Dec 2015 18:56:04 +0800 Message-Id: <1449572164-19846-1-git-send-email-lx@shellcodes.org> X-Mailer: git-send-email 2.5.0 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Tue, 08 Dec 2015 11:34:37 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --- lib-src/etags.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index 8b980d3..7c8c503 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -364,6 +364,7 @@ static void PHP_functions (FILE *); static void PS_functions (FILE *); static void Prolog_functions (FILE *); static void Python_functions (FILE *); +static void Ruby_functions (FILE *); static void Scheme_functions (FILE *); static void TeX_commands (FILE *); static void Texinfo_nodes (FILE *); @@ -722,6 +723,12 @@ static const char Python_help [] = "In Python code, 'def' or 'class' at the beginning of a line\n\ generate a tag."; +static const char *Ruby_suffixes [] = + { "rb", NULL }; +static const char Ruby_help [] = + "In Ruby code, 'def' or 'class' at the beginning of a line\n\ +generate a tag."; + /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; @@ -800,6 +807,7 @@ static language lang_names [] = { "proc", no_lang_help, plain_C_entries, plain_C_suffixes }, { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes }, { "python", Python_help, Python_functions, Python_suffixes }, + { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -4532,6 +4540,31 @@ Python_functions (FILE *inf) } } +/* + * Ruby support + * Idea by Xi Lu (2015) + */ +static void +Ruby_functions (FILE *inf) +{ + char *cp = NULL; + + LOOP_ON_INPUT_LINES (inf, lb, cp) + { + cp = skip_spaces (cp); + if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) + { + char *name = cp; + + while (!notinname (*cp)) + cp++; + + make_tag(name, cp -name, true, + lb.buffer, cp - lb.buffer + 1, lineno, linecharno); + } + } +} + /* * PHP support @@ -4954,7 +4987,22 @@ Lua_functions (FILE *inf) (void)LOOKING_AT (bp, "local"); /* skip possible "local" */ if (LOOKING_AT (bp, "function")) - get_tag (bp, NULL); + { + char *tag_name, *tp_dot, *tp_colon; + + get_tag (bp, &tag_name); + /* If the tag ends with ".foo" or ":foo", make an additional tag for + "foo". */ + tp_dot = strrchr (tag_name, '.'); + tp_colon = strrchr (tag_name, ':'); + if (tp_dot || tp_colon) + { + char *p = tp_dot > tp_colon ? tp_dot : tp_colon; + int len_add = p - tag_name + 1; + + get_tag (bp + len_add, NULL); + } + } } } -- 2.5.0 From unknown Mon Aug 18 08:26:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22116: [PATCH] * etags.c: Add support for Ruby language. Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2015 17:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: lu4nx Cc: 22116@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 22116-submit@debbugs.gnu.org id=B22116.1449595999952 (code B ref 22116); Tue, 08 Dec 2015 17:34:02 +0000 Received: (at 22116) by debbugs.gnu.org; 8 Dec 2015 17:33:19 +0000 Received: from localhost ([127.0.0.1]:43449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6M8c-0000FG-M4 for submit@debbugs.gnu.org; Tue, 08 Dec 2015 12:33:18 -0500 Received: from mtaout23.012.net.il ([80.179.55.175]:40135) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6M8a-0000F8-Ji for 22116@debbugs.gnu.org; Tue, 08 Dec 2015 12:33:17 -0500 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NZ100D00V0R6Z00@a-mtaout23.012.net.il> for 22116@debbugs.gnu.org; Tue, 08 Dec 2015 19:33:15 +0200 (IST) Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NZ100DKUVFF4850@a-mtaout23.012.net.il>; Tue, 08 Dec 2015 19:33:15 +0200 (IST) Date: Tue, 08 Dec 2015 19:33:14 +0200 From: Eli Zaretskii In-reply-to: <1449572164-19846-1-git-send-email-lx@shellcodes.org> X-012-Sender: halo1@inter.net.il Message-id: <836108dew5.fsf@gnu.org> References: <1449572164-19846-1-git-send-email-lx@shellcodes.org> X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.9 (/) > From: lu4nx > Date: Tue, 8 Dec 2015 18:56:04 +0800 > Cc: lu4nx > > +/* > + * Ruby support Thanks. > @@ -4954,7 +4987,22 @@ Lua_functions (FILE *inf) > (void)LOOKING_AT (bp, "local"); /* skip possible "local" */ > > if (LOOKING_AT (bp, "function")) > - get_tag (bp, NULL); > + { > + char *tag_name, *tp_dot, *tp_colon; > + > + get_tag (bp, &tag_name); > + /* If the tag ends with ".foo" or ":foo", make an additional tag for > + "foo". */ > + tp_dot = strrchr (tag_name, '.'); > + tp_colon = strrchr (tag_name, ':'); > + if (tp_dot || tp_colon) > + { > + char *p = tp_dot > tp_colon ? tp_dot : tp_colon; > + int len_add = p - tag_name + 1; > + > + get_tag (bp + len_add, NULL); > + } > + } > } > } This part is certainly not yours, and it has nothing to do with Ruby, AFAICT. Right? From unknown Mon Aug 18 08:26:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22116: [PATCH] * etags.c: Add support for Ruby language. Resent-From: lu4nx Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2015 18:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: lu4nx , 22116@debbugs.gnu.org Received: via spool by 22116-submit@debbugs.gnu.org id=B22116.14495978714131 (code B ref 22116); Tue, 08 Dec 2015 18:05:02 +0000 Received: (at 22116) by debbugs.gnu.org; 8 Dec 2015 18:04:31 +0000 Received: from localhost ([127.0.0.1]:43492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6McW-00014E-1u for submit@debbugs.gnu.org; Tue, 08 Dec 2015 13:04:31 -0500 Received: from smtpproxy19.qq.com ([184.105.206.84]:48248) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6MI7-0000WF-DG for 22116@debbugs.gnu.org; Tue, 08 Dec 2015 12:43:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201307; t=1449596581; bh=LbGShFJpxWneaSe5a0SjoQFWfad13Q9viyr5bfUXnaA=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To; b=ZHSEjfGSJdb+LZ50uXIChPunVaUziCttakiyDze3yoL/AVc+vwilsp1JYmzsOPnCV i6MdHIwfmqNgccwdSCSWbknG6stqZcj/jm/F4mq2KJhjpBKDC6yffIIsb+d0YytaAK UVMYDCbj38pqRc254Q3QwS5nm2O5U8/FF2lfcSGw= X-QQ-mid: esmtp15t1449596579t959t10645 Received: from [192.168.31.140] (unknown [221.3.134.163]) by esmtp5.qq.com (ESMTP) with id ; Wed, 09 Dec 2015 01:42:58 +0800 (CST) X-QQ-SSF: B0000000000000F0FF103300000000Z X-QQ-FEAT: 3GtnPQ8BMmZM1zirFV0iNM5j58GeiEZcohy+CySUKLiWAd9l4jmDfpq4kubqV 5kyMXA0chOTKOyisB3cOK9tMnUmonjw+PSSEjq1cBRZUc9oK9XbC0pBE/DDow9a1e/tKlVJ ink5ATKOcP0Pu49KKYk4F64N7Oc1ApaeWlmlkH9D7VHJew/LCYdj9IJ1WiWQMWmKAJIe9lK 2GKzyAsqAxicDJZbAc+3AYpIlleQmmBhkYdUsXoed7KiOiwjUQnu/4Oh24PY00KY= X-QQ-GoodBg: 0 Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (1.0) From: lu4nx X-Mailer: iPad Mail (13B143) In-Reply-To: <836108dew5.fsf@gnu.org> Date: Wed, 9 Dec 2015 01:43:01 +0800 Content-Transfer-Encoding: quoted-printable Message-Id: <5F105694-F8F3-4BB2-B958-3AEB8D043597@qq.com> References: <1449572164-19846-1-git-send-email-lx@shellcodes.org> <836108dew5.fsf@gnu.org> X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Tue, 08 Dec 2015 13:04:10 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) yes,it has nothing to do with Ruby, thanks ;-) =D4=DA 2015=C4=EA12=D4=C29=C8=D5=A3=AC=C9=CF=CE=E71:33=A3=ACEli Zaretskii =D0=B4=B5=C0=A3=BA >> From: lu4nx >> Date: Tue, 8 Dec 2015 18:56:04 +0800 >> Cc: lu4nx >>=20 >> +/* >> + * Ruby support >=20 > Thanks. >=20 >> @@ -4954,7 +4987,22 @@ Lua_functions (FILE *inf) >> (void)LOOKING_AT (bp, "local"); /* skip possible "local" */ >>=20 >> if (LOOKING_AT (bp, "function")) >> - get_tag (bp, NULL); >> + { >> + char *tag_name, *tp_dot, *tp_colon; >> + >> + get_tag (bp, &tag_name); >> + /* If the tag ends with ".foo" or ":foo", make an additional tag f= or >> + "foo". */ >> + tp_dot =3D strrchr (tag_name, '.'); >> + tp_colon =3D strrchr (tag_name, ':'); >> + if (tp_dot || tp_colon) >> + { >> + char *p =3D tp_dot > tp_colon ? tp_dot : tp_colon; >> + int len_add =3D p - tag_name + 1; >> + >> + get_tag (bp + len_add, NULL); >> + } >> + } >> } >> } >=20 > This part is certainly not yours, and it has nothing to do with Ruby, > AFAICT. Right? >=20 >=20 >=20 From unknown Mon Aug 18 08:26:21 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: lu4nx Subject: bug#22116: closed (Re: bug#22116: [PATCH] * etags.c: Add support for Ruby language.) Message-ID: References: <567E1932.3060707@yandex.ru> <1449572164-19846-1-git-send-email-lx@shellcodes.org> X-Gnu-PR-Message: they-closed 22116 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 22116@debbugs.gnu.org Date: Sat, 26 Dec 2015 04:37:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1451104622-11854-1" This is a multi-part message in MIME format... ------------=_1451104622-11854-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #22116: [PATCH] * etags.c: Add support for Ruby language. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 22116@debbugs.gnu.org. --=20 22116: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D22116 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1451104622-11854-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 22116-done) by debbugs.gnu.org; 26 Dec 2015 04:36:12 +0000 Received: from localhost ([127.0.0.1]:36634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCgaS-000341-9w for submit@debbugs.gnu.org; Fri, 25 Dec 2015 23:36:12 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37169) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCgaQ-00033m-Bj for 22116-done@debbugs.gnu.org; Fri, 25 Dec 2015 23:36:10 -0500 Received: by mail-wm0-f50.google.com with SMTP id p187so217240536wmp.0 for <22116-done@debbugs.gnu.org>; Fri, 25 Dec 2015 20:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=hrvmB6tDtjck2zJ78glIKc/rQVZhKuG80IgHRtU17Bw=; b=Ysa9gi7mwtS0JaHM3Bx/lvvMX+q6hw1pKk8LFhkTe3ZOtt3Ukj/7eMkTkPkeRwF1V5 xC9SJ12FykazuqAmAsnZ430F73I0XHztRuS2o5JiRW0U44v7fPutA2P/BvBIG2DoZ59d fNBsi93UDqV+FXyu0bpGeVl8MEDHqe6q2LeuQvgz+qBd6p40+peELmE/v6a6rDyYWZqr AnzyLOgSoD5D/thylsgNHFTqabknmXjO6GcBLH8CAjWDi4ytPTbhkWiln2XbCIRBpydR 9Cl/r/tZRJ4dFJ4GW8moyUudIIfYH8C6CGUHvrVySAZnVhRKSYy9IeNnQ8ozgKbfAL3M 9Ycg== X-Received: by 10.28.85.70 with SMTP id j67mr49320648wmb.80.1451104564840; Fri, 25 Dec 2015 20:36:04 -0800 (PST) Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id cs4sm47568992wjc.10.2015.12.25.20.36.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Dec 2015 20:36:03 -0800 (PST) Subject: Re: bug#22116: [PATCH] * etags.c: Add support for Ruby language. To: lu4nx , Eli Zaretskii References: <1449572164-19846-1-git-send-email-lx@shellcodes.org> <836108dew5.fsf@gnu.org> <5F105694-F8F3-4BB2-B958-3AEB8D043597@qq.com> From: Dmitry Gutov Message-ID: <567E1932.3060707@yandex.ru> Date: Sat, 26 Dec 2015 06:36:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Thunderbird/42.0 MIME-Version: 1.0 In-Reply-To: <5F105694-F8F3-4BB2-B958-3AEB8D043597@qq.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 22116-done Cc: 22116-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 12/08/2015 07:43 PM, lu4nx wrote: > yes,it has nothing to do with Ruby, thanks ;-) Since this has been applied, closing. Thanks again. ------------=_1451104622-11854-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 8 Dec 2015 16:34:40 +0000 Received: from localhost ([127.0.0.1]:43417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6LDr-0007Aa-2L for submit@debbugs.gnu.org; Tue, 08 Dec 2015 11:34:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45874) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a6Fwk-0005KK-3t for submit@debbugs.gnu.org; Tue, 08 Dec 2015 05:56:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6Fwi-00017L-Qp for submit@debbugs.gnu.org; Tue, 08 Dec 2015 05:56:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Fwi-00017H-Ox for submit@debbugs.gnu.org; Tue, 08 Dec 2015 05:56:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Fwh-0001qE-Of for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 05:56:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6Fwe-00016A-HU for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 05:56:35 -0500 Received: from smtpproxy19.qq.com ([184.105.206.84]:44371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6Fwe-00015i-9d for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2015 05:56:32 -0500 X-QQ-mid: Xesmtp11t1449572184t103t0122 Received: from lx-pc (unknown [182.138.102.86]) by esmtp4.qq.com (ESMTP) with id ; Tue, 08 Dec 2015 18:56:23 +0800 (CST) X-QQ-SSF: B1000000000000F0FF103F00000000Z X-QQ-FEAT: QX/rXDl9P1uGSSJSClE9xIv5li5QBuIVYLPV3ue0URbJH5fc3dchsAXODPMIo AhzzNbE7TaJqJ+1QlXkQu0QoPJtc3IIcxmBw6ElcGQIztCpuom377fQ84C3/F/LfhZ8Sls3 elDNI2CLXsOWhruanNtVH7tbVsz0jf6Zf1uBR4+Di8Wf1UyXWDboDv68P2RAFCmzlxajyc0 21zQeziIGF/s8ULGH4zkJ0cKJ0crZwSCwiSVXlcYmGoRAEXsKuP4tPnz54IjDuN4= X-QQ-GoodBg: 0 From: lu4nx To: bug-gnu-emacs@gnu.org Subject: [PATCH] * etags.c: Add support for Ruby language. Date: Tue, 8 Dec 2015 18:56:04 +0800 Message-Id: <1449572164-19846-1-git-send-email-lx@shellcodes.org> X-Mailer: git-send-email 2.5.0 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 08 Dec 2015 11:34:37 -0500 Cc: lu4nx X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --- lib-src/etags.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/lib-src/etags.c b/lib-src/etags.c index 8b980d3..7c8c503 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -364,6 +364,7 @@ static void PHP_functions (FILE *); static void PS_functions (FILE *); static void Prolog_functions (FILE *); static void Python_functions (FILE *); +static void Ruby_functions (FILE *); static void Scheme_functions (FILE *); static void TeX_commands (FILE *); static void Texinfo_nodes (FILE *); @@ -722,6 +723,12 @@ static const char Python_help [] = "In Python code, 'def' or 'class' at the beginning of a line\n\ generate a tag."; +static const char *Ruby_suffixes [] = + { "rb", NULL }; +static const char Ruby_help [] = + "In Ruby code, 'def' or 'class' at the beginning of a line\n\ +generate a tag."; + /* Can't do the `SCM' or `scm' prefix with a version number. */ static const char *Scheme_suffixes [] = { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; @@ -800,6 +807,7 @@ static language lang_names [] = { "proc", no_lang_help, plain_C_entries, plain_C_suffixes }, { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes }, { "python", Python_help, Python_functions, Python_suffixes }, + { "ruby", Ruby_help, Ruby_functions, Ruby_suffixes }, { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, { "tex", TeX_help, TeX_commands, TeX_suffixes }, { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, @@ -4532,6 +4540,31 @@ Python_functions (FILE *inf) } } +/* + * Ruby support + * Idea by Xi Lu (2015) + */ +static void +Ruby_functions (FILE *inf) +{ + char *cp = NULL; + + LOOP_ON_INPUT_LINES (inf, lb, cp) + { + cp = skip_spaces (cp); + if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) + { + char *name = cp; + + while (!notinname (*cp)) + cp++; + + make_tag(name, cp -name, true, + lb.buffer, cp - lb.buffer + 1, lineno, linecharno); + } + } +} + /* * PHP support @@ -4954,7 +4987,22 @@ Lua_functions (FILE *inf) (void)LOOKING_AT (bp, "local"); /* skip possible "local" */ if (LOOKING_AT (bp, "function")) - get_tag (bp, NULL); + { + char *tag_name, *tp_dot, *tp_colon; + + get_tag (bp, &tag_name); + /* If the tag ends with ".foo" or ":foo", make an additional tag for + "foo". */ + tp_dot = strrchr (tag_name, '.'); + tp_colon = strrchr (tag_name, ':'); + if (tp_dot || tp_colon) + { + char *p = tp_dot > tp_colon ? tp_dot : tp_colon; + int len_add = p - tag_name + 1; + + get_tag (bp + len_add, NULL); + } + } } } -- 2.5.0 ------------=_1451104622-11854-1--