Commit 7187ab3f authored by Naba Kumar's avatar Naba Kumar

Fixed python parser to parser class methods.

	* tagmanager/parse.c, tagmanager/parse.h, tagmanager/python.c:
	Fixed python parser to parser class methods.
parent 24fe8228
2005-07-15 Naba Kumar <naba@gnome.org>
* tagmanager/parse.c, tagmanager/parse.h, tagmanager/python.c:
Fixed python parser to parser class methods.
2005-07-15 Naba Kumar <naba@gnome.org>
* plugins/project-wizard/property.c: Used parenthesis to remove
......
......@@ -55,6 +55,26 @@ extern void makeSimpleTag (const vString* const name,
}
}
extern void makeSimpleScopedTag (const vString* const name,
kindOption* const kinds, const int kind,
const char* scope, const char *scope2,
const char *access)
{
if (name != NULL && vStringLength (name) > 0)
{
tagEntryInfo e;
initTagEntry (&e, vStringValue (name));
e.kindName = kinds [kind].name;
e.kind = kinds [kind].letter;
e.extensionFields.scope[0] = scope;
e.extensionFields.scope[1] = scope2;
e.extensionFields.access = access;
makeTagEntry (&e);
}
}
/*
* parserDescription mapping management
*/
......
......@@ -89,6 +89,8 @@ extern void processLegacyKindOption (const char *const parameter);
/* Language processing and parsing */
extern void makeSimpleTag (const vString* const name, kindOption* const kinds, const int kind);
extern void makeSimpleScopedTag (const vString* const name, kindOption* const kinds, const int kind, const char* scope, const char* scope2, const char *access);
extern parserDefinition* parserNew (const char* name);
extern const char *getLanguageName (const langType language);
extern langType getNamedLanguage (const char *const name);
......
......@@ -24,12 +24,13 @@
* DATA DEFINITIONS
*/
typedef enum {
K_CLASS, K_FUNCTION
K_CLASS, K_FUNCTION, K_METHOD
} pythonKind;
static kindOption PythonKinds [] = {
{ TRUE, 'c', "class", "classes" },
{ TRUE, 'f', "function", "functions" }
{ TRUE, 'f', "function", "functions" },
{ TRUE, 'm', "method", "methods" }
};
/*
......@@ -39,13 +40,14 @@ static kindOption PythonKinds [] = {
static void findPythonTags (void)
{
vString *name = vStringNew ();
vString *lastClass = vStringNew();
const unsigned char *line;
boolean inMultilineString = FALSE;
while ((line = fileReadLine ()) != NULL)
{
const unsigned char *cp = line;
while (*cp != '\0')
{
if (*cp=='"' &&
......@@ -72,6 +74,7 @@ static void findPythonTags (void)
}
vStringTerminate (name);
makeSimpleTag (name, PythonKinds, K_CLASS);
vStringCopy (lastClass, name);
vStringClear (name);
}
}
......@@ -88,7 +91,12 @@ static void findPythonTags (void)
++cp;
}
vStringTerminate (name);
makeSimpleTag (name, PythonKinds, K_FUNCTION);
if (!isspace(*line) || vStringSize(lastClass) <= 0)
makeSimpleTag (name, PythonKinds, K_FUNCTION);
else
makeSimpleScopedTag (name, PythonKinds, K_METHOD,
PythonKinds[K_CLASS].name,
vStringValue(lastClass), "public");
vStringClear (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