ctags.rb 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -0
- data/Rakefile +23 -0
- data/ctags.rb.gemspec +23 -0
- data/ext/.gitignore +3 -0
- data/ext/extconf.rb +15 -0
- data/ext/vendor/exuberant-ctags/.gitignore +6 -0
- data/ext/vendor/exuberant-ctags/.indent.pro +31 -0
- data/ext/vendor/exuberant-ctags/COPYING +340 -0
- data/ext/vendor/exuberant-ctags/EXTENDING.html +386 -0
- data/ext/vendor/exuberant-ctags/FAQ +371 -0
- data/ext/vendor/exuberant-ctags/INSTALL +215 -0
- data/ext/vendor/exuberant-ctags/INSTALL.oth +73 -0
- data/ext/vendor/exuberant-ctags/MAINTAINERS +88 -0
- data/ext/vendor/exuberant-ctags/Makefile.in +222 -0
- data/ext/vendor/exuberant-ctags/NEWS +871 -0
- data/ext/vendor/exuberant-ctags/README +73 -0
- data/ext/vendor/exuberant-ctags/ant.c +42 -0
- data/ext/vendor/exuberant-ctags/argproc.c +505 -0
- data/ext/vendor/exuberant-ctags/args.c +274 -0
- data/ext/vendor/exuberant-ctags/args.h +63 -0
- data/ext/vendor/exuberant-ctags/asm.c +387 -0
- data/ext/vendor/exuberant-ctags/asp.c +328 -0
- data/ext/vendor/exuberant-ctags/awk.c +81 -0
- data/ext/vendor/exuberant-ctags/basic.c +203 -0
- data/ext/vendor/exuberant-ctags/beta.c +321 -0
- data/ext/vendor/exuberant-ctags/c.c +2932 -0
- data/ext/vendor/exuberant-ctags/cobol.c +50 -0
- data/ext/vendor/exuberant-ctags/config.h.in +277 -0
- data/ext/vendor/exuberant-ctags/configure +7704 -0
- data/ext/vendor/exuberant-ctags/configure.ac +532 -0
- data/ext/vendor/exuberant-ctags/ctags.1 +1186 -0
- data/ext/vendor/exuberant-ctags/ctags.h +28 -0
- data/ext/vendor/exuberant-ctags/ctags.html +2087 -0
- data/ext/vendor/exuberant-ctags/ctags.spec +40 -0
- data/ext/vendor/exuberant-ctags/debug.c +113 -0
- data/ext/vendor/exuberant-ctags/debug.h +70 -0
- data/ext/vendor/exuberant-ctags/descrip.mms +68 -0
- data/ext/vendor/exuberant-ctags/dosbatch.c +42 -0
- data/ext/vendor/exuberant-ctags/e_amiga.h +24 -0
- data/ext/vendor/exuberant-ctags/e_djgpp.h +47 -0
- data/ext/vendor/exuberant-ctags/e_mac.h +143 -0
- data/ext/vendor/exuberant-ctags/e_msoft.h +76 -0
- data/ext/vendor/exuberant-ctags/e_os2.h +37 -0
- data/ext/vendor/exuberant-ctags/e_qdos.h +34 -0
- data/ext/vendor/exuberant-ctags/e_riscos.h +58 -0
- data/ext/vendor/exuberant-ctags/e_vms.h +31 -0
- data/ext/vendor/exuberant-ctags/eiffel.c +1352 -0
- data/ext/vendor/exuberant-ctags/entry.c +847 -0
- data/ext/vendor/exuberant-ctags/entry.h +103 -0
- data/ext/vendor/exuberant-ctags/erlang.c +189 -0
- data/ext/vendor/exuberant-ctags/flex.c +2243 -0
- data/ext/vendor/exuberant-ctags/fortran.c +2197 -0
- data/ext/vendor/exuberant-ctags/general.h +127 -0
- data/ext/vendor/exuberant-ctags/get.c +669 -0
- data/ext/vendor/exuberant-ctags/get.h +50 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/all-wcprops +47 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/entries +112 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/README.txt.svn-base +5 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regcomp.c.svn-base +3818 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.c.svn-base +74 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.h.svn-base +575 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.c.svn-base +1713 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.h.svn-base +773 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regexec.c.svn-base +4338 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/README.txt +5 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regcomp.c +3818 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex.c +74 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex.h +575 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex_internal.c +1713 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex_internal.h +773 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regexec.c +4338 -0
- data/ext/vendor/exuberant-ctags/html.c +49 -0
- data/ext/vendor/exuberant-ctags/jscript.c +1572 -0
- data/ext/vendor/exuberant-ctags/keyword.c +258 -0
- data/ext/vendor/exuberant-ctags/keyword.h +34 -0
- data/ext/vendor/exuberant-ctags/lisp.c +139 -0
- data/ext/vendor/exuberant-ctags/lregex.c +704 -0
- data/ext/vendor/exuberant-ctags/lua.c +133 -0
- data/ext/vendor/exuberant-ctags/mac.c +273 -0
- data/ext/vendor/exuberant-ctags/magic.diff +21 -0
- data/ext/vendor/exuberant-ctags/main.c +584 -0
- data/ext/vendor/exuberant-ctags/main.h +32 -0
- data/ext/vendor/exuberant-ctags/maintainer.mak +476 -0
- data/ext/vendor/exuberant-ctags/make.c +217 -0
- data/ext/vendor/exuberant-ctags/matlab.c +44 -0
- data/ext/vendor/exuberant-ctags/mk_bc3.mak +46 -0
- data/ext/vendor/exuberant-ctags/mk_bc5.mak +49 -0
- data/ext/vendor/exuberant-ctags/mk_djg.mak +18 -0
- data/ext/vendor/exuberant-ctags/mk_manx.mak +65 -0
- data/ext/vendor/exuberant-ctags/mk_mingw.mak +31 -0
- data/ext/vendor/exuberant-ctags/mk_mpw.mak +130 -0
- data/ext/vendor/exuberant-ctags/mk_mvc.mak +40 -0
- data/ext/vendor/exuberant-ctags/mk_os2.mak +104 -0
- data/ext/vendor/exuberant-ctags/mk_qdos.mak +100 -0
- data/ext/vendor/exuberant-ctags/mk_sas.mak +63 -0
- data/ext/vendor/exuberant-ctags/mkinstalldirs +40 -0
- data/ext/vendor/exuberant-ctags/ocaml.c +1842 -0
- data/ext/vendor/exuberant-ctags/options.c +1842 -0
- data/ext/vendor/exuberant-ctags/options.h +155 -0
- data/ext/vendor/exuberant-ctags/parse.c +677 -0
- data/ext/vendor/exuberant-ctags/parse.h +129 -0
- data/ext/vendor/exuberant-ctags/parsers.h +63 -0
- data/ext/vendor/exuberant-ctags/pascal.c +267 -0
- data/ext/vendor/exuberant-ctags/perl.c +382 -0
- data/ext/vendor/exuberant-ctags/php.c +237 -0
- data/ext/vendor/exuberant-ctags/python.c +771 -0
- data/ext/vendor/exuberant-ctags/qdos.c +106 -0
- data/ext/vendor/exuberant-ctags/read.c +569 -0
- data/ext/vendor/exuberant-ctags/read.h +116 -0
- data/ext/vendor/exuberant-ctags/readtags.c +959 -0
- data/ext/vendor/exuberant-ctags/readtags.h +252 -0
- data/ext/vendor/exuberant-ctags/rexx.c +39 -0
- data/ext/vendor/exuberant-ctags/routines.c +891 -0
- data/ext/vendor/exuberant-ctags/routines.h +134 -0
- data/ext/vendor/exuberant-ctags/ruby.c +408 -0
- data/ext/vendor/exuberant-ctags/scheme.c +111 -0
- data/ext/vendor/exuberant-ctags/sh.c +115 -0
- data/ext/vendor/exuberant-ctags/slang.c +41 -0
- data/ext/vendor/exuberant-ctags/sml.c +212 -0
- data/ext/vendor/exuberant-ctags/sort.c +230 -0
- data/ext/vendor/exuberant-ctags/sort.h +32 -0
- data/ext/vendor/exuberant-ctags/source.mak +122 -0
- data/ext/vendor/exuberant-ctags/sql.c +2112 -0
- data/ext/vendor/exuberant-ctags/strlist.c +281 -0
- data/ext/vendor/exuberant-ctags/strlist.h +54 -0
- data/ext/vendor/exuberant-ctags/tcl.c +116 -0
- data/ext/vendor/exuberant-ctags/tex.c +524 -0
- data/ext/vendor/exuberant-ctags/verilog.c +340 -0
- data/ext/vendor/exuberant-ctags/vhdl.c +835 -0
- data/ext/vendor/exuberant-ctags/vim.c +636 -0
- data/ext/vendor/exuberant-ctags/vstring.c +232 -0
- data/ext/vendor/exuberant-ctags/vstring.h +85 -0
- data/ext/vendor/exuberant-ctags/yacc.c +40 -0
- data/lib/ctags/exuberant.rb +45 -0
- data/lib/ctags/version.rb +3 -0
- data/lib/ctags.rb +6 -0
- data/test/test_ctags.rb +24 -0
- metadata +233 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* $Id: vstring.c 558 2007-06-15 19:17:02Z elliotth $
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 1998-2002, Darren Hiebert
|
|
5
|
+
*
|
|
6
|
+
* This source code is released for free distribution under the terms of the
|
|
7
|
+
* GNU General Public License.
|
|
8
|
+
*
|
|
9
|
+
* This module contains functions supporting resizeable strings.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* INCLUDE FILES
|
|
14
|
+
*/
|
|
15
|
+
#include "general.h" /* must always come first */
|
|
16
|
+
|
|
17
|
+
#include <limits.h> /* to define INT_MAX */
|
|
18
|
+
#include <string.h>
|
|
19
|
+
#include <ctype.h>
|
|
20
|
+
|
|
21
|
+
#include "debug.h"
|
|
22
|
+
#include "routines.h"
|
|
23
|
+
#include "vstring.h"
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* DATA DEFINITIONS
|
|
27
|
+
*/
|
|
28
|
+
static const size_t vStringInitialSize = 32;
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* FUNCTION DEFINITIONS
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
static void vStringResize (vString *const string, const size_t newSize)
|
|
35
|
+
{
|
|
36
|
+
char *const newBuffer = xRealloc (string->buffer, newSize, char);
|
|
37
|
+
|
|
38
|
+
string->size = newSize;
|
|
39
|
+
string->buffer = newBuffer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* External interface
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
extern boolean vStringAutoResize (vString *const string)
|
|
47
|
+
{
|
|
48
|
+
boolean ok = TRUE;
|
|
49
|
+
|
|
50
|
+
if (string->size <= INT_MAX / 2)
|
|
51
|
+
{
|
|
52
|
+
const size_t newSize = string->size * 2;
|
|
53
|
+
|
|
54
|
+
vStringResize (string, newSize);
|
|
55
|
+
}
|
|
56
|
+
return ok;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
extern void vStringClear (vString *const string)
|
|
60
|
+
{
|
|
61
|
+
string->length = 0;
|
|
62
|
+
string->buffer [0] = '\0';
|
|
63
|
+
DebugStatement ( memset (string->buffer, 0, string->size); )
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
extern void vStringDelete (vString *const string)
|
|
67
|
+
{
|
|
68
|
+
if (string != NULL)
|
|
69
|
+
{
|
|
70
|
+
if (string->buffer != NULL)
|
|
71
|
+
eFree (string->buffer);
|
|
72
|
+
eFree (string);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
extern vString *vStringNew (void)
|
|
77
|
+
{
|
|
78
|
+
vString *const string = xMalloc (1, vString);
|
|
79
|
+
|
|
80
|
+
string->length = 0;
|
|
81
|
+
string->size = vStringInitialSize;
|
|
82
|
+
string->buffer = xMalloc (string->size, char);
|
|
83
|
+
|
|
84
|
+
vStringClear (string);
|
|
85
|
+
|
|
86
|
+
return string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#ifndef VSTRING_PUTC_MACRO
|
|
90
|
+
extern void vStringPut (vString *const string, const int c)
|
|
91
|
+
{
|
|
92
|
+
if (string->length + 1 == string->size) /* check for buffer overflow */
|
|
93
|
+
vStringAutoResize (string);
|
|
94
|
+
|
|
95
|
+
string->buffer [string->length] = c;
|
|
96
|
+
if (c != '\0')
|
|
97
|
+
string->buffer [++string->length] = '\0';
|
|
98
|
+
}
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
extern void vStringCatS (vString *const string, const char *const s)
|
|
102
|
+
{
|
|
103
|
+
#if 1
|
|
104
|
+
const size_t len = strlen (s);
|
|
105
|
+
while (string->length + len + 1 >= string->size)/* check for buffer overflow */
|
|
106
|
+
vStringAutoResize (string);
|
|
107
|
+
strcpy (string->buffer + string->length, s);
|
|
108
|
+
string->length += len;
|
|
109
|
+
#else
|
|
110
|
+
const char *p = s;
|
|
111
|
+
do
|
|
112
|
+
vStringPut (string, *p);
|
|
113
|
+
while (*p++ != '\0');
|
|
114
|
+
#endif
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
extern vString *vStringNewCopy (const vString *const string)
|
|
118
|
+
{
|
|
119
|
+
vString *vs = vStringNew ();
|
|
120
|
+
vStringCatS (vs, string->buffer);
|
|
121
|
+
return vs;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
extern vString *vStringNewInit (const char *const s)
|
|
125
|
+
{
|
|
126
|
+
vString *vs = vStringNew ();
|
|
127
|
+
vStringCatS (vs, s);
|
|
128
|
+
return vs;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
extern void vStringNCatS (
|
|
132
|
+
vString *const string, const char *const s, const size_t length)
|
|
133
|
+
{
|
|
134
|
+
const char *p = s;
|
|
135
|
+
size_t remain = length;
|
|
136
|
+
|
|
137
|
+
while (*p != '\0' && remain > 0)
|
|
138
|
+
{
|
|
139
|
+
vStringPut (string, *p);
|
|
140
|
+
--remain;
|
|
141
|
+
++p;
|
|
142
|
+
}
|
|
143
|
+
vStringTerminate (string);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Strip trailing newline from string.
|
|
147
|
+
*/
|
|
148
|
+
extern void vStringStripNewline (vString *const string)
|
|
149
|
+
{
|
|
150
|
+
const size_t final = string->length - 1;
|
|
151
|
+
if (string->buffer [final] == '\n')
|
|
152
|
+
{
|
|
153
|
+
string->buffer [final] = '\0';
|
|
154
|
+
string->length--;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Strip leading white space from string.
|
|
159
|
+
*/
|
|
160
|
+
extern void vStringStripLeading (vString *const string)
|
|
161
|
+
{
|
|
162
|
+
while (isspace ((int) string->buffer [0]) && string->length > 0)
|
|
163
|
+
{
|
|
164
|
+
size_t i;
|
|
165
|
+
for (i = 1 ; i < string->length ; ++i)
|
|
166
|
+
string->buffer [i - 1] = string->buffer [i];
|
|
167
|
+
--string->length;
|
|
168
|
+
string->buffer [string->length] = '\0';
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Strip trailing white space from string.
|
|
173
|
+
*/
|
|
174
|
+
extern void vStringStripTrailing (vString *const string)
|
|
175
|
+
{
|
|
176
|
+
while (isspace ((int) string->buffer [string->length - 1]) &&
|
|
177
|
+
string->length > 0)
|
|
178
|
+
{
|
|
179
|
+
string->length--;
|
|
180
|
+
string->buffer [string->length] = '\0';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Chop last character from string.
|
|
185
|
+
*/
|
|
186
|
+
extern void vStringChop (vString *const string)
|
|
187
|
+
{
|
|
188
|
+
if (string->length > 0)
|
|
189
|
+
{
|
|
190
|
+
--string->length;
|
|
191
|
+
string->buffer [string->length] = '\0';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
extern void vStringCopyS (vString *const string, const char *const s)
|
|
196
|
+
{
|
|
197
|
+
vStringClear (string);
|
|
198
|
+
vStringCatS (string, s);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
extern void vStringNCopyS (
|
|
202
|
+
vString *const string, const char *const s, const size_t length)
|
|
203
|
+
{
|
|
204
|
+
vStringClear (string);
|
|
205
|
+
vStringNCatS (string, s, length);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
extern void vStringCopyToLower (vString *const dest, const vString *const src)
|
|
209
|
+
{
|
|
210
|
+
const size_t length = src->length;
|
|
211
|
+
const char *s = src->buffer;
|
|
212
|
+
char *d;
|
|
213
|
+
size_t i;
|
|
214
|
+
|
|
215
|
+
if (dest->size < src->size)
|
|
216
|
+
vStringResize (dest, src->size);
|
|
217
|
+
d = dest->buffer;
|
|
218
|
+
for (i = 0 ; i < length ; ++i)
|
|
219
|
+
{
|
|
220
|
+
int c = s [i];
|
|
221
|
+
|
|
222
|
+
d [i] = tolower (c);
|
|
223
|
+
}
|
|
224
|
+
d [i] = '\0';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
extern void vStringSetLength (vString *const string)
|
|
228
|
+
{
|
|
229
|
+
string->length = strlen (string->buffer);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* vi:set tabstop=4 shiftwidth=4: */
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* $Id: vstring.h 719 2009-07-07 03:46:59Z dhiebert $
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 1998-2002, Darren Hiebert
|
|
5
|
+
*
|
|
6
|
+
* This source code is released for free distribution under the terms of the
|
|
7
|
+
* GNU General Public License.
|
|
8
|
+
*
|
|
9
|
+
* Provides the external interface for resizeable strings.
|
|
10
|
+
*/
|
|
11
|
+
#ifndef _VSTRING_H
|
|
12
|
+
#define _VSTRING_H
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* INCLUDE FILES
|
|
16
|
+
*/
|
|
17
|
+
#include "general.h" /* must always come first */
|
|
18
|
+
|
|
19
|
+
#if defined(HAVE_STDLIB_H)
|
|
20
|
+
# include <stdlib.h> /* to define size_t */
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* MACROS
|
|
25
|
+
*/
|
|
26
|
+
#ifndef DEBUG
|
|
27
|
+
# define VSTRING_PUTC_MACRO 1
|
|
28
|
+
#endif
|
|
29
|
+
#ifdef VSTRING_PUTC_MACRO
|
|
30
|
+
#define vStringPut(s,c) \
|
|
31
|
+
(void)(((s)->length + 1 == (s)->size ? vStringAutoResize (s) : 0), \
|
|
32
|
+
((s)->buffer [(s)->length] = (c)), \
|
|
33
|
+
((c) == '\0' ? 0 : ((s)->buffer [++(s)->length] = '\0')))
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
#define vStringValue(vs) ((vs)->buffer)
|
|
37
|
+
#define vStringItem(vs,i) ((vs)->buffer[i])
|
|
38
|
+
#define vStringLast(vs) ((vs)->buffer[(vs)->length - 1])
|
|
39
|
+
#define vStringLength(vs) ((vs)->length)
|
|
40
|
+
#define vStringSize(vs) ((vs)->size)
|
|
41
|
+
#define vStringCat(vs,s) vStringCatS((vs), vStringValue((s)))
|
|
42
|
+
#define vStringNCat(vs,s,l) vStringNCatS((vs), vStringValue((s)), (l))
|
|
43
|
+
#define vStringCopy(vs,s) vStringCopyS((vs), vStringValue((s)))
|
|
44
|
+
#define vStringNCopy(vs,s,l) vStringNCopyS((vs), vStringValue((s)), (l))
|
|
45
|
+
#define vStringChar(vs,i) ((vs)->buffer[i])
|
|
46
|
+
#define vStringTerminate(vs) vStringPut(vs, '\0')
|
|
47
|
+
#define vStringLower(vs) toLowerString((vs)->buffer)
|
|
48
|
+
#define vStringUpper(vs) toUpperString((vs)->buffer)
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
* DATA DECLARATIONS
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
typedef struct sVString {
|
|
55
|
+
size_t length; /* size of buffer used */
|
|
56
|
+
size_t size; /* allocated size of buffer */
|
|
57
|
+
char *buffer; /* location of buffer */
|
|
58
|
+
} vString;
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* FUNCTION PROTOTYPES
|
|
62
|
+
*/
|
|
63
|
+
extern boolean vStringAutoResize (vString *const string);
|
|
64
|
+
extern void vStringClear (vString *const string);
|
|
65
|
+
extern vString *vStringNew (void);
|
|
66
|
+
extern void vStringDelete (vString *const string);
|
|
67
|
+
#ifndef VSTRING_PUTC_MACRO
|
|
68
|
+
extern void vStringPut (vString *const string, const int c);
|
|
69
|
+
#endif
|
|
70
|
+
extern void vStringStripNewline (vString *const string);
|
|
71
|
+
extern void vStringStripLeading (vString *const string);
|
|
72
|
+
extern void vStringChop (vString *const string);
|
|
73
|
+
extern void vStringStripTrailing (vString *const string);
|
|
74
|
+
extern void vStringCatS (vString *const string, const char *const s);
|
|
75
|
+
extern void vStringNCatS (vString *const string, const char *const s, const size_t length);
|
|
76
|
+
extern vString *vStringNewCopy (const vString *const string);
|
|
77
|
+
extern vString *vStringNewInit (const char *const s);
|
|
78
|
+
extern void vStringCopyS (vString *const string, const char *const s);
|
|
79
|
+
extern void vStringNCopyS (vString *const string, const char *const s, const size_t length);
|
|
80
|
+
extern void vStringCopyToLower (vString *const dest, const vString *const src);
|
|
81
|
+
extern void vStringSetLength (vString *const string);
|
|
82
|
+
|
|
83
|
+
#endif /* _VSTRING_H */
|
|
84
|
+
|
|
85
|
+
/* vi:set tabstop=4 shiftwidth=4: */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* $Id: yacc.c 443 2006-05-30 04:37:13Z darren $
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2001-2002, Nick Hibma <n_hibma@van-laarhoven.org>
|
|
5
|
+
*
|
|
6
|
+
* This source code is released for free distribution under the terms of the
|
|
7
|
+
* GNU General Public License.
|
|
8
|
+
*
|
|
9
|
+
* This module contains functions for generating tags for YACC language files.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* INCLUDE FILES
|
|
14
|
+
*/
|
|
15
|
+
#include "general.h" /* must always come first */
|
|
16
|
+
|
|
17
|
+
#include <string.h>
|
|
18
|
+
#include "parse.h"
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* FUNCTION DEFINITIONS
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
static void installYaccRegex (const langType language)
|
|
25
|
+
{
|
|
26
|
+
addTagRegex (language,
|
|
27
|
+
"^([A-Za-z][A-Za-z_0-9]+)[ \t]*:", "\\1", "l,label,labels", NULL);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
extern parserDefinition* YaccParser ()
|
|
31
|
+
{
|
|
32
|
+
static const char *const extensions [] = { "y", NULL };
|
|
33
|
+
parserDefinition* const def = parserNew ("YACC");
|
|
34
|
+
def->extensions = extensions;
|
|
35
|
+
def->initialize = installYaccRegex;
|
|
36
|
+
def->regex = TRUE;
|
|
37
|
+
return def;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* vi:set tabstop=4 shiftwidth=4: */
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'posix/spawn'
|
|
2
|
+
|
|
3
|
+
module Ctags
|
|
4
|
+
class Error < StandardError
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
module Exuberant
|
|
8
|
+
include POSIX::Spawn
|
|
9
|
+
|
|
10
|
+
BIN = File.expand_path("../../../ext/dst/bin/ctags", __FILE__)
|
|
11
|
+
|
|
12
|
+
def tags_for_code(file, code)
|
|
13
|
+
tags_for_file(file, code)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def tags_for_file(file, code=nil)
|
|
17
|
+
if code
|
|
18
|
+
child = Child.new(BIN, '-f', '-', '--extra=+f', '--excmd=number', "--stdin-filename=#{file}", :input => code)
|
|
19
|
+
else
|
|
20
|
+
child = Child.new(BIN, '-f', '-', '--extra=+f', '--excmd=number', file)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if !child.status.success?
|
|
24
|
+
raise Error, child.err
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
tags = {}
|
|
28
|
+
|
|
29
|
+
child.out.each_line.map do |line|
|
|
30
|
+
name, file, line, type, *rest = line.split("\t")
|
|
31
|
+
tags[name] = {
|
|
32
|
+
:file => file,
|
|
33
|
+
:line => line.sub(';"','').to_i,
|
|
34
|
+
:type => type.strip
|
|
35
|
+
}
|
|
36
|
+
rest.each do |part|
|
|
37
|
+
key, value = part.strip.split(':', 2)
|
|
38
|
+
tags[name][key.to_sym] = value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
tags
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/lib/ctags.rb
ADDED
data/test/test_ctags.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#coding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'test/unit'
|
|
4
|
+
require File.join(File.dirname(__FILE__), '..', '/lib/ctags.rb')
|
|
5
|
+
|
|
6
|
+
class CtagsTest < Test::Unit::TestCase
|
|
7
|
+
def test_tags_for_file
|
|
8
|
+
tags = Ctags.tags_for_file(__FILE__)
|
|
9
|
+
tag = tags[__method__.to_s]
|
|
10
|
+
|
|
11
|
+
assert_equal __FILE__, tag[:file]
|
|
12
|
+
assert_equal __LINE__-5, tag[:line]
|
|
13
|
+
assert_equal 'CtagsTest', tag[:class]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_tags_for_code
|
|
17
|
+
tags = Ctags.tags_for_code('file.rb', File.read(__FILE__))
|
|
18
|
+
tag = tags[__method__.to_s]
|
|
19
|
+
|
|
20
|
+
assert_equal 'file.rb', tag[:file]
|
|
21
|
+
assert_equal __LINE__-5, tag[:line]
|
|
22
|
+
assert_equal 'CtagsTest', tag[:class]
|
|
23
|
+
end
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ctags.rb
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 23
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 1
|
|
8
|
+
- 0
|
|
9
|
+
- 0
|
|
10
|
+
version: 1.0.0
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Aman Gupta
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2012-12-19 00:00:00 Z
|
|
19
|
+
dependencies:
|
|
20
|
+
- !ruby/object:Gem::Dependency
|
|
21
|
+
name: posix-spawn
|
|
22
|
+
prerelease: false
|
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
24
|
+
none: false
|
|
25
|
+
requirements:
|
|
26
|
+
- - ~>
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
hash: 31
|
|
29
|
+
segments:
|
|
30
|
+
- 0
|
|
31
|
+
- 3
|
|
32
|
+
- 6
|
|
33
|
+
version: 0.3.6
|
|
34
|
+
type: :runtime
|
|
35
|
+
version_requirements: *id001
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: rake-compiler
|
|
38
|
+
prerelease: false
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
40
|
+
none: false
|
|
41
|
+
requirements:
|
|
42
|
+
- - ~>
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
hash: 15
|
|
45
|
+
segments:
|
|
46
|
+
- 0
|
|
47
|
+
- 7
|
|
48
|
+
- 6
|
|
49
|
+
version: 0.7.6
|
|
50
|
+
type: :development
|
|
51
|
+
version_requirements: *id002
|
|
52
|
+
description: ctags.rb exposes exuberant-ctags to Ruby
|
|
53
|
+
email:
|
|
54
|
+
- aman@tmm1.net
|
|
55
|
+
executables: []
|
|
56
|
+
|
|
57
|
+
extensions:
|
|
58
|
+
- ext/extconf.rb
|
|
59
|
+
extra_rdoc_files: []
|
|
60
|
+
|
|
61
|
+
files:
|
|
62
|
+
- Gemfile
|
|
63
|
+
- Rakefile
|
|
64
|
+
- ctags.rb.gemspec
|
|
65
|
+
- ext/.gitignore
|
|
66
|
+
- ext/extconf.rb
|
|
67
|
+
- ext/vendor/exuberant-ctags/.gitignore
|
|
68
|
+
- ext/vendor/exuberant-ctags/.indent.pro
|
|
69
|
+
- ext/vendor/exuberant-ctags/COPYING
|
|
70
|
+
- ext/vendor/exuberant-ctags/EXTENDING.html
|
|
71
|
+
- ext/vendor/exuberant-ctags/FAQ
|
|
72
|
+
- ext/vendor/exuberant-ctags/INSTALL
|
|
73
|
+
- ext/vendor/exuberant-ctags/INSTALL.oth
|
|
74
|
+
- ext/vendor/exuberant-ctags/MAINTAINERS
|
|
75
|
+
- ext/vendor/exuberant-ctags/Makefile.in
|
|
76
|
+
- ext/vendor/exuberant-ctags/NEWS
|
|
77
|
+
- ext/vendor/exuberant-ctags/README
|
|
78
|
+
- ext/vendor/exuberant-ctags/ant.c
|
|
79
|
+
- ext/vendor/exuberant-ctags/argproc.c
|
|
80
|
+
- ext/vendor/exuberant-ctags/args.c
|
|
81
|
+
- ext/vendor/exuberant-ctags/args.h
|
|
82
|
+
- ext/vendor/exuberant-ctags/asm.c
|
|
83
|
+
- ext/vendor/exuberant-ctags/asp.c
|
|
84
|
+
- ext/vendor/exuberant-ctags/awk.c
|
|
85
|
+
- ext/vendor/exuberant-ctags/basic.c
|
|
86
|
+
- ext/vendor/exuberant-ctags/beta.c
|
|
87
|
+
- ext/vendor/exuberant-ctags/c.c
|
|
88
|
+
- ext/vendor/exuberant-ctags/cobol.c
|
|
89
|
+
- ext/vendor/exuberant-ctags/config.h.in
|
|
90
|
+
- ext/vendor/exuberant-ctags/configure
|
|
91
|
+
- ext/vendor/exuberant-ctags/configure.ac
|
|
92
|
+
- ext/vendor/exuberant-ctags/ctags.1
|
|
93
|
+
- ext/vendor/exuberant-ctags/ctags.h
|
|
94
|
+
- ext/vendor/exuberant-ctags/ctags.html
|
|
95
|
+
- ext/vendor/exuberant-ctags/ctags.spec
|
|
96
|
+
- ext/vendor/exuberant-ctags/debug.c
|
|
97
|
+
- ext/vendor/exuberant-ctags/debug.h
|
|
98
|
+
- ext/vendor/exuberant-ctags/descrip.mms
|
|
99
|
+
- ext/vendor/exuberant-ctags/dosbatch.c
|
|
100
|
+
- ext/vendor/exuberant-ctags/e_amiga.h
|
|
101
|
+
- ext/vendor/exuberant-ctags/e_djgpp.h
|
|
102
|
+
- ext/vendor/exuberant-ctags/e_mac.h
|
|
103
|
+
- ext/vendor/exuberant-ctags/e_msoft.h
|
|
104
|
+
- ext/vendor/exuberant-ctags/e_os2.h
|
|
105
|
+
- ext/vendor/exuberant-ctags/e_qdos.h
|
|
106
|
+
- ext/vendor/exuberant-ctags/e_riscos.h
|
|
107
|
+
- ext/vendor/exuberant-ctags/e_vms.h
|
|
108
|
+
- ext/vendor/exuberant-ctags/eiffel.c
|
|
109
|
+
- ext/vendor/exuberant-ctags/entry.c
|
|
110
|
+
- ext/vendor/exuberant-ctags/entry.h
|
|
111
|
+
- ext/vendor/exuberant-ctags/erlang.c
|
|
112
|
+
- ext/vendor/exuberant-ctags/flex.c
|
|
113
|
+
- ext/vendor/exuberant-ctags/fortran.c
|
|
114
|
+
- ext/vendor/exuberant-ctags/general.h
|
|
115
|
+
- ext/vendor/exuberant-ctags/get.c
|
|
116
|
+
- ext/vendor/exuberant-ctags/get.h
|
|
117
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/all-wcprops
|
|
118
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/entries
|
|
119
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/README.txt.svn-base
|
|
120
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regcomp.c.svn-base
|
|
121
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.c.svn-base
|
|
122
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.h.svn-base
|
|
123
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.c.svn-base
|
|
124
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.h.svn-base
|
|
125
|
+
- ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regexec.c.svn-base
|
|
126
|
+
- ext/vendor/exuberant-ctags/gnu_regex/README.txt
|
|
127
|
+
- ext/vendor/exuberant-ctags/gnu_regex/regcomp.c
|
|
128
|
+
- ext/vendor/exuberant-ctags/gnu_regex/regex.c
|
|
129
|
+
- ext/vendor/exuberant-ctags/gnu_regex/regex.h
|
|
130
|
+
- ext/vendor/exuberant-ctags/gnu_regex/regex_internal.c
|
|
131
|
+
- ext/vendor/exuberant-ctags/gnu_regex/regex_internal.h
|
|
132
|
+
- ext/vendor/exuberant-ctags/gnu_regex/regexec.c
|
|
133
|
+
- ext/vendor/exuberant-ctags/html.c
|
|
134
|
+
- ext/vendor/exuberant-ctags/jscript.c
|
|
135
|
+
- ext/vendor/exuberant-ctags/keyword.c
|
|
136
|
+
- ext/vendor/exuberant-ctags/keyword.h
|
|
137
|
+
- ext/vendor/exuberant-ctags/lisp.c
|
|
138
|
+
- ext/vendor/exuberant-ctags/lregex.c
|
|
139
|
+
- ext/vendor/exuberant-ctags/lua.c
|
|
140
|
+
- ext/vendor/exuberant-ctags/mac.c
|
|
141
|
+
- ext/vendor/exuberant-ctags/magic.diff
|
|
142
|
+
- ext/vendor/exuberant-ctags/main.c
|
|
143
|
+
- ext/vendor/exuberant-ctags/main.h
|
|
144
|
+
- ext/vendor/exuberant-ctags/maintainer.mak
|
|
145
|
+
- ext/vendor/exuberant-ctags/make.c
|
|
146
|
+
- ext/vendor/exuberant-ctags/matlab.c
|
|
147
|
+
- ext/vendor/exuberant-ctags/mk_bc3.mak
|
|
148
|
+
- ext/vendor/exuberant-ctags/mk_bc5.mak
|
|
149
|
+
- ext/vendor/exuberant-ctags/mk_djg.mak
|
|
150
|
+
- ext/vendor/exuberant-ctags/mk_manx.mak
|
|
151
|
+
- ext/vendor/exuberant-ctags/mk_mingw.mak
|
|
152
|
+
- ext/vendor/exuberant-ctags/mk_mpw.mak
|
|
153
|
+
- ext/vendor/exuberant-ctags/mk_mvc.mak
|
|
154
|
+
- ext/vendor/exuberant-ctags/mk_os2.mak
|
|
155
|
+
- ext/vendor/exuberant-ctags/mk_qdos.mak
|
|
156
|
+
- ext/vendor/exuberant-ctags/mk_sas.mak
|
|
157
|
+
- ext/vendor/exuberant-ctags/mkinstalldirs
|
|
158
|
+
- ext/vendor/exuberant-ctags/ocaml.c
|
|
159
|
+
- ext/vendor/exuberant-ctags/options.c
|
|
160
|
+
- ext/vendor/exuberant-ctags/options.h
|
|
161
|
+
- ext/vendor/exuberant-ctags/parse.c
|
|
162
|
+
- ext/vendor/exuberant-ctags/parse.h
|
|
163
|
+
- ext/vendor/exuberant-ctags/parsers.h
|
|
164
|
+
- ext/vendor/exuberant-ctags/pascal.c
|
|
165
|
+
- ext/vendor/exuberant-ctags/perl.c
|
|
166
|
+
- ext/vendor/exuberant-ctags/php.c
|
|
167
|
+
- ext/vendor/exuberant-ctags/python.c
|
|
168
|
+
- ext/vendor/exuberant-ctags/qdos.c
|
|
169
|
+
- ext/vendor/exuberant-ctags/read.c
|
|
170
|
+
- ext/vendor/exuberant-ctags/read.h
|
|
171
|
+
- ext/vendor/exuberant-ctags/readtags.c
|
|
172
|
+
- ext/vendor/exuberant-ctags/readtags.h
|
|
173
|
+
- ext/vendor/exuberant-ctags/rexx.c
|
|
174
|
+
- ext/vendor/exuberant-ctags/routines.c
|
|
175
|
+
- ext/vendor/exuberant-ctags/routines.h
|
|
176
|
+
- ext/vendor/exuberant-ctags/ruby.c
|
|
177
|
+
- ext/vendor/exuberant-ctags/scheme.c
|
|
178
|
+
- ext/vendor/exuberant-ctags/sh.c
|
|
179
|
+
- ext/vendor/exuberant-ctags/slang.c
|
|
180
|
+
- ext/vendor/exuberant-ctags/sml.c
|
|
181
|
+
- ext/vendor/exuberant-ctags/sort.c
|
|
182
|
+
- ext/vendor/exuberant-ctags/sort.h
|
|
183
|
+
- ext/vendor/exuberant-ctags/source.mak
|
|
184
|
+
- ext/vendor/exuberant-ctags/sql.c
|
|
185
|
+
- ext/vendor/exuberant-ctags/strlist.c
|
|
186
|
+
- ext/vendor/exuberant-ctags/strlist.h
|
|
187
|
+
- ext/vendor/exuberant-ctags/tcl.c
|
|
188
|
+
- ext/vendor/exuberant-ctags/tex.c
|
|
189
|
+
- ext/vendor/exuberant-ctags/verilog.c
|
|
190
|
+
- ext/vendor/exuberant-ctags/vhdl.c
|
|
191
|
+
- ext/vendor/exuberant-ctags/vim.c
|
|
192
|
+
- ext/vendor/exuberant-ctags/vstring.c
|
|
193
|
+
- ext/vendor/exuberant-ctags/vstring.h
|
|
194
|
+
- ext/vendor/exuberant-ctags/yacc.c
|
|
195
|
+
- lib/ctags.rb
|
|
196
|
+
- lib/ctags/exuberant.rb
|
|
197
|
+
- lib/ctags/version.rb
|
|
198
|
+
- test/test_ctags.rb
|
|
199
|
+
homepage: http://github.com/tmm1/ctags.rb
|
|
200
|
+
licenses: []
|
|
201
|
+
|
|
202
|
+
post_install_message:
|
|
203
|
+
rdoc_options: []
|
|
204
|
+
|
|
205
|
+
require_paths:
|
|
206
|
+
- lib
|
|
207
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
|
+
none: false
|
|
209
|
+
requirements:
|
|
210
|
+
- - ">="
|
|
211
|
+
- !ruby/object:Gem::Version
|
|
212
|
+
hash: 3
|
|
213
|
+
segments:
|
|
214
|
+
- 0
|
|
215
|
+
version: "0"
|
|
216
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
|
+
none: false
|
|
218
|
+
requirements:
|
|
219
|
+
- - ">="
|
|
220
|
+
- !ruby/object:Gem::Version
|
|
221
|
+
hash: 3
|
|
222
|
+
segments:
|
|
223
|
+
- 0
|
|
224
|
+
version: "0"
|
|
225
|
+
requirements: []
|
|
226
|
+
|
|
227
|
+
rubyforge_project:
|
|
228
|
+
rubygems_version: 1.8.24
|
|
229
|
+
signing_key:
|
|
230
|
+
specification_version: 3
|
|
231
|
+
summary: ctags wrapper for ruby
|
|
232
|
+
test_files: []
|
|
233
|
+
|