[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua support in ctags
- From: "Joshua Jensen" <jjensen@...>
- Date: Wed, 28 Nov 2001 11:33:35 -0700
Not that it is very good, but I wrote this for my ctags a while back...
/*
*/
/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include <string.h>
#include "parse.h"
#include "read.h"
#include "vstring.h"
/*
* DATA DEFINITIONS
*/
typedef enum {
K_FUNCTION
} luaKind;
static kindOption LuaKinds [] = {
{ TRUE, 'f', "function", "functions" }
};
/*
* FUNCTION DEFINITIONS
*/
static void findLuaTags (void)
{
vString *name = vStringNew ();
const unsigned char *line;
while ((line = fileReadLine ()) != NULL)
{
int i;
if (line [0] == '\0' || line [0] == '#')
continue;
/* read first word */
for (i = 0 ; line [i] != '\0' && ! isspace (line
[i]) ; ++i)
;
if (strncmp ((const char*) line, "func", (size_t) 4) ==
0)
{
const unsigned char *cp = line + i;
while (isspace ((int) *cp))
++cp;
while (*cp && ! isspace ((int) *cp))
{
vStringPut (name, (int) *cp);
++cp;
}
vStringTerminate (name);
makeSimpleTag (name, LuaKinds, K_FUNCTION);
vStringClear (name);
}
}
vStringDelete (name);
}
extern parserDefinition* LuaParser (void)
{
static const char *const extensions [] = { "lua", NULL };
parserDefinition* def = parserNew ("Lua");
def->kinds = LuaKinds;
def->kindCount = KIND_COUNT (LuaKinds);
def->extensions = extensions;
def->parser = findLuaTags;
return def;
}
/* vi:set tabstop=8 shiftwidth=4: */
-Josh
> -----Original Message-----
> From: owner-lua-l@tecgraf.puc-rio.br
> [mailto:owner-lua-l@tecgraf.puc-rio.br] On Behalf Of Max Ischenko
> Sent: Wednesday, November 28, 2001 4:23 AM
> To: Multiple recipients of list
> Subject: Lua support in ctags
>
>
>
> Does anyone make a support of Lua language to ctags[*]
> program? I'm thinking about to add this, but may be someone
> already did it?
>
>
> * http://ctags.sourceforge.net/
>
>