Fixed missing tags for Korn shell specific function definitions.

git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@329 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
darren 2003-06-11 04:53:45 +00:00
parent eb67b198a9
commit 0b212331f2
4 changed files with 46 additions and 27 deletions

1
NEWS
View File

@ -4,6 +4,7 @@ ctags-5.5.1 (Tue Jun 10 2003)
* Fixed compilation error for uncommon hosts.
* Restored exit of program after --help, --license, and --version options [Bug
#717311, #751240].
* Fixed missing tags for Korn shell specific function definitions. [Sh]
* Allowed semicolon as statement separator [Fortran, Bug #734933].
ctags-5.5 (Tue Apr 1 2003)

7
Test/simple.ksh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/ksh
f1() {
}
function f2 {
}

7
Test/simple.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
f1() {
}
function f2() {
}

58
sh.c
View File

@ -56,40 +56,44 @@ static void findShTags (void)
while ((line = fileReadLine ()) != NULL)
{
const unsigned char* cp = line;
boolean functionFound = FALSE;
if (line [0] == '#')
continue;
if (strchr ((const char*) line, '(') != NULL)
while (isspace (*cp))
cp++;
if (strncmp ((const char*) cp, "function", (size_t) 8) == 0 &&
isspace ((int) cp [8]))
{
const unsigned char* cp = line;
while (isspace (*cp))
cp++;
if (strncmp ((const char*) cp, "function", (size_t) 8) == 0 &&
isspace ((int) cp [8]))
{
cp += 8;
}
functionFound = TRUE;
cp += 8;
if (! isspace ((int) *cp))
continue;
while (isspace ((int) *cp))
++cp;
while (isalnum ((int) *cp) || *cp == '_')
{
vStringPut (name, (int) *cp);
++cp;
}
vStringTerminate (name);
while (isspace ((int) *cp))
++cp;
if (*cp++ == '(')
{
while (isspace ((int) *cp))
++cp;
if (*cp == ')' && ! hackReject (name))
makeSimpleTag (name, ShKinds, K_FUNCTION);
}
vStringClear (name);
}
if (! isalnum ((int) *cp))
continue;
while (isalnum ((int) *cp) || *cp == '_')
{
vStringPut (name, (int) *cp);
++cp;
}
vStringTerminate (name);
while (isspace ((int) *cp))
++cp;
if (*cp++ == '(')
{
while (isspace ((int) *cp))
++cp;
if (*cp == ')' && ! hackReject (name))
functionFound = TRUE;
}
if (functionFound)
makeSimpleTag (name, ShKinds, K_FUNCTION);
vStringClear (name);
}
vStringDelete (name);
}