emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 95b6e13: Initial support for Ruby in 'etags'


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-25 95b6e13: Initial support for Ruby in 'etags'
Date: Fri, 11 Dec 2015 08:53:21 +0000

branch: emacs-25
commit 95b6e13c13e4de9cdd0c3659d4864b17bafd040e
Author: Xi Lu <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Initial support for Ruby in 'etags'
    
    * lib-src/etags.c <Ruby_suffixes>: New variable.
    (lang_names): Add an entry for Ruby.
    (Ruby_functions): New function.  (Bug#22116)
---
 lib-src/etags.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 5f985b0..c91cef4 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
+ * Original code by Xi Lu <address@hidden> (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]