Пример #1
0
Tags::TagList Tags::getMatches(const char* tagFile, const QString & tagpart, bool partial, const QStringList & types )
{
    Tags::TagList list;

    if ( tagpart.isEmpty() ) return list;

    ctags::tagFileInfo info;
    ctags::tagFile * file = ctags::tagsOpen(tagFile, &info );
    ctags::tagEntry entry;

    if ( ctags::tagsFind( file, &entry, tagpart.ascii(), TAG_OBSERVECASE | (partial ? TAG_PARTIALMATCH : TAG_FULLMATCH) ) == ctags::TagSuccess )
    {
        do
        {
            QString type( CTagsKinds::findKind( entry.kind, QString( entry.file ).section( '.', -1 ) ) );
            QString file( entry.file );

            if ( type.isEmpty() && file.endsWith( "Makefile" ) )
            {
                type = "macro";
            }
            if ( types.isEmpty() || types.contains( entry.kind ) )
            {
                list << TagEntry( QString( entry.name ), type, file, QString( entry.address.pattern ) );
            }
        }
        while ( ctags::tagsFindNext( file, &entry ) == ctags::TagSuccess );
    }

    ctags::tagsClose( file );

    return list;
}
Пример #2
0
#include "html.hpp"

BEGIN_NAMESPACE (hy);

#define TEXT_ATTR TagEntry::TEXT_ATTR
#define EMPTY 0

/* 
 *  _char         int           int        bool      bool     _char    _char
 *   name    contextSwitch  contextLevel  closure  occurOnce  parent   rparent
 */

const TagEntry HTMLDoc::s_defaultHTMLTable[] =
{
    TagEntry("html",   1,  1,    true,   true,    EMPTY,      EMPTY),
    TagEntry("head",   1,  2,    true,   true,    "html",  EMPTY),
    TagEntry("body",   1,  2,    true,   true,    "html",  EMPTY),
    TagEntry("table",  2,  11,   true,   false,   EMPTY,      "body"),
    TagEntry("col",    0,  12,   false,  false,   "table", EMPTY),
    TagEntry("tbody",  0,  5,    true,   false,   "table", EMPTY),
    TagEntry("tr",     0,  5,    true,   false,   "table", EMPTY),
    TagEntry("th",     0,  6,    true,   false,   "tr",    EMPTY),
    TagEntry("td",     0,  6,    true,   false,   EMPTY,      "table"),
    TagEntry("title",  0,  10,   true,   true,    "head",  EMPTY),
    TagEntry("pre",    0,  11,   true,   false,   EMPTY,      "body"),
    TagEntry("center", 2,  10,   true,   false,   EMPTY,      "body"),
    TagEntry("p",      1,  12,   false,  false,   EMPTY,      "body"),
    TagEntry("ol",     1,  13,   true,   false,   EMPTY,      "body"),
    TagEntry("ul",     1,  13,   true,   false,   EMPTY,      "body"),
    TagEntry("h1",     1,  14,   true,   false,   EMPTY,      "body"),