Kaydet (Commit) 5c4ea3ee authored tarafından Enrico Tröger's avatar Enrico Tröger

improved

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@320 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst be14d242
......@@ -24,18 +24,25 @@
*/
typedef enum {
K_SUBROUTINE,
K_PACKAGE
K_PACKAGE,
K_LOCAL,
K_MY,
K_OUR
} perlKind;
static kindOption PerlKinds [] = {
{ TRUE, 'f', "function", "functions" },
{ TRUE, 'c', "class", "packages" }
{ TRUE, 'c', "class", "packages" },
{ TRUE, 'l', "macro", "local variables" },
{ TRUE, 'm', "member", "my variables" },
{ TRUE, 'v', "variable", "our variables" }
};
/*
* FUNCTION DEFINITIONS
*/
/* Algorithm adapted from from GNU etags.
* Perl support by Bart Robinson <lomew@cs.utah.edu>
* Perl sub names: look for /^ [ \t\n]sub [ \t\n]+ [^ \t\n{ (]+/
......@@ -73,7 +80,73 @@ static void findPerlTags (void)
while (isspace (*cp))
cp++;
if (strncmp((const char*) cp, "sub", (size_t) 3) == 0 ||
if (strncmp((const char*) cp, "my", (size_t) 2) == 0)
{
cp += 2;
while (isspace (*cp)) cp++;
// skip something like my($bla)
if (*(const char*) cp != '$' && ! isalpha(*(const char*) cp)) continue;
cp++; // to skip the $ sign
if (! isalpha(*(const char*) cp)) continue;
while (! isspace ((int) *cp) && *cp != '\0' && *cp != '=' && *cp != ';')
{
vStringPut (name, (int) *cp);
cp++;
}
vStringTerminate (name);
if (vStringLength (name) > 0)
makeSimpleTag (name, PerlKinds, K_MY);
vStringClear (name);
}
if (strncmp((const char*) cp, "our", (size_t) 3) == 0)
{
cp += 3;
// skip something like my ($bla)
if (*(const char*) cp != '$' && ! isalpha(*(const char*) cp)) continue;
cp++; // to skip the $ sign
if (! isalpha(*(const char*) cp)) continue;
while (! isspace ((int) *cp) && *cp != '\0' && *cp != '=' && *cp != ';')
{
vStringPut (name, (int) *cp);
cp++;
}
vStringTerminate (name);
if (vStringLength (name) > 0)
makeSimpleTag (name, PerlKinds, K_OUR);
vStringClear (name);
}
if (strncmp((const char*) cp, "local", (size_t) 5) == 0)
{
cp += 5;
// skip something like my($bla)
if (*(const char*) cp != '$' && ! isalpha(*(const char*) cp)) continue;
cp++; // to skip the $ sign
if (! isalpha(*(const char*) cp)) continue;
while (! isspace ((int) *cp) && *cp != '\0' && *cp != '=' && *cp != ';')
{
vStringPut (name, (int) *cp);
cp++;
}
vStringTerminate (name);
if (vStringLength (name) > 0)
makeSimpleTag (name, PerlKinds, K_LOCAL);
vStringClear (name);
}
else if (strncmp((const char*) cp, "sub", (size_t) 3) == 0 ||
strncmp((const char*) cp, "package", (size_t) 7) == 0)
{
if (strncmp((const char*) cp, "sub", (size_t) 3) == 0)
......@@ -89,7 +162,7 @@ static void findPerlTags (void)
while (isspace (*cp))
cp++;
while (! isspace ((int) *cp) && *cp != '\0' && *cp != '{' && *cp != '(')
while (! isspace ((int) *cp) && *cp != '\0' && *cp != '{' && *cp != '(' && *cp != ';')
{
vStringPut (name, (int) *cp);
cp++;
......
......@@ -79,7 +79,7 @@ static void findRubyTags (void)
{
while (isspace ((int) *cp))
++cp;
while (isalnum ((int) *cp) || *cp == '_')
while (isalnum ((int) *cp) || *cp == '_' || *cp == ':')
{
vStringPut (name, (int) *cp);
++cp;
......@@ -94,7 +94,7 @@ static void findRubyTags (void)
cp += 3;
if (isspace ((int) *cp))
{
while (isspace ((int) *cp))
while (isalnum ((int) *cp) || *cp == ':')
++cp;
/* Put the valid characters allowed in a variable name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment