Example #1
0
/*
* Emits a tag for the given 'name' of kind 'kind' at the current nesting.
*/
static void emitRubyTag (vString* name, rubyKind kind)
{
	tagEntryInfo tag;
	vString* scope;
	tagEntryInfo *parent;
	rubyKind parent_kind = K_UNDEFINED;
	NestingLevel *lvl;
	const char *unqualified_name;
	const char *qualified_name;
	int r;

        if (!RubyKinds[kind].enabled) {
            return;
        }

	scope = nestingLevelsToScope (nesting);
	lvl = nestingLevelsGetCurrent (nesting);
	parent = getEntryOfNestingLevel (lvl);
	if (parent)
		parent_kind =  parent->kindIndex;

	qualified_name = vStringValue (name);
	unqualified_name = strrchr (qualified_name, SCOPE_SEPARATOR);
	if (unqualified_name && unqualified_name[1])
	{
		if (unqualified_name > qualified_name)
		{
			if (vStringLength (scope) > 0)
				vStringPut (scope, SCOPE_SEPARATOR);
			vStringNCatS (scope, qualified_name,
			              unqualified_name - qualified_name);
			/* assume module parent type for a lack of a better option */
			parent_kind = K_MODULE;
		}
		unqualified_name++;
	}
	else
		unqualified_name = qualified_name;

	initTagEntry (&tag, unqualified_name, kind);
	if (vStringLength (scope) > 0) {
		Assert (0 <= parent_kind &&
		        (size_t) parent_kind < (ARRAY_SIZE (RubyKinds)));

		tag.extensionFields.scopeKindIndex = parent_kind;
		tag.extensionFields.scopeName = vStringValue (scope);
	}
	r = makeTagEntry (&tag);

	nestingLevelsPush (nesting, r);

	vStringClear (name);
	vStringDelete (scope);
}
Example #2
0
static void parseFunction (const unsigned char *line)
{
	vString *name = vStringNew ();
	/* boolean inFunction = FALSE; */
	int scope;

	const unsigned char *cp = line + 1;

	if ((int) *++cp == 'n'	&&	(int) *++cp == 'c'	&&
		(int) *++cp == 't'	&&	(int) *++cp == 'i'	&&
		(int) *++cp == 'o'	&&	(int) *++cp == 'n')
			++cp;
	if ((int) *cp == '!')
		++cp;
	if (isspace ((int) *cp))
	{
		while (*cp && isspace ((int) *cp))
			++cp;

		if (*cp)
		{
			cp = skipPrefix (cp, &scope);
			if (isupper ((int) *cp)  ||  
					scope == 's'  ||  /* script scope */
					scope == '<'  ||  /* script scope */
					scope == 'd'  ||  /* dictionary */
					scope == 'a')	  /* autoload */
			{
				do
				{
					vStringPut (name, (int) *cp);
					++cp;
				} while (isalnum ((int) *cp) ||  *cp == '_' ||	*cp == '.' ||  *cp == '#');
				vStringTerminate (name);
				makeSimpleTag (name, VimKinds, K_FUNCTION);
				vStringClear (name);
			}
		}
	}

	/* TODO - update struct to indicate inside function */
	while ((line = readVimLine ()) != NULL)
	{
		/* 
		 * Vim7 added the for/endfo[r] construct, so we must first
		 * check for an "endfo", before a "endf"
		 */
		if ( (!strncmp ((const char*) line, "endfo", (size_t) 5) == 0) && 
				(strncmp ((const char*) line, "endf", (size_t) 4) == 0)   )
			break;
		/* TODO - call parseVimLine */
	}
	vStringDelete (name);
}
Example #3
0
static void findRustTags (void)
{
	lexerState lexer;
	vString* scope = vStringNew();
	initLexer(&lexer);

	parseBlock(&lexer, FALSE, K_NONE, scope);
	vStringDelete(scope);

	deInitLexer(&lexer);
}
Example #4
0
static void setInputFileName (const char *const fileName)
{
	const char *const head = fileName;
	const char *const tail = baseFilename (head);

	if (File.name != NULL)
		vStringDelete (File.name);
	File.name = vStringNewInit (fileName);

	if (File.path != NULL)
		vStringDelete (File.path);
	if (tail == head)
		File.path = NULL;
	else
	{
		const size_t length = tail - head - 1;
		File.path = vStringNew ();
		vStringNCopyS (File.path, fileName, length);
	}
}
Example #5
0
File: parse.c Project: att/uwin
static langType getInterpreterLanguage (const char *const fileName)
{
    langType result = LANG_IGNORE;
    FILE* const fp = fopen (fileName, "r");
    if (fp != NULL)
    {
	vString* const vLine = vStringNew ();
	const char* const line = readLine (vLine, fp);
	if (line != NULL  &&  line [0] == '#'  &&  line [1] == '!')
	{
	    const char* const lastSlash = strrchr (line, '/');
	    const char *const cmd = lastSlash != NULL ? lastSlash+1 : line+2;
	    vString* const interpreter = determineInterpreter (cmd);
	    result = getExtensionLanguage (vStringValue (interpreter));
	    vStringDelete (interpreter);
	}
	vStringDelete (vLine);
	fclose (fp);
    }
    return result;
}
Example #6
0
static boolean AutomakeMakeTag (vString *const name, const char* suffix, boolean appending,
			    int kindex, int rindex, struct sBlacklist *blacklist,
			    void *data)
{
	int *index = data;
	size_t expected_len;
	size_t len;
	char* tail;
	vString *subname;
	int i;

	len = vStringLength (name);
	expected_len = strlen (suffix);

	if (len <= expected_len)
		return FALSE;

	for (i = 0; blacklist[i].type != BL_END; i++)
	{
		if (bl_check (vStringValue(name), blacklist + i) == FALSE)
			return FALSE;
	}

	tail = vStringValue (name) + len - expected_len;
	if (strcmp (tail, suffix))
		return FALSE;

	subname = vStringNew();

	/* ??? dist, nodist, nobase, notrans,... */
	if (strncmp (vStringValue(name), "dist_", 5) == 0)
		vStringNCopyS(subname, vStringValue(name) + 5, len - expected_len - 5);
	else
		vStringNCopyS(subname, vStringValue(name), len - expected_len);

	if (rindex == ROLE_INDEX_DEFINITION)
	{
		*index = makeSimpleTag (subname, AutomakeKinds, kindex);
		addAutomakeDirectory (subname, *index);
	}
	else
	{
		*index = CORK_NIL;
		if (appending)
			*index = lookupAutomakeDirectory (subname);

		if ((!appending) || (*index == CORK_NIL))
			*index = makeSimpleRefTag (subname, AutomakeKinds, kindex, rindex);
	}

	vStringDelete (subname);
	return TRUE;
}
Example #7
0
static tgTableEntry* freeTgEntry(tgTableEntry *entry)
{
	tgTableEntry* r;

	if (entry->corpus_file)
	{
		eFree (entry->tg_table);
		entry->tg_table = NULL;
		vStringDelete (entry->corpus_file);
		entry->corpus_file = NULL;
	}

	vStringDelete (entry->spec);
	entry->spec = NULL;

	r = entry->next;
	entry->next = NULL;
	eFree(entry);

	return r;
}
Example #8
0
static void findTags (boolean startsInPhpMode)
{
	tokenInfo *const token = newToken ();

	InPhp = startsInPhpMode;
	CurrentStatement.access = ACCESS_UNDEFINED;
	CurrentStatement.impl = IMPL_UNDEFINED;
	CurrentNamesapce = vStringNew ();
	FullScope = vStringNew ();
	AnonymousID = 0;

	do
	{
		enterScope (token, NULL, -1);
	}
	while (token->type != TOKEN_EOF); /* keep going even with unmatched braces */

	vStringDelete (FullScope);
	vStringDelete (CurrentNamesapce);
	deleteToken (token);
}
Example #9
0
static vString* extractZshAutoloadTag(FILE* input)
{
	vString* const vLine = vStringNew ();
	const char* const line = readLine (vLine, input);
	vString* mode = NULL;

	if (line)
		mode = determineZshAutoloadTag (line);

	vStringDelete (vLine);
	return mode;
}
Example #10
0
static void findOcamlTags (void)
{
	vString *name = vStringNew ();
	lexingState st;
	ocaToken tok;

	initStack ();
	computeModuleName ();
	tempIdent = vStringNew ();
	lastModule = vStringNew ();
	lastClass = vStringNew ();
	voidName = vStringNew ();
	vStringCopyS (voidName, "_");

	st.name = vStringNew ();
	st.cp = fileReadLine ();
	toDoNext = &globalScope;
	tok = lex (&st);
	while (tok != Tok_EOF)
	{
		(*toDoNext) (st.name, tok);
		tok = lex (&st);
	}

	vStringDelete (st.name);
	vStringDelete (name);
	vStringDelete (voidName);
	vStringDelete (tempIdent);
	vStringDelete (lastModule);
	vStringDelete (lastClass);
	clearStack ();
}
Example #11
0
static int parseEscapedCharacter (void)
{
	int d = '\0';
	int c = fileGetc ();

	switch (c)
	{
		case 'A':  d = '@';   break;
		case 'B':  d = '\b';  break;
		case 'C':  d = '^';   break;
		case 'D':  d = '$';   break;
		case 'F':  d = '\f';  break;
		case 'H':  d = '\\';  break;
		case 'L':  d = '~';   break;
		case 'N':  d = '\n';  break;
#ifdef QDOS
		case 'Q':  d = 0x9F;  break;
#else
		case 'Q':  d = '`';   break;
#endif
		case 'R':  d = '\r';  break;
		case 'S':  d = '#';   break;
		case 'T':  d = '\t';  break;
		case 'U':  d = '\0';  break;
		case 'V':  d = '|';   break;
		case '%':  d = '%';   break;
		case '\'': d = '\'';  break;
		case '"':  d = '"';   break;
		case '(':  d = '[';   break;
		case ')':  d = ']';   break;
		case '<':  d = '{';   break;
		case '>':  d = '}';   break;

		case '\n': skipToCharacter ('%'); break;

		case '/':
		{
			vString *string = parseInteger ('\0');
			const char *value = vStringValue (string);
			const unsigned long ascii = atol (value);
			vStringDelete (string);

			c = fileGetc ();
			if (c == '/'  &&  ascii < 256)
				d = ascii;
			break;
		}

		default: break;
	}
	return d;
}
Example #12
0
/* Match a "label:" style label. */
static void match_colon_label (char const *p)
{
	char const *end = p + strlen (p) - 1;
	while (isspace (*end))
		end--;
	if (*end == ':')
	{
		vString *name = vStringNew ();
		vStringNCatS (name, p, end - p);
		makeSimpleTag (name, BasicKinds, K_LABEL);
		vStringDelete (name);
	}
}
Example #13
0
File: main.c Project: att/uwin
static boolean recurseIntoDirectory (const char *const dirName)
{
    boolean resize = FALSE;
    if (isRecursiveLink (dirName))
	verbose ("ignoring \"%s\" (recursive link)\n", dirName);
    else if (! Option.recurse)
	verbose ("ignoring \"%s\" (directory)\n", dirName);
    else
    {
	verbose ("RECURSING into directory \"%s\"\n", dirName);
#if defined (HAVE_OPENDIR)
	resize = recurseUsingOpendir (dirName);
#elif defined (HAVE_FINDFIRST) || defined (HAVE__FINDFIRST)
	{
	    vString *const pattern = vStringNew ();
	    vStringCopyS (pattern, dirName);
	    vStringPut (pattern, OUTPUT_PATH_SEPARATOR);
	    vStringCatS (pattern, "*.*");
	    resize = createTagsForWildcardUsingFindfirst (vStringValue (pattern));
	    vStringDelete (pattern);
	}
#elif defined (AMIGA)
	{
	    vString *const pattern = vStringNew ();
	    if (*dirName != '\0'  &&  strcmp (dirName, ".") != 0)
	    {
		vStringCopyS (pattern, dirName);
		if (dirName [strlen (dirName) - 1] != '/')
		    vStringPut (pattern, '/');
	    }
	    vStringCatS (pattern, "#?");
	    resize = createTagsForAmigaWildcard (vStringValue (pattern));
	    vStringDelete (pattern);
	}
#endif
    }
    return resize;
}
Example #14
0
/* Match a keyword starting at p (case insensitive). */
static int match_keyword (const char *p, KeyWord const *kw)
{
	vString *name;
	size_t i;
	int j;
	const char *old_p;
	for (i = 0; i < strlen (kw->token); i++)
	{
		if (tolower (p[i]) != kw->token[i])
			return 0;
	}
	name = vStringNew ();
	p += i;
	if (kw == &freebasic_keywords[0] ||
		kw == &freebasic_keywords[1] ||
		kw == &freebasic_keywords[2])
		return extract_dim (p, name, kw->kind); /* extract_dim adds the found tag(s) */

	old_p = p;
	while (isspace (*p))
		p++;

	/* create tags only if there is some space between the keyword and the identifier */
	if (old_p == p)
	{
		vStringDelete (name);
		return 0;
	}

	for (j = 0; j < 1; j++)
	{
		p = extract_name (p, name);
	}
	makeSimpleTag (name, BasicKinds, kw->kind);
	vStringDelete (name);

	return 1;
}
Example #15
0
static void setInputFileParametersCommon (inputFileInfo *finfo, vString *const fileName,
					  const langType language, stringList *holder)
{
	if (finfo->name != NULL)
		vStringDelete (finfo->name);
	finfo->name = fileName;

	if (finfo->tagPath != NULL)
	{
		if (holder)
			stringListAdd (holder, finfo->tagPath);
		else
			vStringDelete (finfo->tagPath);
	}
	if (! Option.tagRelative || isAbsolutePath (vStringValue (fileName)))
		finfo->tagPath = vStringNewCopy (fileName);
	else
		finfo->tagPath =
				vStringNewOwn (relativeFilename (vStringValue (fileName), TagFile.directory));

	finfo->isHeader = isIncludeFile (vStringValue (fileName));
	finfo->language = language;
}
Example #16
0
File: sml.c Project: shigio/ctags
static void findSmlTags (void)
{
    vString *const identifier = vStringNew ();
    const unsigned char *line;
    smlKind lastTag = K_NONE;

    while ((line = fileReadLine ()) != NULL)
    {
        const unsigned char *cp = skipSpace (line);
        do
        {
            smlKind foundTag;
            if (CommentLevel != 0)
            {
                cp = (const unsigned char *) strstr ((const char *) cp, "*)");
                if (cp == NULL)
                    continue;
                else
                {
                    --CommentLevel;
                    cp += 2;
                }
            }
            foundTag = findNextIdentifier (&cp);
            if (foundTag != K_NONE)
            {
                cp = skipSpace (cp);
                cp = parseIdentifier (cp, identifier);
                if (foundTag == K_AND)
                {
                    if (lastTag != K_NONE)
                        makeSmlTag (lastTag, identifier);
                }
                else
                {
                    makeSmlTag (foundTag, identifier);
                    lastTag = foundTag;
                }
            }
            if (strstr ((const char *) cp, "(*") != NULL)
            {
                cp += 2;
                cp = (const unsigned char *) strstr ((const char *) cp, "*)");
                if (cp == NULL)
                    ++CommentLevel;
            }
        } while (cp != NULL  &&  strcmp ((const char *) cp, "") != 0);
    }
    vStringDelete (identifier);
}
Example #17
0
File: vhdl.c Project: Fordi/geany
static void findVhdlTags (void)
{
    volatile boolean newStatement = TRUE;
    volatile int c = '\0';
    exception_t exception = (exception_t) setjmp (Exception);
	Name = vStringNew ();
    Lastname = vStringNew ();
    Keyword = vStringNew ();
    TagName = vStringNew ();

    if (exception == ExceptionNone) while (c != EOF)
    {
		c = vGetc ();
		switch (c)
		{
			case ';':
			case '\n':
			newStatement = TRUE;
			break;

			case ' ':
			case '\t':
			break;

			default:
			if (newStatement && readIdentifier (Name, c)) {
				findTag (Name);
				}
			newStatement = FALSE;
			break;
		}
    }
    vStringDelete (Name);
    vStringDelete (Lastname);
    vStringDelete (Keyword);
    vStringDelete (TagName);
}
Example #18
0
File: read.c Project: qzhuyan/ctags
static void setInputFileParametersCommon (inputFileInfo *finfo, vString *const fileName,
					  const langType language,
					  void (* setLang) (inputLangInfo *, langType),
					  stringList *holder)
{
	if (finfo->name != NULL)
		vStringDelete (finfo->name);
	finfo->name = fileName;

	if (finfo->tagPath != NULL)
	{
		if (holder)
			stringListAdd (holder, finfo->tagPath);
		else
			vStringDelete (finfo->tagPath);
	}

	if (0)
		;
	else if (  Option.tagRelative == TREL_ALWAYS )
		finfo->tagPath =
			vStringNewOwn (relativeFilename (vStringValue (fileName),
							 getTagFileDirectory ()));
	else if ( Option.tagRelative == TREL_NEVER )
		finfo->tagPath =
			vStringNewOwn (absoluteFilename (vStringValue (fileName)));
	else if ( Option.tagRelative == TREL_NO || isAbsolutePath (vStringValue (fileName)) )
		finfo->tagPath = vStringNewCopy (fileName);
	else
		finfo->tagPath =
			vStringNewOwn (relativeFilename (vStringValue (fileName),
							 getTagFileDirectory ()));

	finfo->isHeader = isIncludeFile (vStringValue (fileName));

	setLang (& (finfo->langInfo), language);
}
Example #19
0
File: tex.c Project: shunlir/ctags
static void makeTexTag (tokenInfo *const token, texKind kind)
{
	if (TexKinds [kind].enabled)
	{
		const char *const name = vStringValue (token->string);
		vString *parentKind = vStringNew();
		vString *parentName = vStringNew();
		tagEntryInfo e;
		initTagEntry (&e, name, &(TexKinds [kind]));

		e.lineNumber   = token->lineNumber;
		e.filePosition = token->filePosition;

		getScopeInfo(kind, parentKind, parentName);
		if (vStringLength(parentKind) > 0) {
			e.extensionFields.scopeKind = kindFromName (vStringValue(parentKind));
			e.extensionFields.scopeName = vStringValue(parentName);
		}

		makeTagEntry (&e);
		vStringDelete (parentKind);
		vStringDelete (parentName);
	}
}
Example #20
0
static void found_tag_cb (const char *line,
			  const regexMatch *matches,
			  unsigned int count,
			  void *userData)
{
	if (count > 0)
	{
		vString *name = vStringNew ();
		vStringNCopyS (name, line + matches[1].start, matches[1].length);
		makeSimpleTag (name, RpmSpecKinds, K_TAG);

		if (count > 1)
		{
			if (strcasecmp (vStringValue (name), "name") == 0)
			{
				vString *package = vStringNew ();
				vStringNCopyS (package, line + matches[2].start, matches[2].length);
				*((int *)userData) = makeSimpleTag (package, RpmSpecKinds, K_PACKAGE);
				vStringDelete (package);
			}
		}
		vStringDelete (name);
	}
}
Example #21
0
File: sh.c Project: ALPHAMARIOX/pn
static void findShTags (void)
{
	vString *name = vStringNew ();
	const unsigned char *line;

	while ((line = fileReadLine ()) != NULL)
	{
		const unsigned char* cp = line;
		boolean functionFound = FALSE;

		if (line [0] == '#')
			continue;

		while (isspace (*cp))
			cp++;
		if (strncmp ((const char*) cp, "function", (size_t) 8) == 0  &&
			isspace ((int) cp [8]))
		{
			functionFound = TRUE;
			cp += 8;
			if (! isspace ((int) *cp))
				continue;
			while (isspace ((int) *cp))
				++cp;
		}
		if (! (isalnum ((int) *cp) || *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);
}
Example #22
0
static void matchTagPattern (const vString* const line,
		const regexPattern* const patbuf,
		const regmatch_t* const pmatch)
{
	vString *const name = substitute (vStringValue (line),
			patbuf->u.tag.name_pattern, BACK_REFERENCE_COUNT, pmatch);
	vStringStripLeading (name);
	vStringStripTrailing (name);
	if (vStringLength (name) > 0)
		makeRegexTag (name, &patbuf->u.tag.kind);
	else
		error (WARNING, "%s:%ld: null expansion of name pattern \"%s\"",
			getInputFileName (), getInputLineNumber (),
			patbuf->u.tag.name_pattern);
	vStringDelete (name);
}
Example #23
0
File: html.c Project: qzhuyan/ctags
static void findHtmlTags (void)
{
	tokenInfo token;

	token.string = vStringNew ();

	do
	{
		readToken (&token, true);
		if (token.type == TOKEN_TAG_START)
			readTag (&token, NULL, 0);
	}
	while (token.type != TOKEN_EOF);

	vStringDelete (token.string);
}
Example #24
0
static smlKind findNextIdentifier (const unsigned char **cp)
{
	smlKind result = K_NONE;
	vString *const identifier = vStringNew ();
	unsigned int count = sizeof (SmlKeywordTypes) / sizeof (SmlKeywordTypes [0]);
	unsigned int i;
	*cp = parseIdentifier (*cp, identifier);
	for (i = 0  ;  i < count  &&  result == K_NONE ;  ++i)
	{
		const char *id = vStringValue (identifier);
		if (strcmp (id, SmlKeywordTypes [i].keyword) == 0)
			result = SmlKeywordTypes [i].kind;
	}
	vStringDelete (identifier);
	return result;
}
Example #25
0
File: main.c Project: koron/ctags
static boolean createTagsForWildcardEntry (
		const char *const pattern, const size_t dirLength,
		const char *const entryName)
{
	boolean resize = FALSE;
	/* we must not recurse into the directories "." or ".." */
	if (strcmp (entryName, ".") != 0  &&  strcmp (entryName, "..") != 0)
	{
		vString *const filePath = vStringNew ();
		vStringNCopyS (filePath, pattern, dirLength);
		vStringCatS (filePath, entryName);
		resize = createTagsForEntry (vStringValue (filePath));
		vStringDelete (filePath);
	}
	return resize;
}
Example #26
0
static void parseFunction (tokenInfo *const token)
{
	tokenInfo *const name = newToken ();
	vString *const signature = vStringNew ();
	boolean is_class = FALSE;

	/*
	 * This deals with these formats
	 *	   function validFunctionTwo(a,b) {}
	 */

	readToken (name);
	if (!isType (name, TOKEN_IDENTIFIER))
		goto cleanUp;

	/* Add scope in case this is an INNER function */
	addToScope(name, token->scope);

	readToken (token);
	while (isType (token, TOKEN_PERIOD))
	{
		readToken (token);
		if ( isKeyword(token, KEYWORD_NONE) )
		{
			addContext (name, token);
			readToken (token);
		}
	}

	if ( isType (token, TOKEN_OPEN_PAREN) )
		skipArgumentList(token, FALSE, signature);

	if ( isType (token, TOKEN_OPEN_CURLY) )
	{
		is_class = parseBlock (token, name);
		if ( is_class )
			makeClassTag (name, signature);
		else
			makeFunctionTag (name, signature);
	}

	findCmdTerm (token, FALSE, FALSE);

 cleanUp:
	vStringDelete (signature);
	deleteToken (name);
}
Example #27
0
static void found_package_cb (const char *line,
			      const regexMatch *matches,
			      unsigned int count,
			      void *userData)
{
	if (count > 0)
	{
		vString *name = vStringNew ();
		tagEntryInfo tag;

		vStringNCopyS (name, line + matches[1].start, matches[1].length);
		initTagEntry (&tag, vStringValue (name), RpmSpecKinds + K_PACKAGE);
		tag.extensionFields.scopeIndex = *(int *)userData;
		makeTagEntry (&tag);
		vStringDelete (name);
	}
}
Example #28
0
void cxxTokenForceDestroy(CXXToken * t)
{
	if(!t)
		return;

	if(t->pChain)
	{
		cxxTokenChainDestroy(t->pChain);
		t->pChain = NULL;
	}

	CXX_DEBUG_ASSERT(t->pszWord,"There should be a word here");

	vStringDelete(t->pszWord);

	eFree(t);
}
Example #29
0
File: vim.c Project: Monits/ctags
static void parseFunction (const unsigned char *line)
{
	vString *name = vStringNew ();
	/* boolean inFunction = FALSE; */
	int scope;
	const unsigned char *cp = line;

	if ((int) *cp == '!')
		++cp;
	if (isspace ((int) *cp))
	{
		while (*cp && isspace ((int) *cp))
			++cp;

		if (*cp)
		{
			cp = skipPrefix (cp, &scope);
			if (isupper ((int) *cp)  ||  
					scope == 's'  ||  /* script scope */
					scope == '<'  ||  /* script scope */
					scope == 'd'  ||  /* dictionary */
					scope == 'a')	  /* autoload */
			{
				do
				{
					vStringPut (name, (int) *cp);
					++cp;
				} while (isalnum ((int) *cp) ||  *cp == '_' ||	*cp == '.' ||  *cp == '#');
				vStringTerminate (name);
				makeSimpleTag (name, VimKinds, K_FUNCTION);
				vStringClear (name);
			}
		}
	}

	/* TODO - update struct to indicate inside function */
	while ((line = readVimLine ()) != NULL)
	{
		if (wordMatchLen (line, "endfunction", 4))
			break;

		parseVimLine(line, TRUE);
	}
	vStringDelete (name);
}
Example #30
0
/* Algorithm adapted from from GNU etags.
 */
static void findLispTags (void)
{
	vString *name = vStringNew ();
	const unsigned char* p;


	while ((p = fileReadLine ()) != NULL)
	{
		if (*p == '(')
		{
			if (L_isdef (p))
			{
				while (*p != '\0' && !isspace ((int) *p))
					p++;
				while (isspace ((int) *p))
					p++;
				L_getit (name, p);
			}
			else
			{
				/* Check for (foo::defmumble name-defined ... */
				do
					p++;
				while (*p != '\0' && !isspace ((int) *p)
						&& *p != ':' && *p != '(' && *p != ')');
				if (*p == ':')
				{
					do
						p++;
					while (*p == ':');

					if (L_isdef (p - 1))
					{
						while (*p != '\0' && !isspace ((int) *p))
							p++;
						while (isspace (*p))
							p++;
						L_getit (name, p);
					}
				}
			}
		}
	}
	vStringDelete (name);
}