Menu

#138 ctags5.6 can\'t parse Ruby\'s anonymous class definition

open
None
5
2007-05-27
2006-08-29
NARUSE, Yui
No

ctags5.6 can't parse Ruby's singleton class
definition.

For example, if there is following script,

class << expression
end

We expect following result.

expression example.rb /^class <<
expression$/;" c

But ctags5.6 doesn't output anything.

This is because parseIdentifier in ruby.c returns
K_UNDEFINED,
when it find "<<" after "class" + SPs.
It doesn't parse SPs + "expression".

Anyway, a patch is below.

--- ruby_orig.c Tue Aug 29 09:54:41 2006
+++ ruby.c Tue Aug 29 09:54:56 2006
@@ -186,7 +186,8 @@
/* Check for an anonymous (singleton) class
such as "class << HTTP". */
if (kind == K_CLASS && **cp == '<' && *(*cp +
1) == '<')
{
- return K_UNDEFINED;
+ *cp += 2;
+ skipWhitespace (cp);
}

/* Check for operators such as "def []=(key,
val)". */

Discussion

  • Darren Hiebert

    Darren Hiebert - 2006-09-21
    • assigned_to: nobody --> elliotth
    • summary: ctags5.6 can't parse Ruby's singleton class definition --> ctags5.6 can\'t parse Ruby\'s singleton class definition
     
  • Elliott Hughes

    Elliott Hughes - 2007-05-27
    • summary: ctags5.6 can\'t parse Ruby\'s singleton class definition --> ctags5.6 can\'t parse Ruby\'s anonymous class definition
     

Log in to post a comment.