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.
Files changed (138) hide show
  1. data/Gemfile +2 -0
  2. data/Rakefile +23 -0
  3. data/ctags.rb.gemspec +23 -0
  4. data/ext/.gitignore +3 -0
  5. data/ext/extconf.rb +15 -0
  6. data/ext/vendor/exuberant-ctags/.gitignore +6 -0
  7. data/ext/vendor/exuberant-ctags/.indent.pro +31 -0
  8. data/ext/vendor/exuberant-ctags/COPYING +340 -0
  9. data/ext/vendor/exuberant-ctags/EXTENDING.html +386 -0
  10. data/ext/vendor/exuberant-ctags/FAQ +371 -0
  11. data/ext/vendor/exuberant-ctags/INSTALL +215 -0
  12. data/ext/vendor/exuberant-ctags/INSTALL.oth +73 -0
  13. data/ext/vendor/exuberant-ctags/MAINTAINERS +88 -0
  14. data/ext/vendor/exuberant-ctags/Makefile.in +222 -0
  15. data/ext/vendor/exuberant-ctags/NEWS +871 -0
  16. data/ext/vendor/exuberant-ctags/README +73 -0
  17. data/ext/vendor/exuberant-ctags/ant.c +42 -0
  18. data/ext/vendor/exuberant-ctags/argproc.c +505 -0
  19. data/ext/vendor/exuberant-ctags/args.c +274 -0
  20. data/ext/vendor/exuberant-ctags/args.h +63 -0
  21. data/ext/vendor/exuberant-ctags/asm.c +387 -0
  22. data/ext/vendor/exuberant-ctags/asp.c +328 -0
  23. data/ext/vendor/exuberant-ctags/awk.c +81 -0
  24. data/ext/vendor/exuberant-ctags/basic.c +203 -0
  25. data/ext/vendor/exuberant-ctags/beta.c +321 -0
  26. data/ext/vendor/exuberant-ctags/c.c +2932 -0
  27. data/ext/vendor/exuberant-ctags/cobol.c +50 -0
  28. data/ext/vendor/exuberant-ctags/config.h.in +277 -0
  29. data/ext/vendor/exuberant-ctags/configure +7704 -0
  30. data/ext/vendor/exuberant-ctags/configure.ac +532 -0
  31. data/ext/vendor/exuberant-ctags/ctags.1 +1186 -0
  32. data/ext/vendor/exuberant-ctags/ctags.h +28 -0
  33. data/ext/vendor/exuberant-ctags/ctags.html +2087 -0
  34. data/ext/vendor/exuberant-ctags/ctags.spec +40 -0
  35. data/ext/vendor/exuberant-ctags/debug.c +113 -0
  36. data/ext/vendor/exuberant-ctags/debug.h +70 -0
  37. data/ext/vendor/exuberant-ctags/descrip.mms +68 -0
  38. data/ext/vendor/exuberant-ctags/dosbatch.c +42 -0
  39. data/ext/vendor/exuberant-ctags/e_amiga.h +24 -0
  40. data/ext/vendor/exuberant-ctags/e_djgpp.h +47 -0
  41. data/ext/vendor/exuberant-ctags/e_mac.h +143 -0
  42. data/ext/vendor/exuberant-ctags/e_msoft.h +76 -0
  43. data/ext/vendor/exuberant-ctags/e_os2.h +37 -0
  44. data/ext/vendor/exuberant-ctags/e_qdos.h +34 -0
  45. data/ext/vendor/exuberant-ctags/e_riscos.h +58 -0
  46. data/ext/vendor/exuberant-ctags/e_vms.h +31 -0
  47. data/ext/vendor/exuberant-ctags/eiffel.c +1352 -0
  48. data/ext/vendor/exuberant-ctags/entry.c +847 -0
  49. data/ext/vendor/exuberant-ctags/entry.h +103 -0
  50. data/ext/vendor/exuberant-ctags/erlang.c +189 -0
  51. data/ext/vendor/exuberant-ctags/flex.c +2243 -0
  52. data/ext/vendor/exuberant-ctags/fortran.c +2197 -0
  53. data/ext/vendor/exuberant-ctags/general.h +127 -0
  54. data/ext/vendor/exuberant-ctags/get.c +669 -0
  55. data/ext/vendor/exuberant-ctags/get.h +50 -0
  56. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/all-wcprops +47 -0
  57. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/entries +112 -0
  58. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/README.txt.svn-base +5 -0
  59. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regcomp.c.svn-base +3818 -0
  60. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.c.svn-base +74 -0
  61. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.h.svn-base +575 -0
  62. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.c.svn-base +1713 -0
  63. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.h.svn-base +773 -0
  64. data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regexec.c.svn-base +4338 -0
  65. data/ext/vendor/exuberant-ctags/gnu_regex/README.txt +5 -0
  66. data/ext/vendor/exuberant-ctags/gnu_regex/regcomp.c +3818 -0
  67. data/ext/vendor/exuberant-ctags/gnu_regex/regex.c +74 -0
  68. data/ext/vendor/exuberant-ctags/gnu_regex/regex.h +575 -0
  69. data/ext/vendor/exuberant-ctags/gnu_regex/regex_internal.c +1713 -0
  70. data/ext/vendor/exuberant-ctags/gnu_regex/regex_internal.h +773 -0
  71. data/ext/vendor/exuberant-ctags/gnu_regex/regexec.c +4338 -0
  72. data/ext/vendor/exuberant-ctags/html.c +49 -0
  73. data/ext/vendor/exuberant-ctags/jscript.c +1572 -0
  74. data/ext/vendor/exuberant-ctags/keyword.c +258 -0
  75. data/ext/vendor/exuberant-ctags/keyword.h +34 -0
  76. data/ext/vendor/exuberant-ctags/lisp.c +139 -0
  77. data/ext/vendor/exuberant-ctags/lregex.c +704 -0
  78. data/ext/vendor/exuberant-ctags/lua.c +133 -0
  79. data/ext/vendor/exuberant-ctags/mac.c +273 -0
  80. data/ext/vendor/exuberant-ctags/magic.diff +21 -0
  81. data/ext/vendor/exuberant-ctags/main.c +584 -0
  82. data/ext/vendor/exuberant-ctags/main.h +32 -0
  83. data/ext/vendor/exuberant-ctags/maintainer.mak +476 -0
  84. data/ext/vendor/exuberant-ctags/make.c +217 -0
  85. data/ext/vendor/exuberant-ctags/matlab.c +44 -0
  86. data/ext/vendor/exuberant-ctags/mk_bc3.mak +46 -0
  87. data/ext/vendor/exuberant-ctags/mk_bc5.mak +49 -0
  88. data/ext/vendor/exuberant-ctags/mk_djg.mak +18 -0
  89. data/ext/vendor/exuberant-ctags/mk_manx.mak +65 -0
  90. data/ext/vendor/exuberant-ctags/mk_mingw.mak +31 -0
  91. data/ext/vendor/exuberant-ctags/mk_mpw.mak +130 -0
  92. data/ext/vendor/exuberant-ctags/mk_mvc.mak +40 -0
  93. data/ext/vendor/exuberant-ctags/mk_os2.mak +104 -0
  94. data/ext/vendor/exuberant-ctags/mk_qdos.mak +100 -0
  95. data/ext/vendor/exuberant-ctags/mk_sas.mak +63 -0
  96. data/ext/vendor/exuberant-ctags/mkinstalldirs +40 -0
  97. data/ext/vendor/exuberant-ctags/ocaml.c +1842 -0
  98. data/ext/vendor/exuberant-ctags/options.c +1842 -0
  99. data/ext/vendor/exuberant-ctags/options.h +155 -0
  100. data/ext/vendor/exuberant-ctags/parse.c +677 -0
  101. data/ext/vendor/exuberant-ctags/parse.h +129 -0
  102. data/ext/vendor/exuberant-ctags/parsers.h +63 -0
  103. data/ext/vendor/exuberant-ctags/pascal.c +267 -0
  104. data/ext/vendor/exuberant-ctags/perl.c +382 -0
  105. data/ext/vendor/exuberant-ctags/php.c +237 -0
  106. data/ext/vendor/exuberant-ctags/python.c +771 -0
  107. data/ext/vendor/exuberant-ctags/qdos.c +106 -0
  108. data/ext/vendor/exuberant-ctags/read.c +569 -0
  109. data/ext/vendor/exuberant-ctags/read.h +116 -0
  110. data/ext/vendor/exuberant-ctags/readtags.c +959 -0
  111. data/ext/vendor/exuberant-ctags/readtags.h +252 -0
  112. data/ext/vendor/exuberant-ctags/rexx.c +39 -0
  113. data/ext/vendor/exuberant-ctags/routines.c +891 -0
  114. data/ext/vendor/exuberant-ctags/routines.h +134 -0
  115. data/ext/vendor/exuberant-ctags/ruby.c +408 -0
  116. data/ext/vendor/exuberant-ctags/scheme.c +111 -0
  117. data/ext/vendor/exuberant-ctags/sh.c +115 -0
  118. data/ext/vendor/exuberant-ctags/slang.c +41 -0
  119. data/ext/vendor/exuberant-ctags/sml.c +212 -0
  120. data/ext/vendor/exuberant-ctags/sort.c +230 -0
  121. data/ext/vendor/exuberant-ctags/sort.h +32 -0
  122. data/ext/vendor/exuberant-ctags/source.mak +122 -0
  123. data/ext/vendor/exuberant-ctags/sql.c +2112 -0
  124. data/ext/vendor/exuberant-ctags/strlist.c +281 -0
  125. data/ext/vendor/exuberant-ctags/strlist.h +54 -0
  126. data/ext/vendor/exuberant-ctags/tcl.c +116 -0
  127. data/ext/vendor/exuberant-ctags/tex.c +524 -0
  128. data/ext/vendor/exuberant-ctags/verilog.c +340 -0
  129. data/ext/vendor/exuberant-ctags/vhdl.c +835 -0
  130. data/ext/vendor/exuberant-ctags/vim.c +636 -0
  131. data/ext/vendor/exuberant-ctags/vstring.c +232 -0
  132. data/ext/vendor/exuberant-ctags/vstring.h +85 -0
  133. data/ext/vendor/exuberant-ctags/yacc.c +40 -0
  134. data/lib/ctags/exuberant.rb +45 -0
  135. data/lib/ctags/version.rb +3 -0
  136. data/lib/ctags.rb +6 -0
  137. data/test/test_ctags.rb +24 -0
  138. metadata +233 -0
@@ -0,0 +1,129 @@
1
+ /*
2
+ * $Id: parse.h 443 2006-05-30 04:37:13Z darren $
3
+ *
4
+ * Copyright (c) 1998-2003, Darren Hiebert
5
+ *
6
+ * This source code is released for free distribution under the terms of the
7
+ * GNU General Public License.
8
+ *
9
+ * Private definitions for parsing support.
10
+ */
11
+ #ifndef _PARSE_H
12
+ #define _PARSE_H
13
+
14
+ /*
15
+ * INCLUDE FILES
16
+ */
17
+ #include "general.h" /* must always come first */
18
+ #include "parsers.h" /* contains list of parsers */
19
+ #include "strlist.h"
20
+
21
+ /*
22
+ * MACROS
23
+ */
24
+ #define KIND_COUNT(kindTable) (sizeof(kindTable)/sizeof(kindOption))
25
+
26
+ #define LANG_AUTO (-1)
27
+ #define LANG_IGNORE (-2)
28
+
29
+ /*
30
+ * DATA DECLARATIONS
31
+ */
32
+ typedef int langType;
33
+
34
+ typedef void (*createRegexTag) (const vString* const name);
35
+ typedef void (*simpleParser) (void);
36
+ typedef boolean (*rescanParser) (const unsigned int passCount);
37
+ typedef void (*parserInitialize) (langType language);
38
+
39
+ typedef struct sKindOption {
40
+ boolean enabled; /* are tags for kind enabled? */
41
+ int letter; /* kind letter */
42
+ const char* name; /* kind name */
43
+ const char* description; /* displayed in --help output */
44
+ } kindOption;
45
+
46
+ typedef struct {
47
+ /* defined by parser */
48
+ char* name; /* name of language */
49
+ kindOption* kinds; /* tag kinds handled by parser */
50
+ unsigned int kindCount; /* size of `kinds' list */
51
+ const char *const *extensions; /* list of default extensions */
52
+ const char *const *patterns; /* list of default file name patterns */
53
+ parserInitialize initialize; /* initialization routine, if needed */
54
+ simpleParser parser; /* simple parser (common case) */
55
+ rescanParser parser2; /* rescanning parser (unusual case) */
56
+ boolean regex; /* is this a regex parser? */
57
+
58
+ /* used internally */
59
+ unsigned int id; /* id assigned to language */
60
+ boolean enabled; /* currently enabled? */
61
+ stringList* currentPatterns; /* current list of file name patterns */
62
+ stringList* currentExtensions; /* current list of extensions */
63
+ } parserDefinition;
64
+
65
+ typedef parserDefinition* (parserDefinitionFunc) (void);
66
+
67
+ typedef struct {
68
+ size_t start; /* character index in line where match starts */
69
+ size_t length; /* length of match */
70
+ } regexMatch;
71
+
72
+ typedef void (*regexCallback) (const char *line, const regexMatch *matches, unsigned int count);
73
+
74
+ /*
75
+ * FUNCTION PROTOTYPES
76
+ */
77
+
78
+ /* Each parsers' definition function is called. The routine is expected to
79
+ * return a structure allocated using parserNew(). This structure must,
80
+ * at minimum, set the `parser' field.
81
+ */
82
+ extern parserDefinitionFunc PARSER_LIST;
83
+
84
+ /* Legacy interface */
85
+ extern boolean includingDefineTags (void);
86
+
87
+ /* Language processing and parsing */
88
+ extern void makeSimpleTag (const vString* const name, kindOption* const kinds, const int kind);
89
+ extern parserDefinition* parserNew (const char* name);
90
+ extern const char *getLanguageName (const langType language);
91
+ extern langType getNamedLanguage (const char *const name);
92
+ extern langType getFileLanguage (const char *const fileName);
93
+ extern void installLanguageMapDefault (const langType language);
94
+ extern void installLanguageMapDefaults (void);
95
+ extern void clearLanguageMap (const langType language);
96
+ extern boolean removeLanguageExtensionMap (const char *const extension);
97
+ extern void addLanguageExtensionMap (const langType language, const char* extension);
98
+ extern void addLanguagePatternMap (const langType language, const char* ptrn);
99
+ extern void printLanguageMap (const langType language);
100
+ extern void printLanguageMaps (const langType language);
101
+ extern void enableLanguages (const boolean state);
102
+ extern void enableLanguage (const langType language, const boolean state);
103
+ extern void initializeParsing (void);
104
+ extern void freeParserResources (void);
105
+ extern void processLanguageDefineOption (const char *const option, const char *const parameter);
106
+ extern boolean processKindOption (const char *const option, const char *const parameter);
107
+ extern void printKindOptions (void);
108
+ extern void printLanguageKinds (const langType language);
109
+ extern void printLanguageList (void);
110
+ extern boolean parseFile (const char *const fileName);
111
+
112
+ /* Regex interface */
113
+ #ifdef HAVE_REGEX
114
+ extern void findRegexTags (void);
115
+ extern boolean matchRegex (const vString* const line, const langType language);
116
+ #endif
117
+ extern boolean processRegexOption (const char *const option, const char *const parameter);
118
+ extern void addLanguageRegex (const langType language, const char* const regex);
119
+ extern void addTagRegex (const langType language, const char* const regex, const char* const name, const char* const kinds, const char* const flags);
120
+ extern void addCallbackRegex (const langType language, const char *const regex, const char *const flags, const regexCallback callback);
121
+ extern void disableRegexKinds (const langType language);
122
+ extern boolean enableRegexKind (const langType language, const int kind, const boolean mode);
123
+ extern void printRegexKinds (const langType language, boolean indent);
124
+ extern void freeRegexResources (void);
125
+ extern void checkRegex (void);
126
+
127
+ #endif /* _PARSE_H */
128
+
129
+ /* vi:set tabstop=4 shiftwidth=4: */
@@ -0,0 +1,63 @@
1
+ /*
2
+ * $Id: parsers.h 717 2009-07-07 03:40:50Z dhiebert $
3
+ *
4
+ * Copyright (c) 2000-2003, Darren Hiebert
5
+ *
6
+ * This source code is released for free distribution under the terms of the
7
+ * GNU General Public License.
8
+ *
9
+ * External interface to all language parsing modules.
10
+ *
11
+ * To add a new language parser, you need only modify this single source
12
+ * file to add the name of the parser definition function.
13
+ */
14
+ #ifndef _PARSERS_H
15
+ #define _PARSERS_H
16
+
17
+ /* Add the name of any new parser definition function here */
18
+ #define PARSER_LIST \
19
+ AntParser, \
20
+ AsmParser, \
21
+ AspParser, \
22
+ AwkParser, \
23
+ BasicParser, \
24
+ BetaParser, \
25
+ CParser, \
26
+ CppParser, \
27
+ CsharpParser, \
28
+ CobolParser, \
29
+ DosBatchParser, \
30
+ EiffelParser, \
31
+ ErlangParser, \
32
+ FlexParser, \
33
+ FortranParser, \
34
+ HtmlParser, \
35
+ JavaParser, \
36
+ JavaScriptParser, \
37
+ LispParser, \
38
+ LuaParser, \
39
+ MakefileParser, \
40
+ MatLabParser, \
41
+ OcamlParser, \
42
+ PascalParser, \
43
+ PerlParser, \
44
+ PhpParser, \
45
+ PythonParser, \
46
+ RexxParser, \
47
+ RubyParser, \
48
+ SchemeParser, \
49
+ ShParser, \
50
+ SlangParser, \
51
+ SmlParser, \
52
+ SqlParser, \
53
+ TclParser, \
54
+ TexParser, \
55
+ VeraParser, \
56
+ VerilogParser, \
57
+ VhdlParser, \
58
+ VimParser, \
59
+ YaccParser
60
+
61
+ #endif /* _PARSERS_H */
62
+
63
+ /* vi:set tabstop=4 shiftwidth=4: */
@@ -0,0 +1,267 @@
1
+ /*
2
+ * $Id: pascal.c 536 2007-06-02 06:09:00Z elliotth $
3
+ *
4
+ * Copyright (c) 2001-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 for generating tags for the Pascal language,
10
+ * including some extensions for Object Pascal.
11
+ */
12
+
13
+ /*
14
+ * INCLUDE FILES
15
+ */
16
+ #include "general.h" /* must always come first */
17
+
18
+ #include <string.h>
19
+
20
+ #include "entry.h"
21
+ #include "parse.h"
22
+ #include "read.h"
23
+ #include "vstring.h"
24
+
25
+ /*
26
+ * DATA DEFINITIONS
27
+ */
28
+ typedef enum {
29
+ K_FUNCTION, K_PROCEDURE
30
+ } pascalKind;
31
+
32
+ static kindOption PascalKinds [] = {
33
+ { TRUE, 'f', "function", "functions"},
34
+ { TRUE, 'p', "procedure", "procedures"}
35
+ };
36
+
37
+ /*
38
+ * FUNCTION DEFINITIONS
39
+ */
40
+
41
+ static void createPascalTag (
42
+ tagEntryInfo* const tag, const vString* const name, const int kind)
43
+ {
44
+ if (PascalKinds [kind].enabled && name != NULL && vStringLength (name) > 0)
45
+ {
46
+ initTagEntry (tag, vStringValue (name));
47
+ tag->kindName = PascalKinds [kind].name;
48
+ tag->kind = PascalKinds [kind].letter;
49
+ }
50
+ else
51
+ initTagEntry (tag, NULL);
52
+ }
53
+
54
+ static void makePascalTag (const tagEntryInfo* const tag)
55
+ {
56
+ if (tag->name != NULL)
57
+ makeTagEntry (tag);
58
+ }
59
+
60
+ static const unsigned char* dbp;
61
+
62
+ #define starttoken(c) (isalpha ((int) c) || (int) c == '_')
63
+ #define intoken(c) (isalnum ((int) c) || (int) c == '_' || (int) c == '.')
64
+ #define endtoken(c) (! intoken (c) && ! isdigit ((int) c))
65
+
66
+ static boolean tail (const char *cp)
67
+ {
68
+ boolean result = FALSE;
69
+ register int len = 0;
70
+
71
+ while (*cp != '\0' && tolower ((int) *cp) == tolower ((int) dbp [len]))
72
+ cp++, len++;
73
+ if (*cp == '\0' && !intoken (dbp [len]))
74
+ {
75
+ dbp += len;
76
+ result = TRUE;
77
+ }
78
+ return result;
79
+ }
80
+
81
+ /* Algorithm adapted from from GNU etags.
82
+ * Locates tags for procedures & functions. Doesn't do any type- or
83
+ * var-definitions. It does look for the keyword "extern" or "forward"
84
+ * immediately following the procedure statement; if found, the tag is
85
+ * skipped.
86
+ */
87
+ static void findPascalTags (void)
88
+ {
89
+ vString *name = vStringNew ();
90
+ tagEntryInfo tag;
91
+ pascalKind kind = K_FUNCTION;
92
+ /* each of these flags is TRUE iff: */
93
+ boolean incomment = FALSE; /* point is inside a comment */
94
+ int comment_char = '\0'; /* type of current comment */
95
+ boolean inquote = FALSE; /* point is inside '..' string */
96
+ boolean get_tagname = FALSE;/* point is after PROCEDURE/FUNCTION
97
+ keyword, so next item = potential tag */
98
+ boolean found_tag = FALSE; /* point is after a potential tag */
99
+ boolean inparms = FALSE; /* point is within parameter-list */
100
+ boolean verify_tag = FALSE;
101
+ /* point has passed the parm-list, so the next token will determine
102
+ * whether this is a FORWARD/EXTERN to be ignored, or whether it is a
103
+ * real tag
104
+ */
105
+
106
+ dbp = fileReadLine ();
107
+ while (dbp != NULL)
108
+ {
109
+ int c = *dbp++;
110
+
111
+ if (c == '\0') /* if end of line */
112
+ {
113
+ dbp = fileReadLine ();
114
+ if (dbp == NULL || *dbp == '\0')
115
+ continue;
116
+ if (!((found_tag && verify_tag) || get_tagname))
117
+ c = *dbp++;
118
+ /* only if don't need *dbp pointing to the beginning of
119
+ * the name of the procedure or function
120
+ */
121
+ }
122
+ if (incomment)
123
+ {
124
+ if (comment_char == '{' && c == '}')
125
+ incomment = FALSE;
126
+ else if (comment_char == '(' && c == '*' && *dbp == ')')
127
+ {
128
+ dbp++;
129
+ incomment = FALSE;
130
+ }
131
+ continue;
132
+ }
133
+ else if (inquote)
134
+ {
135
+ if (c == '\'')
136
+ inquote = FALSE;
137
+ continue;
138
+ }
139
+ else switch (c)
140
+ {
141
+ case '\'':
142
+ inquote = TRUE; /* found first quote */
143
+ continue;
144
+ case '{': /* found open { comment */
145
+ incomment = TRUE;
146
+ comment_char = c;
147
+ continue;
148
+ case '(':
149
+ if (*dbp == '*') /* found open (* comment */
150
+ {
151
+ incomment = TRUE;
152
+ comment_char = c;
153
+ dbp++;
154
+ }
155
+ else if (found_tag) /* found '(' after tag, i.e., parm-list */
156
+ inparms = TRUE;
157
+ continue;
158
+ case ')': /* end of parms list */
159
+ if (inparms)
160
+ inparms = FALSE;
161
+ continue;
162
+ case ';':
163
+ if (found_tag && !inparms) /* end of proc or fn stmt */
164
+ {
165
+ verify_tag = TRUE;
166
+ break;
167
+ }
168
+ continue;
169
+ }
170
+ if (found_tag && verify_tag && *dbp != ' ')
171
+ {
172
+ /* check if this is an "extern" declaration */
173
+ if (*dbp == '\0')
174
+ continue;
175
+ if (tolower ((int) *dbp == 'e'))
176
+ {
177
+ if (tail ("extern")) /* superfluous, really! */
178
+ {
179
+ found_tag = FALSE;
180
+ verify_tag = FALSE;
181
+ }
182
+ }
183
+ else if (tolower ((int) *dbp) == 'f')
184
+ {
185
+ if (tail ("forward")) /* check for forward reference */
186
+ {
187
+ found_tag = FALSE;
188
+ verify_tag = FALSE;
189
+ }
190
+ }
191
+ if (found_tag && verify_tag) /* not external proc, so make tag */
192
+ {
193
+ found_tag = FALSE;
194
+ verify_tag = FALSE;
195
+ makePascalTag (&tag);
196
+ continue;
197
+ }
198
+ }
199
+ if (get_tagname) /* grab name of proc or fn */
200
+ {
201
+ const unsigned char *cp;
202
+
203
+ if (*dbp == '\0')
204
+ continue;
205
+
206
+ /* grab block name */
207
+ while (isspace ((int) *dbp))
208
+ ++dbp;
209
+ for (cp = dbp ; *cp != '\0' && !endtoken (*cp) ; cp++)
210
+ continue;
211
+ vStringNCopyS (name, (const char*) dbp, cp - dbp);
212
+ createPascalTag (&tag, name, kind);
213
+ dbp = cp; /* set dbp to e-o-token */
214
+ get_tagname = FALSE;
215
+ found_tag = TRUE;
216
+ /* and proceed to check for "extern" */
217
+ }
218
+ else if (!incomment && !inquote && !found_tag)
219
+ {
220
+ switch (tolower ((int) c))
221
+ {
222
+ case 'c':
223
+ if (tail ("onstructor"))
224
+ {
225
+ get_tagname = TRUE;
226
+ kind = K_PROCEDURE;
227
+ }
228
+ break;
229
+ case 'd':
230
+ if (tail ("estructor"))
231
+ {
232
+ get_tagname = TRUE;
233
+ kind = K_PROCEDURE;
234
+ }
235
+ break;
236
+ case 'p':
237
+ if (tail ("rocedure"))
238
+ {
239
+ get_tagname = TRUE;
240
+ kind = K_PROCEDURE;
241
+ }
242
+ break;
243
+ case 'f':
244
+ if (tail ("unction"))
245
+ {
246
+ get_tagname = TRUE;
247
+ kind = K_FUNCTION;
248
+ }
249
+ break;
250
+ }
251
+ } /* while not eof */
252
+ }
253
+ vStringDelete (name);
254
+ }
255
+
256
+ extern parserDefinition* PascalParser (void)
257
+ {
258
+ static const char *const extensions [] = { "p", "pas", NULL };
259
+ parserDefinition* def = parserNew ("Pascal");
260
+ def->extensions = extensions;
261
+ def->kinds = PascalKinds;
262
+ def->kindCount = KIND_COUNT (PascalKinds);
263
+ def->parser = findPascalTags;
264
+ return def;
265
+ }
266
+
267
+ /* vi:set tabstop=4 shiftwidth=4: */