Beispiel #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;

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

	vStringTerminate (name);
	scope = stringListToScope (nesting);

	initTagEntry (&tag, vStringValue (name));
	if (vStringLength (scope) > 0) {
	    tag.extensionFields.scope [0] = "class";
	    tag.extensionFields.scope [1] = vStringValue (scope);
	}
	tag.kindName = RubyKinds [kind].name;
	tag.kind = RubyKinds [kind].letter;
	makeTagEntry (&tag);

	stringListAdd (nesting, vStringNewCopy (name));

	vStringClear (name);
	vStringDelete (scope);
}
Beispiel #2
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;
	const char *this_name;

	vStringTerminate (name);
	scope = stringListToScope (nesting);

	/* extract scope and actual name from tag name in case of tags like
	 * "class Foo::Bar::Baz" which are parsed as a single name, "Foo.Bar.Baz" */
	this_name = strrchr (vStringValue (name), '.');
	if (this_name)
	{
		if (vStringLength (scope) > 0)
			vStringPut (scope, '.');
		vStringNCat (scope, name, this_name - vStringValue (name));
		vStringTerminate (scope);
		this_name ++;
	}
	else
		this_name = vStringValue (name);

	initTagEntry (&tag, this_name);
	if (vStringLength (scope) > 0) {
	    tag.extensionFields.scope [0] = "class";
	    tag.extensionFields.scope [1] = vStringValue (scope);
	}
	tag.kindName = RubyKinds [kind].name;
	tag.kind = RubyKinds [kind].letter;
	makeTagEntry (&tag);

	stringListAdd (nesting, vStringNewCopy (name));

	vStringClear (name);
	vStringDelete (scope);
}