27
K_CLASS, K_METHOD, K_PROCEDURE
29
30
static kindOption TclKinds [] = {
30
{ TRUE, 'f', "function", "procedures" }
31
{ TRUE, 'c', "class", "classes" },
32
{ TRUE, 'm', "member", "methods" },
33
{ TRUE, 'p', "function", "procedures" }
34
37
* FUNCTION DEFINITIONS
40
static const unsigned char *makeTclTag (
41
const unsigned char *cp,
46
while ((int) *cp != '\0' && ! isspace ((int) *cp))
48
vStringPut (name, (int) *cp);
51
vStringTerminate (name);
52
makeSimpleTag (name, TclKinds, kind);
56
static boolean match (const unsigned char *line, const char *word)
58
return (boolean) (strncmp ((const char*) line, word, strlen (word)) == 0);
37
61
static void findTclTags (void)
39
vString *name = vStringNew ();
40
const unsigned char *line;
42
while ((line = fileReadLine ()) != NULL)
46
if (line [0] == '\0' || line [0] == '#')
50
for (i = 0 ; line [i] != '\0' && ! isspace (line [i]) ; ++i)
53
if (strncmp ((const char*) line, "proc", (size_t) 4) == 0)
63
vString *name = vStringNew ();
64
const unsigned char *line;
66
while ((line = fileReadLine ()) != NULL)
55
const unsigned char *cp = line + i;
56
while (isspace ((int) *cp))
58
while (line [i] != '\0' && ! isspace ((int) *cp))
60
vStringPut (name, (int) *cp);
63
vStringTerminate (name);
64
makeSimpleTag (name, TclKinds, K_PROCEDURE);
68
const unsigned char *cp;
70
while (isspace (line [0]))
73
if (line [0] == '\0' || line [0] == '#')
77
for (cp = line ; *cp != '\0' && ! isspace ((int) *cp) ; ++cp)
79
if (! isspace ((int) *cp))
81
while (isspace ((int) *cp))
83
/* Now `line' points at first word and `cp' points at next word */
85
if (match (line, "proc"))
86
cp = makeTclTag (cp, name, K_PROCEDURE);
87
else if (match (line, "class") || match (line, "itcl::class"))
88
cp = makeTclTag (cp, name, K_CLASS);
89
else if (match (line, "public") ||
90
match (line, "protected") ||
91
match (line, "private"))
93
if (match (cp, "method"))
96
while (isspace ((int) *cp))
98
cp = makeTclTag (cp, name, K_METHOD);
102
vStringDelete (name);
71
105
extern parserDefinition* TclParser (void)
73
static const char *const extensions [] = { "tcl", "tk", "wish", NULL };
74
parserDefinition* def = parserNew ("Tcl");
75
def->kinds = TclKinds;
76
def->kindCount = KIND_COUNT (TclKinds);
77
def->extensions = extensions;
78
def->parser = findTclTags;
107
static const char *const extensions [] = { "tcl", "tk", "wish", "itcl", NULL };
108
parserDefinition* def = parserNew ("Tcl");
109
def->kinds = TclKinds;
110
def->kindCount = KIND_COUNT (TclKinds);
111
def->extensions = extensions;
112
def->parser = findTclTags;
82
/* vi:set tabstop=8 shiftwidth=4: */
116
/* vi:set tabstop=4 shiftwidth=4: */