From 2f83d0d164a94ab5073eb6e804fca05c17b7bb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= Date: Tue, 11 Oct 2016 17:30:06 +0200 Subject: [PATCH] parse: remove things unused by Geany for simpler merge --- ctags/main/parse.c | 237 +-------------------------------------------- ctags/main/parse.h | 2 - 2 files changed, 2 insertions(+), 237 deletions(-) diff --git a/ctags/main/parse.c b/ctags/main/parse.c index 0fb1b291..fcc7f4a2 100644 --- a/ctags/main/parse.c +++ b/ctags/main/parse.c @@ -228,23 +228,6 @@ extern langType getFileLanguage (const char *const fileName) extern void printLanguageMap (const langType language) { - bool first = true; - unsigned int i; - stringList* map = LanguageTable [language]->currentPatterns; - Assert (0 <= language && language < (int) LanguageCount); - for (i = 0 ; map != NULL && i < stringListCount (map) ; ++i) - { - printf ("%s(%s)", (first ? "" : " "), - vStringValue (stringListItem (map, i))); - first = false; - } - map = LanguageTable [language]->currentExtensions; - for (i = 0 ; map != NULL && i < stringListCount (map) ; ++i) - { - printf ("%s.%s", (first ? "" : " "), - vStringValue (stringListItem (map, i))); - first = false; - } } extern void installLanguageMapDefault (const langType language) @@ -411,221 +394,12 @@ extern void freeParserResources (void) extern void processLanguageDefineOption (const char *const option, const char *const parameter CTAGS_ATTR_UNUSED) { - if (parameter [0] == '\0') - error (WARNING, "No language specified for \"%s\" option", option); - else if (getNamedLanguage (parameter, 0) != LANG_IGNORE) - error (WARNING, "Language \"%s\" already defined", parameter); - else - { - unsigned int i = LanguageCount++; - parserDefinition* const def = parserNew (parameter); - def->parser = findRegexTags; - def->currentPatterns = stringListNew (); - def->currentExtensions = stringListNew (); - def->method = METHOD_NOT_CRAFTED; - def->enabled = true; - def->id = i; - LanguageTable = xRealloc (LanguageTable, i + 1, parserDefinition*); - LanguageTable [i] = def; - } -} - -static kindOption *langKindOption (const langType language, const int flag) -{ - unsigned int i; - kindOption* result = NULL; - const parserDefinition* lang; - Assert (0 <= language && language < (int) LanguageCount); - lang = LanguageTable [language]; - for (i=0 ; i < lang->kindCount && result == NULL ; ++i) - if (lang->kinds [i].letter == flag) - result = &lang->kinds [i]; - return result; -} - -static void disableLanguageKinds (const langType language) -{ - if (LanguageTable [language]->method & METHOD_REGEX) - disableRegexKinds (language); - else - { - unsigned int i; - for (i = 0 ; i < LanguageTable [language]->kindCount ; ++i) - LanguageTable [language]->kinds [i].enabled = false; - } -} - -static bool enableLanguageKind (const langType language, - const int kind, const bool mode) -{ - bool result = false; - if (LanguageTable [language]->method & METHOD_REGEX) - result = enableRegexKind (language, kind, mode); - else - { - kindOption* const opt = langKindOption (language, kind); - if (opt != NULL) - { - opt->enabled = mode; - result = true; - } - } - return result; -} - -static void processLangKindOption (const langType language, - const char *const option, - const char *const parameter) -{ - const char *p = parameter; - bool mode = true; - int c; - - Assert (0 <= language && language < (int) LanguageCount); - if (*p != '+' && *p != '-') - disableLanguageKinds (language); - while ((c = *p++) != '\0') switch (c) - { - case '+': mode = true; break; - case '-': mode = false; break; - - default: - { - if (! enableLanguageKind (language, c, mode)) - error (WARNING, "Unsupported parameter '%c' for --%s option", - c, option); - } break; - } } extern bool processKindOption (const char *const option, const char *const parameter) { - bool handled = false; - const char* const dash = strchr (option, '-'); - if (dash != NULL && - (strcmp (dash + 1, "types") == 0 || strcmp (dash + 1, "kinds") == 0)) - { - langType language; - vString* langName = vStringNew (); - vStringNCopyS (langName, option, dash - option); - language = getNamedLanguage (vStringValue (langName), 0); - if (language == LANG_IGNORE) - error (WARNING, "Unknown language specified in \"%s\" option", option); - else - processLangKindOption (language, option, parameter); - vStringDelete (langName); - handled = true; - } - return handled; -} - -static void printLangugageKindOption (const kindOption* const kind) -{ - printf (" %c %s%s\n", kind->letter, - kind->description != NULL ? kind->description : - (kind->name != NULL ? kind->name : ""), - kind->enabled ? "" : " [off]"); -} - -static void printLangugageKindOptions (const langType language) -{ - const parserDefinition* lang; - Assert (0 <= language && language < (int) LanguageCount); - lang = LanguageTable [language]; - if (lang->kinds != NULL || lang->method & METHOD_NOT_CRAFTED) - { - unsigned int i; - char* const name = newLowerString (lang->name); - printf (" --%s-types=[+|-]kinds\n", name); - eFree (name); - if (lang->kinds != NULL) - for (i = 0 ; i < lang->kindCount ; ++i) - printLangugageKindOption (lang->kinds + i); - /*printRegexKindOptions (language);*/ /* unused */ - } -} - -extern void printKindOptions (void) -{ - unsigned int i; - - printf ( - "\n The following options are used to specify which language-specific tag\n\ - types (or kinds) should be included in the tag file. \"Kinds\" is a group of\n\ - one-letter flags designating kinds of tags to either include or exclude from\n\ - the output. Each letter or group of letters may be preceded by either '+' to\n\ - add it to those already included, or '-' to exclude it from the output. In\n\ - the absence of any preceding '+' or '-' sign, only those kinds listed in\n\ - \"kinds\" will be included in the output. Below each option is a list of the\n\ - flags accepted. All kinds are enabled by default unless otherwise noted.\n\n"); - - for (i = 0 ; i < LanguageCount ; ++i) - printLangugageKindOptions (i); -} - -/* -* File parsing -*/ - -static bool createTagsForFile (const char *const fileName, - const langType language, - const unsigned int passCount) -{ - bool retried = false; - - if (openInputFile (fileName, language, NULL)) - { - - makeFileTag (fileName); - - if (LanguageTable [language]->parser != NULL) - LanguageTable [language]->parser (); - else if (LanguageTable [language]->parser2 != NULL) - retried = LanguageTable [language]->parser2 (passCount); - - - closeInputFile (); - } - - return retried; -} - -static bool createTagsWithFallback (const char *const fileName, - const langType language) -{ - const unsigned long numTags = numTagsAdded (); - MIOPos filePosition; - unsigned int passCount = 0; - bool tagFileResized = false; - - tagFilePosition (&filePosition); - while (createTagsForFile (fileName, language, ++passCount)) - { - /* Restore prior state of tag file. - */ - setTagFilePosition (&filePosition); - setNumTagsAdded (numTags); - tagFileResized = true; - } - return tagFileResized; -} - -extern bool parseFile (const char *const fileName) -{ - bool tagFileResized = false; - langType language = Option.language; - if (Option.language == LANG_AUTO) - language = getFileLanguage (fileName); - Assert (language != LANG_AUTO); - if (Option.filter) - openTagFile (); - - tagFileResized = createTagsWithFallback (fileName, language); - - addTotals (1, 0L, 0L); - - return tagFileResized; + return false; } extern void installTagRegexTable (const langType language) @@ -670,12 +444,5 @@ extern void installKeywordTable (const langType language) extern bool processAliasOption ( const char *const option, const char *const parameter) { - langType language; - - language = getLanguageComponentInOption (option, "alias-"); - if (language == LANG_IGNORE) - return false; - -/* processLangAliasOption (language, parameter); */ - return true; + return false; } diff --git a/ctags/main/parse.h b/ctags/main/parse.h index 3d5089a2..9b8b4fe4 100644 --- a/ctags/main/parse.h +++ b/ctags/main/parse.h @@ -134,8 +134,6 @@ extern void initializeParser (langType language); extern void freeParserResources (void); extern void processLanguageDefineOption (const char *const option, const char *const parameter); extern bool processKindOption (const char *const option, const char *const parameter); -extern void printKindOptions (void); -extern bool parseFile (const char *const fileName); extern void installKeywordTable (const langType language);