2
* $Id: asp.c,v 1.8 2006/05/30 04:37:11 darren Exp $
4
* Copyright (c) 2000, Patrick Dehne <patrick@steidle.net>
6
* This source code is released for free distribution under the terms of the
7
* GNU General Public License.
9
* This module contains functions for generating tags for the ASP (Active
10
* Server Pages) web page scripting language.
16
#include "general.h" /* must always come first */
28
K_CONST, K_FUNCTION, K_SUB, K_DIM
31
static kindOption AspKinds [] = {
32
{ TRUE, 'c', "constant", "constants"},
33
{ TRUE, 'f', "function", "functions"},
34
{ TRUE, 's', "subroutine", "subroutines"},
35
{ TRUE, 'v', "variable", "variables"}
39
* FUNCTION DEFINITIONS
42
static void findAspTags (void)
44
vString *name = vStringNew ();
45
const unsigned char *line;
47
while ((line = fileReadLine ()) != NULL)
49
const unsigned char *cp = line;
53
/* jump over whitespace */
54
while (isspace ((int)*cp))
57
/* jump over strings */
61
while (*cp!='"' && *cp!='\0')
65
/* jump over comments */
69
/* jump over end function/sub lines */
70
else if (strncasecmp ((const char*) cp, "end", (size_t) 3)== 0)
73
if (isspace ((int)*cp))
75
while (isspace ((int)*cp))
78
if (strncasecmp ((const char*) cp, "function", (size_t) 8) == 0)
84
else if (strncasecmp ((const char*) cp, "sub", (size_t) 3) == 0)
92
/* jump over exit function/sub lines */
93
else if (strncasecmp ((const char*) cp, "exit", (size_t) 4)==0)
96
if (isspace ((int) *cp))
98
while (isspace ((int) *cp))
101
if (strncasecmp ((const char*) cp, "function", (size_t) 8) == 0)
107
else if (strncasecmp ((const char*) cp, "sub", (size_t) 3) == 0)
116
else if (strncasecmp ((const char*) cp, "function", (size_t) 8) == 0)
120
if (isspace ((int) *cp))
122
while (isspace ((int) *cp))
124
while (isalnum ((int) *cp) || *cp == '_')
126
vStringPut (name, (int) *cp);
129
vStringTerminate (name);
130
makeSimpleTag (name, AspKinds, K_FUNCTION);
136
else if (strncasecmp ((const char*) cp, "sub", (size_t) 3) == 0)
139
if (isspace ((int) *cp))
141
while (isspace ((int) *cp))
143
while (isalnum ((int) *cp) || *cp == '_')
145
vStringPut (name, (int) *cp);
148
vStringTerminate (name);
149
makeSimpleTag (name, AspKinds, K_SUB);
155
else if (strncasecmp ((const char*) cp, "dim", (size_t) 3) == 0)
158
if (isspace ((int) *cp))
160
while (isspace ((int) *cp))
162
while (isalnum ((int) *cp) || *cp == '_')
164
vStringPut (name, (int) *cp);
167
vStringTerminate (name);
168
makeSimpleTag (name, AspKinds, K_DIM);
173
/* const declaration? */
174
else if (strncasecmp ((const char*) cp, "const", (size_t) 5) == 0)
177
if (isspace ((int) *cp))
179
while (isspace ((int) *cp))
181
while (isalnum ((int) *cp) || *cp == '_')
183
vStringPut (name, (int) *cp);
186
vStringTerminate (name);
187
makeSimpleTag (name, AspKinds, K_CONST);
192
/* nothing relevant */
193
else if (*cp != '\0')
197
vStringDelete (name);
200
extern parserDefinition* AspParser (void)
202
static const char *const extensions [] = { "asp", "asa", NULL };
203
parserDefinition* def = parserNew ("Asp");
204
def->kinds = AspKinds;
205
def->kindCount = KIND_COUNT (AspKinds);
206
def->extensions = extensions;
207
def->parser = findAspTags;
211
/* vi:set tabstop=4 shiftwidth=4: */