Skip to content

Instantly share code, notes, and snippets.

@yoppi
Created December 13, 2010 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoppi/738759 to your computer and use it in GitHub Desktop.
Save yoppi/738759 to your computer and use it in GitHub Desktop.
extern int main(int __unused__ argc, char **argv) {
cookedArgs *args;
[...]
args = cArgNewFromArgv (argv);
[...]
makeTags (args);
/* Clean up.
*/
[...]
exit(0);
return 0;
}
static void makeTags (cookedArgs *args)
{
[...]
if (Options.fileList != NULL) {
verbose ("Reading list file\n");
resize = (boolean) (createTagsFromListFile (Option.fileList) || resize);
}
[...]
}
static boolean createTagsFromListFile(const char *const fileName)
{
boolean resize;
[...]
FILE *fp = fopen (fileName, "r");
resize = createTagsFromFileInput (fp, FALSE);
fclose(fp);
return resize;
}
static boolean createTagsFromFileInput(FILE *fp, const boolean filter)
{
boolean resize = FALSE;
if (fp != NULL) {
cookedArgs *args = cArgNewFromLineFile (fp);
while (! cArgOff (args)) {
resize |= createTagsForEntry (cArgItem (args));
[...]
}
}
return resize;
}
static boolean createTagsForEntry (const char *const entryName)
{
boolean resize = FALSE;
[...]
resize = parseFile (entryName);
return resize;
}
extern boolean parseFile (const char *const fileName)
{
boolean tagFileResized = FALSE;
langType language = Option.language;
if (Option.language == LANG_AUTO)
language = getFileLanguage (fileName);
[...]
tagFileResized = createTagsWithFallback (fileName, language);
[...]
return tagFileResized;
}
static boolean createTagsWithFallback (
const char *const fileName, const langType language)
{
while (createTagsForFile (fileName, language, ++passCount))
{
[...]
}
}
static boolean createTagsForFile(const char *const fileName, const langType language, const unsigned int passCount) {
boolean retried = FALSE;
Assert (0 <= language && language < (int) LanguageCount)
[...]
const parserDefinition *const lang = LanguageTable [language];
if (lang != NULL)
{
lang->parser();
}
[...]
return retried;
}
extern parserDefinition* RubyParser (void)
{
static const char *const extentions [] = { "rb", "ruby", NULL };
parserDefinition *def = parserNew("Ruby");
def->kinds = RubyKinds;
def->kindCount = KIND_COUNT (RubyKinds);
def->extentions = extentions;
def->parser = findRubyTags;
return def;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment