27
K_CLASS, K_METHOD, K_PROCEDURE
27
K_CLASS, K_METHOD, K_PROCEDURE
30
30
static kindOption TclKinds [] = {
31
{ TRUE, 'c', "class", "classes" },
32
{ TRUE, 'm', "method", "methods" },
33
{ TRUE, 'p', "procedure", "procedures" }
31
{ TRUE, 'c', "class", "classes" },
32
{ TRUE, 'm', "method", "methods" },
33
{ TRUE, 'p', "procedure", "procedures" }
40
40
static const unsigned char *makeTclTag (
41
const unsigned char *cp,
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);
46
while ((int) *cp != '\0' && ! isspace ((int) *cp))
48
vStringPut (name, (int) *cp);
51
vStringTerminate (name);
52
makeSimpleTag (name, TclKinds, kind);
56
56
static boolean match (const unsigned char *line, const char *word)
58
return (boolean) (strncmp ((const char*) line, word, strlen (word)) == 0);
58
return (boolean) (strncmp ((const char*) line, word, strlen (word)) == 0);
61
61
static void findTclTags (void)
63
vString *name = vStringNew ();
64
const unsigned char *line;
66
while ((line = fileReadLine ()) != NULL)
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"))
63
vString *name = vStringNew ();
64
const unsigned char *line;
66
while ((line = fileReadLine ()) != NULL)
93
if (match (cp, "method"))
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))
96
81
while (isspace ((int) *cp))
98
cp = makeTclTag (cp, name, K_METHOD);
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);
102
vStringDelete (name);
105
105
extern parserDefinition* TclParser (void)
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;
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;
116
/* vi:set tabstop=8 shiftwidth=4: */
116
/* vi:set tabstop=4 shiftwidth=4: */